Giter VIP home page Giter VIP logo

ansible-role-uwsgi's Introduction

uwsgi

License Build Status Build Status Updates Python 3 Ansible Role GitHub tag

Install uWSGI package.

Requirements

This role requires Ansible 2.4 or higher, and platform requirements are listed in the metadata file.

Testing

This role use Molecule to run tests.

Local and Travis tests run tests on Docker by default. See molecule documentation to use other backend.

Currently, tests are done on:

  • Debian Stretch
  • Ubuntu Xenial
  • Ubuntu Bionic

and use:

  • Ansible 2.4.x
  • Ansible 2.5.x
  • Ansible 2.6.x
  • Ansible 2.7.x

Running tests

Using Docker driver

$ tox

You can also configure molecule options and molecule command using environment variables:

  • MOLECULE_OPTIONS Default: "--debug"
  • MOLECULE_COMMAND Default: "test"
$ MOLECULE_OPTIONS='' MOLECULE_COMMAND=converge tox

Role Variables

Default role variables

You have to change: uid/gid to something like: www-data or nginx You can enable systemd config for uwsgi-emperor install

# Installation vars
uwsgi_install_mode: 'package'
uwsgi_install_emperor: False
uwsgi_packages: "{{ _uwsgi_packages }}"
uwsgi_emperor_packages: "{{ _uwsgi_emperor_packages }}"
uwsgi_service_name: 'uwsgi'
uwsgi_emperor_service_name: 'uwsgi-emperor'
uwsgi_is_systemd_managed: False

# Config vars
uwsgi_config_available_path: "{{ _uwsgi_config_available_path }}"
uwsgi_config_enabled_path: "{{ _uwsgi_config_enabled_path }}"
uwsgi_user: 'www-data'
uwsgi_group: 'root'
uwsgi_ensure_user_group_exists: True
uwsgi_config_log_path: "{{ _uwsgi_config_log_path }}"
uwsgi_config_run_path: "{{ _uwsgi_config_run_path }}"
uwsgi_apps_defaults: "{{ _uwsgi_apps_defaults }}"
uwsgi_emperor_vassals_config_path: "{{ _uwsgi_emperor_vassals_config_path }}"
uwsgi_emperor_vassals_path: '/etc/uwsgi-emperor/vassals'
uwsgi_emperor_user: 'nobody'
uwsgi_emperor_group: 'users'
uwsgi_emperor:
  - service_name: 'uwsgi-emperor'
    src: "{{ role_path }}/templates/emperor.ini.j2"
    dest: '/etc/uwsgi-emperor/emperor.ini'
    owner: 'root'
    group: 'root'
    mode: '0644'
    state: 'started'
    enabled: True
    config:
      uwsgi:
        autoload: True
        master: True
        workers: 2
        no-orphans: True
        log-date: True
        uid: "{{ uwsgi_emperor_user }}"
        gid: "{{ uwsgi_emperor_group }}"
        emperor: "{{ uwsgi_emperor_vassals_path }}"

# Handler management
uwsgi_restart_handler_enabled: True

# systemd management
init_d_disable:
  - name: "{{ uwsgi_emperor[0].service_name }}"
    enabled: False
uwsgi_systemd:
  - src: "{{ role_path }}/templates/systemd.service.j2"
    dest: "{{ _systemd_files_path }}/{{ uwsgi_emperor[0].service_name }}.service"
    owner: 'root'
    group: 'root'
    mode: '0644'
    config:
      Unit:
        Description: 'uWSGI Emperor'
        After: 'syslog.target'
      Service:
        ExecStart: '/usr/bin/uwsgi --ini /etc/uwsgi-emperor/emperor.ini'
        RuntimeDirectory: 'uwsgi'
        Restart: 'always'
        KillSignal: 'SIGQUIT'
        Type: 'notify'
        StandardError: 'syslog'
        NotifyAccess: 'all'
        User: 'root'
        Group: 'root'
      Install:
        WantedBy: 'multi-user.target'

Debian family variables

# Package management
_uwsgi_packages:
  - name: 'uwsgi'
  - name: 'uwsgi-plugin-python'
  - name: 'uwsgi-plugin-python3'

_uwsgi_emperor_packages:
  - name: 'uwsgi-emperor'
  - name: 'uwsgi-plugin-python3'

# Configuration management
_uwsgi_emperor_vassals_config_path: '/etc/uwsgi-emperor/vassals'
_uwsgi_config_available_path: '/etc/uwsgi/apps-available'
_uwsgi_config_enabled_path: '/etc/uwsgi/apps-enabled'
_uwsgi_config_log_path: '/var/log/uwsgi'
_uwsgi_apps_defaults:
  - name: 'default'
    src: "{{ role_path }}/templates/app.yaml.j2"
    dest_available: "{{ _uwsgi_config_available_path }}"
    dest_enabled: "{{ _uwsgi_config_enabled_path }}"
    owner: 'root'
    group: 'root'
    mode: '0644'
    enabled: True
    config:
      uwsgi:
        autoload: true
        master: true
        workers: 2
        no-orphans: true
        pidfile: "/run/uwsgi/%(deb-confnamespace)/%(deb-confname)/pid"
        socket: "/run/uwsgi/%(deb-confnamespace)/%(deb-confname)/socket"
        logto: "{{ _uwsgi_config_log_path }}/%n.log"
        chmod-socket: 660
        log-date: true
        uid: "{{ uwsgi_user }}"
        gid: "{{ uwsgi_group }}"

Dependencies

None

Example Playbook

- hosts: servers
  roles:
    - { role: Temelio.uwsgi }

License

MIT

Author Information

A Chaussier (for infOpen company) L Machetel (for Temelio company)

ansible-role-uwsgi's People

Contributors

achaussier avatar duologic avatar lmachetel avatar pyup-bot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.