salt config changes

This commit is contained in:
Matthew Scragg 2013-10-24 11:21:19 -05:00
parent 3c71b00d05
commit ba1ec10a34
13 changed files with 91 additions and 69 deletions

1
.gitignore vendored
View file

@ -1,4 +1,5 @@
.vagrant .vagrant
.virtualenvs
.idea .idea
.webassets-cache .webassets-cache
*.pyc *.pyc

8
Vagrantfile vendored
View file

@ -7,14 +7,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
salt.minion_config = "srv/minion" salt.minion_config = "srv/minion"
salt.run_highstate = true salt.run_highstate = true
end end
config.vm.provider :digital_ocean do |provider, override|
override.ssh.private_key_path = '~/.ssh/id_dsa'
override.vm.box = 'digital_ocean'
override.vm.box_url = "https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box"
provider.client_id = ''
provider.api_key = ''
end
end end
Vagrant::Config.run do |config| Vagrant::Config.run do |config|

View file

@ -1,13 +1,8 @@
import json import json
import rethinkdb as rdb import rethinkdb as rdb
import bcrypt import bcrypt
from flask import session, flash from flask import session, flash
from flask.ext.login import login_user, logout_user from flask.ext.login import login_user, logout_user
from rethinkORM import RethinkModel
from util import gravatar_url from util import gravatar_url
from services import db, cache from services import db, cache
@ -62,18 +57,17 @@ def cache_it(fn):
return wrap return wrap
class BaseModel(RethinkModel): class BaseModel():
table = None
_conn = db _conn = db
def __init__(self, **kwargs): def __init__(self, **kwargs):
if not kwargs.get('conn'): if not kwargs.get('conn'):
kwargs['conn'] = db kwargs['conn'] = db
super(BaseModel, self).__init__(**kwargs)
@classmethod def create(self, **kwargs):
def create(cls, **kwargs): return rdb.table(self.table).insert(kwargs).run(self._conn)
return super(BaseModel, cls).create(**kwargs)
@cache_it @cache_it
def get_by_id(self, id): def get_by_id(self, id):
@ -135,11 +129,6 @@ class User(BaseModel):
def login(self, login, password): def login(self, login, password):
pass pass
@classmethod
def get(cls, id):
print id
return cls(id=id)
@classmethod @classmethod
def auth(cls, username, password): def auth(cls, username, password):
u = User() u = User()

22
requirements.txt Normal file
View file

@ -0,0 +1,22 @@
Flask==0.10.1
Flask-Assets==0.8
Flask-Bcrypt==0.5.2
Flask-Login==0.2.7
beautifulsoup4==4.3.2
boto==2.13.3
closure==20121212
gevent==0.13.8
ghdiff==0.1
gittle==0.2.2
itsdangerous==0.23
lxml==3.2.3
markdown2==2.1.0
pyzmq==13.0.0
recaptcha==1.0rc1
recaptcha-client==1.0.6
redis==2.8.0
rethinkdb==1.10.0-0
simplejson==3.3.0
sockjs-tornado==1.0.0
supervisor==3.0
tornado==3.1.1

View file

@ -1,3 +1,10 @@
extra-repos:
pkgrepo.managed:
- ppa: chris-lea/python-redis
- ppa: brianmercer/redis
- ppa: chris-lea/node.js
- ppa: nginx/stable
common-pkgs: common-pkgs:
pkg.installed: pkg.installed:
- pkgs: - pkgs:
@ -19,3 +26,5 @@ common-pkgs:
- curl - curl
- libxml2-dev - libxml2-dev
- libxslt-dev - libxslt-dev
- require:
- pkgrepo.managed: extra-repos

View file

@ -1,9 +1,13 @@
node-repos:
pkgrepo.managed:
- ppa: chris-lea/node.js
nodejs: nodejs:
pkg: pkg.installed
- installed
nodejs-dev:
pkg.installed
npm:
pkg.installed
bower:
npm.installed:
- require: - require:
- pkgrepo.managed: node-repos - pkg.installed: npm

View file

@ -1,17 +1,40 @@
python-pkgs: python-dev:
pkg.installed: pkg.installed
- pkgs:
- python-dev
- python-pip
- build-essential
python-pip:
pkg.installed
{% for pkg in ['closure', 'ghdiff', 'tornado', 'pyzmq', 'itsdangerous', 'boto', 'redis', 'simplejson', 'sockjs-tornado', 'flask', 'flask-bcrypt', 'flask-login', 'flask-assets', 'gittle', 'gevent', 'lxml', 'markdown2', 'recaptcha-client', 'RethinkORM' ] %} build-essential:
{{ pkg }}-pip: pkg.installed
pip:
- name: {{ pkg }} realms-repo:
- installed git.latest:
- unless: test -e /vagrant
- name: git@github.com:scragg0x/realms.git
- target: /home/deploy
- rev: master
- user: deploy
- identity: /home/deploy/.ssh/id_rsa
realms-link:
cmd.run:
- onlyif: test -e /vagrant
- name: ln -s /vagrant /home/deploy/realms
/home/deploy/virtualenvs/realms:
file.directory:
- user: deploy
- group: deploy
- makedirs: True
- recurse:
- user
- group
- require: - require:
- pkg.installed: common-pkgs - user.present: deploy
- pkg.installed: rethinkdb virtualenv.managed:
{% endfor %} - name: /home/deploy/virtualenvs/realms
- requirements: /home/deploy/realms/requirements.txt
- watch:
- git: realms-repo
- require:
- file.directory: /home/deploy/virtualenvs/realms

View file

@ -1,8 +1,3 @@
redis-repos:
pkgrepo.managed:
- ppa: chris-lea/python-redis
- ppa: brianmercer/redis
redis-server: redis-server:
pkg: pkg:
- installed - installed
@ -12,4 +7,3 @@ redis-server:
- reload: True - reload: True
- require: - require:
- pkg: redis-server - pkg: redis-server
- pkgrepo.managed: redis-repos

View file

@ -9,12 +9,6 @@ rethinkdb:
pkg: pkg:
- installed - installed
python-pip:
pkg.installed
build-essential:
pkg.installed
rethinkdb-pip: rethinkdb-pip:
pip: pip:
- name: rethinkdb - name: rethinkdb

View file

@ -25,8 +25,8 @@ nocleanup = true
childlogdir = /tmp childlogdir = /tmp
strip_ansi = false strip_ansi = false
[program:reimagine] [program:realms]
command=/usr/bin/python /vagrant/app.py command=/home/deploy/virtualenvs/realms/bin/python /home/deploy/realms/app.py
[program:rethinkdb] [program:rethinkdb]
command=/usr/bin/rethinkdb --config-file /etc/rethinkdb/rdb0.conf command=/usr/bin/rethinkdb --config-file /etc/rethinkdb/rdb0.conf

View file

@ -2,6 +2,7 @@ base:
'*': '*':
- common - common
- users - users
- nodejs
- redis - redis
- nginx - nginx
- rethinkdb - rethinkdb

View file

@ -4,12 +4,6 @@ deploy:
- home: /home/deploy - home: /home/deploy
- fullname: Deploy - fullname: Deploy
scragg:
user.present:
- fullname: Matthew Scragg
- shell: /bin/bash
- home: /home/scragg
sudo: sudo:
pkg: pkg:
- installed - installed

View file

@ -1,2 +1 @@
deploy ALL=(ALL) NOPASSWD:ALL deploy ALL=(ALL) NOPASSWD:ALL
mrobinson ALL=(ALL) NOPASSWD:ALL