Update salt state for gvaweb

This commit improves the gvaweb celery worker setup based on the work
that has been done for gvaldap before. Old files have been removed and
the setup uses the macros from gnuviechadmin/gvaapp_macros.sls.
This commit is contained in:
Jan Dittberner 2020-03-04 00:49:58 +01:00
parent 7381b5bfd8
commit 2da305fb5f
8 changed files with 24 additions and 31 deletions

View file

@ -7,3 +7,7 @@ gnuviechadmin:
component: component:
name: gvaweb name: gvaweb
amqp_user: web amqp_user: web
gvaweb:
git_url: https://git.dittberner.info/gnuviech/gvaweb.git
git_branch: master
celery_module: webtasks

View file

@ -1,8 +1,4 @@
{% macro gvaapp_base(gvaappname, servicename) -%} {% macro gvaapp_base(gvaappname, servicename) -%}
include:
- python.pipenv
- python.virtualenv
{% set app_home = salt['grains.get']('gnuviechadmin:home', '/home/{}'.format(gvaappname)) %} {% set app_home = salt['grains.get']('gnuviechadmin:home', '/home/{}'.format(gvaappname)) %}
{% set app_user = salt['grains.get']('gnuviechadmin:user', gvaappname) %} {% set app_user = salt['grains.get']('gnuviechadmin:user', gvaappname) %}
{% set app_group = salt['grains.get']('gnuviechadmin:group', gvaappname) %} {% set app_group = salt['grains.get']('gnuviechadmin:group', gvaappname) %}

View file

@ -1,6 +1,10 @@
{% set gvaappname = salt['grains.get']('gnuviechadmin:appname') %} {% set gvaappname = salt['grains.get']('gnuviechadmin:appname') %}
{% set purpose = "for LDAP data management" %} {% set purpose = "for LDAP data management" %}
{% from 'gnuviechadmin/gvaapp_macros.sls' import create_celery_worker with context %} {% from 'gnuviechadmin/gvaapp_macros.sls' import create_celery_worker with context %}
include:
- python.pipenv
- python.virtualenv
{{ create_celery_worker(gvaappname, purpose) }} {{ create_celery_worker(gvaappname, purpose) }}
{{ gvaappname }}-dependencies: {{ gvaappname }}-dependencies:

View file

@ -1,14 +1,17 @@
{% set gvaappname = salt['grains.get']('gnuviechadmin:appname') %}
{% set purpose = "for website configuration management" %}
{% from 'gnuviechadmin/gvaapp_macros.sls' import create_celery_worker with context %}
include: include:
- gnuviechadmin.base - base
- gnuviechadmin.celery - python.pipenv
- python.virtualenv
sudo: {{ create_celery_worker(gvaappname, purpose) }}
pkg.installed
/etc/sudoers.d/gvaweb: /etc/sudoers.d/{{ gvaappname }}:
file.managed: file.managed:
- user: root - user: root
- group: root - group: root
- source: salt://gnuviechadmin/gvaweb/sudoers - source: salt://gnuviechadmin/{{ gvaappname }}/sudoers
- require: - require:
- pkg: sudo - pkg: sudo

View file

@ -0,0 +1,6 @@
GVAWEB_BROKER_URL="{{ broker_url }}"
GVAWEB_RESULTS_REDIS_URL="{{ 'redis://:{}@{}/0'.format(salt['pillar.get']('gnviechadmin:redis_password'), salt['pillar.get']('gnuviechadmin:redis_host')) }}"
GVAWEB_NGINX_SITES_AVAILABLE="{{ salt['pillar.get']('gnuviechadmin-gvaweb:nginx_sites_available', '/etc/nginx/sites-available') }}"
GVAWEB_NGINX_SITES_ENABLED="{{ salt['pillar.get']('gnuviechadmin-gvaweb:nginx_sites_enabled', '/etc/nginx/sites-enabled') }}"
GVAWEB_PHPFPM_POOL="{{ salt['pillar.get']('gnuviechadmin-gvaweb:phpfpm_pool', '/etc/php5/fpm/pool.d') }}"
GVAWEB_WWWUSER_MOUNT="{{ salt['pillar.get']('gnuviechadmin-gvaweb:wwwuser_mount', '/srv/wwwfiles') }}"

View file

@ -1,12 +0,0 @@
#!/bin/sh
set -ex
. {{ home }}/gvasettings.sh
unset LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY \
LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT \
LC_IDENTIFICATION LC_ALL
cd {{ appdir }}
{{ virtualenv }}/bin/celery worker -A gvaweb -Q web --loglevel=INFO

View file

@ -1,8 +0,0 @@
#!/bin/sh
export GVAWEB_BROKER_URL='{{ broker_url }}'
export GVAWEB_RESULTS_REDIS_URL="redis://:{{ salt['pillar.get']('gnuviechadmin:redis_password') }}@{{ salt['pillar.get']('gnuviechadmin:redis_host') }}/0"
export GVAWEB_NGINX_SITES_AVAILABLE="{{ salt['pillar.get']('gnuviechadmin:nginx_sites_available', '/etc/nginx/sites-available') }}"
export GVAWEB_NGINX_SITES_ENABLED="{{ salt['pillar.get']('gnuviechadmin:nginx_sites_enabled', '/etc/nginx/sites-enabled') }}"
export GVAWEB_PHPFPM_POOL="{{ salt['pillar.get']('gnuviechadmin:phpfpm_pool', '/etc/php5/fpm/pool.d') }}"
export GVAWEB_WWWUSER_MOUNT="{{ salt['pillar.get']('gnuviechadmin:wwwuser_mount', '/srv/wwwfiles') }}"

View file

@ -1,3 +1,3 @@
Cmnd_Alias GVAWEB_CMDS = /usr/bin/install, /bin/rm, /bin/ln, /usr/sbin/service Cmnd_Alias GVAWEB_CMDS = /usr/bin/install, /bin/rm, /bin/ln, /bin/systemctl
gvaweb ALL = (root) NOPASSWD: GVAWEB_CMDS gvaweb ALL = (root) NOPASSWD: GVAWEB_CMDS