]> git.parisson.com Git - telemeta.git/commitdiff
mv install scripts
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Wed, 20 Jan 2016 19:37:15 +0000 (20:37 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Wed, 20 Jan 2016 19:37:15 +0000 (20:37 +0100)
app/deploy/init.sh.example [new file with mode: 0644]
app/deploy/install_linux_systemd.py [new file with mode: 0755]
app/deploy/install_linux_sysvinit.py [new file with mode: 0755]
init.sh.example [deleted file]
install_linux_systemd.py [deleted file]
install_linux_sysvinit.py [deleted file]

diff --git a/app/deploy/init.sh.example b/app/deploy/init.sh.example
new file mode 100644 (file)
index 0000000..74455fd
--- /dev/null
@@ -0,0 +1,68 @@
+#!/bin/sh
+
+### BEGIN INIT INFO
+# Provides:        %s
+# Required-Start:      docker
+# Required-Stop:       docker
+# Default-Start:       2 3 4 5
+# Default-Stop:                0 1 6
+# Short-Description:   Docker Services
+### END INIT INFO
+
+set -e
+
+PROJECT_NAME=%s
+YAMLFILE=%s
+OPTS="-f $YAMLFILE -p $PROJECT_NAME"
+UPOPTS="-d --no-recreate --no-build --no-deps"
+
+. /lib/lsb/init-functions
+
+case "$1" in
+    start)
+        log_daemon_msg "Starting $PROJECT_NAME composition" "$PROJECT_NAME" || true
+        if su -c "docker-compose $OPTS up $UPOPTS > /dev/null 2>&1" root ; then
+            log_end_msg 0 || true
+        else
+            log_end_msg 1 || true
+        fi
+        ;;
+
+    stop)
+        log_daemon_msg "Stopping $PROJECT_NAME composition" "$PROJECT_NAME" || true
+        if su -c "docker-compose $OPTS stop > /dev/null 2>&1" root; then
+            log_end_msg 0 || true
+        else
+            log_end_msg 1 || true
+        fi
+        ;;
+
+    reload|force-reload)
+        log_daemon_msg "Reloading $PROJECT_NAME composition" "$PROJECT_NAME" || true
+        if docker-compose $OPTS up $UPOPTS > /dev/null 2>&1 ; then
+            log_end_msg 0 || true
+        else
+            log_end_msg 1 || true
+        fi
+        ;;
+
+    restart|try-restart)
+        log_daemon_msg "Restarting $PROJECT_NAME composition" "$PROJECT_NAME" || true
+        if docker-compose $OPTS stop > /dev/null 2>&1; docker-compose $OPTS up $UPOPTS > /dev/null 2>&1 ; then
+            log_end_msg 0 || true
+        else
+            log_end_msg 1 || true
+        fi
+        ;;
+
+    status)
+        docker-compose $OPTS ps && exit 0 || exit $?
+        ;;
+
+    *)
+        log_action_msg "Usage: /etc/init.d/$PROJECT_NAME {start|stop|reload|force-reload|restart|try-restart|status}" || true
+        exit 1
+        ;;
+esac
+
+exit 0
diff --git a/app/deploy/install_linux_systemd.py b/app/deploy/install_linux_systemd.py
new file mode 100755 (executable)
index 0000000..037f3b6
--- /dev/null
@@ -0,0 +1,40 @@
+#!/usr/bin/python
+
+import os
+
+path = os.sep.join(os.getcwd().split(os.sep)[:-2])
+name = path.split(os.sep)[-1].lower()
+conf = path + os.sep + 'docker-compose.yml'
+program = '/usr/local/bin/docker-compose'
+service = '/lib/systemd/system/' + name + '.service'
+
+print 'installing ' + name + '...'
+
+if not os.path.exists('/etc/init.d/docker'):
+    os.system('wget -qO- https://get.docker.com/ | sh')
+    os.system('pip install docker-compose')
+
+rules="""
+[Unit]
+Description=%s composition
+Requires=docker.service
+After=docker.service
+
+[Service]
+ExecStart=%s -f %s up -d
+ExecStop=%s -f %s stop
+
+[Install]
+WantedBy=local.target
+""" % (name, program, conf, program, conf)
+
+# print rules
+
+f = open(service, 'w')
+f.write(rules)
+f.close()
+
+os.system('systemctl enable ' + service)
+os.system('systemctl daemon-reload')
+
+print 'done'
diff --git a/app/deploy/install_linux_sysvinit.py b/app/deploy/install_linux_sysvinit.py
new file mode 100755 (executable)
index 0000000..da6a088
--- /dev/null
@@ -0,0 +1,27 @@
+#!/usr/bin/python
+
+import os
+
+path = os.sep.join(os.getcwd().split(os.sep)[:-2])
+name = path.split(os.sep)[-1].lower()
+conf = path + os.sep + 'docker-compose.yml'
+service = '/etc/init.d/' + name
+
+print 'installing ' + name + '...'
+
+if not os.path.exists('/etc/init.d/docker'):
+    os.system('wget -qO- https://get.docker.com/ | sh')
+    os.system('pip install docker-compose')
+
+f = open('init.sh.example', 'r')
+rules = f.read() % (name, name, conf)
+f.close()
+
+f = open(service, 'w')
+f.write(rules)
+f.close()
+
+os.system('chmod 755 ' + service)
+os.system('update-rc.d ' + name + ' defaults')
+
+print 'done'
diff --git a/init.sh.example b/init.sh.example
deleted file mode 100644 (file)
index 74455fd..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/bin/sh
-
-### BEGIN INIT INFO
-# Provides:        %s
-# Required-Start:      docker
-# Required-Stop:       docker
-# Default-Start:       2 3 4 5
-# Default-Stop:                0 1 6
-# Short-Description:   Docker Services
-### END INIT INFO
-
-set -e
-
-PROJECT_NAME=%s
-YAMLFILE=%s
-OPTS="-f $YAMLFILE -p $PROJECT_NAME"
-UPOPTS="-d --no-recreate --no-build --no-deps"
-
-. /lib/lsb/init-functions
-
-case "$1" in
-    start)
-        log_daemon_msg "Starting $PROJECT_NAME composition" "$PROJECT_NAME" || true
-        if su -c "docker-compose $OPTS up $UPOPTS > /dev/null 2>&1" root ; then
-            log_end_msg 0 || true
-        else
-            log_end_msg 1 || true
-        fi
-        ;;
-
-    stop)
-        log_daemon_msg "Stopping $PROJECT_NAME composition" "$PROJECT_NAME" || true
-        if su -c "docker-compose $OPTS stop > /dev/null 2>&1" root; then
-            log_end_msg 0 || true
-        else
-            log_end_msg 1 || true
-        fi
-        ;;
-
-    reload|force-reload)
-        log_daemon_msg "Reloading $PROJECT_NAME composition" "$PROJECT_NAME" || true
-        if docker-compose $OPTS up $UPOPTS > /dev/null 2>&1 ; then
-            log_end_msg 0 || true
-        else
-            log_end_msg 1 || true
-        fi
-        ;;
-
-    restart|try-restart)
-        log_daemon_msg "Restarting $PROJECT_NAME composition" "$PROJECT_NAME" || true
-        if docker-compose $OPTS stop > /dev/null 2>&1; docker-compose $OPTS up $UPOPTS > /dev/null 2>&1 ; then
-            log_end_msg 0 || true
-        else
-            log_end_msg 1 || true
-        fi
-        ;;
-
-    status)
-        docker-compose $OPTS ps && exit 0 || exit $?
-        ;;
-
-    *)
-        log_action_msg "Usage: /etc/init.d/$PROJECT_NAME {start|stop|reload|force-reload|restart|try-restart|status}" || true
-        exit 1
-        ;;
-esac
-
-exit 0
diff --git a/install_linux_systemd.py b/install_linux_systemd.py
deleted file mode 100755 (executable)
index d6d0d1d..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/python
-
-import os
-
-path = os.getcwd()
-name = path.split(os.sep)[-1]
-service = '/lib/systemd/system/' + name + '.service'
-
-print 'installing ' + name + '...'
-
-if not os.path.exists('/etc/init.d/docker'):
-    os.system('wget -qO- https://get.docker.com/ | sh')
-    os.system('pip install docker-compose')
-
-rules="""
-[Unit]
-Description=%s composition
-Requires=docker.service
-After=docker.service
-
-[Service]
-ExecStart=/usr/local/bin/docker-compose -f %s/docker-compose.yml up -d
-ExecStop=/usr/local/bin/docker-compose -f %s/docker-compose.yml stop
-
-[Install]
-WantedBy=local.target
-""" % (name, path, path)
-
-# print rules
-
-f = open(service, 'w')
-f.write(rules)
-f.close()
-
-os.system('systemctl enable ' + service)
-os.system('systemctl daemon-reload')
-
-print 'done'
diff --git a/install_linux_sysvinit.py b/install_linux_sysvinit.py
deleted file mode 100755 (executable)
index 8c2cf17..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/python
-
-import os
-
-path = os.getcwd()
-name = path.split(os.sep)[-1].lower()
-service = '/etc/init.d/' + name
-conf = path + os.sep + 'docker-compose.yml'
-
-print 'installing ' + name + '...'
-
-if not os.path.exists('/etc/init.d/docker'):
-    os.system('wget -qO- https://get.docker.com/ | sh')
-    os.system('pip install docker-compose')
-
-f = open('init.sh.example', 'r')
-rules = f.read() % (name, name, conf)
-f.close()
-
-f = open(service, 'w')
-f.write(rules)
-f.close()
-
-os.system('chmod 755 ' + service)
-os.system('update-rc.d ' + name + ' defaults')
-
-print 'done'