This project contains the automation scripts used to deploy webapps we have in ARBML. All of these scripts are written using ansible.
We have couple of ARBML web apps that are developed with django. The idea is that whenever we have an app, deploying it to a VM is time-consuming and error prone. This tool takes all of this hassels out and provides an off-the-shelf script to deploy to any VM.
ansible==6.0.0Before you deploy, Please take a look on how the project manages environment and secrets.
This project manages environment with a local_settings.py file. You need to make sure your project settings module imports this module.
There are alot of ways to manage secrets. However, this repo supports ansible-vault to manage secrets. If you prefer other ways, you can write your custom secret retrieval tasks under in pre_tasks in your app.yml.
This project expects that you have a db that is already setup. You just need to put connection params in the local_settings file. If no db is available, the app will be just deployed to the default sqlite.db file. Maybe in the future we will have kind of support to this. Any PR is also appreciated.
- If you are doing this for the first time, you need to setup your project. To do so:
- clone the repo.
- install ansible (better to be in a virtualenv)
python -m venv venv; source venv/bin/activate; pip install -r requirements.txt - install repo ansible requirements
ansible-galaxy install -r requirements.yml - cd to
appsfolder. - copy
project_templatefolder, rename it to yours. - in the inventory file, put remote ip.
- fill in public
varsthat are specific to your project invars/main.ymllike the project repo, branch, server name, etc. - for any secret vars, like secret_key, account passwords, etc, encrypt it to
vars/secret-vars.yml
- Once your project is setup, deploy using:
ansible-playbook -i environment/inventory apps/<your_app>/app.yml --ask-vault-passto deploy - [Optional] you can write your password to
.config/filethen runansible-playbook -i apps/<your_app>/inventory apps/<your_app>/app.yml --vault-password-file=.config/ansible_pass.passwordand ansible will take the password from that file automatically.