Merge ~ubuntu-docker-images/ubuntu-docker-images/+git/postgresql:readme into ~ubuntu-docker-images/ubuntu-docker-images/+git/postgresql:edge
- Git
- lp:~ubuntu-docker-images/ubuntu-docker-images/+git/postgresql
- readme
- Merge into edge
Proposed by
Lucas Kanashiro
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 10a67da71b5fa2b715fea1d78614ea93d3aba91e | ||||
Proposed branch: | ~ubuntu-docker-images/ubuntu-docker-images/+git/postgresql:readme | ||||
Merge into: | ~ubuntu-docker-images/ubuntu-docker-images/+git/postgresql:edge | ||||
Diff against target: |
1130 lines (+1081/-9) 6 files modified
HACKING.md (+14/-0) README.md (+193/-9) examples/README.md (+44/-0) examples/config/postgresql.conf (+750/-0) examples/docker-compose.yml (+12/-0) examples/postgres-deployment.yml (+68/-0) |
||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Lucas Kanashiro | Approve | ||
Sergio Durigan Junior | Needs Fixing | ||
Richard Harding | Pending | ||
Review via email: mp+393823@code.launchpad.net |
Commit message
Description of the change
Improve README.
To post a comment you must log in.
Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote : | # |
Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote : | # |
I hope it is now better aligned with what was defined. Up for review.
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote : | # |
I'm going to review this one.
Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote : | # |
I added the content of the README.md file to our DockerHub page to see how it looks like:
https:/
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote : | # |
Thanks for the MP, Lucas. Overall it's really good, I've left comments in places where I think adjustments are needed. After you fix them, feel free to approve and push it.
review:
Needs Fixing
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote : | # |
Sorry, forgot to say something else: Rick mentioned that we should optimize for vertical space, so I think you can un-break the commands (i.e., remove the backslashes) and leave everything in one line.
Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote : | # |
Thanks Sergio. All the comments addressed. I am going to merge it and update the DockerHub page.
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/HACKING.md b/HACKING.md |
2 | new file mode 100644 |
3 | index 0000000..528be1f |
4 | --- /dev/null |
5 | +++ b/HACKING.md |
6 | @@ -0,0 +1,14 @@ |
7 | +# Contributing |
8 | + |
9 | +In order to contribute to the Postgres OCI image do the following: |
10 | + |
11 | +* Create a new branch. |
12 | +* Make your changes. Keep your commits logically separated. If it is fixing a bug do not forget to mention it in the commit message. |
13 | +* Build a new image with your changes. You can use the following command: |
14 | + |
15 | +``` |
16 | +$ docker build -t squeakywheel/postgres:test -f Dockerfile . |
17 | +``` |
18 | + |
19 | +* Test the new image. Run it in some way that exercises your changes, you can also check th README.md file. |
20 | +* If everything goes well submit a merge proposal. |
21 | diff --git a/README.md b/README.md |
22 | index 9135bcb..7e5762b 100644 |
23 | --- a/README.md |
24 | +++ b/README.md |
25 | @@ -1,14 +1,198 @@ |
26 | -## Ubuntu postgresql 12 OCI image |
27 | +# Postgres | Ubuntu |
28 | |
29 | -This is a fork of upstream's postgresql image building at https://github.com/docker-library/postgres |
30 | +## About Postgres |
31 | |
32 | -These are the main changes: |
33 | -- using Ubuntu Focal 20.04 LTS as the layer |
34 | -- installing postgresql 12 from Ubuntu Focal 12.04 LTS |
35 | -- amd64 only at the moment |
36 | +PostgreSQL is a powerful, open source object-relational database system. It is |
37 | +fully ACID compliant, has full support for foreign keys, joins, views, |
38 | +triggers, and stored procedures (in multiple languages). It includes most |
39 | +SQL:2008 data types, including INTEGER, NUMERIC, BOOLEAN, CHAR, VARCHAR, DATE, |
40 | +INTERVAL, and TIMESTAMP. It also supports storage of binary large objects, |
41 | +including pictures, sounds, or video. It has native programming interfaces for |
42 | +C/C++, Java, .Net, Perl, Python, Ruby, Tcl, ODBC, among others, and exceptional |
43 | +documentation. |
44 | |
45 | -The entrypoint and environment variables were not changed. |
46 | +## Tags |
47 | |
48 | -Bugs? Comments? Get in touch with the Ubuntu Server team at |
49 | -https://discourse.ubuntu.com/c/server/ |
50 | +- `12.4-focal`, `12.4`, `12-focal`, `12`, `beta` - **/!\ this is a beta release** |
51 | |
52 | +### Architectures supported |
53 | + |
54 | +- `amd64`, `arm64`, `s390x` |
55 | + |
56 | +## Usage |
57 | + |
58 | +### Docker CLI |
59 | + |
60 | +```sh |
61 | +$ docker network create postgres-net |
62 | +# Run the server |
63 | +$ docker run --name postgres-instance --network postgres-net --env POSTGRES_PASSWORD=My$seCret --detach squeakywheel/postgres:edge |
64 | +# Run the client |
65 | +$ docker run --interactive --tty --rm --network postgres-net squeakywheel/postgres:edge psql -h postgres-instance -U postgres |
66 | +``` |
67 | + |
68 | +The password will be asked and you can enter `My$seCret`. Now, you are logged in and can enjoy your new instance. |
69 | + |
70 | +Since containers are ephemeral you might be interested in persist data and not initialize a new database every time you launch a new container. To do that you can use docker volumes: |
71 | + |
72 | +```sh |
73 | +$ docker run --name postgres --volume /path/to/persisted/data:/var/lib/postgresql/data squeakywheel/postgres:edge |
74 | +``` |
75 | + |
76 | +#### Parameters |
77 | + |
78 | +| Parameter | Description | |
79 | +|---|---| |
80 | +| `-e TZ=UTC` | Timezone | |
81 | +| `-e POSTGRES_PASSWORD=secret` | Set the password for the superuser which is `postgres` by default. Bear in mind that to connect to the database in the same host the password is not needed but to access it via an external host (for instance another container) the password is needed. This option is **mandatory** and **must not be empty**. | |
82 | +| `-e POSTGRES_USER=john` | Create a new user with superuser privileges. This is used in conjunction with `POSTGRES_PASSWORD` | |
83 | +| `-e POSTGRES_DB=db_test` | Set the name of the default database. | |
84 | +| `-e POSTGRES_INITDB_ARGS="--data-checksums"` | Pass arguments to the `postgres initdb` call. | |
85 | +| `-e POSTGRES_INITDB_WALDIR=/path/to/location` | Set the location of the Postgres transaction log. By default it is stored in a subdirectory of the main Postgres data folder (`PGDATA`). | |
86 | +| `-e POSTGRES_HOST_AUTH_METHOD=trust` | Set the `auth-method` for `host` connections for `all` databases, `all` users, and `all` addresses. The following will be added to the `pg_hba.conf` if this option is passed: `host all all all $POSTGRES_HOST_AUTH_METHOD`. | |
87 | +| `-e PGDATA=/path/to/location` | set the location of the database files. The default is `/var/lib/postgresql/data`. | |
88 | + |
89 | +#### Initialization Scripts |
90 | + |
91 | +One can also add initialization scripts to their containers. This includes `*.sql`, `.sql.gz`, and `*.sh` scripts, and you just need to put them inside the `/docker-entrypoint-initdb.d` directory inside the container. After Postgres initialization is done and the default database and user are created, the scripts are executed in the following order: |
92 | + |
93 | +* Run any `*.sql` files in alphabetically order. It will be executed with `POSTGRES_USER`. |
94 | +* Run any executable `*.sh` scripts in alphabetically order. |
95 | +* Source any non-executable `*.sh` scripts in alphabetically order. |
96 | + |
97 | +All of this is done before the Postgres service is started. Keep in mind if your `PGDATA` directory is not empty (contains pre-existing database) they will be left untouched. |
98 | + |
99 | +#### Database Configuration |
100 | + |
101 | +You can pass your own configuration file to the container doing the following: |
102 | + |
103 | +```sh |
104 | +$ docker run --name postgres --volume /path/to/postgres/config/file/postgresql.conf:/etc/postgresql/postgresql.conf --env POSTGRES_PASSWORD=P@sSwd squeakywheel/postgres:edge |
105 | +``` |
106 | + |
107 | +#### Debugging |
108 | + |
109 | +In case you need to debug what it is happening with the container you can run `docker logs <name_of_the_container>`. But if you want to get access to an interactive shell run: |
110 | + |
111 | +```sh |
112 | +$ docker exec -it <name_of_the_container> /bin/bash |
113 | +``` |
114 | + |
115 | +To see how to use the Postgres OCI image with `docker-compose` and `kubernetes` check the `examples/README.md` file. |
116 | + |
117 | +## Deploy with Kubernetes |
118 | + |
119 | +You can use your favorite Kubernetes distribution; if you don't have one, consider [installing MicroK8s](https://microk8s.io/). |
120 | + |
121 | +With microk8s running, enable the `dns` and `storage` add-ons: |
122 | +```sh |
123 | +$ microk8s enable dns storage |
124 | + ``` |
125 | + |
126 | +Create a configmap for the configuration files (download a self-documented `postgresql.conf` file [here](https://github.com/postgres/postgres/raw/REL_12_STABLE/src/backend/utils/misc/postgresql.conf.sample)): |
127 | + |
128 | +```sh |
129 | +$ microk8s kubectl create configmap postgres-config --from-file=main-config=config/postgresql.conf |
130 | +``` |
131 | + |
132 | +Use the sample deployment yaml provided [here](https://git.launchpad.net/~canonical-server/ubuntu-server-oci/+git/postgresql/plain/examples/postgres-deployment.yml). |
133 | + |
134 | +<details> |
135 | + <summary>Apply the `postgres-deployment.yml` (click to expand)</summary> |
136 | + |
137 | +```yaml |
138 | +# postgres-deployment.yml |
139 | +--- |
140 | +apiVersion: v1 |
141 | +kind: PersistentVolumeClaim |
142 | +metadata: |
143 | + name: postgres-volume-claim |
144 | +spec: |
145 | + accessModes: |
146 | + - ReadWriteOnce |
147 | + storageClassName: microk8s-hostpath |
148 | + resources: |
149 | + requests: |
150 | + storage: 500M |
151 | +--- |
152 | +apiVersion: apps/v1 |
153 | +kind: Deployment |
154 | +metadata: |
155 | + name: postgres-deployment |
156 | +spec: |
157 | + replicas: 1 |
158 | + selector: |
159 | + matchLabels: |
160 | + app: postgres |
161 | + template: |
162 | + metadata: |
163 | + labels: |
164 | + app: postgres |
165 | + spec: |
166 | + containers: |
167 | + - name: postgres |
168 | + image: squeakywheel/postgres:edge |
169 | + env: |
170 | + - name: POSTGRES_PASSWORD |
171 | + value: "myS&cret" |
172 | + volumeMounts: |
173 | + - name: postgres-config-volume |
174 | + mountPath: /etc/postgresql/postgresql.conf |
175 | + subPath: postgresql.conf |
176 | + - name: postgres-data |
177 | + mountPath: /var/lib/postgresql/data |
178 | + ports: |
179 | + - containerPort: 5432 |
180 | + name: postgres |
181 | + protocol: TCP |
182 | + volumes: |
183 | + - name: postgres-config-volume |
184 | + configMap: |
185 | + name: postgres-config |
186 | + items: |
187 | + - key: main-config |
188 | + path: postgresql.conf |
189 | + - name: postgres-data |
190 | + persistentVolumeClaim: |
191 | + claimName: postgres-volume-claim |
192 | +--- |
193 | +apiVersion: v1 |
194 | +kind: Service |
195 | +metadata: |
196 | + name: postgres-service |
197 | +spec: |
198 | + type: NodePort |
199 | + selector: |
200 | + app: postgres |
201 | + ports: |
202 | + - protocol: TCP |
203 | + port: 5432 |
204 | + targetPort: 5432 |
205 | + nodePort: 30432 |
206 | + name: postgres |
207 | +``` |
208 | + |
209 | +</details> |
210 | + |
211 | +```sh |
212 | +$ microk8s kubectl apply -f postgres-deployment.yml |
213 | +``` |
214 | + |
215 | +You will now be able to connect to the Postgres server on `localhost:30432`. |
216 | + |
217 | +## Bugs and Features request |
218 | + |
219 | +If you find a bug in our image or want to request a specific feature file a bug here: |
220 | + |
221 | +https://bugs.launchpad.net/ubuntu-server-oci/+filebug |
222 | + |
223 | +In the title of the bug add `postgres: <reason>`. |
224 | + |
225 | +Make sure to include: |
226 | + |
227 | +* The digest of the image you are using, you can find it using this command replacing `<tag>` with the one you used to run the image: |
228 | +```sh |
229 | +$ docker images --no-trunc --quiet squeakywheel/postgres:<tag> |
230 | +``` |
231 | +* Reproduction steps for the deployment |
232 | +* If it is a feature request, please provide as much detail as possible |
233 | diff --git a/examples/README.md b/examples/README.md |
234 | new file mode 100644 |
235 | index 0000000..6f5d679 |
236 | --- /dev/null |
237 | +++ b/examples/README.md |
238 | @@ -0,0 +1,44 @@ |
239 | +# Running the examples |
240 | + |
241 | +## docker-compose |
242 | + |
243 | +Install `docker-compose` from the Ubuntu archive: |
244 | + |
245 | +``` |
246 | +$ sudo apt install -y docker-compose |
247 | +``` |
248 | + |
249 | +Call `docker-compose` from the examples directory: |
250 | + |
251 | +``` |
252 | +$ docker-compose up -d |
253 | +``` |
254 | + |
255 | +Postgres will be running and available via port `5432` on your host. The password of the `postgres` user will be `myS&cret`. To stop it run: |
256 | + |
257 | +``` |
258 | +$ docker-compose down |
259 | +``` |
260 | + |
261 | +# Microk8s |
262 | + |
263 | +With microk8s running, enable the `dns` and `storage` add-ons: |
264 | + |
265 | +``` |
266 | +$ microk8s enable dns storage |
267 | +``` |
268 | + |
269 | +Create a configmap for the configuration files: |
270 | + |
271 | +``` |
272 | +$ microk8s kubectl create configmap postgres-config \ |
273 | + --from-file=main-config=config/postgresql.conf |
274 | +``` |
275 | + |
276 | +Apply the `postgres-deployment.yml`: |
277 | + |
278 | +``` |
279 | +$ microk8s kubectl apply -f postgres-deployment.yml |
280 | +``` |
281 | + |
282 | +Postgres will be running and available via port `30432` on your host. The password of the `postgres` user will be `myS&cret`. |
283 | diff --git a/examples/config/postgresql.conf b/examples/config/postgresql.conf |
284 | new file mode 100644 |
285 | index 0000000..d702576 |
286 | --- /dev/null |
287 | +++ b/examples/config/postgresql.conf |
288 | @@ -0,0 +1,750 @@ |
289 | +# ----------------------------- |
290 | +# PostgreSQL configuration file |
291 | +# ----------------------------- |
292 | +# |
293 | +# This file consists of lines of the form: |
294 | +# |
295 | +# name = value |
296 | +# |
297 | +# (The "=" is optional.) Whitespace may be used. Comments are introduced with |
298 | +# "#" anywhere on a line. The complete list of parameter names and allowed |
299 | +# values can be found in the PostgreSQL documentation. |
300 | +# |
301 | +# The commented-out settings shown in this file represent the default values. |
302 | +# Re-commenting a setting is NOT sufficient to revert it to the default value; |
303 | +# you need to reload the server. |
304 | +# |
305 | +# This file is read on server startup and when the server receives a SIGHUP |
306 | +# signal. If you edit the file on a running system, you have to SIGHUP the |
307 | +# server for the changes to take effect, run "pg_ctl reload", or execute |
308 | +# "SELECT pg_reload_conf()". Some parameters, which are marked below, |
309 | +# require a server shutdown and restart to take effect. |
310 | +# |
311 | +# Any parameter can also be given as a command-line option to the server, e.g., |
312 | +# "postgres -c log_connections=on". Some parameters can be changed at run time |
313 | +# with the "SET" SQL command. |
314 | +# |
315 | +# Memory units: kB = kilobytes Time units: ms = milliseconds |
316 | +# MB = megabytes s = seconds |
317 | +# GB = gigabytes min = minutes |
318 | +# TB = terabytes h = hours |
319 | +# d = days |
320 | + |
321 | + |
322 | +#------------------------------------------------------------------------------ |
323 | +# FILE LOCATIONS |
324 | +#------------------------------------------------------------------------------ |
325 | + |
326 | +# The default values of these variables are driven from the -D command-line |
327 | +# option or PGDATA environment variable, represented here as ConfigDir. |
328 | + |
329 | +#data_directory = 'ConfigDir' # use data in another directory |
330 | + # (change requires restart) |
331 | +#hba_file = 'ConfigDir/pg_hba.conf' # host-based authentication file |
332 | + # (change requires restart) |
333 | +#ident_file = 'ConfigDir/pg_ident.conf' # ident configuration file |
334 | + # (change requires restart) |
335 | + |
336 | +# If external_pid_file is not explicitly set, no extra PID file is written. |
337 | +#external_pid_file = '' # write an extra PID file |
338 | + # (change requires restart) |
339 | + |
340 | + |
341 | +#------------------------------------------------------------------------------ |
342 | +# CONNECTIONS AND AUTHENTICATION |
343 | +#------------------------------------------------------------------------------ |
344 | + |
345 | +# - Connection Settings - |
346 | + |
347 | +listen_addresses = '*' # what IP address(es) to listen on; |
348 | + # comma-separated list of addresses; |
349 | + # defaults to 'localhost'; use '*' for all |
350 | + # (change requires restart) |
351 | +#port = 5432 # (change requires restart) |
352 | +#max_connections = 100 # (change requires restart) |
353 | +#superuser_reserved_connections = 3 # (change requires restart) |
354 | +#unix_socket_directories = '/tmp' # comma-separated list of directories |
355 | + # (change requires restart) |
356 | +#unix_socket_group = '' # (change requires restart) |
357 | +#unix_socket_permissions = 0777 # begin with 0 to use octal notation |
358 | + # (change requires restart) |
359 | +#bonjour = off # advertise server via Bonjour |
360 | + # (change requires restart) |
361 | +#bonjour_name = '' # defaults to the computer name |
362 | + # (change requires restart) |
363 | + |
364 | +# - TCP settings - |
365 | +# see "man 7 tcp" for details |
366 | + |
367 | +#tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds; |
368 | + # 0 selects the system default |
369 | +#tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds; |
370 | + # 0 selects the system default |
371 | +#tcp_keepalives_count = 0 # TCP_KEEPCNT; |
372 | + # 0 selects the system default |
373 | +#tcp_user_timeout = 0 # TCP_USER_TIMEOUT, in milliseconds; |
374 | + # 0 selects the system default |
375 | + |
376 | +# - Authentication - |
377 | + |
378 | +#authentication_timeout = 1min # 1s-600s |
379 | +#password_encryption = md5 # md5 or scram-sha-256 |
380 | +#db_user_namespace = off |
381 | + |
382 | +# GSSAPI using Kerberos |
383 | +#krb_server_keyfile = '' |
384 | +#krb_caseins_users = off |
385 | + |
386 | +# - SSL - |
387 | + |
388 | +#ssl = off |
389 | +#ssl_ca_file = '' |
390 | +#ssl_cert_file = 'server.crt' |
391 | +#ssl_crl_file = '' |
392 | +#ssl_key_file = 'server.key' |
393 | +#ssl_ciphers = 'HIGH:MEDIUM:+3DES:!aNULL' # allowed SSL ciphers |
394 | +#ssl_prefer_server_ciphers = on |
395 | +#ssl_ecdh_curve = 'prime256v1' |
396 | +#ssl_min_protocol_version = 'TLSv1' |
397 | +#ssl_max_protocol_version = '' |
398 | +#ssl_dh_params_file = '' |
399 | +#ssl_passphrase_command = '' |
400 | +#ssl_passphrase_command_supports_reload = off |
401 | + |
402 | + |
403 | +#------------------------------------------------------------------------------ |
404 | +# RESOURCE USAGE (except WAL) |
405 | +#------------------------------------------------------------------------------ |
406 | + |
407 | +# - Memory - |
408 | + |
409 | +#shared_buffers = 32MB # min 128kB |
410 | + # (change requires restart) |
411 | +#huge_pages = try # on, off, or try |
412 | + # (change requires restart) |
413 | +#temp_buffers = 8MB # min 800kB |
414 | +#max_prepared_transactions = 0 # zero disables the feature |
415 | + # (change requires restart) |
416 | +# Caution: it is not advisable to set max_prepared_transactions nonzero unless |
417 | +# you actively intend to use prepared transactions. |
418 | +#work_mem = 4MB # min 64kB |
419 | +#maintenance_work_mem = 64MB # min 1MB |
420 | +#autovacuum_work_mem = -1 # min 1MB, or -1 to use maintenance_work_mem |
421 | +#max_stack_depth = 2MB # min 100kB |
422 | +#shared_memory_type = mmap # the default is the first option |
423 | + # supported by the operating system: |
424 | + # mmap |
425 | + # sysv |
426 | + # windows |
427 | + # (change requires restart) |
428 | +#dynamic_shared_memory_type = posix # the default is the first option |
429 | + # supported by the operating system: |
430 | + # posix |
431 | + # sysv |
432 | + # windows |
433 | + # mmap |
434 | + # (change requires restart) |
435 | + |
436 | +# - Disk - |
437 | + |
438 | +#temp_file_limit = -1 # limits per-process temp file space |
439 | + # in kB, or -1 for no limit |
440 | + |
441 | +# - Kernel Resources - |
442 | + |
443 | +#max_files_per_process = 1000 # min 25 |
444 | + # (change requires restart) |
445 | + |
446 | +# - Cost-Based Vacuum Delay - |
447 | + |
448 | +#vacuum_cost_delay = 0 # 0-100 milliseconds (0 disables) |
449 | +#vacuum_cost_page_hit = 1 # 0-10000 credits |
450 | +#vacuum_cost_page_miss = 10 # 0-10000 credits |
451 | +#vacuum_cost_page_dirty = 20 # 0-10000 credits |
452 | +#vacuum_cost_limit = 200 # 1-10000 credits |
453 | + |
454 | +# - Background Writer - |
455 | + |
456 | +#bgwriter_delay = 200ms # 10-10000ms between rounds |
457 | +#bgwriter_lru_maxpages = 100 # max buffers written/round, 0 disables |
458 | +#bgwriter_lru_multiplier = 2.0 # 0-10.0 multiplier on buffers scanned/round |
459 | +#bgwriter_flush_after = 0 # measured in pages, 0 disables |
460 | + |
461 | +# - Asynchronous Behavior - |
462 | + |
463 | +#effective_io_concurrency = 1 # 1-1000; 0 disables prefetching |
464 | +#max_worker_processes = 8 # (change requires restart) |
465 | +#max_parallel_maintenance_workers = 2 # taken from max_parallel_workers |
466 | +#max_parallel_workers_per_gather = 2 # taken from max_parallel_workers |
467 | +#parallel_leader_participation = on |
468 | +#max_parallel_workers = 8 # maximum number of max_worker_processes that |
469 | + # can be used in parallel operations |
470 | +#old_snapshot_threshold = -1 # 1min-60d; -1 disables; 0 is immediate |
471 | + # (change requires restart) |
472 | +#backend_flush_after = 0 # measured in pages, 0 disables |
473 | + |
474 | + |
475 | +#------------------------------------------------------------------------------ |
476 | +# WRITE-AHEAD LOG |
477 | +#------------------------------------------------------------------------------ |
478 | + |
479 | +# - Settings - |
480 | + |
481 | +#wal_level = replica # minimal, replica, or logical |
482 | + # (change requires restart) |
483 | +#fsync = on # flush data to disk for crash safety |
484 | + # (turning this off can cause |
485 | + # unrecoverable data corruption) |
486 | +#synchronous_commit = on # synchronization level; |
487 | + # off, local, remote_write, remote_apply, or on |
488 | +#wal_sync_method = fsync # the default is the first option |
489 | + # supported by the operating system: |
490 | + # open_datasync |
491 | + # fdatasync (default on Linux) |
492 | + # fsync |
493 | + # fsync_writethrough |
494 | + # open_sync |
495 | +#full_page_writes = on # recover from partial page writes |
496 | +#wal_compression = off # enable compression of full-page writes |
497 | +#wal_log_hints = off # also do full page writes of non-critical updates |
498 | + # (change requires restart) |
499 | +#wal_init_zero = on # zero-fill new WAL files |
500 | +#wal_recycle = on # recycle WAL files |
501 | +#wal_buffers = -1 # min 32kB, -1 sets based on shared_buffers |
502 | + # (change requires restart) |
503 | +#wal_writer_delay = 200ms # 1-10000 milliseconds |
504 | +#wal_writer_flush_after = 1MB # measured in pages, 0 disables |
505 | + |
506 | +#commit_delay = 0 # range 0-100000, in microseconds |
507 | +#commit_siblings = 5 # range 1-1000 |
508 | + |
509 | +# - Checkpoints - |
510 | + |
511 | +#checkpoint_timeout = 5min # range 30s-1d |
512 | +#max_wal_size = 1GB |
513 | +#min_wal_size = 80MB |
514 | +#checkpoint_completion_target = 0.5 # checkpoint target duration, 0.0 - 1.0 |
515 | +#checkpoint_flush_after = 0 # measured in pages, 0 disables |
516 | +#checkpoint_warning = 30s # 0 disables |
517 | + |
518 | +# - Archiving - |
519 | + |
520 | +#archive_mode = off # enables archiving; off, on, or always |
521 | + # (change requires restart) |
522 | +#archive_command = '' # command to use to archive a logfile segment |
523 | + # placeholders: %p = path of file to archive |
524 | + # %f = file name only |
525 | + # e.g. 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f' |
526 | +#archive_timeout = 0 # force a logfile segment switch after this |
527 | + # number of seconds; 0 disables |
528 | + |
529 | +# - Archive Recovery - |
530 | + |
531 | +# These are only used in recovery mode. |
532 | + |
533 | +#restore_command = '' # command to use to restore an archived logfile segment |
534 | + # placeholders: %p = path of file to restore |
535 | + # %f = file name only |
536 | + # e.g. 'cp /mnt/server/archivedir/%f %p' |
537 | + # (change requires restart) |
538 | +#archive_cleanup_command = '' # command to execute at every restartpoint |
539 | +#recovery_end_command = '' # command to execute at completion of recovery |
540 | + |
541 | +# - Recovery Target - |
542 | + |
543 | +# Set these only when performing a targeted recovery. |
544 | + |
545 | +#recovery_target = '' # 'immediate' to end recovery as soon as a |
546 | + # consistent state is reached |
547 | + # (change requires restart) |
548 | +#recovery_target_name = '' # the named restore point to which recovery will proceed |
549 | + # (change requires restart) |
550 | +#recovery_target_time = '' # the time stamp up to which recovery will proceed |
551 | + # (change requires restart) |
552 | +#recovery_target_xid = '' # the transaction ID up to which recovery will proceed |
553 | + # (change requires restart) |
554 | +#recovery_target_lsn = '' # the WAL LSN up to which recovery will proceed |
555 | + # (change requires restart) |
556 | +#recovery_target_inclusive = on # Specifies whether to stop: |
557 | + # just after the specified recovery target (on) |
558 | + # just before the recovery target (off) |
559 | + # (change requires restart) |
560 | +#recovery_target_timeline = 'latest' # 'current', 'latest', or timeline ID |
561 | + # (change requires restart) |
562 | +#recovery_target_action = 'pause' # 'pause', 'promote', 'shutdown' |
563 | + # (change requires restart) |
564 | + |
565 | + |
566 | +#------------------------------------------------------------------------------ |
567 | +# REPLICATION |
568 | +#------------------------------------------------------------------------------ |
569 | + |
570 | +# - Sending Servers - |
571 | + |
572 | +# Set these on the master and on any standby that will send replication data. |
573 | + |
574 | +#max_wal_senders = 10 # max number of walsender processes |
575 | + # (change requires restart) |
576 | +#wal_keep_segments = 0 # in logfile segments; 0 disables |
577 | +#wal_sender_timeout = 60s # in milliseconds; 0 disables |
578 | + |
579 | +#max_replication_slots = 10 # max number of replication slots |
580 | + # (change requires restart) |
581 | +#track_commit_timestamp = off # collect timestamp of transaction commit |
582 | + # (change requires restart) |
583 | + |
584 | +# - Master Server - |
585 | + |
586 | +# These settings are ignored on a standby server. |
587 | + |
588 | +#synchronous_standby_names = '' # standby servers that provide sync rep |
589 | + # method to choose sync standbys, number of sync standbys, |
590 | + # and comma-separated list of application_name |
591 | + # from standby(s); '*' = all |
592 | +#vacuum_defer_cleanup_age = 0 # number of xacts by which cleanup is delayed |
593 | + |
594 | +# - Standby Servers - |
595 | + |
596 | +# These settings are ignored on a master server. |
597 | + |
598 | +#primary_conninfo = '' # connection string to sending server |
599 | + # (change requires restart) |
600 | +#primary_slot_name = '' # replication slot on sending server |
601 | + # (change requires restart) |
602 | +#promote_trigger_file = '' # file name whose presence ends recovery |
603 | +#hot_standby = on # "off" disallows queries during recovery |
604 | + # (change requires restart) |
605 | +#max_standby_archive_delay = 30s # max delay before canceling queries |
606 | + # when reading WAL from archive; |
607 | + # -1 allows indefinite delay |
608 | +#max_standby_streaming_delay = 30s # max delay before canceling queries |
609 | + # when reading streaming WAL; |
610 | + # -1 allows indefinite delay |
611 | +#wal_receiver_status_interval = 10s # send replies at least this often |
612 | + # 0 disables |
613 | +#hot_standby_feedback = off # send info from standby to prevent |
614 | + # query conflicts |
615 | +#wal_receiver_timeout = 60s # time that receiver waits for |
616 | + # communication from master |
617 | + # in milliseconds; 0 disables |
618 | +#wal_retrieve_retry_interval = 5s # time to wait before retrying to |
619 | + # retrieve WAL after a failed attempt |
620 | +#recovery_min_apply_delay = 0 # minimum delay for applying changes during recovery |
621 | + |
622 | +# - Subscribers - |
623 | + |
624 | +# These settings are ignored on a publisher. |
625 | + |
626 | +#max_logical_replication_workers = 4 # taken from max_worker_processes |
627 | + # (change requires restart) |
628 | +#max_sync_workers_per_subscription = 2 # taken from max_logical_replication_workers |
629 | + |
630 | + |
631 | +#------------------------------------------------------------------------------ |
632 | +# QUERY TUNING |
633 | +#------------------------------------------------------------------------------ |
634 | + |
635 | +# - Planner Method Configuration - |
636 | + |
637 | +#enable_bitmapscan = on |
638 | +#enable_hashagg = on |
639 | +#enable_hashjoin = on |
640 | +#enable_indexscan = on |
641 | +#enable_indexonlyscan = on |
642 | +#enable_material = on |
643 | +#enable_mergejoin = on |
644 | +#enable_nestloop = on |
645 | +#enable_parallel_append = on |
646 | +#enable_seqscan = on |
647 | +#enable_sort = on |
648 | +#enable_tidscan = on |
649 | +#enable_partitionwise_join = off |
650 | +#enable_partitionwise_aggregate = off |
651 | +#enable_parallel_hash = on |
652 | +#enable_partition_pruning = on |
653 | + |
654 | +# - Planner Cost Constants - |
655 | + |
656 | +#seq_page_cost = 1.0 # measured on an arbitrary scale |
657 | +#random_page_cost = 4.0 # same scale as above |
658 | +#cpu_tuple_cost = 0.01 # same scale as above |
659 | +#cpu_index_tuple_cost = 0.005 # same scale as above |
660 | +#cpu_operator_cost = 0.0025 # same scale as above |
661 | +#parallel_tuple_cost = 0.1 # same scale as above |
662 | +#parallel_setup_cost = 1000.0 # same scale as above |
663 | + |
664 | +#jit_above_cost = 100000 # perform JIT compilation if available |
665 | + # and query more expensive than this; |
666 | + # -1 disables |
667 | +#jit_inline_above_cost = 500000 # inline small functions if query is |
668 | + # more expensive than this; -1 disables |
669 | +#jit_optimize_above_cost = 500000 # use expensive JIT optimizations if |
670 | + # query is more expensive than this; |
671 | + # -1 disables |
672 | + |
673 | +#min_parallel_table_scan_size = 8MB |
674 | +#min_parallel_index_scan_size = 512kB |
675 | +#effective_cache_size = 4GB |
676 | + |
677 | +# - Genetic Query Optimizer - |
678 | + |
679 | +#geqo = on |
680 | +#geqo_threshold = 12 |
681 | +#geqo_effort = 5 # range 1-10 |
682 | +#geqo_pool_size = 0 # selects default based on effort |
683 | +#geqo_generations = 0 # selects default based on effort |
684 | +#geqo_selection_bias = 2.0 # range 1.5-2.0 |
685 | +#geqo_seed = 0.0 # range 0.0-1.0 |
686 | + |
687 | +# - Other Planner Options - |
688 | + |
689 | +#default_statistics_target = 100 # range 1-10000 |
690 | +#constraint_exclusion = partition # on, off, or partition |
691 | +#cursor_tuple_fraction = 0.1 # range 0.0-1.0 |
692 | +#from_collapse_limit = 8 |
693 | +#join_collapse_limit = 8 # 1 disables collapsing of explicit |
694 | + # JOIN clauses |
695 | +#force_parallel_mode = off |
696 | +#jit = on # allow JIT compilation |
697 | +#plan_cache_mode = auto # auto, force_generic_plan or |
698 | + # force_custom_plan |
699 | + |
700 | + |
701 | +#------------------------------------------------------------------------------ |
702 | +# REPORTING AND LOGGING |
703 | +#------------------------------------------------------------------------------ |
704 | + |
705 | +# - Where to Log - |
706 | + |
707 | +#log_destination = 'stderr' # Valid values are combinations of |
708 | + # stderr, csvlog, syslog, and eventlog, |
709 | + # depending on platform. csvlog |
710 | + # requires logging_collector to be on. |
711 | + |
712 | +# This is used when logging to stderr: |
713 | +#logging_collector = off # Enable capturing of stderr and csvlog |
714 | + # into log files. Required to be on for |
715 | + # csvlogs. |
716 | + # (change requires restart) |
717 | + |
718 | +# These are only used if logging_collector is on: |
719 | +#log_directory = 'log' # directory where log files are written, |
720 | + # can be absolute or relative to PGDATA |
721 | +#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern, |
722 | + # can include strftime() escapes |
723 | +#log_file_mode = 0600 # creation mode for log files, |
724 | + # begin with 0 to use octal notation |
725 | +#log_truncate_on_rotation = off # If on, an existing log file with the |
726 | + # same name as the new log file will be |
727 | + # truncated rather than appended to. |
728 | + # But such truncation only occurs on |
729 | + # time-driven rotation, not on restarts |
730 | + # or size-driven rotation. Default is |
731 | + # off, meaning append to existing files |
732 | + # in all cases. |
733 | +#log_rotation_age = 1d # Automatic rotation of logfiles will |
734 | + # happen after that time. 0 disables. |
735 | +#log_rotation_size = 10MB # Automatic rotation of logfiles will |
736 | + # happen after that much log output. |
737 | + # 0 disables. |
738 | + |
739 | +# These are relevant when logging to syslog: |
740 | +#syslog_facility = 'LOCAL0' |
741 | +#syslog_ident = 'postgres' |
742 | +#syslog_sequence_numbers = on |
743 | +#syslog_split_messages = on |
744 | + |
745 | +# This is only relevant when logging to eventlog (win32): |
746 | +# (change requires restart) |
747 | +#event_source = 'PostgreSQL' |
748 | + |
749 | +# - When to Log - |
750 | + |
751 | +#log_min_messages = warning # values in order of decreasing detail: |
752 | + # debug5 |
753 | + # debug4 |
754 | + # debug3 |
755 | + # debug2 |
756 | + # debug1 |
757 | + # info |
758 | + # notice |
759 | + # warning |
760 | + # error |
761 | + # log |
762 | + # fatal |
763 | + # panic |
764 | + |
765 | +#log_min_error_statement = error # values in order of decreasing detail: |
766 | + # debug5 |
767 | + # debug4 |
768 | + # debug3 |
769 | + # debug2 |
770 | + # debug1 |
771 | + # info |
772 | + # notice |
773 | + # warning |
774 | + # error |
775 | + # log |
776 | + # fatal |
777 | + # panic (effectively off) |
778 | + |
779 | +#log_min_duration_statement = -1 # -1 is disabled, 0 logs all statements |
780 | + # and their durations, > 0 logs only |
781 | + # statements running at least this number |
782 | + # of milliseconds |
783 | + |
784 | +#log_transaction_sample_rate = 0.0 # Fraction of transactions whose statements |
785 | + # are logged regardless of their duration. 1.0 logs all |
786 | + # statements from all transactions, 0.0 never logs. |
787 | + |
788 | +# - What to Log - |
789 | + |
790 | +#debug_print_parse = off |
791 | +#debug_print_rewritten = off |
792 | +#debug_print_plan = off |
793 | +#debug_pretty_print = on |
794 | +#log_checkpoints = off |
795 | +#log_connections = off |
796 | +#log_disconnections = off |
797 | +#log_duration = off |
798 | +#log_error_verbosity = default # terse, default, or verbose messages |
799 | +#log_hostname = off |
800 | +#log_line_prefix = '%m [%p] ' # special values: |
801 | + # %a = application name |
802 | + # %u = user name |
803 | + # %d = database name |
804 | + # %r = remote host and port |
805 | + # %h = remote host |
806 | + # %p = process ID |
807 | + # %t = timestamp without milliseconds |
808 | + # %m = timestamp with milliseconds |
809 | + # %n = timestamp with milliseconds (as a Unix epoch) |
810 | + # %i = command tag |
811 | + # %e = SQL state |
812 | + # %c = session ID |
813 | + # %l = session line number |
814 | + # %s = session start timestamp |
815 | + # %v = virtual transaction ID |
816 | + # %x = transaction ID (0 if none) |
817 | + # %q = stop here in non-session |
818 | + # processes |
819 | + # %% = '%' |
820 | + # e.g. '<%u%%%d> ' |
821 | +#log_lock_waits = off # log lock waits >= deadlock_timeout |
822 | +#log_statement = 'none' # none, ddl, mod, all |
823 | +#log_replication_commands = off |
824 | +#log_temp_files = -1 # log temporary files equal or larger |
825 | + # than the specified size in kilobytes; |
826 | + # -1 disables, 0 logs all temp files |
827 | +#log_timezone = 'GMT' |
828 | + |
829 | +#------------------------------------------------------------------------------ |
830 | +# PROCESS TITLE |
831 | +#------------------------------------------------------------------------------ |
832 | + |
833 | +#cluster_name = '' # added to process titles if nonempty |
834 | + # (change requires restart) |
835 | +#update_process_title = on |
836 | + |
837 | + |
838 | +#------------------------------------------------------------------------------ |
839 | +# STATISTICS |
840 | +#------------------------------------------------------------------------------ |
841 | + |
842 | +# - Query and Index Statistics Collector - |
843 | + |
844 | +#track_activities = on |
845 | +#track_counts = on |
846 | +#track_io_timing = off |
847 | +#track_functions = none # none, pl, all |
848 | +#track_activity_query_size = 1024 # (change requires restart) |
849 | +#stats_temp_directory = 'pg_stat_tmp' |
850 | + |
851 | + |
852 | +# - Monitoring - |
853 | + |
854 | +#log_parser_stats = off |
855 | +#log_planner_stats = off |
856 | +#log_executor_stats = off |
857 | +#log_statement_stats = off |
858 | + |
859 | + |
860 | +#------------------------------------------------------------------------------ |
861 | +# AUTOVACUUM |
862 | +#------------------------------------------------------------------------------ |
863 | + |
864 | +#autovacuum = on # Enable autovacuum subprocess? 'on' |
865 | + # requires track_counts to also be on. |
866 | +#log_autovacuum_min_duration = -1 # -1 disables, 0 logs all actions and |
867 | + # their durations, > 0 logs only |
868 | + # actions running at least this number |
869 | + # of milliseconds. |
870 | +#autovacuum_max_workers = 3 # max number of autovacuum subprocesses |
871 | + # (change requires restart) |
872 | +#autovacuum_naptime = 1min # time between autovacuum runs |
873 | +#autovacuum_vacuum_threshold = 50 # min number of row updates before |
874 | + # vacuum |
875 | +#autovacuum_analyze_threshold = 50 # min number of row updates before |
876 | + # analyze |
877 | +#autovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuum |
878 | +#autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze |
879 | +#autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum |
880 | + # (change requires restart) |
881 | +#autovacuum_multixact_freeze_max_age = 400000000 # maximum multixact age |
882 | + # before forced vacuum |
883 | + # (change requires restart) |
884 | +#autovacuum_vacuum_cost_delay = 2ms # default vacuum cost delay for |
885 | + # autovacuum, in milliseconds; |
886 | + # -1 means use vacuum_cost_delay |
887 | +#autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for |
888 | + # autovacuum, -1 means use |
889 | + # vacuum_cost_limit |
890 | + |
891 | + |
892 | +#------------------------------------------------------------------------------ |
893 | +# CLIENT CONNECTION DEFAULTS |
894 | +#------------------------------------------------------------------------------ |
895 | + |
896 | +# - Statement Behavior - |
897 | + |
898 | +#client_min_messages = notice # values in order of decreasing detail: |
899 | + # debug5 |
900 | + # debug4 |
901 | + # debug3 |
902 | + # debug2 |
903 | + # debug1 |
904 | + # log |
905 | + # notice |
906 | + # warning |
907 | + # error |
908 | +#search_path = '"$user", public' # schema names |
909 | +#row_security = on |
910 | +#default_tablespace = '' # a tablespace name, '' uses the default |
911 | +#temp_tablespaces = '' # a list of tablespace names, '' uses |
912 | + # only default tablespace |
913 | +#default_table_access_method = 'heap' |
914 | +#check_function_bodies = on |
915 | +#default_transaction_isolation = 'read committed' |
916 | +#default_transaction_read_only = off |
917 | +#default_transaction_deferrable = off |
918 | +#session_replication_role = 'origin' |
919 | +#statement_timeout = 0 # in milliseconds, 0 is disabled |
920 | +#lock_timeout = 0 # in milliseconds, 0 is disabled |
921 | +#idle_in_transaction_session_timeout = 0 # in milliseconds, 0 is disabled |
922 | +#vacuum_freeze_min_age = 50000000 |
923 | +#vacuum_freeze_table_age = 150000000 |
924 | +#vacuum_multixact_freeze_min_age = 5000000 |
925 | +#vacuum_multixact_freeze_table_age = 150000000 |
926 | +#vacuum_cleanup_index_scale_factor = 0.1 # fraction of total number of tuples |
927 | + # before index cleanup, 0 always performs |
928 | + # index cleanup |
929 | +#bytea_output = 'hex' # hex, escape |
930 | +#xmlbinary = 'base64' |
931 | +#xmloption = 'content' |
932 | +#gin_fuzzy_search_limit = 0 |
933 | +#gin_pending_list_limit = 4MB |
934 | + |
935 | +# - Locale and Formatting - |
936 | + |
937 | +#datestyle = 'iso, mdy' |
938 | +#intervalstyle = 'postgres' |
939 | +#timezone = 'GMT' |
940 | +#timezone_abbreviations = 'Default' # Select the set of available time zone |
941 | + # abbreviations. Currently, there are |
942 | + # Default |
943 | + # Australia (historical usage) |
944 | + # India |
945 | + # You can create your own file in |
946 | + # share/timezonesets/. |
947 | +#extra_float_digits = 1 # min -15, max 3; any value >0 actually |
948 | + # selects precise output mode |
949 | +#client_encoding = sql_ascii # actually, defaults to database |
950 | + # encoding |
951 | + |
952 | +# These settings are initialized by initdb, but they can be changed. |
953 | +#lc_messages = 'C' # locale for system error message |
954 | + # strings |
955 | +#lc_monetary = 'C' # locale for monetary formatting |
956 | +#lc_numeric = 'C' # locale for number formatting |
957 | +#lc_time = 'C' # locale for time formatting |
958 | + |
959 | +# default configuration for text search |
960 | +#default_text_search_config = 'pg_catalog.simple' |
961 | + |
962 | +# - Shared Library Preloading - |
963 | + |
964 | +#shared_preload_libraries = '' # (change requires restart) |
965 | +#local_preload_libraries = '' |
966 | +#session_preload_libraries = '' |
967 | +#jit_provider = 'llvmjit' # JIT library to use |
968 | + |
969 | +# - Other Defaults - |
970 | + |
971 | +#dynamic_library_path = '$libdir' |
972 | + |
973 | + |
974 | +#------------------------------------------------------------------------------ |
975 | +# LOCK MANAGEMENT |
976 | +#------------------------------------------------------------------------------ |
977 | + |
978 | +#deadlock_timeout = 1s |
979 | +#max_locks_per_transaction = 64 # min 10 |
980 | + # (change requires restart) |
981 | +#max_pred_locks_per_transaction = 64 # min 10 |
982 | + # (change requires restart) |
983 | +#max_pred_locks_per_relation = -2 # negative values mean |
984 | + # (max_pred_locks_per_transaction |
985 | + # / -max_pred_locks_per_relation) - 1 |
986 | +#max_pred_locks_per_page = 2 # min 0 |
987 | + |
988 | + |
989 | +#------------------------------------------------------------------------------ |
990 | +# VERSION AND PLATFORM COMPATIBILITY |
991 | +#------------------------------------------------------------------------------ |
992 | + |
993 | +# - Previous PostgreSQL Versions - |
994 | + |
995 | +#array_nulls = on |
996 | +#backslash_quote = safe_encoding # on, off, or safe_encoding |
997 | +#escape_string_warning = on |
998 | +#lo_compat_privileges = off |
999 | +#operator_precedence_warning = off |
1000 | +#quote_all_identifiers = off |
1001 | +#standard_conforming_strings = on |
1002 | +#synchronize_seqscans = on |
1003 | + |
1004 | +# - Other Platforms and Clients - |
1005 | + |
1006 | +#transform_null_equals = off |
1007 | + |
1008 | + |
1009 | +#------------------------------------------------------------------------------ |
1010 | +# ERROR HANDLING |
1011 | +#------------------------------------------------------------------------------ |
1012 | + |
1013 | +#exit_on_error = off # terminate session on any error? |
1014 | +#restart_after_crash = on # reinitialize after backend crash? |
1015 | +#data_sync_retry = off # retry or panic on failure to fsync |
1016 | + # data? |
1017 | + # (change requires restart) |
1018 | + |
1019 | + |
1020 | +#------------------------------------------------------------------------------ |
1021 | +# CONFIG FILE INCLUDES |
1022 | +#------------------------------------------------------------------------------ |
1023 | + |
1024 | +# These options allow settings to be loaded from files other than the |
1025 | +# default postgresql.conf. Note that these are directives, not variable |
1026 | +# assignments, so they can usefully be given more than once. |
1027 | + |
1028 | +#include_dir = '...' # include files ending in '.conf' from |
1029 | + # a directory, e.g., 'conf.d' |
1030 | +#include_if_exists = '...' # include file only if it exists |
1031 | +#include = '...' # include file |
1032 | + |
1033 | + |
1034 | +#------------------------------------------------------------------------------ |
1035 | +# CUSTOMIZED OPTIONS |
1036 | +#------------------------------------------------------------------------------ |
1037 | + |
1038 | +# Add settings for extensions here |
1039 | diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml |
1040 | new file mode 100644 |
1041 | index 0000000..e512c9b |
1042 | --- /dev/null |
1043 | +++ b/examples/docker-compose.yml |
1044 | @@ -0,0 +1,12 @@ |
1045 | +version: '2' |
1046 | + |
1047 | +services: |
1048 | + postgres: |
1049 | + image: squeakywheel/postgres:edge |
1050 | + network_mode: "host" |
1051 | + ports: |
1052 | + - 5432:5432 |
1053 | + environment: |
1054 | + - POSTGRES_PASSWORD=myS&cret |
1055 | + volumes: |
1056 | + - ./config/postgresql.conf:/etc/postgresql/postgresql.conf |
1057 | diff --git a/examples/postgres-deployment.yml b/examples/postgres-deployment.yml |
1058 | new file mode 100644 |
1059 | index 0000000..c53d465 |
1060 | --- /dev/null |
1061 | +++ b/examples/postgres-deployment.yml |
1062 | @@ -0,0 +1,68 @@ |
1063 | +--- |
1064 | +apiVersion: v1 |
1065 | +kind: PersistentVolumeClaim |
1066 | +metadata: |
1067 | + name: postgres-volume-claim |
1068 | +spec: |
1069 | + accessModes: |
1070 | + - ReadWriteOnce |
1071 | + storageClassName: microk8s-hostpath |
1072 | + resources: |
1073 | + requests: |
1074 | + storage: 500M |
1075 | +--- |
1076 | +apiVersion: apps/v1 |
1077 | +kind: Deployment |
1078 | +metadata: |
1079 | + name: postgres-deployment |
1080 | +spec: |
1081 | + replicas: 1 |
1082 | + selector: |
1083 | + matchLabels: |
1084 | + app: postgres |
1085 | + template: |
1086 | + metadata: |
1087 | + labels: |
1088 | + app: postgres |
1089 | + spec: |
1090 | + containers: |
1091 | + - name: postgres |
1092 | + image: squeakywheel/postgres:edge |
1093 | + env: |
1094 | + - name: POSTGRES_PASSWORD |
1095 | + value: "myS&cret" |
1096 | + volumeMounts: |
1097 | + - name: postgres-config-volume |
1098 | + mountPath: /etc/postgresql/postgresql.conf |
1099 | + subPath: postgresql.conf |
1100 | + - name: postgres-data |
1101 | + mountPath: /var/lib/postgresql/data |
1102 | + ports: |
1103 | + - containerPort: 5432 |
1104 | + name: postgres |
1105 | + protocol: TCP |
1106 | + volumes: |
1107 | + - name: postgres-config-volume |
1108 | + configMap: |
1109 | + name: postgres-config |
1110 | + items: |
1111 | + - key: main-config |
1112 | + path: postgresql.conf |
1113 | + - name: postgres-data |
1114 | + persistentVolumeClaim: |
1115 | + claimName: postgres-volume-claim |
1116 | +--- |
1117 | +apiVersion: v1 |
1118 | +kind: Service |
1119 | +metadata: |
1120 | + name: postgres-service |
1121 | +spec: |
1122 | + type: NodePort |
1123 | + selector: |
1124 | + app: postgres |
1125 | + ports: |
1126 | + - protocol: TCP |
1127 | + port: 5432 |
1128 | + targetPort: 5432 |
1129 | + nodePort: 30432 |
1130 | + name: postgres |
Sorry, just noticed we have an approved template in LP #1904407 for the README file and I am not following it. I am working on it.