Add separate ansible playbook for setting up webapp folders.

Add logging configuration for rookeries.
This commit is contained in:
Dorian 2014-11-26 22:04:01 -05:00
parent 401d0d1b6c
commit d99bc0edce
5 changed files with 32 additions and 17 deletions

View File

@ -1,12 +1,16 @@
server { server {
server_name localhost; server_name localhost;
access_log /srv/www/logs/nginx/rookeries-access.log;
error_log /srv/www/logs/nginx/rookeries-error.log info;
location /static/ { location /static/ {
alias /srv/www/rookeries_webapp/rookeries/static/; alias /srv/www/rookeries_webapp/rookeries/static/;
} }
location / { try_files $uri @yourapplication; } location / {
try_files $uri @yourapplication;
}
location @yourapplication { location @yourapplication {
include uwsgi_params; include uwsgi_params;
uwsgi_pass 127.0.0.1:8001; uwsgi_pass 127.0.0.1:8001;

View File

@ -2,5 +2,6 @@
- include: pre_deployment/base_linux.yaml - include: pre_deployment/base_linux.yaml
- include: pre_deployment/python.yaml - include: pre_deployment/python.yaml
- include: pre_deployment/mysql_db.yaml - include: pre_deployment/mysql_db.yaml
- include: pre_deployment/web_data_folders.yaml
- include: pre_deployment/nodejs.yaml - include: pre_deployment/nodejs.yaml
- include: pre_deployment/nginx.yaml - include: pre_deployment/nginx.yaml

View File

@ -4,7 +4,6 @@
vars: vars:
rookeries_nginx_conf: rookeries-uwsgi.conf rookeries_nginx_conf: rookeries-uwsgi.conf
web_server_group: www-data web_server_group: www-data
web_server_home: /srv/www
tasks: tasks:
- name: Setup nginx webserver - name: Setup nginx webserver
@ -24,17 +23,6 @@
- name: Run nginx service - name: Run nginx service
service: name=nginx state=restarted service: name=nginx state=restarted
- name: Setup webapp deployment folder with the correct permissions
file: path={{ web_server_home }} state=directory
owner={{ ansible_env.SUDO_USER }} group={{ web_server_group }} mode=0774
- name: Setup webapp deployment configuration folder with the correct permissions
file: path={{ web_server_home }}/config state=directory
owner={{ ansible_env.SUDO_USER }} group={{ web_server_group }} mode=0774
- name: Add vagrant user to www-data
user: name={{ ansible_env.SUDO_USER }} append=yes groups={{ web_server_group }}
- name: Change permissions on nginx logs - name: Change permissions on nginx logs
file: path=/var/log/nginx state=directory file: path=/var/log/nginx state=directory
owner={{ web_server_group }} group={{ web_server_group }} mode=0766 owner={{ web_server_group }} group={{ web_server_group }} mode=0766

View File

@ -13,6 +13,6 @@
easy_install: name=pip easy_install: name=pip
- name: Basic Python dependencies - name: Basic Python dependencies
pip: name={{ item }} use_mirrors=no pip: name={{ item }}
with_items: with_items:
- virtualenv - virtualenv

View File

@ -0,0 +1,22 @@
---
- hosts: all
sudo: yes
vars:
user: "{{ ansible_env.SUDO_USER }}"
web_app_home: /srv/www
web_server_group: www-data
tasks:
- name: setup webapp deployment folder with the correct permissions
file: path={{ web_app_home }} state=directory owner={{ web_server_group }} group=www-data mode=0774
- name: setup webapp deployment configuration + log folders with the correct permissions
file: path={{ web_app_home }}/{{ item }} state=directory
owner={{ web_server_group }} group={{ web_server_group }} mode=0774
with_items:
- config
- logs
- logs/nginx
- name: add user to www-data
user: name={{ user }} append=yes groups={{ web_server_group }}