Setup gvapgsql using new mechanisms

This commit is contained in:
Jan Dittberner 2020-03-04 17:47:24 +01:00
parent ed4e371ccb
commit 3b48b4a455
5 changed files with 33 additions and 35 deletions

View file

@ -4,8 +4,12 @@ include:
- gnuviechadmin.queues.gvapgsql - gnuviechadmin.queues.gvapgsql
gnuviechadmin: gnuviechadmin:
component: appname: gvapgsql
name: gvapgsql gvapgsql:
amqp_user: pgsql amqp_user: pgsql
pgsql_admin_user: gvapgsql fullname: PostgreSQL Server
pgsql_admin_password: AAv6d1t9p/vtX/kVorim2MJROQfQPWJoZP3mzyMW pgsql_admin_user: gvapgsql
pgsql_admin_password: AAv6d1t9p/vtX/kVorim2MJROQfQPWJoZP3mzyMW
git_url: https://git.dittberner.info/gnuviech/gvapgsql.git
git_branch: master
celery_module: pgsqltasks

View file

@ -1,18 +1,26 @@
{% set gvaappname = salt['pillar.get']('gnuviechadmin:appname') %}
{% set purpose = "for PostgreSQL configuration management" %}
{% from 'gnuviechadmin/gvaapp_macros.sls' import create_celery_worker with context %}
include: include:
- gnuviechadmin.base - python.pipenv
- gnuviechadmin.celery - python.virtualenv
- postgresql-server
gvapgsql-pgsql-user: {{ create_celery_worker(gvaappname, purpose) }}
postgres_user.present:
- name: {{ salt['pillar.get']('gnuviechadmin:pgsql_admin_user', 'gvapgsql') }}
- password: {{ salt['pillar.get']('gnuviechadmin:pgsql_admin_password') }}
- user: postgres
- superuser: True
- login: True
gvapgsql-packages: {{ gvaappname }}-dependencies:
pkg.installed: pkg.installed:
- pkgs: - pkgs:
- libpq-dev - libpq-dev
- require_in: - require_in:
- pkg: gnuviechadmin-packages - cmd: {{ gvaappname }}-requirements
gvapgsql-pgsql-user:
postgres_user.present:
- name: {{ salt['pillar.get']('gnuviechadmin:{}:pgsql_admin_user'.format(gvaappname), 'gvapgsql') }}
- password: {{ salt['pillar.get']('gnuviechadmin:{}:pgsql_admin_password'.format(gvaappname)) }}
- user: postgres
- superuser: True
- login: True
- require:
- pkg: postgresql

View file

@ -0,0 +1,6 @@
GVAPGSQL_BROKER_URL='{{ broker_url }}'
GVAPGSQL_RESULTS_REDIS_URL="{{ result_url }}"
GVAPGSQL_DBADMIN_HOST="{{ salt['pillar.get']('gnuviechadmin:gvapgsql:pgsql_admin_host', 'localhost') }}"
GVAPGSQL_DBADMIN_PORT="{{ salt['pillar.get']('gnuviechadmin:gvapgsql:pgsql_admin_port', 5432) }}"
GVAPGSQL_DBADMIN_USER="{{ salt['pillar.get']('gnuviechadmin:gvapgsql:pgsql_admin_user', 'gvapgsql') }}"
GVAPGSQL_DBADMIN_PASSWORD="{{ salt['pillar.get']('gnuviechadmin:gvapgsql:pgsql_admin_password') }}"

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 gvapgsql -Q pgsql --loglevel=INFO

View file

@ -1,8 +0,0 @@
#!/bin/sh
export GVAPGSQL_BROKER_URL='{{ broker_url }}'
export GVAPGSQL_RESULTS_REDIS_URL="redis://:{{ salt['pillar.get']('gnuviechadmin:redis_password') }}@{{ salt['pillar.get']('gnuviechadmin:redis_host') }}/0"
export GVAPGSQL_DBADMIN_HOST="{{ salt['pillar.get']('gnuviechadmin:pgsql_admin_host', 'localhost') }}"
export GVAPGSQL_DBADMIN_PORT="{{ salt['pillar.get']('gnuviechadmin:pgsql_admin_port', 5432) }}"
export GVAPGSQL_DBADMIN_USER="{{ salt['pillar.get']('gnuviechadmin:pgsql_admin_user', 'gvapgsql') }}"
export GVAPGSQL_DBADMIN_PASSWORD="{{ salt['pillar.get']('gnuviechadmin:pgsql_admin_password') }}"