This is an automated email from the ASF dual-hosted git repository.
ioleksandr pushed a commit to branch DLAB-657
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
The following commit(s) were added to refs/heads/DLAB-657 by this push:
new f166b16 [DLAB-656] self-service and billing separate images
f166b16 is described below
commit f166b16d0b0855a8819e537b32af1ac4d1432747
Author: Oleksandr_Isniuk <[email protected]>
AuthorDate: Mon May 27 16:31:33 2019 +0300
[DLAB-656] self-service and billing separate images
---
.../aws/{webui_Dockerfile => billing_Dockerfile} | 3 +-
.../src/general/files/aws/webui_Dockerfile | 1 +
.../src/general/lib/os/debian/ssn_lib.py | 72 +++++++++++++++-------
.../src/ssn/scripts/configure_ui.py | 6 +-
4 files changed, 53 insertions(+), 29 deletions(-)
diff --git a/infrastructure-provisioning/src/general/files/aws/webui_Dockerfile
b/infrastructure-provisioning/src/general/files/aws/billing_Dockerfile
similarity index 92%
copy from infrastructure-provisioning/src/general/files/aws/webui_Dockerfile
copy to infrastructure-provisioning/src/general/files/aws/billing_Dockerfile
index 1ec8721..c0952c4 100644
--- a/infrastructure-provisioning/src/general/files/aws/webui_Dockerfile
+++ b/infrastructure-provisioning/src/general/files/aws/billing_Dockerfile
@@ -35,5 +35,6 @@ RUN apt-get install -y default-jre && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY tmp-kuber/* /root/
+COPY tmp-kuber/conf/* /root/
-CMD sudo java -Xmx1024M -jar -Duser.timezone=UTC -Dfile.encoding=UTF-8
-DDLAB_CONF_DIR=/root/ /root/self-service-2.1.jar server /root/self-service.yml
\ No newline at end of file
+CMD sudo java -Xmx1024M -jar -Duser.timezone=UTC -Dfile.encoding=UTF-8
-DDLAB_CONF_DIR=/root/ /root/billing-aws-2.1.jar --conf /root/billing.yml
\ No newline at end of file
diff --git a/infrastructure-provisioning/src/general/files/aws/webui_Dockerfile
b/infrastructure-provisioning/src/general/files/aws/webui_Dockerfile
index 1ec8721..78e6680 100644
--- a/infrastructure-provisioning/src/general/files/aws/webui_Dockerfile
+++ b/infrastructure-provisioning/src/general/files/aws/webui_Dockerfile
@@ -35,5 +35,6 @@ RUN apt-get install -y default-jre && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY tmp-kuber/* /root/
+COPY tmp-kuber/conf/* /root/
CMD sudo java -Xmx1024M -jar -Duser.timezone=UTC -Dfile.encoding=UTF-8
-DDLAB_CONF_DIR=/root/ /root/self-service-2.1.jar server /root/self-service.yml
\ No newline at end of file
diff --git a/infrastructure-provisioning/src/general/lib/os/debian/ssn_lib.py
b/infrastructure-provisioning/src/general/lib/os/debian/ssn_lib.py
index 36f12b0..eac937e 100644
--- a/infrastructure-provisioning/src/general/lib/os/debian/ssn_lib.py
+++ b/infrastructure-provisioning/src/general/lib/os/debian/ssn_lib.py
@@ -190,17 +190,6 @@ def start_ss(keyfile, host_string, dlab_conf_dir, web_path,
sudo('mv /tmp/ssn.yml ' + os.environ['ssn_dlab_path'] + 'conf/')
put('/root/templates/proxy_location_webapp_template.conf',
'/tmp/proxy_location_webapp_template.conf')
sudo('mv /tmp/proxy_location_webapp_template.conf ' +
os.environ['ssn_dlab_path'] + 'tmp/')
- with open('/root/templates/supervisor_svc.conf', 'r') as f:
- text = f.read()
- text = text.replace('WEB_CONF', dlab_conf_dir).replace('OS_USR',
os_user)
- with open('/root/templates/supervisor_svc.conf', 'w') as f:
- f.write(text)
- put('/root/templates/supervisor_svc.conf',
'/tmp/supervisor_svc.conf')
- sudo('mv /tmp/supervisor_svc.conf ' + os.environ['ssn_dlab_path']
+ 'tmp/')
- sudo('cp ' + os.environ['ssn_dlab_path'] +
- 'tmp/proxy_location_webapp_template.conf
/etc/nginx/locations/proxy_location_webapp.conf')
- sudo('cp ' + os.environ['ssn_dlab_path'] +
'tmp/supervisor_svc.conf {}'.format(supervisor_conf))
- sudo('sed -i \'s=WEB_APP_DIR={}=\' {}'.format(web_path,
supervisor_conf))
try:
sudo('mkdir -p /var/log/application')
run('mkdir -p /tmp/yml_tmp/')
@@ -292,25 +281,62 @@ def start_ss(keyfile, host_string, dlab_conf_dir,
web_path,
except:
append_result("Unable to generate cert and copy to java
keystore")
sys.exit(1)
- sudo('service supervisor start')
- sudo('service nginx restart')
- sudo('service supervisor restart')
- sudo('touch ' + os.environ['ssn_dlab_path'] + 'tmp/ss_started')
+ if kuber_enabled:
+ try:
+ dlab_source_dir =
'{}sources/infrastructure-provisioning/src/'.format(dlab_path)
+ k8s_dir = '{}tmp-kuber/'.format(dlab_source_dir)
+ sudo("mkdir {}".format(k8s_dir))
+ sudo("cp -r {0}conf/ {1}".format(dlab_path))
+ sudo("cp -r {0}webapp/self-service/lib/*.jar
{1}".format(dlab_path, k8s_dir))
+ sudo("cp -r {0}webapp/security-service/lib/*.jar
{1}".format(dlab_path, k8s_dir))
+ sudo("cp -r {0}webapp/provisioning-service/lib/*.jar
{1}".format(dlab_path, k8s_dir))
+ sudo("cp -r {0}webapp/billing/lib/*.jar
{1}".format(dlab_path, k8s_dir))
+ sudo('sed -i "s|ssn.yml|/root/ssn.yml|g"
{}self-service.yml'.format(k8s_dir))
+ sudo("cd {}; docker build --file
general/files/aws/webui_Dockerfile -t docker.dlab-ui ."
+ .format(dlab_source_dir))
+ sudo("cd {}; docker build --file
general/files/aws/billing_Dockerfile -t docker.dlab-billing ."
+ .format(dlab_source_dir))
+ except Exception as err:
+ traceback.print_exc()
+ print('Failed to build images for services: ', str(err))
+ sys.exit(1)
+ else:
+ with open('/root/templates/supervisor_svc.conf', 'r') as f:
+ text = f.read()
+ text = text.replace('WEB_CONF',
dlab_conf_dir).replace('OS_USR', os_user)
+ with open('/root/templates/supervisor_svc.conf', 'w') as f:
+ f.write(text)
+ put('/root/templates/supervisor_svc.conf',
'/tmp/supervisor_svc.conf')
+ sudo('mv /tmp/supervisor_svc.conf ' +
os.environ['ssn_dlab_path'] + 'tmp/')
+ sudo('cp ' + os.environ['ssn_dlab_path'] +
+ 'tmp/proxy_location_webapp_template.conf
/etc/nginx/locations/proxy_location_webapp.conf')
+ sudo('cp ' + os.environ['ssn_dlab_path'] +
'tmp/supervisor_svc.conf {}'.format(supervisor_conf))
+ sudo('sed -i \'s=WEB_APP_DIR={}=\' {}'.format(web_path,
supervisor_conf))
+ sudo('service supervisor start')
+ sudo('service nginx restart')
+ sudo('service supervisor restart')
+ sudo('touch ' + os.environ['ssn_dlab_path'] + 'tmp/ss_started')
except Exception as err:
traceback.print_exc()
print('Failed to start Self-service: ', str(err))
sys.exit(1)
-def create_kuber_images():
+def create_kuber_images(dlab_path):
try:
- sudo("mkdir
/opt/dlab/sources/infrastructure-provisioning/src/tmp-kuber/")
- sudo("cp -r /opt/dlab/conf/
/opt/dlab/sources/infrastructure-provisioning/src/tmp-kuber/")
- sudo("cp -r /opt/dlab/webapp/self-service/lib/*.jar
/opt/dlab/sources/infrastructure-provisioning/src/tmp-kuber/")
- sudo("cp -r /opt/dlab/webapp/security-service/lib/*.jar
/opt/dlab/sources/infrastructure-provisioning/src/tmp-kuber/")
- sudo("cp -r /opt/dlab/webapp/provisioning-service/lib/*.jar
/opt/dlab/sources/infrastructure-provisioning/src/tmp-kuber/")
- sudo("cp -r /opt/dlab/webapp/billing/lib/*.jar
/opt/dlab/sources/infrastructure-provisioning/src/tmp-kuber/")
- sudo("cd /opt/dlab/sources/infrastructure-provisioning/src/; docker
build --file general/files/aws/webui_Dockerfile --no-cache -t docker.dlab-ui .")
+ dlab_source_dir =
'{}sources/infrastructure-provisioning/src/'.format(dlab_path)
+ k8s_dir = '{}tmp-kuber/'.format(dlab_source_dir)
+ sudo("mkdir {}".format(k8s_dir))
+ sudo("cp -r {0}conf/ {1}".format(dlab_path))
+ sudo("cp -r {0}webapp/self-service/lib/*.jar {1}".format(dlab_path,
k8s_dir))
+ sudo("cp -r {0}webapp/security-service/lib/*.jar
{1}".format(dlab_path, k8s_dir))
+ sudo("cp -r {0}webapp/provisioning-service/lib/*.jar
{1}".format(dlab_path, k8s_dir))
+ sudo("cp -r {0}webapp/billing/lib/*.jar {1}".format(dlab_path,
k8s_dir))
+ sudo('sed -i "s|ssn.yml|/root/ssn.yml|g"
{}self-service.yml'.format(k8s_dir))
+ sudo("cd {}; docker build --file general/files/aws/webui_Dockerfile -t
docker.dlab-ui .".format(dlab_source_dir))
+ sudo("cd {}; docker build --file general/files/aws/billing_Dockerfile
-t docker.dlab-billing ."
+ .format(dlab_source_dir))
+
except Exception as err:
traceback.print_exc()
print('Failed to build images for Kubernetes', str(err))
diff --git a/infrastructure-provisioning/src/ssn/scripts/configure_ui.py
b/infrastructure-provisioning/src/ssn/scripts/configure_ui.py
index 87fda84..daafc19 100644
--- a/infrastructure-provisioning/src/ssn/scripts/configure_ui.py
+++ b/infrastructure-provisioning/src/ssn/scripts/configure_ui.py
@@ -239,8 +239,4 @@ if __name__ == "__main__":
args.region_info, args.ldap_login, args.tenant_id,
args.application_id,
args.hostname, args.datalake_store_name, args.subscription_id,
args.validate_permission_scope,
args.dlab_id, args.usage_date, args.product, args.usage_type,
- args.usage, args.cost, args.resource_id, args.tags)
-
- #raw draft for kuber
- print("Creating Kuber images")
- create_kuber_images()
\ No newline at end of file
+ args.usage, args.cost, args.resource_id, args.tags)
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]