devops stuff

This commit is contained in:
Matthew Scragg 2013-12-02 16:23:43 -06:00
parent 810845441c
commit d68c6f1d4e
8 changed files with 69 additions and 9 deletions

2
Vagrantfile vendored
View file

@ -12,6 +12,6 @@ end
Vagrant::Config.run do |config|
config.vm.forward_port 80, 8000
config.vm.forward_port 5432, 5432
config.vm.forward_port 10000, 10000
config.vm.forward_port 20000, 20000
end

View file

@ -19,4 +19,5 @@ rethinkdb==1.10.0-0
simplejson==3.3.0
sockjs-tornado==1.0.0
supervisor==3.0
SQLAlchemy==0.8.3
tornado==3.1.1

View file

@ -1,18 +1,26 @@
redis-lea-repo:
pkgrepo.managed:
- name: 'deb http://ppa.launchpad.net/chris-lea/redis-server/ubuntu precise main'
- ppa: chris-lea/redis-server
- required_in: redis-server
nodejs-lea-repo:
pkgrepo.managed:
- name: 'deb http://ppa.launchpad.net/chris-lea/node.js/ubuntu precise main'
- ppa: chris-lea/node.js
python-redis-lea-repo:
pkgrepo.managed:
- name: 'deb http://ppa.launchpad.net/chris-lea/python-redis/ubuntu precise main'
- ppa: chris-lea/python-redis
nginx-stable-repo:
pkgrepo.managed:
- name: 'deb http://ppa.launchpad.net/nginx/stable/ubuntu precise main'
- 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:
@ -41,3 +49,4 @@ common-pkgs:
- pkgrepo.managed: redis-lea-repo
- pkgrepo.managed: python-redis-lea-repo
- pkgrepo.managed: nginx-stable-repo
- pkgrepo.managed: postgres-repo

View file

@ -0,0 +1,16 @@
postgresql:
pkg.installed:
- name: postgresql-9.3
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

View file

@ -0,0 +1,26 @@
DROP TABLE IF EXISTS users;
CREATE TABLE users (
id SERIAL,
username VARCHAR(100),
password VARCHAR(255),
email VARCHAR(255),
joined TIMESTAMP
);
DROP TABLE IF EXISTS sites;
CREATE TABLE sites (
name VARCHAR(255),
pages INT,
views INT,
created TIMESTAMP
);
DROP TABLE IF EXISTS pages;
CREATE TABLE pages (
id VARCHAR(255), -- <site name>/<path>
edits INT,
views INT,
author INT,
created TIMESTAMP,
modified TIMESTAMP
);

View file

@ -14,6 +14,7 @@ virtualenvwrapper:
bower:
npm.installed:
- user: root
- require:
- pkg.installed: common-pkgs
@ -26,3 +27,9 @@ realms-repo:
- user: deploy
- identity: /home/deploy/.ssh/id_rsa
/home/deploy/virtualenvs/realms:
virtualenv.managed:
- requirements: /home/deploy/realms/requirements.txt
- cwd: /home/deploy/realms
- runas: deploy

View file

@ -2,9 +2,8 @@ base:
'*':
- common
- users
- nodejs
- redis
- nginx
- rethinkdb
- postgres
- realms
- supervisor

View file

@ -42,3 +42,5 @@ bashrc-append:
file.append:
- name: /home/deploy/.bashrc
- text: . ~/.bash_profile
- user: deploy
- group: deploy