Web application server with Ansible
NB This is a work in progress. Use at your own risk.
The setup here has not been tested. Please don't base your production server on this code without testing and checking security. Additions and pull requests for enhancements gratefully received!
Provision an Ubuntu 12.04 64bit Server for serving web applications with the following stack:
- Node (to be completed)
The scripts should work with small modifications on other version of Ubuntu and Debian.
- Install Ansible
- Set up a VPS with a bare Ubuntu 12.04 64bit image.
- Make sure you can log into the server from your development box using key based login and a non root account with sudo priviliges.
TODO: The following needs to be added to the server setup playbook.
Set up the firewall on the server with:
ufw default deny incoming ufw default allow outgoing ufw allow www ufw allow ssh ufw allow ntp ufw enable
Make sure you can still log in before clossing the SSH session.
- Make a
hostsfile in the
devopsfolder based on
- Update the
deploy.ymlto your own values.
ansible-playbook devops/setup-server.yml -i devops/hosts --ask-sudo-pass
- Enter password for your user on the server
- Create and test database with:
ansible-playbook devops/setup-database.yml -i devops/hosts --ask-sudo-pass
ansible-playbook devops/deploy.yml -i devops/hosts --ask-sudo-pass
This will set up a basic Flask application to run via Supervisor using uWSGI and Nginx.
http://[yourhost]and you should see the application running.