SlideShare a Scribd company logo
1 of 45
Download to read offline
From Zero to Hero
Job Ganzevoort
Douwe van der Meij
Goldmund, Wyldebeast & Wunderliebe
{ ganzevoort, vandermeij } @gw20e.com
Outline
● Introduction
● Initial Setup
● Deployment
● Maintenance
● Deployment continued
● Conclusion
Introduction
● People have great ideas
● Django is perfect for RAD
○ But...
● How to deploy to production?
● How to keep the system maintainable?
○ Or even…
● When is my application production ready?
Why this presentation?
Initial Setup
● Before you do anything related to code:
○ git init
● Make sure you track everything you do in a
VCS
Version Control System
● In the first stage of development, program
only the parts that are the core of your
application
● But how to do this in git?
Define Minimum Viable Product
● Have base/production code in master
branch
● git branch for every code change
● Merge all branches with acceptance
branch before going live (again)
Use branches (1/2)
Use branches (2/2)
master
acceptance
time
bi-weekly
release
change #123
branch
mergemerge
Deployment
● VPS
● Provision with e.g., Puppet
● Find or create scripts
● Put the scripts in version control!
Server(s)
node 'kiezel.gw20e.com' {
class { 'ssh':
server_options => {
'PasswordAuthentication' => 'no',
'PermitRootLogin' => 'no',
},
}
appie::app { "mysite":
envs => ["tst", "acc", "prd"],
secret => "secret",
accountinfo => $gw20e::user_accounts,
accounts => ['ganzevoort', 'vandermeij'],
}
}
● Create a user per environment-layer
combination
○ app-mysite-tst
○ app-mysite-acc
○ app-mysite-prd
● With their own home dir, postgresql DB,
nginx glue
● Check out (and fork) our puppet module:
○ puppet-appie @ GitHub
Separate users
● Use fabric to script deploying to your
servers:
○ fab deploy:layer=tst
● Put the scripts in version control!
● Check out (and fork) our template:
○ templateproject @ GitHub
○ It includes gunicorn and supervisor configurations
Use scripts to deploy
● Don’t just change Django’s settings.py
● Keep dev, tst, acc and prd specific
settings in separate files
● Put the settings in version control!
Different DTAP layers (1/6)
● Deploy to their respective environment
Different DTAP layers (2/6)
DEV
● Laboratory setup
● Switch to the branch you’re working on
● Work with dev settings
● Deploy to TST, ACC or PRD environment
Different DTAP layers (3/6)
TST
● Real deployment, but alpha
● Work with tst settings
Different DTAP layers (4/6)
ACC
● Real deployment, but beta
● Work with acc settings
Different DTAP layers (5/6)
PRD
● Real deployment!
● Work with prd settings
● Setup monitoring
○ Nagios
○ Sentry
○ ...
● Setup backup
○ Database
○ Uploaded media
Different DTAP layers (6/6)
● Move settings.py as is to:
settings/core.py
● Create: settings/base.py
○ Add: from settings.core import *
○ Add your own generic settings
● Create: settings/{dev,tst,acc,prd}.
py
○ Add: from settings.base import *
○ Add your own layer specific settings
Django settings (1/4)
Django settings (2/4)
settings.py core.py
base.py
LAYER.py
settings/
● Use Fabric to create:
settings/__init__.py
● This command:
○ fab pick_settings:layer=prd
● Results in:
○ from settings.prd import *
● Stackable settings scale
○ Imagine (white) labeling
Django settings (3/4)
Django settings (4/4)
__init__.pysettings/
dev.py tst.py acc.py prd.py
base.py
core.py
Django settings (5/4)
Database passwords in version control?
from .base import *
read_pgpass('app-mysite-prd')
Maintenance
● Scrum, RUP, etc.
○ Any iterative methodology will do
● Basicly:
○ Have periodic deadlines/releases
■ Bi-weekly
○ Deliver each iteration
■ To ACC, if OK, to PRD
○ Release early, release often (MVP)
Iterative development
● Create a ticket for every change (RFC)
● Estimate the ticket
● Have discussion in ticket thread
● Create a code branch per ticket
○ Let git help you
● Deploy to a separate TST environment
○ (with separate database)
(How to) use a ticket system
Branching revisited
master
acceptance
time
bi-weekly
release
change #123
branch
mergemerge
iteration
● On your test machine, let each ticket/branch
have its own environment (with database)
● Test implementations individually, care for
code merging later
● Multiple TST environments means multiple
deployments
○ So not only three (= TST, ACC, PRD)
Separate environments for TST (1/5)
● change_123/$ fab deploy
● Is shorthand for:
○ fab deploy:layer=tst,branch=change_123
Separate environments for TST (2/5)
● Isn’t setting up separate webserver(s),
database(s), etc. causing a lot of overhead?
Separate environments for TST (3/5)
● Computer says NO
○ If you do it the right way
Separate environments for TST (4/5)
● Keep your (webserver) configuration files in
version control
○ Use e.g., Django templates to construct environment
specific files
● Keep your database scripts in version
control
○ To copy a new DB from a production fixture
○ To install a new DB from scratch with fixtures
○ Or both!
Separate environments for TST (5/5)
Deployment continued
● Have separate deployment settings per
layer:
○ use_https
○ path_to_certificate
○ sitename
○ deploy_user_at_host
○ dir_to_deploy_to
○ ...
Deployment settings (1/4)
Deployment settings (2/4)
LAYER.pydeployment/
● Use the Django template engine to construct
configuration files on deployment:
{% if use_https %}
server {
listen 80;
server_name {{ sitename }};
rewrite ^(.*) https://$server_name$request_uri?;
}
...
Deployment settings (3/4)
● Symlink the generated configuration files
from the user homedir into the place they’re
needed
● E.g.
○ ln -s ~/current/etc/nginx.conf
/etc/nginx/sites-enabled/SITENAME.conf
○ service nginx reload
Deployment settings (4/4)
● Create a tag for each PRD release
● Switch to that tag on deploy to PRD
○ For easy rollback
■ Switch to previous tag to rollback
● Run migration scripts after switch
○ Watch out for backwards incompatible changes!
Use Git tagging
● When using Pip
○ pip freeze > frozen.txt
● Add to version control!
● pip install -r frozen.txt
Freeze dependencies
Conclusion
● Use a VCS
● Have separate DTAP layers
● Script and store
● Work with RFCs
● Make everything repeatable
○ By your colleague
Conclusion(s)
● github.com/
○ Goldmund-Wyldebeast-Wunderliebe/
■ templateproject
■ puppet-appie
References
Thank you!
Job Ganzevoort,
Douwe van der Meij
Goldmund, Wyldebeast & Wunderliebe
{ ganzevoort, vandermeij } @gw20e.com

More Related Content

What's hot

ClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander ZaitsevClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander ZaitsevAltinity Ltd
 
Migration to ClickHouse. Practical guide, by Alexander Zaitsev
Migration to ClickHouse. Practical guide, by Alexander ZaitsevMigration to ClickHouse. Practical guide, by Alexander Zaitsev
Migration to ClickHouse. Practical guide, by Alexander ZaitsevAltinity Ltd
 
ClickHouse Paris Meetup. Pragma Analytics Software Suite w/ClickHouse, by Mat...
ClickHouse Paris Meetup. Pragma Analytics Software Suite w/ClickHouse, by Mat...ClickHouse Paris Meetup. Pragma Analytics Software Suite w/ClickHouse, by Mat...
ClickHouse Paris Meetup. Pragma Analytics Software Suite w/ClickHouse, by Mat...Altinity Ltd
 
ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...
ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...
ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...Altinity Ltd
 
How to build analytics for 100bn logs a month with ClickHouse. By Vadim Tkach...
How to build analytics for 100bn logs a month with ClickHouse. By Vadim Tkach...How to build analytics for 100bn logs a month with ClickHouse. By Vadim Tkach...
How to build analytics for 100bn logs a month with ClickHouse. By Vadim Tkach...Valery Tkachenko
 
Analyzing MySQL Logs with ClickHouse, by Peter Zaitsev
Analyzing MySQL Logs with ClickHouse, by Peter ZaitsevAnalyzing MySQL Logs with ClickHouse, by Peter Zaitsev
Analyzing MySQL Logs with ClickHouse, by Peter ZaitsevAltinity Ltd
 
Journey and evolution of Presto@Grab
Journey and evolution of Presto@GrabJourney and evolution of Presto@Grab
Journey and evolution of Presto@GrabShubham Tagra
 
ClickHouse on Plug-n-Play Cloud, by Som Sikdar, Kodiak Data
ClickHouse on Plug-n-Play Cloud, by Som Sikdar, Kodiak DataClickHouse on Plug-n-Play Cloud, by Som Sikdar, Kodiak Data
ClickHouse on Plug-n-Play Cloud, by Som Sikdar, Kodiak DataAltinity Ltd
 
How to be Successful with Scylla
How to be Successful with ScyllaHow to be Successful with Scylla
How to be Successful with ScyllaScyllaDB
 
Clickhouse at Cloudflare. By Marek Vavrusa
Clickhouse at Cloudflare. By Marek VavrusaClickhouse at Cloudflare. By Marek Vavrusa
Clickhouse at Cloudflare. By Marek VavrusaValery Tkachenko
 
AWS Athena vs. Google BigQuery for interactive SQL Queries
AWS Athena vs. Google BigQuery for interactive SQL QueriesAWS Athena vs. Google BigQuery for interactive SQL Queries
AWS Athena vs. Google BigQuery for interactive SQL QueriesDoiT International
 
P99CONF — What We Need to Unlearn About Persistent Storage
P99CONF — What We Need to Unlearn About Persistent StorageP99CONF — What We Need to Unlearn About Persistent Storage
P99CONF — What We Need to Unlearn About Persistent StorageScyllaDB
 
BaseX user-group-talk XML Prague 2013
BaseX user-group-talk XML Prague 2013BaseX user-group-talk XML Prague 2013
BaseX user-group-talk XML Prague 2013Andy Bunce
 
Our Story With ClickHouse at seo.do
Our Story With ClickHouse at seo.doOur Story With ClickHouse at seo.do
Our Story With ClickHouse at seo.doMetehan Çetinkaya
 
Supercharge your Analytics with ClickHouse, v.2. By Vadim Tkachenko
Supercharge your Analytics with ClickHouse, v.2. By Vadim TkachenkoSupercharge your Analytics with ClickHouse, v.2. By Vadim Tkachenko
Supercharge your Analytics with ClickHouse, v.2. By Vadim TkachenkoAltinity Ltd
 
You might be paying too much for BigQuery
You might be paying too much for BigQueryYou might be paying too much for BigQuery
You might be paying too much for BigQueryRyuji Tamagawa
 
Mongo db admin_20110316
Mongo db admin_20110316Mongo db admin_20110316
Mongo db admin_20110316radiocats
 

What's hot (20)

ClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander ZaitsevClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
 
Migration to ClickHouse. Practical guide, by Alexander Zaitsev
Migration to ClickHouse. Practical guide, by Alexander ZaitsevMigration to ClickHouse. Practical guide, by Alexander Zaitsev
Migration to ClickHouse. Practical guide, by Alexander Zaitsev
 
Netflix Data Benchmark @ HPTS 2017
Netflix Data Benchmark @ HPTS 2017Netflix Data Benchmark @ HPTS 2017
Netflix Data Benchmark @ HPTS 2017
 
ClickHouse Paris Meetup. Pragma Analytics Software Suite w/ClickHouse, by Mat...
ClickHouse Paris Meetup. Pragma Analytics Software Suite w/ClickHouse, by Mat...ClickHouse Paris Meetup. Pragma Analytics Software Suite w/ClickHouse, by Mat...
ClickHouse Paris Meetup. Pragma Analytics Software Suite w/ClickHouse, by Mat...
 
Tick
TickTick
Tick
 
ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...
ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...
ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...
 
How to build analytics for 100bn logs a month with ClickHouse. By Vadim Tkach...
How to build analytics for 100bn logs a month with ClickHouse. By Vadim Tkach...How to build analytics for 100bn logs a month with ClickHouse. By Vadim Tkach...
How to build analytics for 100bn logs a month with ClickHouse. By Vadim Tkach...
 
Analyzing MySQL Logs with ClickHouse, by Peter Zaitsev
Analyzing MySQL Logs with ClickHouse, by Peter ZaitsevAnalyzing MySQL Logs with ClickHouse, by Peter Zaitsev
Analyzing MySQL Logs with ClickHouse, by Peter Zaitsev
 
Journey and evolution of Presto@Grab
Journey and evolution of Presto@GrabJourney and evolution of Presto@Grab
Journey and evolution of Presto@Grab
 
ClickHouse on Plug-n-Play Cloud, by Som Sikdar, Kodiak Data
ClickHouse on Plug-n-Play Cloud, by Som Sikdar, Kodiak DataClickHouse on Plug-n-Play Cloud, by Som Sikdar, Kodiak Data
ClickHouse on Plug-n-Play Cloud, by Som Sikdar, Kodiak Data
 
How to be Successful with Scylla
How to be Successful with ScyllaHow to be Successful with Scylla
How to be Successful with Scylla
 
Clickhouse at Cloudflare. By Marek Vavrusa
Clickhouse at Cloudflare. By Marek VavrusaClickhouse at Cloudflare. By Marek Vavrusa
Clickhouse at Cloudflare. By Marek Vavrusa
 
AWS Athena vs. Google BigQuery for interactive SQL Queries
AWS Athena vs. Google BigQuery for interactive SQL QueriesAWS Athena vs. Google BigQuery for interactive SQL Queries
AWS Athena vs. Google BigQuery for interactive SQL Queries
 
P99CONF — What We Need to Unlearn About Persistent Storage
P99CONF — What We Need to Unlearn About Persistent StorageP99CONF — What We Need to Unlearn About Persistent Storage
P99CONF — What We Need to Unlearn About Persistent Storage
 
BaseX user-group-talk XML Prague 2013
BaseX user-group-talk XML Prague 2013BaseX user-group-talk XML Prague 2013
BaseX user-group-talk XML Prague 2013
 
Our Story With ClickHouse at seo.do
Our Story With ClickHouse at seo.doOur Story With ClickHouse at seo.do
Our Story With ClickHouse at seo.do
 
Supercharge your Analytics with ClickHouse, v.2. By Vadim Tkachenko
Supercharge your Analytics with ClickHouse, v.2. By Vadim TkachenkoSupercharge your Analytics with ClickHouse, v.2. By Vadim Tkachenko
Supercharge your Analytics with ClickHouse, v.2. By Vadim Tkachenko
 
You might be paying too much for BigQuery
You might be paying too much for BigQueryYou might be paying too much for BigQuery
You might be paying too much for BigQuery
 
Indexes don't mean slow inserts.
Indexes don't mean slow inserts.Indexes don't mean slow inserts.
Indexes don't mean slow inserts.
 
Mongo db admin_20110316
Mongo db admin_20110316Mongo db admin_20110316
Mongo db admin_20110316
 

Viewers also liked

Edmodoparentfinal
EdmodoparentfinalEdmodoparentfinal
Edmodoparentfinaldrrevdean
 
Udlrevolution
UdlrevolutionUdlrevolution
Udlrevolutiondrrevdean
 
HHS: Using Tech To Reduce Paper Usage
HHS: Using Tech To Reduce Paper UsageHHS: Using Tech To Reduce Paper Usage
HHS: Using Tech To Reduce Paper Usagedrrevdean
 
Bryan Dean UDL-IRN Summit/March 2014
Bryan Dean UDL-IRN Summit/March 2014Bryan Dean UDL-IRN Summit/March 2014
Bryan Dean UDL-IRN Summit/March 2014drrevdean
 
How to enroll in bdo’s online banking
How to enroll in bdo’s online bankingHow to enroll in bdo’s online banking
How to enroll in bdo’s online bankingJeffBadanoy
 
Những đóng góp của ngành thương mại Việt Nam trong việc chống tụt hậu kinh tế...
Những đóng góp của ngành thương mại Việt Nam trong việc chống tụt hậu kinh tế...Những đóng góp của ngành thương mại Việt Nam trong việc chống tụt hậu kinh tế...
Những đóng góp của ngành thương mại Việt Nam trong việc chống tụt hậu kinh tế...Khánh Linh Trần
 
4t Virtual Con Guerrilla Flip
4t Virtual Con Guerrilla Flip4t Virtual Con Guerrilla Flip
4t Virtual Con Guerrilla Flipdrrevdean
 
1 modeling concepts
1 modeling concepts1 modeling concepts
1 modeling conceptsMinal Maniar
 
Building an open source python application the right way
Building an open source python application the right wayBuilding an open source python application the right way
Building an open source python application the right wayKiran Gangadharan
 
Intro To Spring Python
Intro To Spring PythonIntro To Spring Python
Intro To Spring Pythongturnquist
 
CLTL python course: Object Oriented Programming (1/3)
CLTL python course: Object Oriented Programming (1/3)CLTL python course: Object Oriented Programming (1/3)
CLTL python course: Object Oriented Programming (1/3)Rubén Izquierdo Beviá
 
AOP in Python API design
AOP in Python API designAOP in Python API design
AOP in Python API designmeij200
 
Rapid Web Development with Python for Absolute Beginners
Rapid Web Development with Python for Absolute BeginnersRapid Web Development with Python for Absolute Beginners
Rapid Web Development with Python for Absolute BeginnersFatih Karatana
 
Ingreso prefectura asignaturas
Ingreso prefectura asignaturasIngreso prefectura asignaturas
Ingreso prefectura asignaturasGisela Gerje
 
Python tutorial
Python tutorialPython tutorial
Python tutorialGuru99
 
Protecting Your APIs Against Attack & Hijack
Protecting Your APIs Against Attack & Hijack Protecting Your APIs Against Attack & Hijack
Protecting Your APIs Against Attack & Hijack CA API Management
 

Viewers also liked (20)

Sacrifice for success
Sacrifice for successSacrifice for success
Sacrifice for success
 
Sacrifice for success
Sacrifice for successSacrifice for success
Sacrifice for success
 
Edmodoparentfinal
EdmodoparentfinalEdmodoparentfinal
Edmodoparentfinal
 
Child find
Child findChild find
Child find
 
Udlrevolution
UdlrevolutionUdlrevolution
Udlrevolution
 
HHS: Using Tech To Reduce Paper Usage
HHS: Using Tech To Reduce Paper UsageHHS: Using Tech To Reduce Paper Usage
HHS: Using Tech To Reduce Paper Usage
 
Bryan Dean UDL-IRN Summit/March 2014
Bryan Dean UDL-IRN Summit/March 2014Bryan Dean UDL-IRN Summit/March 2014
Bryan Dean UDL-IRN Summit/March 2014
 
How to enroll in bdo’s online banking
How to enroll in bdo’s online bankingHow to enroll in bdo’s online banking
How to enroll in bdo’s online banking
 
Những đóng góp của ngành thương mại Việt Nam trong việc chống tụt hậu kinh tế...
Những đóng góp của ngành thương mại Việt Nam trong việc chống tụt hậu kinh tế...Những đóng góp của ngành thương mại Việt Nam trong việc chống tụt hậu kinh tế...
Những đóng góp của ngành thương mại Việt Nam trong việc chống tụt hậu kinh tế...
 
4t Virtual Con Guerrilla Flip
4t Virtual Con Guerrilla Flip4t Virtual Con Guerrilla Flip
4t Virtual Con Guerrilla Flip
 
1 modeling concepts
1 modeling concepts1 modeling concepts
1 modeling concepts
 
Building an open source python application the right way
Building an open source python application the right wayBuilding an open source python application the right way
Building an open source python application the right way
 
Intro To Spring Python
Intro To Spring PythonIntro To Spring Python
Intro To Spring Python
 
CLTL python course: Object Oriented Programming (1/3)
CLTL python course: Object Oriented Programming (1/3)CLTL python course: Object Oriented Programming (1/3)
CLTL python course: Object Oriented Programming (1/3)
 
Python
PythonPython
Python
 
AOP in Python API design
AOP in Python API designAOP in Python API design
AOP in Python API design
 
Rapid Web Development with Python for Absolute Beginners
Rapid Web Development with Python for Absolute BeginnersRapid Web Development with Python for Absolute Beginners
Rapid Web Development with Python for Absolute Beginners
 
Ingreso prefectura asignaturas
Ingreso prefectura asignaturasIngreso prefectura asignaturas
Ingreso prefectura asignaturas
 
Python tutorial
Python tutorialPython tutorial
Python tutorial
 
Protecting Your APIs Against Attack & Hijack
Protecting Your APIs Against Attack & Hijack Protecting Your APIs Against Attack & Hijack
Protecting Your APIs Against Attack & Hijack
 

Similar to From Zero to Hero @ PyGrunn 2014

A3Sec Advanced Deployment System
A3Sec Advanced Deployment SystemA3Sec Advanced Deployment System
A3Sec Advanced Deployment Systema3sec
 
Getting started with drupal 8 code
Getting started with drupal 8 codeGetting started with drupal 8 code
Getting started with drupal 8 codeForum One
 
Buildout: creating and deploying repeatable applications in python
Buildout: creating and deploying repeatable applications in pythonBuildout: creating and deploying repeatable applications in python
Buildout: creating and deploying repeatable applications in pythonCodeSyntax
 
GeoServer Developers Workshop
GeoServer Developers WorkshopGeoServer Developers Workshop
GeoServer Developers WorkshopJody Garnett
 
Wrangling 3rd Party Installers from Puppet
Wrangling 3rd Party Installers from PuppetWrangling 3rd Party Installers from Puppet
Wrangling 3rd Party Installers from PuppetPuppet
 
Ceph Day Beijing: CeTune: A Framework of Profile and Tune Ceph Performance
Ceph Day Beijing: CeTune: A Framework of Profile and Tune Ceph Performance Ceph Day Beijing: CeTune: A Framework of Profile and Tune Ceph Performance
Ceph Day Beijing: CeTune: A Framework of Profile and Tune Ceph Performance Ceph Community
 
PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)
PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)
PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)Aleksander Alekseev
 
High performance json- postgre sql vs. mongodb
High performance json- postgre sql vs. mongodbHigh performance json- postgre sql vs. mongodb
High performance json- postgre sql vs. mongodbWei Shan Ang
 
Upgrade to MySQL 5.6 without downtime
Upgrade to MySQL 5.6 without downtimeUpgrade to MySQL 5.6 without downtime
Upgrade to MySQL 5.6 without downtimeOlivier DASINI
 
My "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails ProjectsMy "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails ProjectsGR8Conf
 
Pivotal Greenplum Cloud Marketplaces - Greenplum Summit 2019
Pivotal Greenplum Cloud Marketplaces - Greenplum Summit 2019Pivotal Greenplum Cloud Marketplaces - Greenplum Summit 2019
Pivotal Greenplum Cloud Marketplaces - Greenplum Summit 2019VMware Tanzu
 
Linux Distribution Automated Testing
 Linux Distribution Automated Testing Linux Distribution Automated Testing
Linux Distribution Automated TestingAleksander Baranowski
 
Plc2 2015 your own ide
Plc2 2015 your own idePlc2 2015 your own ide
Plc2 2015 your own ideSigasi
 
Strategies for developing and deploying your embedded applications and images
Strategies for developing and deploying your embedded applications and imagesStrategies for developing and deploying your embedded applications and images
Strategies for developing and deploying your embedded applications and imagesMender.io
 
LISA15: systemd, the Next-Generation Linux System Manager
LISA15: systemd, the Next-Generation Linux System Manager LISA15: systemd, the Next-Generation Linux System Manager
LISA15: systemd, the Next-Generation Linux System Manager Alison Chaiken
 
OSMC 2009 | Windows monitoring - Going where no man has gone before... by Mic...
OSMC 2009 | Windows monitoring - Going where no man has gone before... by Mic...OSMC 2009 | Windows monitoring - Going where no man has gone before... by Mic...
OSMC 2009 | Windows monitoring - Going where no man has gone before... by Mic...NETWAYS
 
High-availability with Galera Cluster for MySQL
High-availability with Galera Cluster for MySQLHigh-availability with Galera Cluster for MySQL
High-availability with Galera Cluster for MySQLFromDual GmbH
 
Nagios Conference 2014 - Eric Mislivec - Getting Started With Nagios Core
Nagios Conference 2014 - Eric Mislivec - Getting Started With Nagios CoreNagios Conference 2014 - Eric Mislivec - Getting Started With Nagios Core
Nagios Conference 2014 - Eric Mislivec - Getting Started With Nagios CoreNagios
 

Similar to From Zero to Hero @ PyGrunn 2014 (20)

A3Sec Advanced Deployment System
A3Sec Advanced Deployment SystemA3Sec Advanced Deployment System
A3Sec Advanced Deployment System
 
Getting started with drupal 8 code
Getting started with drupal 8 codeGetting started with drupal 8 code
Getting started with drupal 8 code
 
Buildout: creating and deploying repeatable applications in python
Buildout: creating and deploying repeatable applications in pythonBuildout: creating and deploying repeatable applications in python
Buildout: creating and deploying repeatable applications in python
 
GeoServer Developers Workshop
GeoServer Developers WorkshopGeoServer Developers Workshop
GeoServer Developers Workshop
 
Wrangling 3rd Party Installers from Puppet
Wrangling 3rd Party Installers from PuppetWrangling 3rd Party Installers from Puppet
Wrangling 3rd Party Installers from Puppet
 
Ceph Day Beijing: CeTune: A Framework of Profile and Tune Ceph Performance
Ceph Day Beijing: CeTune: A Framework of Profile and Tune Ceph Performance Ceph Day Beijing: CeTune: A Framework of Profile and Tune Ceph Performance
Ceph Day Beijing: CeTune: A Framework of Profile and Tune Ceph Performance
 
PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)
PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)
PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)
 
High performance json- postgre sql vs. mongodb
High performance json- postgre sql vs. mongodbHigh performance json- postgre sql vs. mongodb
High performance json- postgre sql vs. mongodb
 
Upgrade to MySQL 5.6 without downtime
Upgrade to MySQL 5.6 without downtimeUpgrade to MySQL 5.6 without downtime
Upgrade to MySQL 5.6 without downtime
 
Installing and Upgrading AtoM
Installing and Upgrading AtoMInstalling and Upgrading AtoM
Installing and Upgrading AtoM
 
My "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails ProjectsMy "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails Projects
 
Pivotal Greenplum Cloud Marketplaces - Greenplum Summit 2019
Pivotal Greenplum Cloud Marketplaces - Greenplum Summit 2019Pivotal Greenplum Cloud Marketplaces - Greenplum Summit 2019
Pivotal Greenplum Cloud Marketplaces - Greenplum Summit 2019
 
Linux Distribution Automated Testing
 Linux Distribution Automated Testing Linux Distribution Automated Testing
Linux Distribution Automated Testing
 
Plc2 2015 your own ide
Plc2 2015 your own idePlc2 2015 your own ide
Plc2 2015 your own ide
 
Strategies for developing and deploying your embedded applications and images
Strategies for developing and deploying your embedded applications and imagesStrategies for developing and deploying your embedded applications and images
Strategies for developing and deploying your embedded applications and images
 
LISA15: systemd, the Next-Generation Linux System Manager
LISA15: systemd, the Next-Generation Linux System Manager LISA15: systemd, the Next-Generation Linux System Manager
LISA15: systemd, the Next-Generation Linux System Manager
 
Drupal Best Practices
Drupal Best PracticesDrupal Best Practices
Drupal Best Practices
 
OSMC 2009 | Windows monitoring - Going where no man has gone before... by Mic...
OSMC 2009 | Windows monitoring - Going where no man has gone before... by Mic...OSMC 2009 | Windows monitoring - Going where no man has gone before... by Mic...
OSMC 2009 | Windows monitoring - Going where no man has gone before... by Mic...
 
High-availability with Galera Cluster for MySQL
High-availability with Galera Cluster for MySQLHigh-availability with Galera Cluster for MySQL
High-availability with Galera Cluster for MySQL
 
Nagios Conference 2014 - Eric Mislivec - Getting Started With Nagios Core
Nagios Conference 2014 - Eric Mislivec - Getting Started With Nagios CoreNagios Conference 2014 - Eric Mislivec - Getting Started With Nagios Core
Nagios Conference 2014 - Eric Mislivec - Getting Started With Nagios Core
 

Recently uploaded

WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationJuha-Pekka Tolvanen
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benonimasabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 

Recently uploaded (20)

WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 

From Zero to Hero @ PyGrunn 2014

  • 1. From Zero to Hero Job Ganzevoort Douwe van der Meij Goldmund, Wyldebeast & Wunderliebe { ganzevoort, vandermeij } @gw20e.com
  • 2. Outline ● Introduction ● Initial Setup ● Deployment ● Maintenance ● Deployment continued ● Conclusion
  • 4. ● People have great ideas ● Django is perfect for RAD ○ But... ● How to deploy to production? ● How to keep the system maintainable? ○ Or even… ● When is my application production ready? Why this presentation?
  • 6. ● Before you do anything related to code: ○ git init ● Make sure you track everything you do in a VCS Version Control System
  • 7. ● In the first stage of development, program only the parts that are the core of your application ● But how to do this in git? Define Minimum Viable Product
  • 8. ● Have base/production code in master branch ● git branch for every code change ● Merge all branches with acceptance branch before going live (again) Use branches (1/2)
  • 11. ● VPS ● Provision with e.g., Puppet ● Find or create scripts ● Put the scripts in version control! Server(s)
  • 12. node 'kiezel.gw20e.com' { class { 'ssh': server_options => { 'PasswordAuthentication' => 'no', 'PermitRootLogin' => 'no', }, } appie::app { "mysite": envs => ["tst", "acc", "prd"], secret => "secret", accountinfo => $gw20e::user_accounts, accounts => ['ganzevoort', 'vandermeij'], } }
  • 13. ● Create a user per environment-layer combination ○ app-mysite-tst ○ app-mysite-acc ○ app-mysite-prd ● With their own home dir, postgresql DB, nginx glue ● Check out (and fork) our puppet module: ○ puppet-appie @ GitHub Separate users
  • 14. ● Use fabric to script deploying to your servers: ○ fab deploy:layer=tst ● Put the scripts in version control! ● Check out (and fork) our template: ○ templateproject @ GitHub ○ It includes gunicorn and supervisor configurations Use scripts to deploy
  • 15. ● Don’t just change Django’s settings.py ● Keep dev, tst, acc and prd specific settings in separate files ● Put the settings in version control! Different DTAP layers (1/6)
  • 16. ● Deploy to their respective environment Different DTAP layers (2/6)
  • 17. DEV ● Laboratory setup ● Switch to the branch you’re working on ● Work with dev settings ● Deploy to TST, ACC or PRD environment Different DTAP layers (3/6)
  • 18. TST ● Real deployment, but alpha ● Work with tst settings Different DTAP layers (4/6)
  • 19. ACC ● Real deployment, but beta ● Work with acc settings Different DTAP layers (5/6)
  • 20. PRD ● Real deployment! ● Work with prd settings ● Setup monitoring ○ Nagios ○ Sentry ○ ... ● Setup backup ○ Database ○ Uploaded media Different DTAP layers (6/6)
  • 21. ● Move settings.py as is to: settings/core.py ● Create: settings/base.py ○ Add: from settings.core import * ○ Add your own generic settings ● Create: settings/{dev,tst,acc,prd}. py ○ Add: from settings.base import * ○ Add your own layer specific settings Django settings (1/4)
  • 22. Django settings (2/4) settings.py core.py base.py LAYER.py settings/
  • 23. ● Use Fabric to create: settings/__init__.py ● This command: ○ fab pick_settings:layer=prd ● Results in: ○ from settings.prd import * ● Stackable settings scale ○ Imagine (white) labeling Django settings (3/4)
  • 24. Django settings (4/4) __init__.pysettings/ dev.py tst.py acc.py prd.py base.py core.py
  • 25. Django settings (5/4) Database passwords in version control? from .base import * read_pgpass('app-mysite-prd')
  • 27. ● Scrum, RUP, etc. ○ Any iterative methodology will do ● Basicly: ○ Have periodic deadlines/releases ■ Bi-weekly ○ Deliver each iteration ■ To ACC, if OK, to PRD ○ Release early, release often (MVP) Iterative development
  • 28. ● Create a ticket for every change (RFC) ● Estimate the ticket ● Have discussion in ticket thread ● Create a code branch per ticket ○ Let git help you ● Deploy to a separate TST environment ○ (with separate database) (How to) use a ticket system
  • 30. ● On your test machine, let each ticket/branch have its own environment (with database) ● Test implementations individually, care for code merging later ● Multiple TST environments means multiple deployments ○ So not only three (= TST, ACC, PRD) Separate environments for TST (1/5)
  • 31. ● change_123/$ fab deploy ● Is shorthand for: ○ fab deploy:layer=tst,branch=change_123 Separate environments for TST (2/5)
  • 32. ● Isn’t setting up separate webserver(s), database(s), etc. causing a lot of overhead? Separate environments for TST (3/5)
  • 33. ● Computer says NO ○ If you do it the right way Separate environments for TST (4/5)
  • 34. ● Keep your (webserver) configuration files in version control ○ Use e.g., Django templates to construct environment specific files ● Keep your database scripts in version control ○ To copy a new DB from a production fixture ○ To install a new DB from scratch with fixtures ○ Or both! Separate environments for TST (5/5)
  • 36. ● Have separate deployment settings per layer: ○ use_https ○ path_to_certificate ○ sitename ○ deploy_user_at_host ○ dir_to_deploy_to ○ ... Deployment settings (1/4)
  • 38. ● Use the Django template engine to construct configuration files on deployment: {% if use_https %} server { listen 80; server_name {{ sitename }}; rewrite ^(.*) https://$server_name$request_uri?; } ... Deployment settings (3/4)
  • 39. ● Symlink the generated configuration files from the user homedir into the place they’re needed ● E.g. ○ ln -s ~/current/etc/nginx.conf /etc/nginx/sites-enabled/SITENAME.conf ○ service nginx reload Deployment settings (4/4)
  • 40. ● Create a tag for each PRD release ● Switch to that tag on deploy to PRD ○ For easy rollback ■ Switch to previous tag to rollback ● Run migration scripts after switch ○ Watch out for backwards incompatible changes! Use Git tagging
  • 41. ● When using Pip ○ pip freeze > frozen.txt ● Add to version control! ● pip install -r frozen.txt Freeze dependencies
  • 43. ● Use a VCS ● Have separate DTAP layers ● Script and store ● Work with RFCs ● Make everything repeatable ○ By your colleague Conclusion(s)
  • 44. ● github.com/ ○ Goldmund-Wyldebeast-Wunderliebe/ ■ templateproject ■ puppet-appie References
  • 45. Thank you! Job Ganzevoort, Douwe van der Meij Goldmund, Wyldebeast & Wunderliebe { ganzevoort, vandermeij } @gw20e.com