-
Notifications
You must be signed in to change notification settings - Fork 20
Automated Deployment (Docker)
The following describes the process by which the OOI UI and associated OOI UI Services and database server are built and launched in order to obtain a complete distribution of the OOI UI.
- Add support for launching the OOI UI stack for a specific release
These instructions are meant to be used on a CentOS 6.x server as the root user.
yum -y update
yum -y install epel-release
yum -y groupinstall 'Development Tools'
yum -y install git
yum -y install wget
yum -y install bzip2
yum -y install bzip2-devel
yum -y install tar
yum -y update gmp
yum -y install db4-devel
yum -y install db4-devel-static
yum -y install zlib
yum -y install zlib-devel
yum -y install gcc
yum -y install openssl-devel
yum -y install libxml2-devel
yum -y install libxslt-devel
yum -y install libcurl-devel
yum -y install sqlite-devel
yum -y install readline-devel
yum -y install db4-devel
yum -y install db4-devel-static
yum -y install ctags-etags
yum -y install tmux
yum -y install java-1.7.0-openjdk-devel
yum -y install docker-io
chkconfig docker on
service docker start
cd /tmp
wget http://python.org/ftp/python/2.7.6/Python-2.7.6.tgz && tar -xzvf Python-2.7.6.tgz -C /usr/local/src/
rm -rf Python-2.7.6.tgz
cd /usr/local/src/Python-2.7.6
./configure --with-zlib --prefix=/usr/local && /usr/bin/make && /usr/bin/make altinstall
ln -s /usr/local/bin/python2.7 /usr/local/bin/python27
cd /root
wget https://raw.githubusercontent.com/brainsik/virtualenv-burrito/master/virtualenv-burrito.sh
chmod +x virtualenv-burrito.sh
./virtualenv-burrito.sh
chmod +x /root/.venvburrito/startup.sh
source /root/.venvburrito/startup.sh && mkvirtualenv --no-site-packages --python=/usr/local/bin/python27 ooiui
This quick-start is the recommended procedure for deploying the OOI UI stack
-
Make sure you have a Python 2.7.x virtual environment installed and running
-
Install docker-compose requirements:
wget https://raw.githubusercontent.com/docker/fig/master/requirements.txt
pip install -r requirements.txt
-
Install docker-compose:
pip install docker-compose==1.1.0-rc2
wget https://raw.githubusercontent.com/oceanzus/ooi-ui-deployments/master/docker-compose.yml
- Edit docker-compose.yml as necessary for the installation environment
docker-compose up
docker-compose stop
docker-compose pull
git clone https://github.com/oceanzus/docker-postgis.git
sudo docker build --no-cache=true -t="oceanzus/docker_postgis:v1" .
mkdir $HOME/postgres_data
from command line:
sudo docker run -e USERNAME=<username> -e PASS=<password> -d --name ooiuidb -v $HOME/postgres_data:/var/lib/postgresql oceanzus/docker_postgis:v1
using supervisord:
sudo docker run -e USERNAME=<username> -e PASS=<password> -a stdout -a stderr --rm=true --name ooiuidb -v $HOME/postgres_data:/var/lib/postgresql oceanzus/docker_postgis:v1
sudo docker ps
sudo docker inspect <container id>
psql -h <ip from inspect> -U <username> -W postgres
git clone https://github.com/oceanzus/ooi-ui-services-deploy.git
sudo docker build --no-cache=true -t="oceanzus/ooi_ui_services_deploy:v1" .
from command line:
sudo docker run -e HOST_IP=0.0.0.0 -e DB_PORT=<port> -e DB_USER=<user> -e DB_PASS=<password> -e DB_HOST=<url> -e DB_NAME=<database name> -e DB_RESET=<true|false> -d --name ooiuiservices --link ooiuidb:ooiuidb oceanzus/ooi_ui_services_deploy:v1
using supervisord:
sudo docker run -e HOST_IP=0.0.0.0 -e DB_PORT=<port> -e DB_USER=<user> -e DB_PASS=<password> -e DB_HOST=<url> -e DB_NAME=<database name> -e DB_RESET=<true|false> -a stdout -a stderr --rm=true --name ooiuiservices --link ooiuidb:ooiuidb oceanzus/ooi_ui_services_deploy:v1
sudo docker run -e HOST_IP=0.0.0.0 -e DB_PORT=<port> -e DB_USER=<user> -e DB_PASS=<password> -e DB_HOST=<url> -e DB_NAME=<database name> -e DB_RESET=<true|false> -t -i --name ooiuiservices --link ooiuidb:ooiuidb oceanzus/ooi_ui_services_deploy:v1 /bin/bash
./start_ooi-ui-services.sh
git clone https://github.com/oceanzus/ooi-ui-deploy.git
sudo docker build --no-cache=true -t="oceanzus/ooi_ui_deploy:v1" .
from command line:
sudo docker run -d -p <host external ip>:5000:5000 --name ooiui --link ooiuiservices:ooiuiservices oceanzus/ooi_ui_deploy:v1
from supervisord:
sudo docker run -a stdout -a stderr --rm=true -p <host external ip>:5000:5000 --name ooiui --link ooiuiservices:ooiuiservices oceanzus/ooi_ui_deploy:v1
sudo docker run -t -i -p <host external ip>:5000:5000 --name ooiui --link ooiuiservices:ooiuiservices oceanzus/ooi_ui_deploy:v1 /bin/bash
./start_ooi-ui.sh
sudo docker stop $(sudo docker ps -a -q)
sudo docker rm $(sudo docker ps -a -q)
sudo docker rmi $(sudo docker images -q)
- Create CentOS 6.x Server or VM
- Log in as root
- Make sure root volume is proper size if larger than default (EC2-related)
sudo resize2fs /dev/xvde
- Install Docker and set-up ooiui user
yum -y install epel-release
yum -y install docker-io
chkconfig docker on
service docker start
adduser ooiui
vi /etc/sudoers
Add the following:
ooiui ALL=(ALL) NOPASSWD: ALL
su - ooiui
- Run the Docker management app DockerUI (optional)
sudo docker run -d -p 9000:9000 --privileged -v /var/run/docker.sock:/var/run/docker.sock dockerui/dockerui
mkdir $HOME/postgres_data
- Start the PostgreSQL container
sudo docker run -e USERNAME=ooiui -e PASS=ooiui -d --name ooiuidb -v $HOME/postgres_data:/var/lib/postgresql oceanzus/docker_postgis
- Start the ooi-ui-services container (remember to use your own IP address in the -p option)
sudo docker run -e HOST_IP=0.0.0.0 -e DB_PORT=5432 -e DB_USER=ooiui -e DB_PASS=ooiui -e DB_HOST=ooiuidb -e DB_NAME=ooiuidev -e DB_RESET=true -p 10.181.61.91:4000:4000 -d --name ooiuiservices --link ooiuidb:ooiuidb oceanzus/ooi-ui-services-deploy
- Start the first ooi-ui container
sudo docker run -d --name ooiui1 --link ooiuiservices:ooiuiservices oceanzus/ooi-ui-deploy
- Start the second ooi-ui container
sudo docker run -d --name ooiui2 --link ooiuiservices:ooiuiservices oceanzus/ooi-ui-deploy
- Start the HAProxy load balancer bound to the EC2 internal (eth0) IP address on port 80
sudo docker run -d --link ooiui1:ooiui1 --link ooiui2:ooiui2 --name ooiui-haproxy -e PORT=5000 -p 10.181.61.91:80:80 oceanzus/haproxy
-
Stop all Docker containers
sudo docker stop $(sudo docker ps -a -q)
-
Remove all Docker containers
sudo docker rm $(sudo docker ps -a -q)
-
Pull the latest images from Docker Hub
sudo docker pull oceanzus/docker_postgis
sudo docker pull oceanzus/ooi-ui-services-deploy
sudo docker pull oceanzus/ooi-ui-deploy
sudo docker pull oceanzus/haproxy
Note that the postgresql container (ooiuidb in this example) will use the existing database files in $HOME/postgres_data and DB_RESET=true could be changed to DB_RESET=false if ooi-ui-services-deploy was not updated.
- Start all Docker containers as we did above