# Prepare docker
apt-get update
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
bash -c "echo deb https://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
apt-get update
apt-get install -y lxc-docker
# docker pull docker.futuredial.com/isd_redis
# docker pull docker.futuredial.com/isd_postgres
# docker pull docker.futuredial.com/isd_pgbouncer
# docker pull docker.futuredial.com/isd_server:1.8.3

# Install settings
rm -r /var/www/isd/installer/1.8.3/
apt install -y wget supervisor
wget http://cmc-dl.futuredial.com/tools/isd/isd_installer_1.8.3.tar.gz
mkdir -p /var/www/isd/installer/1.8.3/
mkdir -p /var/www/isd/log/
tar zxvf isd_installer_1.8.3.tar.gz -C /var/www/isd/installer/1.8.3/
cd /var/www/isd/installer/1.8.3/
docker load < isd_redis.tar
docker load < isd_postgres.tar
docker load < isd_pgbouncer.tar
docker load < isd_server_1.8.3.tar
cp isd.conf /etc/supervisor/conf.d/isd.conf
cp start_redis.sh /var/www/isd/start_redis.sh
cp start_postgres.sh /var/www/isd/start_postgres.sh
cp start_pgbouncer.sh /var/www/isd/start_pgbouncer.sh
cp start_server.sh /var/www/isd/start_server.sh
systemctl enable docker
service supervisor restart
