|
|
@ -15,7 +15,10 @@ GIT_0K_CLONE_OPTIONS=${GIT_0K_CLONE_OPTIONS:-""} |
|
|
|
|
|
|
|
mkdir -p /opt/apps |
|
|
|
( |
|
|
|
if ! [ -d "/opt/apps/0k-manage" ]; then |
|
|
|
if [ -d "/opt/apps/0k-manage" ]; then |
|
|
|
cd /opt/apps/0k-manage && |
|
|
|
git pull -r |
|
|
|
else |
|
|
|
cd /opt/apps && |
|
|
|
git clone $GIT_0K_CLONE_OPTIONS "$GIT_0K_BASE/0k/0k-manage.git" && |
|
|
|
cd /opt/apps/0k-manage && |
|
|
@ -48,20 +51,19 @@ mkdir -p /opt/apps |
|
|
|
## |
|
|
|
|
|
|
|
( |
|
|
|
if ! [ -d "/opt/apps/0k-charms" ]; then |
|
|
|
cd /opt/apps && |
|
|
|
git clone $GIT_0K_CLONE_OPTIONS "$GIT_0K_BASE/0k/0k-charms.git" && |
|
|
|
if [ -d "/opt/apps/0k-charms" ]; then |
|
|
|
cd /opt/apps/0k-charms && |
|
|
|
git checkout master |
|
|
|
git checkout master && |
|
|
|
git pull -r |
|
|
|
else |
|
|
|
cd /opt/apps && |
|
|
|
git clone $GIT_0K_CLONE_OPTIONS "$GIT_0K_BASE/0k/0k-charms.git" |
|
|
|
fi |
|
|
|
|
|
|
|
if ! [ -d "/srv/charm-store" ]; then |
|
|
|
mkdir -p /srv/charm-store && |
|
|
|
find /opt/apps/0k-charms -type d -exec /usr/bin/test -e {}/metadata.yml \ |
|
|
|
-o -e {}/metadata.yaml \; -print | while read f; do |
|
|
|
ln -sf "$f" /srv/charm-store/ |
|
|
|
done |
|
|
|
mkdir -p /srv/charm-store |
|
|
|
fi |
|
|
|
ln -sfn /opt/apps/0k-charms /srv/charm-store/0k-charms |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
@ -73,19 +75,27 @@ mkdir -p /opt/apps |
|
|
|
( |
|
|
|
if ! [ -d "/opt/apps/lxc-scripts" ]; then |
|
|
|
cd /opt/apps && |
|
|
|
git clone $GIT_0K_CLONE_OPTIONS "$GIT_0K_BASE/0k/lxc-scripts.git" && |
|
|
|
cd /opt/apps/0k-manage && |
|
|
|
git clone $GIT_0K_CLONE_OPTIONS "$GIT_0K_BASE/0k/lxc-scripts.git" |
|
|
|
fi |
|
|
|
|
|
|
|
cd /opt/apps/lxc-scripts && |
|
|
|
git checkout master && |
|
|
|
ln -sf /opt/apps/lxc-scripts/bin/lxc-* /usr/local/sbin/ && |
|
|
|
git pull -r && |
|
|
|
ln -sfn /opt/apps/lxc-scripts/bin/lxc-* /usr/local/sbin/ && |
|
|
|
|
|
|
|
if [ -f /etc/default/lxc.pre-install ]; then |
|
|
|
cp /etc/default/lxc.pre-install /etc/default/lxc |
|
|
|
else |
|
|
|
cp /etc/default/lxc /etc/default/lxc.pre-install |
|
|
|
fi |
|
|
|
[ -d /usr/lib/lxc/templates ] && { |
|
|
|
ln -sf /opt/apps/lxc-scripts/usr/lib/lxc/templates/lxc-0k-ubuntu-cloud /usr/lib/lxc/templates/ |
|
|
|
ln -sfn /opt/apps/lxc-scripts/usr/lib/lxc/templates/lxc-0k-ubuntu-cloud /usr/lib/lxc/templates/ |
|
|
|
echo TEMPLATE_PATH=/usr/lib/lxc/templates >> /etc/default/lxc |
|
|
|
} |
|
|
|
[ -d /usr/share/lxc/templates ] && { |
|
|
|
ln -sf /opt/apps/lxc-scripts/usr/lib/lxc/templates/lxc-0k-ubuntu-cloud /usr/share/lxc/templates |
|
|
|
ln -sfn /opt/apps/lxc-scripts/usr/lib/lxc/templates/lxc-0k-ubuntu-cloud /usr/share/lxc/templates |
|
|
|
echo TEMPLATE_PATH=/usr/share/lxc/templates >> /etc/default/lxc |
|
|
|
} |
|
|
|
fi |
|
|
|
) |
|
|
|
|
|
|
|
## |
|
|
@ -94,9 +104,8 @@ mkdir -p /opt/apps |
|
|
|
|
|
|
|
## Note that docker should be installed after (or be restarted). |
|
|
|
|
|
|
|
type -p curl >/dev/null 2>&1 || apt-get install -y curl </dev/null |
|
|
|
apt-get install -y curl </dev/null |
|
|
|
|
|
|
|
if ! [ -r /etc/ssl/ca.0k.io.pem ]; then |
|
|
|
|
|
|
|
## This does not seem to work anymore (docker v1.12, ubutnu 14.04 on gani) |
|
|
|
echo "Fetching 0k.io CA certificate..." |
|
|
@ -105,8 +114,8 @@ if ! [ -r /etc/ssl/ca.0k.io.pem ]; then |
|
|
|
|
|
|
|
## This is the new way: https://docs.docker.com/engine/security/certificates/ |
|
|
|
mkdir -p /etc/docker/certs.d/docker.0k.io |
|
|
|
ln -sf /etc/ssl/ca.0k.io.pem /etc/docker/certs.d/docker.0k.io/ca.crt |
|
|
|
fi |
|
|
|
ln -sfn /etc/ssl/ca.0k.io.pem /etc/docker/certs.d/docker.0k.io/ca.crt |
|
|
|
|
|
|
|
|
|
|
|
service docker restart |
|
|
|
|
|
|
@ -173,7 +182,10 @@ EOF |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
if ! [ -d "/opt/apps/0k-compose" ]; then |
|
|
|
if [ -d "/opt/apps/0k-compose" ]; then |
|
|
|
cd "/opt/apps/0k-compose" && |
|
|
|
git pull -r |
|
|
|
else |
|
|
|
mkdir -p /opt/apps && cd /opt/apps |
|
|
|
git clone "$GIT_0K_BASE"/0k/0k-compose.git |
|
|
|
fi |
|
|
@ -197,8 +209,9 @@ export CONFIGSTORE=\$DOCKER_DATASTORE/config |
|
|
|
|
|
|
|
EOF |
|
|
|
|
|
|
|
|
|
|
|
if ! egrep "^DEFAULT_COMPOSE_FILE=/etc/compose/compose.yml$" /etc/compose/local.conf >/dev/null 2>&1; then |
|
|
|
echo "DEFAULT_COMPOSE_FILE=/etc/compose/compose.yml" >> /etc/compose/local.conf |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
## |
|
|
@ -207,7 +220,10 @@ echo "DEFAULT_COMPOSE_FILE=/etc/compose/compose.yml" >> /etc/compose/local.conf |
|
|
|
|
|
|
|
|
|
|
|
( |
|
|
|
if ! [ -d "/opt/apps/0k-pgm" ]; then |
|
|
|
if [ -d "/opt/apps/0k-pgm" ]; then |
|
|
|
cd /opt/apps/0k-pgm && |
|
|
|
git pull -r |
|
|
|
else |
|
|
|
cd /opt/apps && |
|
|
|
git clone $GIT_0K_CLONE_OPTIONS "$GIT_0K_BASE/0k/0k-pgm.git" && |
|
|
|
cd /opt/apps/0k-pgm && |
|
|
@ -216,6 +232,6 @@ echo "DEFAULT_COMPOSE_FILE=/etc/compose/compose.yml" >> /etc/compose/local.conf |
|
|
|
|
|
|
|
ln -sf /opt/apps/0k-pgm/bin/* /usr/local/bin/ |
|
|
|
apt-get install -y --force-yes pv buffer < /dev/null |
|
|
|
require psql || apt-get install -y postgresql-client </dev/null |
|
|
|
apt-get install -y postgresql-client </dev/null |
|
|
|
|
|
|
|
) |