Add Vagrant setup of database and uwsgi app.

This commit is contained in:
Dorian 2013-12-30 19:13:58 -05:00
parent fcffea3319
commit fc76648f91
5 changed files with 63 additions and 13 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
.idea/
vagrant/.vagrant
vagrant/vagrant_ansible_inventory_default
passenger_wsgi.py
rookeries_webapp_config.cfg

View File

@ -14,5 +14,6 @@ tox==1.6.1
flake8==2.1.0
# Deployment
# Deployment and Automation
Fabric==1.8.0
ansible==1.4.3

30
vagrant/Vagrantfile vendored
View File

@ -16,13 +16,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# doesn't already exist on the user's system.
config.vm.box_url = "http://dl.dropbox.com/u/54390273/vagrantboxes/Squeeze64_VirtualBox4.2.4.box"
# Provisioning...
config.vm.provision :shell, :path => "bootstrap.sh"
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
config.vm.network :forwarded_port, guest: 80, host: 4567
config.vm.network :forwarded_port, guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
@ -47,13 +44,24 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider :virtualbox do |vb|
# # Don't boot with headless mode
# vb.gui = true
#
# # Use VBoxManage to customize the VM. For example to change memory:
# vb.customize ["modifyvm", :id, "--memory", "1024"]
# end
config.vm.provider :virtualbox do |vb|
# Don't boot with headless mode
vb.gui = false
# Use VBoxManage to customize the VM. For example to change memory:
vb.customize ["modifyvm", :id, "--memory", "1024"]
end
# Shell bootstrap provising
config.vm.provision "shell", path: "bootstrap.sh"
# Ansible provising
config.vm.provision "ansible" do |ansible|
ansible.verbose = "v"
ansible.playbook = "playbook.yaml"
ansible.host_key_checking = false
end
#
# View the documentation for the provider you're using for more
# information on available options.

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
aptitude update
aptitude install -y apache2 python2.6 python-pip python-virtualenv mysql-server-5.1 libapache2-mod-wsgi libapache2-mod-python
aptitude install -y python

40
vagrant/playbook.yaml Normal file
View File

@ -0,0 +1,40 @@
---
- hosts: all
sudo: yes
tasks:
# Start with the basic Python requirements.
- name: Verify that Python PIP is installed
easy_install: name=pip
- name: Verify that Python virtualenv is installed
pip: name=virtualenv
# Next setup our webserver and uwsgi container.
- name: Verify that lighttpd is installed.
apt: pkg=lighttpd update_cache=no state=present
- name: Verify that uwsgi is installed.
pip: name=uwsgi
# Setup the database user and all.
- name: Verify that MySQL 5x is installed.
apt: pkg=mysql-server-5.1 update_cache=no state=present
- name: Verify that mysqldb is installed.
apt: pkg=python-mysqldb update_cache=no state=present
- name: Setup MySQL database for rookeries.
mysql_db: name=rookeries state=present
- name: Setup MySQL database user for rookeries.
mysql_user: name=rookeries priv=rookeries:ALL
# Checkout the code and install the requirements for rookeries.
- name: Checkout rookeries code from Git.
git: repo=https://github.com/dorianpula/rookeries dest=/rookeries-app
- name: Install rookeries dependencies.
pip: requires=/rookeries-app/requirements.txt virtualenv=/rookeries-app/virtualenv
# TODO Add in separate test machine for Jenkins integration.