From 1c402521123cb4a3b00bd8446c5eef88c7c88b6b Mon Sep 17 00:00:00 2001 From: Disassembler Date: Tue, 4 Sep 2018 21:42:26 +0200 Subject: [PATCH] Initial commit for LXCification --- alpine.sh | 2 +- basic-runtimes.sh | 5 +++ basic-runtimes/var/lib/lxc/shared/config | 24 +++++++++++ basic.sh | 31 +++++++------- basic/etc/conf.d/iptables | 14 +++++++ basic/etc/init.d/docker | 40 ------------------- basic/etc/init.d/{vm-appmgr => vmmgr} | 4 +- basic/etc/iptables/rules-save | 7 ++++ basic/etc/network/interfaces | 15 +++++++ basic/sbin/vmtty | 2 +- basic/srv/vm/cli.py | 4 +- basic/srv/vm/{appmgr => mgr}/__init__.py | 2 +- basic/srv/vm/{appmgr => mgr}/confupdater.py | 0 basic/srv/vm/{appmgr => mgr}/tools.py | 0 basic/srv/vm/{appmgr => mgr}/validator.py | 0 basic/srv/vm/{appmgr => mgr}/wsgiapp.py | 6 +-- basic/srv/vm/{appmgr => mgr}/wsgilang.py | 0 basic/srv/vm/{appmgr => mgr}/wsgisession.py | 0 basic/srv/vm/wsgi.py | 2 +- ckan.sh | 2 +- ckan/etc/init.d/ckan | 4 +- crisiscleanup.sh | 2 +- crisiscleanup/etc/init.d/crisiscleanup | 4 +- cts.sh | 2 +- cts/etc/init.d/cts | 4 +- frontlinesms.sh | 2 +- frontlinesms/etc/init.d/frontlinesms | 4 +- gnuhealth.sh | 2 +- gnuhealth/etc/init.d/gnuhealth | 4 +- kanboard.sh | 2 +- kanboard/etc/init.d/kanboard | 4 +- mifosx.sh | 2 +- mifosx/etc/init.d/mifosx | 4 +- motech.sh | 2 +- motech/etc/init.d/motech | 4 +- .../etc/init.d/opendatakit-build | 4 +- opendatakit.sh | 2 +- opendatakit/etc/init.d/opendatakit | 4 +- openmapkit.sh | 2 +- openmapkit/etc/init.d/openmapkit | 4 +- pandora.sh | 2 +- pandora/etc/init.d/pandora | 4 +- sahana-demo.sh | 2 +- sahana-demo/etc/init.d/sahana-demo | 4 +- sahana.sh | 2 +- sahana/etc/init.d/sahana | 4 +- sambro.sh | 2 +- sambro/etc/init.d/sambro | 4 +- seeddms.sh | 2 +- seeddms/etc/init.d/seeddms | 4 +- sigmah.sh | 2 +- sigmah/etc/init.d/sigmah | 4 +- ushahidi.sh | 2 +- ushahidi/etc/init.d/ushahidi | 4 +- 54 files changed, 144 insertions(+), 120 deletions(-) create mode 100644 basic-runtimes/var/lib/lxc/shared/config create mode 100644 basic/etc/conf.d/iptables delete mode 100755 basic/etc/init.d/docker rename basic/etc/init.d/{vm-appmgr => vmmgr} (66%) create mode 100644 basic/etc/iptables/rules-save create mode 100644 basic/etc/network/interfaces rename basic/srv/vm/{appmgr => mgr}/__init__.py (99%) rename basic/srv/vm/{appmgr => mgr}/confupdater.py (100%) rename basic/srv/vm/{appmgr => mgr}/tools.py (100%) rename basic/srv/vm/{appmgr => mgr}/validator.py (100%) rename basic/srv/vm/{appmgr => mgr}/wsgiapp.py (99%) rename basic/srv/vm/{appmgr => mgr}/wsgilang.py (100%) rename basic/srv/vm/{appmgr => mgr}/wsgisession.py (100%) diff --git a/alpine.sh b/alpine.sh index bd7d4b2..0649a4e 100755 --- a/alpine.sh +++ b/alpine.sh @@ -82,7 +82,7 @@ chroot /mnt setup-timezone -z Europe/Prague # Set hostname echo 'spotter.vm' >/mnt/etc/hostname -echo '127.0.0.1 spotter.vm localhost localhost.localdomain' >/mnt/etc/hosts +echo -e '127.0.0.1 localhost\n::1 localhost' >/mnt/etc/hosts sed -i '/hostname/d' /mnt/etc/network/interfaces # Enable services on boot diff --git a/basic-runtimes.sh b/basic-runtimes.sh index 8e27f51..ec9650c 100755 --- a/basic-runtimes.sh +++ b/basic-runtimes.sh @@ -3,6 +3,11 @@ set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/basic-runtimes +# Build basic Alpine image +mkdir -p /var/lib/lxc/shared/alpine +wget https://github.com/gliderlabs/docker-alpine/raw/2bfe6510ee31d86cfeb2f37587f4cf866f28ffbc/versions/library-3.8/x86_64/rootfs.tar.xz -O - | tar xJf - -C /var/lib/lxc/shared/alpine +cp ${SOURCE_DIR}/var/lib/lxc/shared/config /var/lib/lxc/shared/config + # Build Docker images docker build -t java ${SOURCE_DIR}/java docker build -t php ${SOURCE_DIR}/php diff --git a/basic-runtimes/var/lib/lxc/shared/config b/basic-runtimes/var/lib/lxc/shared/config new file mode 100644 index 0000000..c11764f --- /dev/null +++ b/basic-runtimes/var/lib/lxc/shared/config @@ -0,0 +1,24 @@ +# Hostname +lxc.uts.name = shared + +# Network +lxc.net.0.type = veth +lxc.net.0.link = lxcbr0 +lxc.net.0.flags = up +lxc.net.0.ipv4.address = 172.17.0.2/16 +lxc.net.0.ipv4.gateway = auto + +# Volumes +lxc.rootfs.path = /var/lib/lxc/shared/alpine + +# Mounts +lxc.mount.entry = /etc/hosts /etc/hosts none bind 0 0 +lxc.mount.entry = /etc/resolv.conf /etc/resolv.conf none bind 0 0 + +# Halt +lxc.signal.halt = SIGTERM + +# Other +lxc.arch = x86_64 +lxc.cap.drop = sys_admin +lxc.include = /usr/share/lxc/config/alpine.common.conf diff --git a/basic.sh b/basic.sh index 36378e8..6ad9f5f 100755 --- a/basic.sh +++ b/basic.sh @@ -4,7 +4,7 @@ set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/basic # Install packages -apk --no-cache add curl docker e2fsprogs-extra gettext kbd-misc libressl python3 py3-bcrypt py3-cffi py3-dnspython py3-jinja2 py3-requests py3-six py3-werkzeug nginx util-linux +apk --no-cache add curl bridge e2fsprogs-extra gettext iptables kbd-misc libressl lxc python3 py3-bcrypt py3-cffi py3-dnspython py3-jinja2 py3-requests py3-six py3-werkzeug nginx util-linux if [ ${DEBUG:-0} -eq 1 ]; then # Install some utilities for DEBUG mode apk --no-cache add git file htop less openssh-server openssh-sftp-server @@ -33,38 +33,37 @@ cp ${SOURCE_DIR}/etc/conf.d/consolefont /etc/conf.d/consolefont # Configure NTP client cp ${SOURCE_DIR}/etc/conf.d/ntpd /etc/conf.d/ntpd +# Configure networking +cp ${SOURCE_DIR}/etc/conf.d/iptables /etc/conf.d/iptables +cp ${SOURCE_DIR}/etc/iptables/rules-save /etc/iptables/rules-save +cp ${SOURCE_DIR}/etc/network/interfaces /etc/network/interfaces +service networking restart +service iptables restart +echo -e "172.17.0.1 host\n172.17.0.1 postfix" >>/etc/hosts + # Download and configure acme.sh mkdir /etc/acme.sh.d wget https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh -O /usr/bin/acme.sh sed -i 's|$HOME/.$PROJECT_NAME|/etc/acme.sh.d|' /usr/bin/acme.sh chmod +x /usr/bin/acme.sh -# Copy AppMgr resources -cp ${SOURCE_DIR}/etc/init.d/vm-appmgr /etc/init.d/vm-appmgr +# Copy VMMgr resources +cp ${SOURCE_DIR}/etc/init.d/vmmgr /etc/init.d/vmmgr rc-update -u cp -r ${SOURCE_DIR}/srv/vm /srv/vm -ln -s /srv/vm/cli.py /usr/bin/vm-appmgr +ln -s /srv/vm/cli.py /usr/bin/vmmgr # Create a self-signed certificate -vm-appmgr create-selfsigned +vmmgr create-selfsigned # Configure nginx cp ${SOURCE_DIR}/etc/nginx/nginx.conf /etc/nginx/nginx.conf # Configure services -for SERVICE in consolefont crond nginx ntpd sshd vm-appmgr swap; do +for SERVICE in consolefont crond nginx ntpd lxd sshd swap vmmgr; do rc-update add ${SERVICE} boot service ${SERVICE} start done -# Configure Docker service -cp ${SOURCE_DIR}/etc/init.d/docker /etc/init.d/docker -rc-update -u -rc-update add docker -service docker start - -# Create basic images -docker build -t alpine ${SOURCE_DIR} - # Set dummy host and generate related files -vm-appmgr update-host spotter.vm 443 +vmmgr update-host spotter.vm 443 diff --git a/basic/etc/conf.d/iptables b/basic/etc/conf.d/iptables new file mode 100644 index 0000000..e2a9fd4 --- /dev/null +++ b/basic/etc/conf.d/iptables @@ -0,0 +1,14 @@ +# /etc/conf.d/iptables + +# Location in which iptables initscript will save set rules on +# service shutdown +IPTABLES_SAVE="/etc/iptables/rules-save" + +# Options to pass to iptables-save and iptables-restore +SAVE_RESTORE_OPTIONS="-c" + +# Save state on stopping iptables +SAVE_ON_STOP="yes" + +# Enable/disable IPv4 forwarding with the rules +IPFORWARD="yes" diff --git a/basic/etc/init.d/docker b/basic/etc/init.d/docker deleted file mode 100755 index 7b3a7f7..0000000 --- a/basic/etc/init.d/docker +++ /dev/null @@ -1,40 +0,0 @@ -#!/sbin/openrc-run -# Copyright 1999-2013 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -command="${DOCKERD_BINARY:-/usr/bin/dockerd}" -pidfile="${DOCKER_PIDFILE:-/run/${RC_SVCNAME}.pid}" -command_args="-p \"${pidfile}\" ${DOCKER_OPTS}" -DOCKER_LOGFILE="${DOCKER_LOGFILE:-/var/log/${RC_SVCNAME}.log}" -DOCKER_ERRFILE="${DOCKER_ERRFILE:-${DOCKER_LOGFILE}}" -DOCKER_OUTFILE="${DOCKER_OUTFILE:-${DOCKER_LOGFILE}}" -start_stop_daemon_args="--background \ - --stderr \"${DOCKER_ERRFILE}\" --stdout \"${DOCKER_OUTFILE}\"" - -grsecdir=/proc/sys/kernel/grsecurity - -depend() { - need sysfs cgroups -} - -start_pre() { - checkpath -f -m 0644 -o root:docker "$DOCKER_LOGFILE" - - for i in $disable_grsec; do - if [ -e "$grsecdir/$i" ]; then - einfo " Disabling $i" - echo 0 > "$grsecdir/$i" - fi - done - ulimit -n 1048576 - - # Having non-zero limits causes performance problems due to accounting overhead - # in the kernel. We recommend using cgroups to do container-local accounting. - ulimit -p unlimited - - return 0 -} - -start_post() { - ewaitfile 10 /var/run/docker.sock -} diff --git a/basic/etc/init.d/vm-appmgr b/basic/etc/init.d/vmmgr similarity index 66% rename from basic/etc/init.d/vm-appmgr rename to basic/etc/init.d/vmmgr index 5c93035..366d19f 100755 --- a/basic/etc/init.d/vm-appmgr +++ b/basic/etc/init.d/vmmgr @@ -1,6 +1,6 @@ #!/sbin/openrc-run command=/srv/vm/wsgi.py -description="VM application manager" -pidfile=/var/run/vm-appmgr.pid +description="VM manager" +pidfile=/var/run/vmmgr.pid start_stop_daemon_args="--background --make-pidfile --stderr /dev/null --stdout /dev/null" diff --git a/basic/etc/iptables/rules-save b/basic/etc/iptables/rules-save new file mode 100644 index 0000000..8d489a6 --- /dev/null +++ b/basic/etc/iptables/rules-save @@ -0,0 +1,7 @@ +*nat +:PREROUTING ACCEPT [0:0] +:INPUT ACCEPT [0:0] +:OUTPUT ACCEPT [0:0] +:POSTROUTING ACCEPT [0:0] +[0:0] -A POSTROUTING -o eth0 -j MASQUERADE +COMMIT diff --git a/basic/etc/network/interfaces b/basic/etc/network/interfaces new file mode 100644 index 0000000..5ffc97b --- /dev/null +++ b/basic/etc/network/interfaces @@ -0,0 +1,15 @@ +auto lo +iface lo inet loopback + +auto eth0 +iface eth0 inet dhcp + +auto lxcbr0 +iface lxcbr0 inet static + address 172.17.0.1 + network 172.17.0.0 + netmask 255.255.0.0 + broadcast 172.17.255.255 + bridge_fd 0 + bridge_stp off + bridge_waitport 0 diff --git a/basic/sbin/vmtty b/basic/sbin/vmtty index 624e9cf..7acea0f 100755 --- a/basic/sbin/vmtty +++ b/basic/sbin/vmtty @@ -1,7 +1,7 @@ #!/bin/sh # Rebuild /etc/issue -/usr/bin/vm-appmgr rebuild-issue +/usr/bin/vmmgr rebuild-issue # Remove double-escaping needed for the real /etc/issue /bin/sed 's|\\\\|\\|g' /etc/issue # Wait for key press diff --git a/basic/srv/vm/cli.py b/basic/srv/vm/cli.py index 0e22021..f63b08b 100755 --- a/basic/srv/vm/cli.py +++ b/basic/srv/vm/cli.py @@ -6,7 +6,7 @@ import getpass import sys sys.path.append('/srv/vm') -from appmgr import AppMgr +from mgr import VMMgr parser = argparse.ArgumentParser(description='VM application manager') subparsers = parser.add_subparsers() @@ -77,7 +77,7 @@ parser_install_cert.add_argument('certificate', help='Certificate file') parser_install_cert.add_argument('key', help='Key file') args = parser.parse_args() -mgr = AppMgr() +mgr = VMMgr() if args.action == 'update-login': mgr.update_login(args.app, args.login, args.password) elif args.action == 'show-tiles': diff --git a/basic/srv/vm/appmgr/__init__.py b/basic/srv/vm/mgr/__init__.py similarity index 99% rename from basic/srv/vm/appmgr/__init__.py rename to basic/srv/vm/mgr/__init__.py index ab6bcb6..c51274b 100644 --- a/basic/srv/vm/appmgr/__init__.py +++ b/basic/srv/vm/mgr/__init__.py @@ -122,7 +122,7 @@ x509_extensions = ext subjectAltName=DNS:{domain},DNS:*.{domain}" ''' -class AppMgr: +class VMMgr: def __init__(self): # Load JSON configuration with open(CONF_FILE, 'r') as f: diff --git a/basic/srv/vm/appmgr/confupdater.py b/basic/srv/vm/mgr/confupdater.py similarity index 100% rename from basic/srv/vm/appmgr/confupdater.py rename to basic/srv/vm/mgr/confupdater.py diff --git a/basic/srv/vm/appmgr/tools.py b/basic/srv/vm/mgr/tools.py similarity index 100% rename from basic/srv/vm/appmgr/tools.py rename to basic/srv/vm/mgr/tools.py diff --git a/basic/srv/vm/appmgr/validator.py b/basic/srv/vm/mgr/validator.py similarity index 100% rename from basic/srv/vm/appmgr/validator.py rename to basic/srv/vm/mgr/validator.py diff --git a/basic/srv/vm/appmgr/wsgiapp.py b/basic/srv/vm/mgr/wsgiapp.py similarity index 99% rename from basic/srv/vm/appmgr/wsgiapp.py rename to basic/srv/vm/mgr/wsgiapp.py index 60cf0fe..8158b06 100644 --- a/basic/srv/vm/appmgr/wsgiapp.py +++ b/basic/srv/vm/mgr/wsgiapp.py @@ -10,7 +10,7 @@ from werkzeug.wrappers import Request, Response from werkzeug.wsgi import ClosingIterator from jinja2 import Environment, FileSystemLoader -from . import AppMgr, CERT_PUB_FILE +from . import VMMgr, CERT_PUB_FILE from . import tools from .validator import InvalidValueException from .wsgilang import WSGILang @@ -30,7 +30,7 @@ class WSGIApp(object): def wsgi_app(self, environ, start_response): request = Request(environ) # Enhance request - request.mgr = AppMgr() + request.mgr = VMMgr() request.session = WSGISession(request.cookies, SESSION_KEY) request.session.lang = WSGILang() # Dispatch request @@ -254,7 +254,7 @@ class WSGIApp(object): return self.render_json({'ok': request.session.lang.app_stopped()}) def update_password_action(self, request): - # Updates password for both HDD encryption (LUKS-on-LVM) and admin account to vm-appmgr + # Updates password for both HDD encryption (LUKS-on-LVM) and admin account to vmmgr try: if request.form['newpassword'] != request.form['newpassword2']: return self.render_json({'error': request.session.lang.password_mismatch()}) diff --git a/basic/srv/vm/appmgr/wsgilang.py b/basic/srv/vm/mgr/wsgilang.py similarity index 100% rename from basic/srv/vm/appmgr/wsgilang.py rename to basic/srv/vm/mgr/wsgilang.py diff --git a/basic/srv/vm/appmgr/wsgisession.py b/basic/srv/vm/mgr/wsgisession.py similarity index 100% rename from basic/srv/vm/appmgr/wsgisession.py rename to basic/srv/vm/mgr/wsgisession.py diff --git a/basic/srv/vm/wsgi.py b/basic/srv/vm/wsgi.py index 7ee6bd9..13b7ffe 100755 --- a/basic/srv/vm/wsgi.py +++ b/basic/srv/vm/wsgi.py @@ -4,7 +4,7 @@ import sys sys.path.append('/srv/vm') -from appmgr.wsgiapp import WSGIApp +from mgr.wsgiapp import WSGIApp application = WSGIApp() diff --git a/ckan.sh b/ckan.sh index 694d93c..a8b8b00 100755 --- a/ckan.sh +++ b/ckan.sh @@ -56,7 +56,7 @@ export CKAN_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export CKAN_ADMIN_HASH=$(docker run --rm ckan python -c "from passlib.hash import pbkdf2_sha512;print pbkdf2_sha512.encrypt('${CKAN_ADMIN_PWD}')") export CKAN_ADMIN_EMAIL="admin@example.com" envsubst <${SOURCE_DIR}/adminpwd.sql | docker exec -i postgres psql ckan -vm-appmgr update-login ckan "${CKAN_ADMIN_USER}" "${CKAN_ADMIN_PWD}" +vmmgr update-login ckan "${CKAN_ADMIN_USER}" "${CKAN_ADMIN_PWD}" # Install cron job cp ${SOURCE_DIR}/etc/periodic/hourly/ckan /etc/periodic/hourly/ckan diff --git a/ckan/etc/init.d/ckan b/ckan/etc/init.d/ckan index e9fce2f..12381e4 100755 --- a/ckan/etc/init.d/ckan +++ b/ckan/etc/init.d/ckan @@ -21,11 +21,11 @@ start() { } start_post() { - /usr/bin/vm-appmgr register-proxy ckan + /usr/bin/vmmgr register-proxy ckan } stop_pre() { - /usr/bin/vm-appmgr unregister-proxy ckan + /usr/bin/vmmgr unregister-proxy ckan } stop() { diff --git a/crisiscleanup.sh b/crisiscleanup.sh index afcde37..2389063 100755 --- a/crisiscleanup.sh +++ b/crisiscleanup.sh @@ -31,7 +31,7 @@ envsubst <${SOURCE_DIR}/srv/crisiscleanup/conf/database.yml >/srv/crisiscleanup/ cp ${SOURCE_DIR}/srv/crisiscleanup/conf/boot.rb /srv/crisiscleanup/conf/boot.rb cp ${SOURCE_DIR}/srv/crisiscleanup/conf/initializers/devise.rb /srv/crisiscleanup/conf/initializers/devise.rb cp ${SOURCE_DIR}/srv/crisiscleanup/conf/environments/production.rb /srv/crisiscleanup/conf/environments/production.rb -vm-appmgr update-login crisiscleanup "${CRISISCLEANUP_ADMIN_EMAIL}" "${CRISISCLEANUP_ADMIN_PWD}" +vmmgr update-login crisiscleanup "${CRISISCLEANUP_ADMIN_EMAIL}" "${CRISISCLEANUP_ADMIN_PWD}" # Populate database envsubst <${SOURCE_DIR}/srv/crisiscleanup/db/seeds.rb >/tmp/seeds.rb diff --git a/crisiscleanup/etc/init.d/crisiscleanup b/crisiscleanup/etc/init.d/crisiscleanup index 4020c98..555dc1b 100755 --- a/crisiscleanup/etc/init.d/crisiscleanup +++ b/crisiscleanup/etc/init.d/crisiscleanup @@ -17,11 +17,11 @@ start() { } start_post() { - /usr/bin/vm-appmgr register-proxy crisiscleanup + /usr/bin/vmmgr register-proxy crisiscleanup } stop_pre() { - /usr/bin/vm-appmgr unregister-proxy crisiscleanup + /usr/bin/vmmgr unregister-proxy crisiscleanup } stop() { diff --git a/cts.sh b/cts.sh index 36852e3..f54c905 100755 --- a/cts.sh +++ b/cts.sh @@ -39,7 +39,7 @@ export CTS_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export CTS_ADMIN_HASH=$(docker run --rm -h cts -v /srv/cts/conf:/srv/cts/cts/settings cts python -c "from django.contrib.auth.hashers import make_password; print make_password('${CTS_ADMIN_PWD}')") export CTS_ADMIN_SECRET=$(head -c 12 /dev/urandom | sha256sum | cut -c1-13) envsubst <${SOURCE_DIR}/adminpwd.sql | docker exec -i postgres psql cts -vm-appmgr update-login cts "${CTS_ADMIN_EMAIL}" "${CTS_ADMIN_PWD}" +vmmgr update-login cts "${CTS_ADMIN_EMAIL}" "${CTS_ADMIN_PWD}" # Stop services required for build service postgres stop diff --git a/cts/etc/init.d/cts b/cts/etc/init.d/cts index 0775cad..af4c2cb 100755 --- a/cts/etc/init.d/cts +++ b/cts/etc/init.d/cts @@ -16,11 +16,11 @@ start() { } start_post() { - /usr/bin/vm-appmgr register-proxy cts + /usr/bin/vmmgr register-proxy cts } stop_pre() { - /usr/bin/vm-appmgr unregister-proxy cts + /usr/bin/vmmgr unregister-proxy cts } stop() { diff --git a/frontlinesms.sh b/frontlinesms.sh index 13ba416..9a8d029 100755 --- a/frontlinesms.sh +++ b/frontlinesms.sh @@ -16,4 +16,4 @@ export FRONTLINESMS_ADMIN_USER_HASH=$(echo -n "${FRONTLINESMS_ADMIN_USER}" | bas export FRONTLINESMS_ADMIN_PWD_HASH=$(echo -n "${FRONTLINESMS_ADMIN_PWD}" | base64) envsubst <${SOURCE_DIR}/srv/frontlinesms/data/app-settings.properties >/srv/frontlinesms/data/app-settings.properties chown -R 8018:8018 /srv/frontlinesms/data -vm-appmgr update-login frontlinesms "${FRONTLINESMS_ADMIN_USER}" "${FRONTLINESMS_ADMIN_PWD}" +vmmgr update-login frontlinesms "${FRONTLINESMS_ADMIN_USER}" "${FRONTLINESMS_ADMIN_PWD}" diff --git a/frontlinesms/etc/init.d/frontlinesms b/frontlinesms/etc/init.d/frontlinesms index 701042f..4713582 100755 --- a/frontlinesms/etc/init.d/frontlinesms +++ b/frontlinesms/etc/init.d/frontlinesms @@ -15,11 +15,11 @@ start() { } start_post() { - /usr/bin/vm-appmgr register-proxy frontlinesms + /usr/bin/vmmgr register-proxy frontlinesms } stop_pre() { - /usr/bin/vm-appmgr unregister-proxy frontlinesms + /usr/bin/vmmgr unregister-proxy frontlinesms } stop() { diff --git a/gnuhealth.sh b/gnuhealth.sh index c3ece90..a4b0e5d 100755 --- a/gnuhealth.sh +++ b/gnuhealth.sh @@ -27,7 +27,7 @@ export GNUHEALTH_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) echo ${GNUHEALTH_ADMIN_PWD} >/tmp/.adminpwd docker run --rm -h gnuhealth --link postgres -v /srv/gnuhealth/conf:/srv/gnuhealth/gnuhealth/tryton/server/config -v /tmp/.adminpwd:/tmp/.adminpwd -e TRYTONPASSFILE=/tmp/.adminpwd gnuhealth /srv/gnuhealth/gnuhealth/tryton/server/trytond-4.2.15/bin/trytond-admin -d gnuhealth --all -v rm -f /tmp/.adminpwd -vm-appmgr update-login gnuhealth "${GNUHEALTH_ADMIN_USER}" "${GNUHEALTH_ADMIN_PWD}" +vmmgr update-login gnuhealth "${GNUHEALTH_ADMIN_USER}" "${GNUHEALTH_ADMIN_PWD}" # Populate demo database wget http://health.gnu.org/downloads/postgres_dumps/gnuhealth-32-demo.sql.gz -O /tmp/gnuhealth_demo.sql.gz diff --git a/gnuhealth/etc/init.d/gnuhealth b/gnuhealth/etc/init.d/gnuhealth index d658081..e6a33f7 100755 --- a/gnuhealth/etc/init.d/gnuhealth +++ b/gnuhealth/etc/init.d/gnuhealth @@ -17,11 +17,11 @@ start() { } start_post() { - /usr/bin/vm-appmgr register-proxy gnuhealth + /usr/bin/vmmgr register-proxy gnuhealth } stop_pre() { - /usr/bin/vm-appmgr unregister-proxy gnuhealth + /usr/bin/vmmgr unregister-proxy gnuhealth } stop() { diff --git a/kanboard.sh b/kanboard.sh index ab7edf8..c82c210 100755 --- a/kanboard.sh +++ b/kanboard.sh @@ -26,7 +26,7 @@ export KANBOARD_ADMIN_USER=admin export KANBOARD_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export KANBOARD_ADMIN_HASH=$(docker run --rm kanboard php -r "echo password_hash('${KANBOARD_ADMIN_PWD}', PASSWORD_BCRYPT);") envsubst <${SOURCE_DIR}/adminpwd.sql | docker exec -i postgres psql kanboard -vm-appmgr update-login kanboard "${KANBOARD_ADMIN_USER}" "${KANBOARD_ADMIN_PWD}" +vmmgr update-login kanboard "${KANBOARD_ADMIN_USER}" "${KANBOARD_ADMIN_PWD}" # Install cron job cp ${SOURCE_DIR}/etc/periodic/daily/kanboard /etc/periodic/daily/kanboard diff --git a/kanboard/etc/init.d/kanboard b/kanboard/etc/init.d/kanboard index af0aac5..7307afc 100755 --- a/kanboard/etc/init.d/kanboard +++ b/kanboard/etc/init.d/kanboard @@ -18,11 +18,11 @@ start() { } start_post() { - /usr/bin/vm-appmgr register-proxy kanboard + /usr/bin/vmmgr register-proxy kanboard } stop_pre() { - /usr/bin/vm-appmgr unregister-proxy kanboard + /usr/bin/vmmgr unregister-proxy kanboard } stop() { diff --git a/mifosx.sh b/mifosx.sh index f86ac70..5a64fa2 100755 --- a/mifosx.sh +++ b/mifosx.sh @@ -42,7 +42,7 @@ export MIFOSX_ADMIN_EMAIL=admin@example.com export MIFOSX_ADMIN_PWD=$(head -c 12 /dev/urandom | base64 | tr -d "+") export MIFOSX_ADMIN_HASH=$(echo -n "${MIFOSX_ADMIN_PWD}{1}" | sha256sum | awk '{print $1}') envsubst <${SOURCE_DIR}/adminpwd.sql | docker exec -i mariadb mysql mifostenant-default -vm-appmgr update-login mifosx "${MIFOSX_ADMIN_USER}" "${MIFOSX_ADMIN_PWD}" +vmmgr update-login mifosx "${MIFOSX_ADMIN_USER}" "${MIFOSX_ADMIN_PWD}" # Stop services required for build service mariadb stop diff --git a/mifosx/etc/init.d/mifosx b/mifosx/etc/init.d/mifosx index a75023d..009e4f4 100755 --- a/mifosx/etc/init.d/mifosx +++ b/mifosx/etc/init.d/mifosx @@ -18,11 +18,11 @@ start() { } start_post() { - /usr/bin/vm-appmgr register-proxy mifosx + /usr/bin/vmmgr register-proxy mifosx } stop_pre() { - /usr/bin/vm-appmgr unregister-proxy mifosx + /usr/bin/vmmgr unregister-proxy mifosx } stop() { diff --git a/motech.sh b/motech.sh index 7087f5f..e2436cb 100755 --- a/motech.sh +++ b/motech.sh @@ -38,7 +38,7 @@ export MOTECH_ADMIN_EMAIL="admin@example.com" export MOTECH_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) curl -H "Content-Type: application/json" -X POST -d "{\"adminLogin\":\"${MOTECH_ADMIN_USER}\",\"adminEmail\":\"${MOTECH_ADMIN_EMAIL}\",\"adminPassword\":\"${MOTECH_ADMIN_PWD}\",\"adminConfirmPassword\":\"${MOTECH_ADMIN_PWD}\",\"language\":\"cs\",\"providerName\":\"\",\"providerUrl\":\"\",\"schedulerUrl\":\"\"}" http://${MOTECH_IP}:8080/module/server/startup/ service motech stop -vm-appmgr update-login motech "${MOTECH_ADMIN_USER}" "${MOTECH_ADMIN_PWD}" +vmmgr update-login motech "${MOTECH_ADMIN_USER}" "${MOTECH_ADMIN_PWD}" # Stop services required for build service activemq stop diff --git a/motech/etc/init.d/motech b/motech/etc/init.d/motech index ae0b52f..11fb84c 100755 --- a/motech/etc/init.d/motech +++ b/motech/etc/init.d/motech @@ -18,11 +18,11 @@ start() { } start_post() { - /usr/bin/vm-appmgr register-proxy motech + /usr/bin/vmmgr register-proxy motech } stop_pre() { - /usr/bin/vm-appmgr unregister-proxy motech + /usr/bin/vmmgr unregister-proxy motech } stop() { diff --git a/opendatakit-build/etc/init.d/opendatakit-build b/opendatakit-build/etc/init.d/opendatakit-build index 95aa0cb..ca05399 100755 --- a/opendatakit-build/etc/init.d/opendatakit-build +++ b/opendatakit-build/etc/init.d/opendatakit-build @@ -17,11 +17,11 @@ start() { } start_post() { - /usr/bin/vm-appmgr register-proxy opendatakit-build + /usr/bin/vmmgr register-proxy opendatakit-build } stop_pre() { - /usr/bin/vm-appmgr unregister-proxy opendatakit-build + /usr/bin/vmmgr unregister-proxy opendatakit-build } stop() { diff --git a/opendatakit.sh b/opendatakit.sh index 6551d07..4777a03 100755 --- a/opendatakit.sh +++ b/opendatakit.sh @@ -39,7 +39,7 @@ export OPENDATAKIT_ADMIN_SALT=$(head -c 4 /dev/urandom | hexdump -e '"%x"') # Mu export OPENDATAKIT_ADMIN_BASIC_HASH=$(echo -n "${OPENDATAKIT_ADMIN_PWD}{${OPENDATAKIT_ADMIN_SALT}}" | sha1sum | tr -d " -") export OPENDATAKIT_ADMIN_DIGEST_HASH=$(echo -n "${OPENDATAKIT_ADMIN_USER}:${OPENDATAKIT_ADMIN_REALM}:${OPENDATAKIT_ADMIN_PWD}" | md5sum | tr -d " -") envsubst <${SOURCE_DIR}/adminpwd.sql | docker exec -i postgres psql opendatakit -vm-appmgr update-login opendatakit "${OPENDATAKIT_ADMIN_USER}" "${OPENDATAKIT_ADMIN_PWD}" +vmmgr update-login opendatakit "${OPENDATAKIT_ADMIN_USER}" "${OPENDATAKIT_ADMIN_PWD}" # Stop services required for build service postgres stop diff --git a/opendatakit/etc/init.d/opendatakit b/opendatakit/etc/init.d/opendatakit index bf5d5b0..902cec5 100755 --- a/opendatakit/etc/init.d/opendatakit +++ b/opendatakit/etc/init.d/opendatakit @@ -19,11 +19,11 @@ start() { } start_post() { - /usr/bin/vm-appmgr register-proxy opendatakit + /usr/bin/vmmgr register-proxy opendatakit } stop_pre() { - /usr/bin/vm-appmgr unregister-proxy opendatakit + /usr/bin/vmmgr unregister-proxy opendatakit } stop() { diff --git a/openmapkit.sh b/openmapkit.sh index c931c0a..a7e0f24 100755 --- a/openmapkit.sh +++ b/openmapkit.sh @@ -15,4 +15,4 @@ mkdir -p /srv/openmapkit/conf /srv/openmapkit/data chown -R 8007:8007 /srv/openmapkit/data docker run --rm -v /srv/openmapkit/data:/mnt/data openmapkit cp -rp /srv/openmapkit/data/. /mnt/data envsubst <${SOURCE_DIR}/srv/openmapkit/conf/settings.js >/srv/openmapkit/conf/settings.js -vm-appmgr update-login openmapkit "${OPENMAPKIT_ADMIN_USER}" "${OPENMAPKIT_ADMIN_PWD}" +vmmgr update-login openmapkit "${OPENMAPKIT_ADMIN_USER}" "${OPENMAPKIT_ADMIN_PWD}" diff --git a/openmapkit/etc/init.d/openmapkit b/openmapkit/etc/init.d/openmapkit index 1d42c76..511ab56 100755 --- a/openmapkit/etc/init.d/openmapkit +++ b/openmapkit/etc/init.d/openmapkit @@ -16,11 +16,11 @@ start() { } start_post() { - /usr/bin/vm-appmgr register-proxy openmapkit + /usr/bin/vmmgr register-proxy openmapkit } stop_pre() { - /usr/bin/vm-appmgr unregister-proxy openmapkit + /usr/bin/vmmgr unregister-proxy openmapkit } stop() { diff --git a/pandora.sh b/pandora.sh index f6522b9..e692f4f 100755 --- a/pandora.sh +++ b/pandora.sh @@ -55,7 +55,7 @@ export PANDORA_ADMIN_EMAIL=admin@example.com export PANDORA_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export PANDORA_ADMIN_HASH=$(docker run --rm -h pandora -e DJANGO_SETTINGS_MODULE=pandora.settings -v /srv/pandora/conf:/srv/pandora/conf pandora python3 -c "from django.contrib.auth.hashers import make_password; print(make_password('${PANDORA_ADMIN_PWD}'))") envsubst <${SOURCE_DIR}/adminpwd.sql | docker exec -i postgres psql pandora -vm-appmgr update-login pandora "${PANDORA_ADMIN_USER}" "${PANDORA_ADMIN_PWD}" +vmmgr update-login pandora "${PANDORA_ADMIN_USER}" "${PANDORA_ADMIN_PWD}" # Stop services required for build service rabbitmq stop diff --git a/pandora/etc/init.d/pandora b/pandora/etc/init.d/pandora index 540a6f9..02a6680 100755 --- a/pandora/etc/init.d/pandora +++ b/pandora/etc/init.d/pandora @@ -19,11 +19,11 @@ start() { } start_post() { - /usr/bin/vm-appmgr register-proxy pandora + /usr/bin/vmmgr register-proxy pandora } stop_pre() { - /usr/bin/vm-appmgr unregister-proxy pandora + /usr/bin/vmmgr unregister-proxy pandora } stop() { diff --git a/sahana-demo.sh b/sahana-demo.sh index 9ee4d1b..9f034b5 100755 --- a/sahana-demo.sh +++ b/sahana-demo.sh @@ -30,7 +30,7 @@ export SAHANADEMO_ADMIN_USER=admin@example.com export SAHANADEMO_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) envsubst <${SOURCE_DIR}/srv/sahana-demo/conf/000_config.py >/srv/sahana-demo/conf/000_config.py envsubst <${SOURCE_DIR}/masterUsers.csv >/tmp/masterUsers.csv -vm-appmgr update-login sahana-demo "${SAHANADEMO_ADMIN_USER}" "${SAHANADEMO_ADMIN_PWD}" +vmmgr update-login sahana-demo "${SAHANADEMO_ADMIN_USER}" "${SAHANADEMO_ADMIN_PWD}" # Populate database docker run --rm -h sahana-demo --link postgres -v /srv/sahana-demo/conf:/srv/web2py/applications/eden/models -v /srv/sahana-demo/data/${TEMPLATE}:/srv/web2py/applications/eden/modules/templates/${TEMPLATE} -v /srv/sahana-demo/data/databases:/srv/web2py/applications/eden/databases -v /tmp/masterUsers.csv:/srv/web2py/applications/eden/modules/templates/default/users/masterUsers.csv sahana su - sahana -c "./web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py" diff --git a/sahana-demo/etc/init.d/sahana-demo b/sahana-demo/etc/init.d/sahana-demo index 412661b..d22bc8f 100755 --- a/sahana-demo/etc/init.d/sahana-demo +++ b/sahana-demo/etc/init.d/sahana-demo @@ -20,11 +20,11 @@ start() { } start_post() { - /usr/bin/vm-appmgr register-proxy sahana-demo + /usr/bin/vmmgr register-proxy sahana-demo } stop_pre() { - /usr/bin/vm-appmgr unregister-proxy sahana-demo + /usr/bin/vmmgr unregister-proxy sahana-demo } stop() { diff --git a/sahana.sh b/sahana.sh index 1047434..37bf5b3 100755 --- a/sahana.sh +++ b/sahana.sh @@ -33,7 +33,7 @@ export SAHANA_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) envsubst <${SOURCE_DIR}/srv/sahana/conf/000_config.py >/srv/sahana/conf/000_config.py envsubst <${SOURCE_DIR}/srv/sahana/data/Spotter/masterUsers.csv >/srv/sahana/data/Spotter/masterUsers.csv cp ${SOURCE_DIR}/srv/sahana/conf/00_settings.py /srv/sahana/conf/00_settings.py -vm-appmgr update-login sahana "${SAHANA_ADMIN_USER}" "${SAHANA_ADMIN_PWD}" +vmmgr update-login sahana "${SAHANA_ADMIN_USER}" "${SAHANA_ADMIN_PWD}" # Populate database docker run --rm -h sahana --link postgres -v /srv/sahana/conf:/srv/web2py/applications/eden/models -v /srv/sahana/data/Spotter:/srv/web2py/applications/eden/modules/templates/Spotter -v /srv/sahana/data/databases:/srv/web2py/applications/eden/databases sahana su - sahana -c "./web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py" diff --git a/sahana/etc/init.d/sahana b/sahana/etc/init.d/sahana index aec3a2f..804a7ab 100755 --- a/sahana/etc/init.d/sahana +++ b/sahana/etc/init.d/sahana @@ -20,11 +20,11 @@ start() { } start_post() { - /usr/bin/vm-appmgr register-proxy sahana + /usr/bin/vmmgr register-proxy sahana } stop_pre() { - /usr/bin/vm-appmgr unregister-proxy sahana + /usr/bin/vmmgr unregister-proxy sahana } stop() { diff --git a/sambro.sh b/sambro.sh index ad36595..b7555d4 100755 --- a/sambro.sh +++ b/sambro.sh @@ -31,7 +31,7 @@ envsubst <${SOURCE_DIR}/srv/sambro/conf/000_config.py >/srv/sambro/conf/000_conf envsubst <${SOURCE_DIR}/masterUsers.csv >/tmp/masterUsers.csv cp ${SOURCE_DIR}/srv/sambro/conf/00_settings.py /srv/sambro/conf/00_settings.py cp ${SOURCE_DIR}/srv/sambro/data/SAMBRO/config.py /srv/sambro/data/SAMBRO/config.py -vm-appmgr update-login sambro "${SAMBRO_ADMIN_USER}" "${SAMBRO_ADMIN_PWD}" +vmmgr update-login sambro "${SAMBRO_ADMIN_USER}" "${SAMBRO_ADMIN_PWD}" # Populate database docker run --rm -h sambro --link postgres -v /srv/sambro/conf:/srv/web2py/applications/eden/models -v /srv/sambro/data/SAMBRO:/srv/web2py/applications/eden/modules/templates/SAMBRO -v /tmp/masterUsers.csv:/srv/web2py/applications/eden/modules/templates/default/users/masterUsers.csv -v /srv/sambro/data/databases:/srv/web2py/applications/eden/databases sahana su - sahana -c "./web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py" diff --git a/sambro/etc/init.d/sambro b/sambro/etc/init.d/sambro index ae97922..ad199ff 100755 --- a/sambro/etc/init.d/sambro +++ b/sambro/etc/init.d/sambro @@ -20,11 +20,11 @@ start() { } start_post() { - /usr/bin/vm-appmgr register-proxy sambro + /usr/bin/vmmgr register-proxy sambro } stop_pre() { - /usr/bin/vm-appmgr unregister-proxy sambro + /usr/bin/vmmgr unregister-proxy sambro } stop() { diff --git a/seeddms.sh b/seeddms.sh index 3ec1775..a4723f1 100755 --- a/seeddms.sh +++ b/seeddms.sh @@ -32,7 +32,7 @@ export SEEDDMS_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export SEEDDMS_ADMIN_EMAIL=admin@example.com envsubst <${SOURCE_DIR}/adminpwd.sql | docker exec -i postgres psql seeddms chown -R 8010:8010 /srv/seeddms/conf -vm-appmgr update-login seeddms "${SEEDDMS_ADMIN_USER}" "${SEEDDMS_ADMIN_PWD}" +vmmgr update-login seeddms "${SEEDDMS_ADMIN_USER}" "${SEEDDMS_ADMIN_PWD}" # Install cron job cp ${SOURCE_DIR}/etc/periodic/hourly/seeddms /etc/periodic/hourly/seeddms diff --git a/seeddms/etc/init.d/seeddms b/seeddms/etc/init.d/seeddms index 8105a02..69fcaa8 100755 --- a/seeddms/etc/init.d/seeddms +++ b/seeddms/etc/init.d/seeddms @@ -18,11 +18,11 @@ start() { } start_post() { - /usr/bin/vm-appmgr register-proxy seeddms + /usr/bin/vmmgr register-proxy seeddms } stop_pre() { - /usr/bin/vm-appmgr unregister-proxy seeddms + /usr/bin/vmmgr unregister-proxy seeddms } stop() { diff --git a/sigmah.sh b/sigmah.sh index cb0450c..6bcb7e3 100755 --- a/sigmah.sh +++ b/sigmah.sh @@ -44,7 +44,7 @@ sed -i "s|\$2a\$10\$pMcTA1p9fefR8U9NoOPei.H0eq/TbbdSF27M0tn9iDWBrA4JHeCDC|${SIGM cat /tmp/sigmah-MinimumDataKit.sql | docker exec -i -e PGPASSWORD=${SIGMAH_PWD} postgres psql -U sigmah sigmah cat /tmp/sigmah-newOrganizationLaunchScript.sql | docker exec -i -e PGPASSWORD=${SIGMAH_PWD} postgres psql -U sigmah sigmah rm -f /tmp/sigmah-MinimumDataKit.sql /tmp/sigmah-newOrganizationLaunchScript.sql -vm-appmgr update-login sigmah "${SIGMAH_ADMIN_EMAIL}" "${SIGMAH_ADMIN_PWD}" +vmmgr update-login sigmah "${SIGMAH_ADMIN_EMAIL}" "${SIGMAH_ADMIN_PWD}" # Stop services required for build service postgres stop diff --git a/sigmah/etc/init.d/sigmah b/sigmah/etc/init.d/sigmah index 4420642..f8545eb 100755 --- a/sigmah/etc/init.d/sigmah +++ b/sigmah/etc/init.d/sigmah @@ -19,11 +19,11 @@ start() { } start_post() { - /usr/bin/vm-appmgr register-proxy sigmah + /usr/bin/vmmgr register-proxy sigmah } stop_pre() { - /usr/bin/vm-appmgr unregister-proxy sigmah + /usr/bin/vmmgr unregister-proxy sigmah } stop() { diff --git a/ushahidi.sh b/ushahidi.sh index 214967e..e9d8fda 100755 --- a/ushahidi.sh +++ b/ushahidi.sh @@ -31,7 +31,7 @@ export USHAHIDI_ADMIN_USER=admin@example.com export USHAHIDI_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export USHAHIDI_ADMIN_HASH=$(docker run --rm ushahidi php -r "echo password_hash('${USHAHIDI_ADMIN_PWD}', PASSWORD_BCRYPT);") envsubst <${SOURCE_DIR}/adminpwd.sql | docker exec -i mariadb mysql ushahidi -vm-appmgr update-login ushahidi "${USHAHIDI_ADMIN_USER}" "${USHAHIDI_ADMIN_PWD}" +vmmgr update-login ushahidi "${USHAHIDI_ADMIN_USER}" "${USHAHIDI_ADMIN_PWD}" # Install cron job cp ${SOURCE_DIR}/etc/periodic/15min/ushahidi /etc/periodic/15min/ushahidi diff --git a/ushahidi/etc/init.d/ushahidi b/ushahidi/etc/init.d/ushahidi index 1a1b29e..6faa0de 100755 --- a/ushahidi/etc/init.d/ushahidi +++ b/ushahidi/etc/init.d/ushahidi @@ -19,11 +19,11 @@ start() { } start_post() { - /usr/bin/vm-appmgr register-proxy ushahidi + /usr/bin/vmmgr register-proxy ushahidi } stop_pre() { - /usr/bin/vm-appmgr unregister-proxy ushahidi + /usr/bin/vmmgr unregister-proxy ushahidi } stop() {