|
3 weeks ago | |
---|---|---|
.. | ||
hooks | 1 month ago | |
lib | 1 month ago | |
README.org | 1 month ago | |
metadata.yml | 1 month ago |
README.org
Description
postgres-stub
allows you to declare an external postgres
so that
your local services can connect to it. It assumes you have the host,
port of the external postgres access, and a login, password, and a
database (already created) to connect to.
For now, this stub can't manage an admin access to create database, and more. This would be an easy addition thou.
This can be useful for instance if you have an external provider giving you access to their postgres (use SSL then!), or in your private cloud, or on the same host but not managed by docker, either directly on the host or by other virtual services (LXC, VMWare…).
Usage
You can declare a stub service by specifying at least the host of your
external postgres
database.
my-postgres-stub: charm: postgres-stub options: host: my-host.mydomain.fr:20432
If you don't specify a port, then it'll be defaulted to 5432
Any service that want to connect to this database could then:
myservice: # ... relations: postgres-database: postgres-stub: my-postgres-stub: dbname: my-db-name user: my-username password: my-p4s5w0rd
database name and user automatic assignation
It can be useful, if you have several services in the same compose.yml
to assign database names and user automatically to avoid repeating them.
my-postgres-stub: charm: postgres-stub options: host: my-host.mydomain.fr:20432 service-dbname-map: service1: u_foo ## Leveraging regex replacement for all other services .*: xyz_$0 service-user-map: .*: u_$0