You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by io...@apache.org on 2019/05/14 10:38:50 UTC

[incubator-dlab] 01/03: add cron reboot job and autorestart to dockers

This is an automated email from the ASF dual-hosted git repository.

ioleksandr pushed a commit to branch DLAB-3
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git

commit c89eb75ce02451a8361106d488ba2b0f4833a010
Author: Oleksandr_Isniuk <i....@gmail.com>
AuthorDate: Tue May 14 13:36:59 2019 +0300

    add cron reboot job and autorestart to dockers
---
 infrastructure-provisioning/src/ssn/scripts/configure_docker.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/infrastructure-provisioning/src/ssn/scripts/configure_docker.py b/infrastructure-provisioning/src/ssn/scripts/configure_docker.py
index e61fb2c..3952400 100644
--- a/infrastructure-provisioning/src/ssn/scripts/configure_docker.py
+++ b/infrastructure-provisioning/src/ssn/scripts/configure_docker.py
@@ -123,9 +123,12 @@ def configure_guacamole():
         sudo("docker run --name guacamole --restart unless-stopped --link guacd:guacd --link guac-mysql:mysql -e MYSQL_DATABASE='guacamole' -e MYSQL_USER='guacamole' -e MYSQL_PASSWORD='guacamole' -d -p 8080:8080 guacamole/guacamole")
         #create cronjob for run containers on reboot
         sudo('mkdir /opt/dlab/cron')
-        put('/root/templates/mysql.sh /opt/dlab/cron/mysql.sh')
+        sudo('touch /opt/dlab/cron/mysql.sh')
         sudo('chmod 755 /opt/dlab/cron/mysql.sh')
-        sudo('sed -i "s|MYSQL_GENERATED_PASS|{}| /opt/dlab/cron/mysql.sh"'.format(mysql_pass))
+        sudo('echo "docker start guacd" >> /opt/dlab/cron/mysql.sh')
+        sudo('echo "docker start guac-mysql" >> /opt/dlab/cron/mysql.sh')
+        sudo('echo "docker rm guacamole" >> /opt/dlab/cron/mysql.sh')
+        sudo("""echo "docker run --name guacamole --restart unless-stopped --link guacd:guacd --link guac-mysql:mysql -e MYSQL_DATABASE='guacamole' -e MYSQL_USER='guacamole' -e MYSQL_PASSWORD='{}' -d -p 8080:8080 guacamole/guacamole" >> /opt/dlab/cron/mysql.sh""".format(mysql_pass))
         sudo('crontab -l | { cat; echo "@reboot sh /opt/dlab/cron/mysql.sh"; } | crontab -')
         return True
     except Exception as err:


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org