Skip to content

Instantly share code, notes, and snippets.

@calvinchengx
Created May 9, 2012 06:39
Show Gist options
  • Save calvinchengx/2642480 to your computer and use it in GitHub Desktop.
Save calvinchengx/2642480 to your computer and use it in GitHub Desktop.
Automated, programmatic creation of cherokee virtual server, reverse proxy with django cherrypy information sources
# User provides these input on an existing web interface, say for example on "www.od-eon.com/deploy":-
* project name
* project's domain name
* and his email address
# PHASE 1: MASTER SERVER SET-UP
# linode server kernel build `bootstrapping`
# base package installation in the new machine instance
# root user, web user and git user creation
# visudo install and enable a "wheel" group with sudo rights
# add web user to "wheel" group
# preparing the pid file directory for cherrypy instances and make sure the `web` user owns it
* mkdir /var/run/cherrypy
* chown web:web -R /var/run/cherrypy
# base python2.7 installation up to pip
# installation of postgresql, cherokee etc
# systemd add (postgresql, cherokee etc) so these services start up after a reboot
# sudo pip install python-cherokee
# programmatic creation of virtual server in cherokee.conf using python-cherokee
# sudo pip install virtualenvwrapper (note, `pip2` if using arch linux)
# mkvirtualenv -p python2.7 --no-site-packages [project name]
# pip install django
# cd /var/www; django-admin.py startproject [project name]
# pip install psycopg2
# pip install django-cherrypy
# somehow include (via pip probably) a standard "fabric script" or collection of fabric scripts
# programmatically create postgresql db name and user
# programmatically write into the project's settings.py and add "django_cherrypy" into INSTALLED_APPS
# programmatically enable django admin in INSTALLED_APPS and urls.py
# programmatically write postgresql db name and user into the project's settings.py DATABASES
# python manage.py syncdb (answer questions programmatically and create superuser programmatically)
# python manage.py runcpserver (with various options to daemonize and create 4 workers and each bound to a unique port)
* (Executed by looping "4" times to generate 4 processes by default, each process having 1 thread.)
* python manage.py runcpserver daemonize=1 port=3035 pidfile="/var/run/cherrypy/[project name].pid-1" threads=1 request_queue_size=0 verbose=0
* python manage.py runcpserver daemonize=1 port=3036 pidfile="/var/run/cherrypy/[project name].pid-2" threads=1 request_queue_size=0 verbose=0
* python manage.py runcpserver daemonize=1 port=3037 pidfile="/var/run/cherrypy/[project name].pid-3" threads=1 request_queue_size=0 verbose=0
* python manage.py runcpserver daemonize=1 port=3038 pidfile="/var/run/cherrypy/[project name].pid-4" threads=1 request_queue_size=0 verbose=0
* (This needs to be in a fabric script which systemd can access)
* systemd add (cherrypy start up)
# send to User's email:-
* server root user's password
* server web user's password
* django superadmin user and password
# Other things to think of - auto-creation of git repository and a way for user to git pull and start designing and writing code locally!
# Choose between a simple "shared gituser" git repo set-up or a gitolite oriented set-up
# Various advance options like choosing which CSS Framework or UI Framework to include immediately.
# PHASE 2: SCALING THE TEAM
# Instantiating a continuous integration build server
# Install bcfg2 and putting configuration files into bcfg2 on this master server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment