pgadmin with an external volume.

This commit is contained in:
Andrea Dell'Amico 2023-05-11 18:01:24 +02:00
parent e3b303ad2d
commit 431d0be42b
Signed by: andrea.dellamico
GPG Key ID: 147ABE6CEB9E20FF
3 changed files with 47 additions and 3 deletions

View File

@ -23,10 +23,10 @@ open_asfa_db_volume: 'asfa_pg_data'
open_asfa_db_allowed_hosts:
- '127.0.0.1/8'
open_asfa_db_constraints: '[node.labels.asfa_pg_data==asfa_server]'
open_asfa_pgadmin_image: 'dpage/pgadmin4'
open_asfa_pgadmin_data_vol: 'asfa_test_pgadmin_data'
open_asfa_pgadmin_image: 'dpage/pgadmin4:6'
open_asfa_pgadmin_data_vol: 'open_asfa_test_pgadmin_data'
open_asfa_pgadmin_docker_host: '{{ open_asfa_db_docker_host }}'
open_asfa_pgadmin_constraints: '[node.labels.asfa_pgadmin_data==asfa_server]'
open_asfa_pgadmin_constraints: '[node.role == worker]'
open_asfa_pgadmin_email: 'noreply@example.com'
#open_asfa_pgadmin_default_pwd: 'Use a vault'
open_asfa_pgadmin_inactivity_timeout: '1200'

View File

@ -75,6 +75,31 @@
group: root
mode: 0400
- name: Install the pgadmin configuration files
ansible.builtin.template:
src: '{{ open_asfa_pgadmin_config_item }}.j2'
dest: '{{ open_asfa_compose_dir }}/{{ open_asfa_pgadmin_config_item }}'
owner: root
group: root
mode: 0444
loop:
- pgadmin_config_local.py
- pgadmin_servers.json
loop_control:
loop_var: open_asfa_pgadmin_config_item
- name: Create the secret for the pgadmin config local
community.docker.docker_secret:
name: open_asfa_pgadmin_config
data_src: '{{ open_asfa_compose_dir }}/pgadmin_config_local.py'
state: present
- name: Create the secret for the pgadmin config servers
community.docker.docker_secret:
name: open_asfa_pgadmin_servers
data_src: '{{ open_asfa_compose_dir }}/pgadmin_servers.json'
state: present
- name: Start the OpenAsfa stack
community.docker.docker_stack:
name: open-asfa

View File

@ -12,6 +12,18 @@ volumes:
{{ open_asfa_db_volume }}:
{% endif %}
{{ open_asfa_pgadmin_data_vol }}:
driver: local
driver_opts:
type: nfs4
# o: "nfsvers=4,addr=146.48.123.250,rw,nolock,soft"
o: "nfsvers=4,addr=146.48.123.250,rw"
device: ":/nfs/open_asfa_pgadmin_data"
secrets:
pgadmin_config:
external: true
pgadmin_servers:
external: true
services:
{% if open_asfa_db_as_container %}
@ -58,6 +70,13 @@ services:
PGADMIN_LISTEN_ADDRESS: 0.0.0.0
PGADMIN_LISTEN_PORT: 5050
GUNICORN_THREADS: 20
secrets:
- source: open_asfa_pgadmin_config
target: /pgadmin4/config_local.py
mode: 0444
- source: open_asfa_pgadmin_servers
target: /pgadmin4/servers.json
mode: 0444
deploy:
placement:
constraints: {{ open_asfa_pgadmin_constraints }}