Skip to content

Client Project Deployment

cccs-ip edited this page Oct 6, 2014 · 2 revisions

CCCS client project deployments use multiple repositories, making the set-up a little complex.

In retrospect, we probably should have used git submodules, but what is here works fine.

  1. Add the client project user
  2. Ensure the user has a .ssh folder and appropriate deploy key (which needs to be in each required repo)

Set up the database

~ $ psql -c "CREATE USER abadi WITH PASSWORD '<password>';"
CREATE ROLE
~ $ pg_restore -d paul -C abadi.pg_dump 
~ $ sudo chown abadi:abadi secret.py 
~ $ sudo mv secret.py /home/abadi/production/abadi/settings

Set up the working copies and virtualenv

abadi:~ $ git clone git@gitlab.crossculturalconsult.com:abadi/abadi-web.git production
...
abadi:~ $ git clone git@gitlab.crossculturalconsult.com:abadi/map-app.git production_map_app
...
abadi:~ $ cd production
abadi:~/production $ mkvirtualenv production
New python executable in production/bin/python
Installing setuptools, pip...done.
(production)abadi:~/production $ add2virtualenv .
Warning: Converting "." to "/home/abadi/production"
(production)abadi:~/production $ setvirtualenvproject
Setting project for production to /home/abadi/production
(production)abadi:~/production $ echo "export DJANGO_SETTINGS_MODULE=abadi.settings.production" >> ~/.virtualenvs/production/bin/postactivate 
(production)abadi:~/production $ deactivate
abadi:~/production $ workon production
(production)abadi:~/production $ pip install -r requirements.txt 
(production)abadi:~/production $ ln -s ../production_map_app/leaflet/
(production)abadi:~/production $ ln -s ../production_map_app/ol3js/
(production)abadi:~/production $ cd ..
(production)abadi:~ $ git clone git@gitlab.crossculturalconsult.com:abadi/engagement-app.git production_engagement
(production)abadi:~ $ cdproject
(production)abadi:~/production $ ln -s ../production_engagement/engagements/
(production)abadi:~/production $ ln -s ../production_engagement/stakeholders/

Setup nginx and upstart

~ $ sudo ln -s /home/abadi/production/deploy/production_nginx /etc/nginx/sites-available/production
~ $ sudo ln -s /etc/nginx/sites-available/production /etc/nginx/sites-enabled/production
~ $ sudo service nginx restart
 * Restarting nginx nginx                                                                                                         [ OK ] 
~ $ sudo cp /home/abadi/production/abadi/deploy/production_upstart.conf /etc/init/abadi_production.conf
~ $ sudo service abadi_production start
abadi_production start/running, process 15999