Jared Ondricek
flamableconcrete@gmail.com https://github.com/flamableconcrete
NOVA-Python 10/27/2016
Ansible
Supervisor
Fabric
- Started a new project
- Bash scripts
- Python scripts
- Need a database
- Python module
- Message Queue
- Other apt-get dependencies
- Wrote a Flask web app
- All of a sudden, spaghetti code
Linux/OS X
$ sudo pip install ansible
Windows
(contents of /etc/ansible/hosts) mail.example.com [webservers] foo.example.com bar.example.com [dbservers] one.example.com two.example.com three.example.com
$ ansible webservers -a "touch /home/user/foo.log" $ ansible mail.example.com -a "/sbin/reboot" -u username --become -K $ ansible dbservers -m copy -a "src=/etc/hosts dest=/tmp/hosts"
$ ansible-playbook playbook.yml
$ sudo apt-get install supervisor $ sudo yum install supervisor $ sudo pip install supervisor
Gotcha: if you pip install, it is on you to (auto)start the supervisord process
The config file can define the set of programs that must be run in
for a single project
Manage processes through:
Config file sections of note are "include" and "program". Let's take a look at the docs
Enable the [inet_http_server] if you want the web interface.
Processes that Supervisor controls must run in foreground - can't be daemonized.
Multiple programs can be put in process groups to manage simultaneously.
Great. Now you've told Supervisor to do something. Is it doing it?
Always good to check the logs if your process isn't starting, or frequently restarting.
Ansible can be used to install Supervisor, then add programs that are managed by it. It is also used in some Docker containers to run multiple processes instead of just one.
Python 2 library for automating and streamlining app deployment over ssh. A little overlap with Ansible, but still useful.
Space | Forward |
---|---|
Right, Down, Page Down | Next slide |
Left, Up, Page Up | Previous slide |
P | Open presenter console |
H | Toggle this help |