Django makes it so easy to get started; ``manage.py runserver`` and away you go. But deploying an application so that the system can provide redundancy and scalability requires some heavier lifting: package installs, configuration settings, multiple servers, security, backups, etc.
Ansible is a python-based configuration management tool which helps automate and repeat deployments whether the hardware is local or in the cloud. We'll be covering how to leverage existing configurations, write your own and sharing best practices for deploying django applications.
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Deploying Django with Ansible
1. copyright
2014.
all
rights
reserved.
Deploying Django with Ansible
Andrew
Mirsky
2. copyright
2014.
all
rights
reserved.
For
development:
~/myproject > ./manage.py runserver
Validating models...
0 errors found
May 30, 2014 - 11:31:08
Django version 1.6.2, using settings 'settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
For
produc0on:
/var/www > sudo ./manage.py runserver 0.0.0.0:80 /dev/null 2>&1 &
/var/www >
running a django server
3. copyright
2014.
all
rights
reserved.
production setup
• One
or
more
applica=ons
(aka
virtual
servers)
• Mul=ple
applica=on
processes
&
monitoring
• Data
storage
&
retrieval
(aka
databases)
• Security
• Maintainable,
robust,
scalable
12. copyright
2014.
all
rights
reserved.
building playbooks
> pip install ansible-role-manager
> arm help
usage: /Users/andrew/env/arm/bin/arm [-h] {freeze,help,init,install,uninstall} ...
positional arguments: {freeze,help,init,install,uninstall}
freeze produces dependencies file for this playbook based on...
help an alias for calling `-h` on any subcommand
init initialize directory structure & files
install install playbook role
uninstall remove a role from the library of dependencies
> arm init -p mydjangoplaybook
ansible playbook created successfully
> arm install git+https://github.com/mirskytech-ansible/role-postgres.git