LXCize Motech setup
This commit is contained in:
parent
db9458b4ad
commit
365f983c2d
@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/kanboard
|
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
|
||||||
|
|
||||||
# Check prerequisites
|
# Check prerequisites
|
||||||
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
|
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/mifosx
|
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
|
||||||
|
|
||||||
# Check prerequisites
|
# Check prerequisites
|
||||||
[ ! -e /run/openrc/started/mariadb ] && service mariadb start && STOP_MARIADB=1
|
[ ! -e /run/openrc/started/mariadb ] && service mariadb start && STOP_MARIADB=1
|
||||||
|
@ -1,22 +1,15 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/motech
|
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
|
||||||
|
|
||||||
# Check prerequisites
|
# Check prerequisites
|
||||||
lxc-ls | grep -q activemq || $(realpath $(dirname "${0}"))/activemq.sh
|
[ ! -e /run/openrc/started/activemq ] && service activemq start && STOP_ACTIVEMQ=1
|
||||||
lxc-ls | grep -q postfix || $(realpath $(dirname "${0}"))/postfix.sh
|
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
|
||||||
lxc-ls | grep -q postgres || $(realpath $(dirname "${0}"))/postgres.sh
|
|
||||||
service postgres start
|
|
||||||
|
|
||||||
# Build Docker container
|
|
||||||
docker build -t motech ${SOURCE_DIR}
|
|
||||||
cp ${SOURCE_DIR}/etc/init.d/motech /etc/init.d/motech
|
|
||||||
rc-update -u
|
|
||||||
|
|
||||||
# Create database
|
# Create database
|
||||||
export MOTECH_PWD=$(head -c 18 /dev/urandom | base64)
|
export MOTECH_PWD=$(head -c 18 /dev/urandom | base64)
|
||||||
envsubst <${SOURCE_DIR}/createdb.sql | docker exec -i postgres psql
|
envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
|
||||||
|
|
||||||
# Configure Motech
|
# Configure Motech
|
||||||
mkdir -p /srv/motech/conf/config/org.motechproject.motech-platform-email
|
mkdir -p /srv/motech/conf/config/org.motechproject.motech-platform-email
|
||||||
@ -26,10 +19,14 @@ cp ${SOURCE_DIR}/srv/motech/conf/config/motech-settings.properties /srv/motech/c
|
|||||||
cp ${SOURCE_DIR}/srv/motech/conf/config/org.motechproject.motech-platform-email/motech-email.properties /srv/motech/conf/config/org.motechproject.motech-platform-email/motech-email.properties
|
cp ${SOURCE_DIR}/srv/motech/conf/config/org.motechproject.motech-platform-email/motech-email.properties /srv/motech/conf/config/org.motechproject.motech-platform-email/motech-email.properties
|
||||||
chown -R 8013:8013 /srv/motech/conf
|
chown -R 8013:8013 /srv/motech/conf
|
||||||
|
|
||||||
|
# Install service
|
||||||
|
cp ${SOURCE_DIR}/etc/init.d/motech /etc/init.d/motech
|
||||||
|
rc-update -u
|
||||||
|
|
||||||
# Populate database and create admin account
|
# Populate database and create admin account
|
||||||
service motech start
|
service motech start
|
||||||
echo `date` '- Waiting for database to be populated. This should take about a minute.'
|
echo `date` '- Waiting for database to be populated. This should take about a minute.'
|
||||||
MOTECH_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' motech)
|
MOTECH_IP=$(awk '/ motech/ {print $1}' /etc/hosts)
|
||||||
until curl -s "http://${MOTECH_IP}:8080/module/server/startup/" | grep -q adminLogin; do
|
until curl -s "http://${MOTECH_IP}:8080/module/server/startup/" | grep -q adminLogin; do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
@ -41,5 +38,5 @@ service motech stop
|
|||||||
vmmgr update-login motech "${MOTECH_ADMIN_USER}" "${MOTECH_ADMIN_PWD}"
|
vmmgr update-login motech "${MOTECH_ADMIN_USER}" "${MOTECH_ADMIN_PWD}"
|
||||||
|
|
||||||
# Stop services required for build
|
# Stop services required for build
|
||||||
service activemq stop
|
[ ! -z ${STOP_ACTIVEMQ} ] && service activemq stop
|
||||||
service postgres stop
|
[ ! -z ${STOP_POSTGRES} ] && service postgres stop
|
||||||
|
@ -1,20 +1,13 @@
|
|||||||
#!/sbin/openrc-run
|
#!/sbin/openrc-run
|
||||||
|
|
||||||
description="Motech docker container"
|
description="Motech container"
|
||||||
|
|
||||||
depend() {
|
depend() {
|
||||||
need docker activemq postfix postgres
|
need cgroups activemq postgres
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
/usr/bin/docker run -d --rm \
|
lxc-start motech
|
||||||
--name motech \
|
|
||||||
-h motech \
|
|
||||||
--link activemq \
|
|
||||||
--link postfix \
|
|
||||||
--link postgres \
|
|
||||||
-v /srv/motech/conf:/srv/tomcat/.motech \
|
|
||||||
motech
|
|
||||||
}
|
}
|
||||||
|
|
||||||
start_post() {
|
start_post() {
|
||||||
@ -26,5 +19,5 @@ stop_pre() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
/usr/bin/docker stop motech
|
lxc-stop motech
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user