Template in makesite - sctructure of files and folders. It will be copied when makesite install project.
Contents
In template files (with extention .tmpl), you can use simple syntax.
listen {{ port }};
server_name {{ domain }};
access_log {{ deploy_dir }}/logs/nginx_access.log;
error_log {{ deploy_dir }}/logs/nginx_error.log;
Context for templates will be created from config files and command line options. In target files .tmpl will be removed.
Standart structure of makesite template:
template-name
deploy -- configuration files
...
file1.conf.tmpl -- file will be rendered with template engine
file2.conf -- file will be copied as is
service -- service install, remove, update files
static -- static files
...
[ makesite.ini ] -- custom template config (for default values)
[ .makesite ] -- separated list of required templates (them will be installed before)
Template celery3 has controled celery process with supervisor.
Installed Supervisor.
Define params for run celery (celery $celery_params)
Default: worker -A celery.celery -B -l info
Define path for make link on generated supervisor config
Default: /etc/supervisor/conf.d/%(project)s.%(safe_branch)s.celery
Copy link on generated supervisor.conf to supervisor directory. Update supervisor loaded programs.
Restart the supervisor celery program.
Remove link on celery supervisor conf. Restart supervisor.
Template has created virtualenv and watching requirements.txt for changes and updates.
Installed pip and virtualenv python packages
Define directory for create virtualenv
Default: %(deploy_dir)s/.virtualenv
Define path to requirements.txt file. In project source by default.
Default: %(deploy_dir)s/source/requirements.txt
Define command line options for run PIP
Default: -IM -download-cache=/tmp/.pip-cache
Create virtualenv in virtualenv_dir. Install requirements from pip_projectfile.
Update requirements from pip_projectfile if it changes.
db-mysql — Create project role and database in mysql if it not exists.
Installed mysql
MySQL user has rights for create DB
Default: root
Password for { mysqluser }
Default: root
Host of mysql DB
Default: localhost
Port of mysql DB
Default: 3306
Name of project database
Default: { project }_master
Owner name of project database
Default: { project }
Password for { db_user }
Default: { project }
Create role { dbuser } and database { dbname } if it not exists.
db-postgres — Create project role and database in postgres if it not exists.
PG user has rights for create DB
Default: postgres
Password for { pguser }
Default: postgres
Host of postgres DB
Default: localhost
Port of postgres DB
Default: 5432
Name of project database
Default: { project }_master
Owner name of project database
Default: { project }
Password for { dbuser }
Default: { project }
Create role { dbuser } and database { dbname } if it not exists.
base, src-dir, src-git, db-postgres, django, tornado, memcached, cron, nginx, supervisor, uwsgi, zeta, compass, html
Auto added to all makesite projects. Load project source and create base structure. base source
INSTALL, UPDATE
Change deploy folder owner and group to makesite option <site_user>:<site_group>, default is www-data
Make service files is executable.
Load code in project from path.
This template will be auto added in project if deploy source it is local path. src-dir source
UPDATE
Copy project source from source dir to deploy source dir
Copy static dir from deploy source static dir to deploy static dir
Load code in project from git source.
This template will be auto added in project if deploy source it is git path. src-git source
UPDATE
Update git project source dir.
Auto create user and db for project if it not exist. db-postgres source .. note
Require <pguser>, <pghost>, <pgpassword>, <pgport> variables in configs with admin rights
INSTALL
Create postgres user <dbuser> if not exists, default is <project> with password <dbpassword> default is <project>
Create postgres db <dbname> default <project>_master.
Deploy and update django projects. django source
Note
Now it working in last django version from trunk collectstatic Required manage.py in project root.
INCLUDED memcached, virtualenv, cron
INSTALL
Run manage.py syncdb
UPDATE
Run manage.py migrate Run manage.py collectstatic
Deploy and update tornado projects. Contains nginx and supervisor configs. tornado source
Note
Required app.py in project root with tornado application app.py must parse –port option
INCLUDED virtualenv, cron, memcached, supervisor, nginx
Install python-memcached and flush memcached cache on updates. memcached source
default options
memcached_host=localhost
memcached_port=11211
INSTALL, UPDATE
Install python-memcached if not exist and flush memcached cache
Create virtual env for project and update pip requirements.
INSTALL
Install virtualenv in it not exists. Create virtual env and update pip requirements
UPDATE
Update pip requirements if it needed
Add project cron tasks in crond. cron source
Note
Default <cron_projectfile> is crontab in project root. File in cron format. Commands from this file will be runned from <site_user> relative project root and with enabled project virtualenv
default options
cron_projectfile={{ project_sourcedir }}/crontab
cron_outputfile=/etc/cron.d/{{ project }}-{{ branch }}
INSTALL, UPDATE
Parse project crontab file and add it to cron.
REMOVE
Remove project cron tasks from cron.
nginx support
default options
nginx_target_confpath=/etc/nginx/sites-enabled/{{ project }}.{{ branch }}.conf
nginx_source_confpath=<deploy_dir>/deploy/nginx.conf
INSTALL
Install nginx if not exist Create link <nginx_confpath> to deploy nginx.conf ( its make other templates ex django or tornado ) Restart nginx
REMOVE
Remove link <nginx_confpath> Restart nginx
Supervisor_ support.
INSTALL
Install supervisor if not exists Create link to <supervisor_confpath> its make another templates ex: django, tornado Reread supervisor configs
UPDATE
Restart supervisor project task
REMOVE
Remove link <supervisor_confpath> Reread supervisor configs
uwsgi support. Contains nginx and supervisor configs. uwsgi source
Note
uwsgi template waiting file wsgi.py in project source root with defined wsgi application
zeta support. Packing project static files. zeta source
INSTALL, UPDATE
Packing js, css, scss files from deploy static dir.