Skip to content

Commit

Permalink
feat: (#2) Allow to expose PostgreSQL port to a private network
Browse files Browse the repository at this point in the history
  • Loading branch information
B&R committed Feb 4, 2023
1 parent 9479783 commit 2ce5abc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ PostgreSQL

A dependency to Passbolt and Gitea.

### Exposing to Kubernetes cluster for performing backups

PostgreSQL instance can be exposed via `5432/tcp` port to a private subnet to let other applications connect to it, or to perform backups.

```yaml
postgres_forward_port_to_ip: "127.0.0.1" # use 127.0.0.1 to "disable" port forwarding. Use your private subnet address to expose PostgreSQL into e.g. Kubernetes cluster
postgres_forward_port_to_port: "5432"
```

Exposing service using Kubernetes
---------------------------------

Expand Down
2 changes: 2 additions & 0 deletions defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ pg_admin_user: "anticapitalist"
pg_admin_password: "read-about-anarchist-syndicalism"
pg_ip: "172.131.2.210"
pg_port: "5432"
postgres_forward_port_to_ip: "127.0.0.1" # use 127.0.0.1 to "disable" port forwarding. Use your private subnet address to expose PostgreSQL into e.g. Kubernetes cluster
postgres_forward_port_to_port: "5432"

# ---------
# Passbolt
Expand Down
2 changes: 2 additions & 0 deletions tasks/postgres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
- type=bind,source=/var/lib/riotkit-core/var/lib/postgresql/data,destination=/var/lib/postgresql/data,relabel=shared
expose:
- "5432"
ports:
- "{{ postgres_forward_port_to_ip }}:{{ postgres_forward_port_to_port }}:5432/tcp"
generate_systemd:
path: /etc/systemd/system
restart_policy: always
Expand Down

0 comments on commit 2ce5abc

Please sign in to comment.