If you just want to easily setup a linux environment ready to run Python wsgi compatible apps, this kit can help you.
If you're not from Brasil, maybe you'll have to change server/server_setup.sh
timezone, currently configured to America/Sao_Paulo
This kit is intended to work with Python WSGI Apps but currently we only use and test it against Django apps.
This is how we bootstrap our Django Projects
chmod +x boom
./boom project_name app_name /tmp
There are 3 phases:
- Environment Settings.
- Setup Remote Access.
- Configure a Python Wsgi Friendly machine.
- Install envkit in your project.
- Setup a machine to run some specific app.
Loogica Envkit will look for environment files over env/
. If it finds a file
named stage.cfg
it'll configure and environment called stage
that will work
as a regular fabric environment.
This is the template for a environment file:
[environment]
address=
admin_user=root
project_user=
[application]
name=
An Admin can do basically everything since it's a sudoer.
A Project User can only execute tasks related to a project like:
- Deploy and Restart.
- Read Logs.
- Database tasks per project.
Given a Root password, you already can setup what we call Admin and Project acctouns on your machine.
To create an remote admin account given a public key:
fab environment config_user:[pub_key_path]
If you'll use your own public key just:
fab environment config_user
fab environment remove_user:username
This task will ask for a IP Address and at the end, the username picked in the previous step will be able to connect with this machine using your public key. You'll also have to choose between install or not Postgresql
fab config server_bootstrap:loogica,loogica.net,[email protected]
./install_kit.sh SERVERNAME_OR_IP APP_NAME /full/path/to/app/root
After the previous phase, you should have env/deploy.cfg
in your project root. Change
it if needed but the default file works fine for initial setups.
cd /full/path/to/app/root
fab prod setup_app
dbname should be same as project name
fab prod postgres_db_create:dbuser,dbname,password
fab prod nginx_setup
Your project root must have a Makefile in order to make the deploy possible. Here's an example:
server_dbinitial:
python manage.py syncdb --noinput && python manage.py createsuperuser --user admin --email [email protected]
migrate_no_input:
python manage.py migrate --noinput $(APPS)
update_deps:
sudo pip install -r requirements.txt
If you're running, for instance, a Flask app, some targets may be empty.
fab prod first_deploy:HEAD
fab prod deploy:HEAD
Create a new app based on our app template.
make new_app app_name
Add this app to settings.py INSTALLED_APPS
and create
initial migration for it
make app_schemamigration app_name
Finally, update you Makefile
and modify it's first line adding your app
separeted by space like:
APPS=app1 app2
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/>