The Devops Repo for VIDA. These projects/repository started from a clone of the FireCARES project developed by Prominent Edge and can benefit from occasional selective syncing with the original repo.
Ansible Playbook that installs and configures these applications that are commonly used in production Django deployments:
- Nginx
- Gunicorn
- PostgreSQL
- Supervisor
- Virtualenv
- Memcached
- Celery
- RabbitMQ
Default settings are stored in roles/role_name/vars/main.yml
. Environment-specific settings are in the env_vars
directory.
Tested with OS: Ubuntu 14.04 LTS x64
A quick way to get started is with Vagrant and VirtualBox.
git clone https://github.com/ROGUE-JCTD/vida-ansible.git
git clone https://github.com/ROGUE-JCTD/vida.git
cd vida-ansible
vagrant up
Wait a few minutes for the magic to happen. Access the app by going to this URL: http://192.168.33.15
SSH to the box
vagrant ssh
Re-provision the box to apply the changes you made to the Ansible configuration
vagrant provision
Reboot the box
vagrant reload
Shutdown the box
vagrant halt
First, create an inventory file for the environment, for example:
# development
[all:vars]
env=dev
[webservers]
webserver1.example.com
webserver2.example.com
[dbservers]
dbserver1.example.com
Next, create a playbook for the server type. See webservers.yml for an example.
Run the playbook:
ansible-playbook -i development webservers.yml
You can also provision an entire site by combining multiple playbooks. For example, I created a playbook called site.yml
that includes both the webservers.yml
and dbservers.yml
playbook.
A few notes here:
- The
dbservers.yml
playbook will only provision servers in the[dbservers]
section of the inventory file. - The
webservers.yml
playbook will only provision servers in the[webservers]
section of the inventory file. - An inventory var called
env
is also set which applies toall
hosts in the inventory. This is used in the playbook to determine whichenv_var
file to use.
You can then provision the entire site with this command:
ansible-playbook -i development site.yml
If you're testing with vagrant, you can use this command:
ansible-playbook -i vagrant_ansible_inventory_default --private-key=~/.vagrant.d/insecure_private_key vagrant.yml
vagrant ssh
sudo su vida
workon vida
When you install FireCARES using Vagrant, the default configuration will restart the Gunicorn process on every request so your server-side modifications should immediately show up.
For client-side changes, you currently need to manually run the collectstatic
in order to update the static assets. You
can run collect static from the firecares-ansible
directory on the host machine using the following command:
ansible-playbook vagrant.yml -i vagrant_server --tags django.collectstatic
This project uses LESS CSS pre-processor to generate CSS rules. To make a modification to a CSS rule, follow these steps:
- Make the modification in the appropriate LESS file. For example: style.less
- Use the
lessc
command to compile the CSS from LESS and pipe the output to the appropriate locationlessc style.less > ../css/style.css
.
You can use Pycharm to put breakpoints and perform typical IDE debugging tasks. See this documentation for instructions