Skip to content

singleplatform-eng/ansible-role-gunicorn-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

Gunicorn

This role is designed to provide all the needed directories, config files, service units, and service handlers for managing gunicorn services using systemd on Ubuntu. It does not manage the installation of a gunicorn binary, users, groups, or wsgi applications.

Requirements

Ubuntu 18.04+

Role Variables

Defaults

gunicorn_config_dir: /etc/gunicorn
gunicorn_log_dir: /var/log/gunicorn
gunicorn_systemd_service_dir: /etc/systemd/system
gunicorn_access_logfile: "{{gunicorn_log_dir}}/access.log"
gunicorn_python_path: /usr

gunicorn_tmp_dir: /run/lock
gunicorn_read_timeout: 60
gunicorn_user: gunicorn

gunicorn_bind_port: '127.0.0.1:8000'

gunicorn_start_command: "{{gunicorn_python_path}}/bin/gunicorn"
gunicorn_install_service: true
gunicorn_enable_service: false

gunicorn_environment: {}

Required Vars

gunicorn_app_dir
gunicorn_wsgi_module_name
gunicorn_state - when gunicorn_enable_service=True

Note that environment variables that need to be enclosed by quotes should have them explicitly defined.

In addition, since systemd units are only capable of reading a single EnvironmentFile, if global Environment Variables are for both celery and non-celery service units - you may optionally define a variable "service_global_env" dictionary of those Environment Variables that will be additionally appended to the Celery Systemd Service Unit.

Dependencies

None

Example Playbook

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:

- hosts: localhost
  vars:
 gunicorn_app_dir: /srv/django
 gunicorn_wsgi_module_name: django_app.wsgi:application
 gunicorn_user: django
 gunicorn_environment: { DJANGO_SETTINGS_MODULE: django.settings, HOME: "{{gunicorn_app_dir}}", PATH: django_virtualenv/bin }
  roles:
     - { role: ansible-role-gunicorn }

Author Information

SinglePlatform Engineering

License

BSD 3-Clause

About

systemd service unit management role for gunicorn.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published