Given a Ansible Playbook, we are going to provision and start DemocracyOS on a CentOS/RedHat/Ubuntu VM.
- Make sure to have Ansible 2.1.0.0 or greater installed locally (Installation Guide)
- Clone this repo and make sure to have the necessary roles with:
ansible-galaxy install -p ./roles -r ./requirements.yml
First, make sure to have a VM (where DemocracyOS is going to run) with root
access to it, and can login with your SSH Key. If you don't know how to do any of that, follow this tutorial.
Then, you will have to customize how your environment is going to run. To do that you have to create an Inventory file and a configuration file with your custom variables. Use as reference inventories/example
and inventories/example.yml
. The file names should be the same as your environment, e.g.: inventories/staging
and inventories/staging.yml
.
Lastly, just run:
ansible-playbook playbook.yml -i inventories/<path to your inventory file>
This command is going to execute all the tasks defined at playbook.yml; if you need to know how that works, here's the official docs.
## How to manage your running VM
Inside your VM, you can run the following commands:
# Deploy a new Docker image
docker pull democracyos/democracyos:latest && docker-compose -f /usr/src/docker-compose.yml restart -d
# See the logs
docker-compose -f /usr/src/docker-compose.yml logs --follow
# View all the services running
docker-compose -f /usr/src/docker-compose.yml ps
# Connect to the running MongoDb console
docker exec -it src_mongo_1 mongo democracyos-staging
# Connect to the image running DemocracyOS
docker exec -it src_app_1 bash
# Scale the number of DemocracyOS instances running
docker-compose -f /usr/src/docker-compose.yml scale app=3
If you're running on staging
or production
environment, everyday at 23:59
a dump of the entire database will be saved to /usr/src/backups
. You can check the file templates/backup.j2
to see what it does.