WIP
This commit is contained in:
parent
d0777e2b85
commit
b02d3db684
41 changed files with 426 additions and 647 deletions
|
@ -11,30 +11,14 @@ python-redis-lea-repo:
|
|||
pkgrepo.managed:
|
||||
- ppa: chris-lea/python-redis
|
||||
|
||||
nginx-stable-repo:
|
||||
pkgrepo.managed:
|
||||
- ppa: nginx/stable
|
||||
- required_in: nginx
|
||||
|
||||
postgres-repo:
|
||||
pkgrepo.managed:
|
||||
- name: deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main
|
||||
- key_url: https://www.postgresql.org/media/keys/ACCC4CF8.asc
|
||||
- required_in: postgresql
|
||||
|
||||
common-pkgs:
|
||||
pkg.installed:
|
||||
- pkgs:
|
||||
- python
|
||||
- vim
|
||||
- build-essential
|
||||
- screen
|
||||
- htop
|
||||
- git
|
||||
- ntp
|
||||
- libpcre3-dev
|
||||
- libevent-dev
|
||||
- iptraf
|
||||
- python-software-properties
|
||||
- python-pip
|
||||
- python-virtualenv
|
||||
|
@ -43,11 +27,10 @@ common-pkgs:
|
|||
- curl
|
||||
- libxml2-dev
|
||||
- libxslt1-dev
|
||||
- zlib1g-dev
|
||||
- libffi-dev
|
||||
- nodejs
|
||||
- supervisor
|
||||
- require:
|
||||
- pkgrepo.managed: nodejs-lea-repo
|
||||
- pkgrepo.managed: redis-lea-repo
|
||||
- pkgrepo.managed: python-redis-lea-repo
|
||||
- pkgrepo.managed: nginx-stable-repo
|
||||
- pkgrepo.managed: postgres-repo
|
||||
- pkgrepo: nodejs-lea-repo
|
||||
- pkgrepo: redis-lea-repo
|
||||
- pkgrepo: python-redis-lea-repo
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
nginx:
|
||||
pkg:
|
||||
- installed
|
||||
service.running:
|
||||
- enable: True
|
||||
- reload: True
|
||||
- require:
|
||||
- pkg: nginx
|
||||
- watch:
|
||||
- file: /etc/nginx/conf.d/realms.conf
|
||||
|
||||
/etc/nginx/conf.d/realms.conf:
|
||||
file.managed:
|
||||
- template: jinja
|
||||
- source: salt://nginx/nginx.conf
|
|
@ -1,71 +0,0 @@
|
|||
{% set root = '/home/deploy/realms/realms' %}
|
||||
{% set ssl_certificate = False %}
|
||||
gzip_proxied any;
|
||||
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
|
||||
upstream web {
|
||||
fair;
|
||||
server 127.0.0.1:10000;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
# Allow file uploads
|
||||
client_max_body_size 50M;
|
||||
|
||||
location ^~ /static/ {
|
||||
root {{ root }};
|
||||
expires max;
|
||||
}
|
||||
|
||||
location = /favicon.ico {
|
||||
rewrite (.*) /static/favicon.ico;
|
||||
}
|
||||
|
||||
location = /robots.txt {
|
||||
rewrite (.*) /static/robots.txt;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass_header Server;
|
||||
proxy_redirect off;
|
||||
proxy_buffering off;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Scheme $scheme;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_pass http://web;
|
||||
error_page 502 = /maintenance.html;
|
||||
}
|
||||
|
||||
location /maintenance.html {
|
||||
root {{ root }}/templates/;
|
||||
add_header Cache-Control private;
|
||||
expires epoch;
|
||||
}
|
||||
}
|
||||
|
||||
{% if ssl_certificate %}
|
||||
server {
|
||||
listen 443;
|
||||
ssl on;
|
||||
ssl_certificate {{ ssl_certificate }};
|
||||
ssl_certificate_key {{ ssl_certificate_key }};
|
||||
|
||||
location ^~ /static/ {
|
||||
root {{ root }};
|
||||
expires max;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass_header Server;
|
||||
proxy_redirect off;
|
||||
proxy_buffering off;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Scheme $scheme;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_pass http://web;
|
||||
error_page 502 = /maintenance.html;
|
||||
}
|
||||
}
|
||||
{% endif %}
|
|
@ -1,18 +0,0 @@
|
|||
postgresql:
|
||||
pkg.installed:
|
||||
- name: postgresql-9.3
|
||||
|
||||
libpq-dev:
|
||||
pkg.installed
|
||||
|
||||
createdb:
|
||||
cmd.run:
|
||||
- name: createdb -T template1 realms
|
||||
- user: postgres
|
||||
- require:
|
||||
- pkg.installed: postgresql-9.3
|
||||
|
||||
initdb:
|
||||
cmd.run:
|
||||
- name: psql realms < /srv/salt/postgres/init.sql
|
||||
- user: postgres
|
|
@ -1,2 +0,0 @@
|
|||
CREATE USER deploy WITH PASSWORD 'dbpassword';
|
||||
GRANT ALL PRIVILEGES ON DATABASE "realms" to deploy;
|
|
@ -16,13 +16,13 @@ bower:
|
|||
npm.installed:
|
||||
- user: root
|
||||
- require:
|
||||
- pkg.installed: common-pkgs
|
||||
- pkg: common-pkgs
|
||||
|
||||
uglify-js:
|
||||
npm.installed:
|
||||
- user: root
|
||||
- require:
|
||||
- pkg.installed: common-pkgs
|
||||
- pkg: common-pkgs
|
||||
|
||||
create_virtualenv:
|
||||
virtualenv.managed:
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
/etc/supervisor/conf.d/realms.conf:
|
||||
file.managed:
|
||||
- source: salt://supervisor/supervisord.conf
|
|
@ -1,3 +0,0 @@
|
|||
[program:realms]
|
||||
user=deploy
|
||||
command=/home/deploy/realms/virtualenvs/realms/bin/python /home/deploy/realms/manage.py server
|
|
@ -3,7 +3,4 @@ base:
|
|||
- common
|
||||
- users
|
||||
- redis
|
||||
- nginx
|
||||
- postgres
|
||||
- realms
|
||||
- supervisor
|
|
@ -29,7 +29,7 @@ sudo:
|
|||
- user: deploy
|
||||
- group: deploy
|
||||
- require:
|
||||
- file.directory: /home/deploy
|
||||
- file: /home/deploy
|
||||
|
||||
/home/deploy/.bashrc:
|
||||
file.copy:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue