Deployment template for hosting multiple projects with multiple environments under the same box.

I work for a digital agency, and we replaced our internal fabric deployment tools with Ansible. Using ansible it makes our lifes easier and more productive.

I have created this project repo for myself to reuse ansible roles and playbooks over time.

If you want to deploy several projects with different environments (e.g. dev, test, stage), then the following instructions and setup will help you.

  • Get a box
  • Buy a domain e.g. zendevbox.com
  • Set a wildcard record *.zendevbox.com to the box ip address
  • Buy a wildcard SSL certificate and install on your load balancer (optional)
  • Configure jenkins to auto-deploy on commits (optional)
Projects will be available like:
https://myproject-dev.zendevbox.com
https://myproject-test.zendevbox.com
https://myproject-stage.zendevbox.com

Deployment | Examples

Django Project
# DEV environment
ansible-playbook deployment/ansible/playbook/site_django.yml -i deployment/ansible/inventory-example-django/dev
Static Project
# DEV environment
ansible-playbook deployment/ansible/playbook/site_static.yml -i deployment/ansible/inventory-example-static/dev
Drupal Project
# DEV environment
ansible-playbook deployment/ansible/playbook/site_drupal.yml -i deployment/ansible/inventory-example-static/dev

Django Project Stack
- ubuntu
- memcached
- nginx
- postgres
- mysql
- uwsgi
- django

# Includes 
    - database migrations
    - cron jobs
Static Project Stack
- ubuntu
- nginx
Drupal Project Stack
- ubuntu
- memcached
- mysql
- php5
- php5-fpm
- drupalapp
- nginx
- varnish

# Includes 
    - drush clear cache
    - drush features revert
    - database import/backup | soon