A very basic structure for hosting sample application on tomcat application server.
- Docker is installed on the machine
- Ansible is installed on the machine
- Python/Pytest is installed on the machine on default location
/usr/local/bin/pytest
- Port 8080 is available
- Clone git repo to your local repository
- Run ansible playbook with predefined hosts file :
sudo ansible-playbook -i hosts main.yml
- All done - application should be hosted on http://localhost:8080/sample
- Folder /docker contains Dockerfile and sample app (sample.war).
- File hosts contains localhost address - our app destination.
- File main.yml is playbook containing complete server deployment procedure.
- File test-avialability.py checks if our app is up and running at desired address.
- Ansible first checks via pytest if our app is currently up and running, and if yes, skip whole process.
- If our application is not running at http://localhost:8080/sample, first docker image is build, then run at localhost:8080.
- After that pytest check runs again to make sure that app is up and running.