Add Vagrant setup of database and uwsgi app.
This commit is contained in:
parent
fcffea3319
commit
fc76648f91
|
@ -1,5 +1,6 @@
|
||||||
.idea/
|
.idea/
|
||||||
vagrant/.vagrant
|
vagrant/.vagrant
|
||||||
|
vagrant/vagrant_ansible_inventory_default
|
||||||
|
|
||||||
passenger_wsgi.py
|
passenger_wsgi.py
|
||||||
rookeries_webapp_config.cfg
|
rookeries_webapp_config.cfg
|
||||||
|
|
|
@ -14,5 +14,6 @@ tox==1.6.1
|
||||||
|
|
||||||
flake8==2.1.0
|
flake8==2.1.0
|
||||||
|
|
||||||
# Deployment
|
# Deployment and Automation
|
||||||
Fabric==1.8.0
|
Fabric==1.8.0
|
||||||
|
ansible==1.4.3
|
||||||
|
|
|
@ -16,13 +16,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||||
# doesn't already exist on the user's system.
|
# 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"
|
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
|
# 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,
|
# 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.
|
# 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
|
# Create a private network, which allows host-only access to the machine
|
||||||
# using a specific IP.
|
# using a specific IP.
|
||||||
|
@ -47,13 +44,24 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||||
# backing providers for Vagrant. These expose provider-specific options.
|
# backing providers for Vagrant. These expose provider-specific options.
|
||||||
# Example for VirtualBox:
|
# Example for VirtualBox:
|
||||||
#
|
#
|
||||||
# config.vm.provider :virtualbox do |vb|
|
config.vm.provider :virtualbox do |vb|
|
||||||
# # Don't boot with headless mode
|
# Don't boot with headless mode
|
||||||
# vb.gui = true
|
vb.gui = false
|
||||||
#
|
|
||||||
# # Use VBoxManage to customize the VM. For example to change memory:
|
# Use VBoxManage to customize the VM. For example to change memory:
|
||||||
# vb.customize ["modifyvm", :id, "--memory", "1024"]
|
vb.customize ["modifyvm", :id, "--memory", "1024"]
|
||||||
# end
|
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
|
# View the documentation for the provider you're using for more
|
||||||
# information on available options.
|
# information on available options.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
aptitude update
|
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
|
||||||
|
|
||||||
|
|
|
@ -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.
|
Loading…
Reference in New Issue