-
Notifications
You must be signed in to change notification settings - Fork 0
Multiple Deploys Per Server Notes
Ryan Hodges edited this page Dec 10, 2015
·
1 revision
This guide assumes you have a server already running one instance of Compass already.
This one is easy, simply:
- Log in as the owning user of the application directory (most likely 'ubuntu')
- Copy the entirety of the application directory (most likely '/usr/local/apps/COMPASS') into the 'apps' directory with a new name (like '/usr/local/apps/dev-compass')
- Do not use sudo: you want to maintain similar ownership
- this killed me
- Do not use sudo: you want to maintain similar ownership
This gets a little hairier, and I recommend going through the install steps, especially when it comes to creating the new DB. Fortunately you can re-use the already existing DB user and save yourself some headache.
- Update '{app}/mp/settings_local.py':
- The DB name
- MEDIA_ROOT
- ADMIN_MEDIA_PATH
- Update '{app}/scripts/compass_provision.sh'
- Update any reference to the old application location in '{app}/deploy/'
vim {app}/deploy/compass_uwsgi.ini- Update any references to original application location (done in 'app config' section)
- Provide a unique and valid socket location for 'socket' (more on this later)
- If constrained by memory, drop the # of processes down
- this also killed me
- Update '{app}/deploy/compass.config'
- Remove references to original app's directory (done in 'app config' section)
- Assign a new port to listen on
- Add ':{port_no}' to your 'server_name' argument
- rename the 'upstream' section
- such as replacing 'arcgis_services' with 'arcgis_services2' in:
- 'upstream'
- 'location /arcgis/' ('proxy_pass')
- this also killed me
- such as replacing 'arcgis_services' with 'arcgis_services2' in:
- Under 'location /' provide a unique and valid socket location (more on this later)
- Copy your updated config to '/etc/nginx/sites-available/{new-app-name}'
sudo ln -s /etc/nginx/sites-available/{new-app-name} /etc/nginx/sites-enabled/{new-app-name}
- Create a directory for sockets to live
sudo chown www-data:adm {socket-dir}sudo chmod 775 {socket-dir}
- be sure all references to creating uniquely named socket files in uWSGI and NGINX configs go here.
- Logs should be writable
- '/var/log/rc.local.log' gets CRAZY big
- Create new places for logs to land
mkdir {app}/logs
- Make it plenty writable
- edit /etc/rc.local
- have all uwsgi calls start with nohup to prevent them from dying
- have all uwsgi calls end with & to allow your script to continue
- this also killed me
- have all uwsgi calls output to a nice logfile
- an example of all of these:
nohup /usr/bin/uwsgi --ini /usr/local/apps/dev-compass/deploy/compass_uwsgi.ini --uid www-data --gid www-data >> /usr/local/apps/dev-compass/logs/rc.local.log 2>&1 &
At this point you should be able to just run your uWSGI processes and restart NGINX, but this has given me some problems. Instead I recommend rebooting.
- First page hit (on each served app) will have an NGINX error.
- Second page hit will load the page all wonky.
- Third page hit (on each) should be solid.
Be sure to check areas where the DB may be different in the admin to be sure you are indeed running two different databases.