Browse Source

new: including ``pandachi-install``

This script was not in any git place and should be the preferred way to
install a docker-host from scratch.
rc1
Valentin Lab 6 years ago
parent
commit
3b906c3ee3
  1. 80
      bin/pandachi-install
  2. 0
      bin/pandachi-update

80
bin/pandachi-install

@ -0,0 +1,80 @@
#!/bin/bash
## Installing base docker-host
wget http://docker.0k.io/get/ -qO - | bash
## shlib is now available
. /etc/shlib || {
echo "shlib is not available. Bailing out." >&2
exit 1
}
set -e
if ! [ -d "/opt/apps/pandachi-deploy" ]; then
mkdir -p /opt/apps && cd /opt/apps
git clone git.0k.io:/var/git/0k/pandachi-deploy.git
fi
#[ -e /etc/compose.conf ] || ln -sfv /opt/apps/pandachi-deploy/etc/compose.conf /etc/compose.conf
## XXXvlab: should get rid of this file in some future
cd /opt/apps/pandachi-deploy
if ! grep "^DEFAULT_COMPOSE_FILE=$PWD/compose.yml$" /etc/compose/local.conf >/dev/null 2>&1; then
echo "Adding CWD=$PWD to docker-compose."
cat <<EOF >> /etc/compose/local.conf
DEFAULT_COMPOSE_FILE=$PWD/compose.yml
EOF
fi
#type -t docker-compose || ln -sfv /opt/apps/compose/bin/docker-compose /usr/local/bin
type -t docker-clean || ln -sfv /opt/apps/0k-docker/bin/docker-clean /usr/local/bin
if [ -d "/opt/apps/0k-docker" ]; then ## should come from http://docker.0k.io/get/
(
cd /opt/apps/0k-docker
git checkout master
)
fi
echo "Login into our server."
docker login -u deploy -p deployinvm git.panda-chi.io:5002
cd /opt/apps/pandachi-deploy
cat <<EOF > /root/.pgm.rc
prefix_pg_local_command=" " ## otherwise, will default to sudo -u postgres
pgpass="/srv/datastore/data/postgres/var/lib/postgresql/data/pgpass"
[ -f "$pgpass" ] || {
echo "No '$pgpass' found. Postgres database doesn't seem to be setup." >&2
exit 1
}
cp "$pgpass" /root/.pgpass
PGUSER=postgres
PGHOST=$(docker-ip | grep postgres | xargs echo | cut -f 3 -d " ") || {
echo "No local running postgres docker found." >&2
exit 1
}
export PGHOST PGUSER
EOF
if [ "$DOMAIN" ]; then
sed -ri "s/^(\s+domain:\s+).*$/\1$DOMAIN/g" compose.yml
fi
if [ "$MAIN_PASSWORD" ]; then
sed -ri "s/^(\s+admin-password:\s+).*$/\1$MAIN_PASSWORD/g" compose.yml
fi
pip install ovh
ln -sf /opt/apps/pandachi-deploy/bin/* /usr/local/bin/
#compose --debug up odoo apache
## Marker to probe if this script finished it's job
echo "done" > /var/run/pandachi-installer.0k.io.state

0
bin/update → bin/pandachi-update

Loading…
Cancel
Save