Skip to content

Commit

Permalink
Add scripts and settings for deployment to txels.com
Browse files Browse the repository at this point in the history
  • Loading branch information
txels committed Apr 16, 2013
1 parent ecec5be commit 289be78
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions deploy-requirements.txt
@@ -0,0 +1 @@
fabric
22 changes: 22 additions & 0 deletions deploy/lighttpd.pretenders
@@ -0,0 +1,22 @@
# Serve bottle app via fast cgi

$HTTP["host"] =~ "^pretenders\.txels\.com$" {
fastcgi.server = ("/pretenders.fcgi" =>
((
"socket" => env.HOME + "/srv/pretenders/pretenders.sock",
"bin-path" => env.HOME + "/srv/pretenders/deploy/pretenders.fcgi",
"check-local" => "disable",
"max-procs" => 1
))
)

alias.url = (
"/static" => env.HOME + "/srv/pretenders/pretenders/server/static",
)

url.rewrite-once = (
"^(/static($|/.*))$" => "$1",
# "^/favicon\.ico$" => "/media/favicon.ico",
"^(/.*)$" => "/pretenders.fcgi$1",
)
}
10 changes: 10 additions & 0 deletions deploy/pretenders.fcgi
@@ -0,0 +1,10 @@
#!/usr/bin/env python
import sys
import os

sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))

if __name__ == '__main__':
from pretenders.server import pretender_app
from flup.server.fcgi import WSGIServer
WSGIServer(pretender_app).run()
23 changes: 23 additions & 0 deletions fabfile.py
@@ -0,0 +1,23 @@
from fabric.api import task, put, run, get, local
from fabric.contrib.project import rsync_project


#DAEMON = '~/init/wishlist'
LIGHTTPD = '~/init/lighttpd'
LIGHTTPD_CONF = '~/lighttpd/pretenders.conf'
SRV_HOME = '~/srv/pretenders'
ENV_HOME = '~/env/pretenders'
PYTHON = ENV_HOME + '/bin/python'
# MANAGE = '{0} {1}'.format(PYTHON, SRV_HOME + '/manage.py')


@task
def deploy():
"""Copy project to txels.com"""
rsync_project(
local_dir='.',
remote_dir=SRV_HOME,
exclude=['test', '.*', '*~', '*.pyc'],
extra_opts='--omit-dir-times')
put('deploy/lighttpd.pretenders', LIGHTTPD_CONF)
run(LIGHTTPD + ' restart')
1 change: 1 addition & 0 deletions live-requirements.txt
@@ -0,0 +1 @@
flup

0 comments on commit 289be78

Please sign in to comment.