From 357004fbf11ff42aa65c9aa0bbe30fa8c394bb0b Mon Sep 17 00:00:00 2001 From: yixingj Date: Fri, 22 Sep 2017 10:46:02 +0800 Subject: [PATCH] Make Harbor database configurable --- make/common/templates/adminserver/env | 6 +++--- make/harbor.cfg | 12 +++++++++++- make/prepare | 6 ++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/make/common/templates/adminserver/env b/make/common/templates/adminserver/env index 53b6244aa..0bdb92c49 100644 --- a/make/common/templates/adminserver/env +++ b/make/common/templates/adminserver/env @@ -11,9 +11,9 @@ LDAP_UID=$ldap_uid LDAP_SCOPE=$ldap_scope LDAP_TIMEOUT=$ldap_timeout DATABASE_TYPE=mysql -MYSQL_HOST=mysql -MYSQL_PORT=3306 -MYSQL_USR=root +MYSQL_HOST=$db_host +MYSQL_PORT=$db_port +MYSQL_USR=$db_user MYSQL_PWD=$db_password MYSQL_DATABASE=registry REGISTRY_URL=http://registry:5000 diff --git a/make/harbor.cfg b/make/harbor.cfg index 93720ea09..8ad8e1853 100644 --- a/make/harbor.cfg +++ b/make/harbor.cfg @@ -101,6 +101,16 @@ project_creation_restriction = everyone #Determine whether the job service should verify the ssl cert when it connects to a remote registry. #Set this flag to off when the remote registry uses a self-signed or untrusted certificate. verify_remote_cert = on + +#The follow configurations are for Harbor HA mode only + +#the address of the mysql database. +db_host = mysql + +#The port of mysql database host +db_port = 3306 + +#The user name of mysql database +db_user = root #************************END INITIAL PROPERTIES************************ ############# - diff --git a/make/prepare b/make/prepare index 7cde72116..c15fc2035 100755 --- a/make/prepare +++ b/make/prepare @@ -139,6 +139,9 @@ ldap_uid = rcp.get("configuration", "ldap_uid") ldap_scope = rcp.get("configuration", "ldap_scope") ldap_timeout = rcp.get("configuration", "ldap_timeout") db_password = rcp.get("configuration", "db_password") +db_host = rcp.get("configuration", "db_host") +db_port = rcp.get("configuration", "db_port") +db_user = rcp.get("configuration", "db_user") self_registration = rcp.get("configuration", "self_registration") if protocol == "https": cert_path = rcp.get("configuration", "ssl_cert") @@ -210,6 +213,9 @@ render(os.path.join(templates_dir, "adminserver", "env"), ldap_scope=ldap_scope, ldap_timeout=ldap_timeout, db_password=db_password, + db_host=db_host, + db_port=db_port, + db_user=db_user, email_host=email_host, email_port=email_port, email_usr=email_usr,