AppCivist multi-container docker composer. This includes: appcivist-backend, appcivist-voting-api, appcivist-pb-client, etherpad-lite, socialbus components
$ sudo apt-get install docker
$ sudo pip install docker-compose
$ sudo apt-get install git
$ useradd -m -c "AppCivist" ${USER}t -s /bin/bash
$ sudo usermod -aG docker ${USER}
$ usermod -aG sudo username`
$ su ${USER}
$ cd /path/to/home
$ mkdir production
$ cd production
$ git clone https://github.com/socialappslab/appcivist-platform.git
$ chmod -R 777 appcivist-platform
$ git clone https://github.com/socialappslab/appcivist-pb-client.git
$ $ chmod -R 777 appcivist-pb-client
$ git clone https://github.com/socialappslab/appcivist-voting-api.git
$ chmod -R 777 appcivist-voting-api
$ mkdir usnb
$ cd usnb
$ git clone https://github.com/socialappslab/usnb.git
$ mkdir api-gateway email-bindingcomponent entity-manager facebook-bindingcomponent subscription-manager
$ cd ..
$ git clone https://github.com/socialappslab/appcivist-docker-compose.git
$ cd appcivist-docker-compose
### Make a copy of .env.sample file named .env and set the users and password for all the systems
$ cp .env.sample .env
$ nano .env
Default configuration files are available in the apache/confs
folders. Domain names, redirections and a file server are all configured by these configuration files. By default, they have the original configuration of the prototype appcivist service instance, but you should absolutely modify them to your needs. Having a better organized boiler plate for this confs has been on our TODO list for a while.
For SSL, make sure sites are by default configured to use SSL certificates that sit on the apache/certs
folder, mounted as /etc/apache2/certs
in the container. Make sure that, if you do not have SSL certificates, comment all the lines that attempt to configure vhosts for it in the conf file, otherwise apache will not run. If you do have cert files, copy them to apache/certs
and then update the links in the configurations. As an option, our Dockerfile for apache installs (certbo-auto
)[https://certbot.eff.org/lets-encrypt/debianjessie-apache], which you can use to easily issue and install Let's Encrypt certificates. All you have to do is running the following, selecting properly the domains for which you would like to create certificates:
/usr/local/bin/certbot-auto --apache certonly
After the certificate is created and available somewhere in the container, you can change configurations to use them.
Finally, the apache/confs
folder is mounted as a volume inside of the apache container, becoming effectively the /etc/apache2/sites-available
within the container. What this means is that after building the apache container, you will have to enter that container and add each site configuration using the a2ensite
.
# Run this after the apache has been build and is running
$ docker exec -t -i apache /bin/bash
$ cd /etc/apache2/sites-available
$ a2ensite *.conf
$ service apache reload
$ cd ..
$ cd ..
$ docker-compose build db && docker-compose up -d db
With the postgres up and with the appcivist and etherpads db backups files already in the server, make the restore with:
$ docker cp 20180312_appcivist db:/tmp
$ docker cp 20180312_etherpad_appcivist db:/tmp
$ docker exec -t -i db /bin/bash
$ psql -U appcivist appcivist < /tmp/20180312_appcivist
$ psql -U appcivist appcivist
$ create database “20180312_etherpad_appcivist”;
$ \q
$ psql -U appcivist 20180312_etherpad_appcivist < /tmp/20180312_etherpad_appcivist
$ exit
$ docker-compose build mongo && docker-compose up -d mongo
With the mongo up and with the mongodump db backups files already in the server, make the restore with:
$ docker cp /tmp/20180324_mongo/ mongo:/tmp/20180324_mongo/
$ docker exec mongo mongorestore /tmp/20180324_mongo/
$ sh deploy_all.sh
$ docker ps
$ docker-compose logs
$ docker-compose stop {container_name}