Setup and pre-deployment Ansible playbook.
Fix deploy to vagrant tasks. Move configuration files around for Ansible.
This commit is contained in:
parent
0b291af9e7
commit
d2db632bb8
|
@ -0,0 +1,7 @@
|
||||||
|
:syntax on
|
||||||
|
:set number
|
||||||
|
:set textwidth=125
|
||||||
|
:set autoindent
|
||||||
|
:set shiftwidth=4
|
||||||
|
:set nobackup
|
||||||
|
:set nowritebackup
|
|
@ -0,0 +1,14 @@
|
||||||
|
server {
|
||||||
|
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
location /static/ {
|
||||||
|
alias /var/www/rookeries/static/;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / { try_files $uri @yourapplication; }
|
||||||
|
location @yourapplication {
|
||||||
|
include uwsgi_params;
|
||||||
|
uwsgi_pass 127.0.0.1:8001;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
--allow-external mysql-connector-python
|
||||||
|
--allow-unverified mysql-connector-python
|
||||||
|
|
||||||
|
mysql-connector-python==1.1.6
|
||||||
|
uwsgi==2.0
|
||||||
|
mailsink==0.0.2
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Basic environmental
|
||||||
|
ENVIRONMENTAL_NAME = "Vagrant"
|
||||||
|
TESTING = False
|
||||||
|
DEBUG = True
|
||||||
|
|
||||||
|
# Password salts + secrets
|
||||||
|
PASSWORD_SALT = "secret"
|
||||||
|
SECRET_KEY = "development"
|
||||||
|
USER_REGISTRATION_INVITE_KEY = None
|
||||||
|
|
||||||
|
# Database
|
||||||
|
DATABASE_URI = "mysql+mysqlconnector://rookeries:penguin2013flight@localhost:3306/rookeries?charset=utf8"
|
||||||
|
|
||||||
|
# Mail server configuration
|
||||||
|
MAIL_SERVER = "localhost"
|
||||||
|
MAIL_PORT = 25
|
||||||
|
MAIL_USERNAME = "admin@rookeri.es"
|
||||||
|
MAIL_PASSWORD = "password"
|
||||||
|
MAIL_DEFAULT_SENDER = "admin@rookeri.es"
|
||||||
|
MAIL_USE_TLS = False
|
||||||
|
MAIL_USE_SSL = False
|
|
@ -0,0 +1,5 @@
|
||||||
|
[uwsgi]
|
||||||
|
socket = :8001
|
||||||
|
log = /tmp/rookeries-uwsgi.log
|
||||||
|
master = true
|
||||||
|
module = rookeries:app
|
|
@ -1,6 +1,4 @@
|
||||||
---
|
---
|
||||||
- hosts: all
|
- include: deployment/rookeries_install.yaml
|
||||||
sudo: yes
|
- include: deployment/email_server.yaml
|
||||||
tasks:
|
- include: deployment/uwsgi.yaml
|
||||||
|
|
||||||
# TODO Include all necessary deployment playbooks
|
|
||||||
|
|
|
@ -4,5 +4,5 @@
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
# TODO PIP install mailsink into a virtualenv somewhere
|
# TODO PIP install mailsink into a virtualenv somewhere
|
||||||
- name: Install fake SMTP server for email development.
|
# - name: Install fake SMTP server for email development.
|
||||||
pip: name=mailsink use_mirrors=no
|
# pip: name=mailsink use_mirrors=no
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
- hosts: all
|
- include: pre_deployment/base_linux.yaml
|
||||||
sudo: yes
|
- include: pre_deployment/python.yaml
|
||||||
tasks:
|
- include: pre_deployment/mysql_db.yaml
|
||||||
|
- include: pre_deployment/nodejs.yaml
|
||||||
# TODO Include all necessary playbooks
|
- include: pre_deployment/nginx.yaml
|
||||||
|
|
|
@ -3,10 +3,11 @@
|
||||||
sudo: yes
|
sudo: yes
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
|
- name: Update and upgrade system
|
||||||
|
apt: update_cache=yes upgrade=full
|
||||||
|
|
||||||
- name: Install vim
|
- name: Install vim
|
||||||
apt: pkg=vim update_cache=yes state=present
|
apt: pkg=vim state=present
|
||||||
|
|
||||||
- name: Configure vim
|
- name: Configure vim
|
||||||
copy: src=config/base/_vimrc dest=/home/vagrant/.vimrc
|
copy: src=../config/base/_vimrc dest=/home/vagrant/.vimrc
|
||||||
|
|
||||||
# TODO Add update of apt cache + any extra repo setup here.
|
|
||||||
|
|
|
@ -1,18 +1,23 @@
|
||||||
---
|
---
|
||||||
- hosts: all
|
- hosts: all
|
||||||
sudo: yes
|
sudo: yes
|
||||||
|
vars:
|
||||||
|
databases:
|
||||||
|
rookeries:
|
||||||
|
username: rookeries
|
||||||
|
password: system_admin
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
# Setup MySQL dependencies.
|
- name: Setup MySQL 5 server + Python dependencies
|
||||||
# TODO Extract all variables into an easy to configure file.
|
apt: pkg={{ item }} state=present
|
||||||
- name: Install MySQL 5x server
|
with_items:
|
||||||
apt: pkg=mysql-server update_cache=no state=present
|
- mysql-server
|
||||||
|
- python-mysqldb
|
||||||
|
|
||||||
- name: Install mysqldb is installed.
|
- name: Setup MySQL databases for rookeries.
|
||||||
apt: pkg=python-mysqldb update_cache=no state=present
|
mysql_db: name={{ item.key }} state=present
|
||||||
|
with_dict: databases
|
||||||
|
|
||||||
- name: Setup MySQL database for rookeries.
|
- name: Setup MySQL database users for rookeries.
|
||||||
mysql_db: name=rookeries state=present
|
mysql_user: name={{ item.value.username }} password={{ item.value.password }} priv={{ item.key }}:ALL
|
||||||
|
with_dict: databases
|
||||||
- name: Setup MySQL database user for rookeries.
|
|
||||||
mysql_user: name=rookeries password=system_admin priv=rookeries:ALL
|
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
---
|
---
|
||||||
- hosts: all
|
- hosts: all
|
||||||
sudo: yes
|
sudo: yes
|
||||||
|
vars:
|
||||||
|
rookeries_nginx_conf: rookeries-uwsgi.conf
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
# Next setup our webserver.
|
- name: Setup nginx webserver
|
||||||
# TODO Extract variables into a single easy to configure place.
|
apt: pkg=nginx-full state=present
|
||||||
- name: Install nginx
|
|
||||||
apt: pkg=nginx-full update_cache=yes state=present
|
|
||||||
|
|
||||||
- name: Configure nginx
|
- name: Configure nginx
|
||||||
copy: src=config/nginx/rookeries-uwsgi.conf dest=/etc/nginx/sites-available
|
copy: src=../config/nginx/{{ rookeries_nginx_conf }} dest=/etc/nginx/sites-available
|
||||||
|
|
||||||
- name: Link the rookeries uwsgi file
|
- name: Link the rookeries uwsgi file
|
||||||
file: state=link
|
file: state=link
|
||||||
src=/etc/nginx/sites-available/rookeries-uwsgi.conf
|
src=/etc/nginx/sites-available/{{ rookeries_nginx_conf }}
|
||||||
path=/etc/nginx/sites-enabled/rookeries-uwsgi.conf
|
path=/etc/nginx/sites-enabled/{{ rookeries_nginx_conf }}
|
||||||
|
|
||||||
- name: Unlink the default page
|
- name: Unlink the default page
|
||||||
file: state=absent path=/etc/nginx/sites-enabled/default
|
file: state=absent path=/etc/nginx/sites-enabled/default
|
||||||
|
@ -22,8 +22,9 @@
|
||||||
- name: Run nginx service
|
- name: Run nginx service
|
||||||
command: service nginx restart
|
command: service nginx restart
|
||||||
|
|
||||||
- name: Setup webapp deployment folder with the correct permissions
|
# TODO Verify if still required for pip package deployment
|
||||||
file: path=/var/www state=directory owner=vagrant group=www-data mode=0774
|
# - name: Setup webapp deployment folder with the correct permissions
|
||||||
|
# file: path=/var/www state=directory owner=vagrant group=www-data mode=0774
|
||||||
- name: Add vagrant user to www-data
|
#
|
||||||
user: name=vagrant append=yes groups=www-data
|
# - name: Add vagrant user to www-data
|
||||||
|
# user: name=vagrant append=yes groups=www-data
|
||||||
|
|
|
@ -3,4 +3,14 @@
|
||||||
sudo: yes
|
sudo: yes
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
# TODO Install nodejs + coffeescript dependencies
|
- name: Setup nodejs + npm dependencies
|
||||||
|
apt: pkg={{ item }} state=present
|
||||||
|
with_items:
|
||||||
|
- nodejs
|
||||||
|
- npm
|
||||||
|
|
||||||
|
- name: Setup coffeescript + lessc dependency
|
||||||
|
npm: name={{ item }} global=yes state=present
|
||||||
|
with_items:
|
||||||
|
- coffee-script
|
||||||
|
- less
|
||||||
|
|
|
@ -3,18 +3,20 @@
|
||||||
sudo: yes
|
sudo: yes
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
# Setup Python dependencies.
|
- name: Setup Python setuptools dependencies
|
||||||
- name: Python Development
|
apt: pkg={{ item }} state=present
|
||||||
apt: pkg=python-dev update_cache=no state=present
|
with_items:
|
||||||
|
- python-dev
|
||||||
- name: Bootstrap Python SetupTools
|
- python-setuptools
|
||||||
apt: pkg=python-setuptools update_cache=no state=present
|
|
||||||
|
|
||||||
- name: Bootstrap PIP using Setuptools
|
- name: Bootstrap PIP using Setuptools
|
||||||
easy_install: pkg=pip state=present
|
easy_install: name=pip
|
||||||
|
|
||||||
- name: Install Python virtualenvwrapper
|
- name: Basic Python dependencies
|
||||||
pip: name=virtualenvwrapper use_mirrors=no
|
pip: name={{ item }} use_mirrors=no
|
||||||
|
with_items:
|
||||||
|
- virtualenv
|
||||||
|
- virtualenvwrapper
|
||||||
|
|
||||||
- name: Configure Bash to use virtualenvwrapper
|
- name: Add virtualenvwrapper to bashrc
|
||||||
lineinfile: dest=/home/vagrant/.bashrc line="source virtualenvwrapper.sh"
|
lineinfile: dest=/home/vagrant/.bashrc line="source virtualenvwrapper.sh"
|
||||||
|
|
Loading…
Reference in New Issue