This project builds a Node.js-based API app inside a VM. It is meant as a demonstration of application deployments (in this case, a Node.js-based app) using Ansible.
- Download and install VirtualBox.
- Download and install Vagrant.
- [Mac/Linux only] Install Ansible.
- Run
ansible-galaxy install -r requirements.yml
in this directory to get the required Ansible roles. - Run
vagrant up
to build the VM and deploy the version of the app specified inplaybooks/vars.yml
.
Once the VM is built, you can test the API by running the following command (copy and paste verbatim, without the leading $
), which requests the /hello/:name
endpoint on each server:
$ for i in {2..5}; \
do curl -w "\n" "http://192.168.3.$i:8080/hello/john"; \
done
If the above command outputs "hello john"
on four lines, everything worked correctly!
The first 'production' release of this demo app is version 1.0.0
, which contains one simple endpoint for /hello/:name
and an integration test to make sure it's working correctly. Subsequent releases can be deployed by incrementing the app_version
in playbooks/vars.yml
, then running the Ansible provisioner again with vagrant provision
.
Some notable releases you could test:
2.0.0
: The first stable release, passing all tests.2.0.1
: A code change was made which broke one of the tests.2.0.2
: The code was fixed, and all tests pass again.
This project was created by Jeff Geerling as an example for Ansible for DevOps.