From a8f6b010a83dd4d77f80d7f082015089ce36847d Mon Sep 17 00:00:00 2001 From: Androz 2091 Date: Mon, 7 Oct 2024 13:13:45 +0200 Subject: [PATCH] move dev to dev.md --- README.md | 36 +----------------------------------- dev.md | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 35 deletions(-) create mode 100644 dev.md diff --git a/README.md b/README.md index 584f602..701c996 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This repository contains the Dockerfile used to build a PostgreSQL image with [P The following environment variables are available. By default, the image should be run with `RESTORE_ENABLED=false`. It is going to start backing up the database, archiving the WAL and pushing them to the configured repositories. -When starting the image with the same repositories and `RESTORE_ENABLED=true`, the image **WILL ERASE THE CURRENT CLUSTER** (if existing) and restore it to the specified timestamp (if a valid backup can be found). +When starting the image with the same repositories and `RESTORE_ENABLED=true`, it **WILL ERASE THE CURRENT CLUSTER DATA** (if existing) and restore the cluster to the specified timestamp (if a valid backup can be found on the repositories). ### Restore configuration @@ -51,37 +51,3 @@ To enable WAL archiving, the script updates the `postgresql.conf` file and resta ### Retention The WAL is kept as long as a full backup is not expired. When a full backup expires, all the incrementals/differentials that depend on it are expired too. Incremental backups can not be expired independently, they are always expired with the full/differential backup they depend on. - -### Debug locally - -Here are some useful debug commands when developing locally: - -``` -mkdir test -mkdir test/data -mkdir test/pgbackrest -sudo chown -R 999:999 test -sudo docker build . -t pgbr && sudo docker run -e PG_BACKREST_REPO_LOCAL_ENABLED=true -e POSTGRES_PASSWORD=mysecretpassword -p 5435:5432 -v ./test/data:/var/lib/postgresql/data -v ./test/pgbackrest:/var/lib/pgbackrest pgbr -``` -``` -sudo rm -rf test && mkdir test && mkdir test/data && mkdir test/pgbackrest && sudo chown -R 999:999 test -``` - -``` -sudo docker build . -t pgbr && sudo docker run -e PG_BACKREST_REPO_LOCAL_ENABLED=true -e POSTGRES_PASSWORD=mysecretpassword -e RESTORE_ENABLED=true -e RESTORE_TIMESTAMP="2024-10-06 17:33:27" -p 5435:5432 -v ./test/data:/var/lib/postgresql/data -v ./test/pgbackrest:/var/lib/pgbackrest pgbr -``` - -``` -create table users_test ( - user_id varchar(50), - date timestamp NOT NULL DEFAULT NOW() -); -``` - -``` -insert into users_test (user_id) values (1); -``` - -``` -pgbackrest --stanza=my-pg-pgbackrest-stanza --type=time --target="2024-10-05 12:53:55" restore -``` diff --git a/dev.md b/dev.md new file mode 100644 index 0000000..2c32c13 --- /dev/null +++ b/dev.md @@ -0,0 +1,33 @@ +### Debug locally + +Here are some useful debug commands when developing locally: + +``` +mkdir test +mkdir test/data +mkdir test/pgbackrest +sudo chown -R 999:999 test +sudo docker build . -t pgbr && sudo docker run -e PG_BACKREST_REPO_LOCAL_ENABLED=true -e POSTGRES_PASSWORD=mysecretpassword -p 5435:5432 -v ./test/data:/var/lib/postgresql/data -v ./test/pgbackrest:/var/lib/pgbackrest pgbr +``` +``` +sudo rm -rf test && mkdir test && mkdir test/data && mkdir test/pgbackrest && sudo chown -R 999:999 test +``` + +``` +sudo docker build . -t pgbr && sudo docker run -e PG_BACKREST_REPO_LOCAL_ENABLED=true -e POSTGRES_PASSWORD=mysecretpassword -e RESTORE_ENABLED=true -e RESTORE_TIMESTAMP="2024-10-06 17:33:27" -p 5435:5432 -v ./test/data:/var/lib/postgresql/data -v ./test/pgbackrest:/var/lib/pgbackrest pgbr +``` + +``` +create table users_test ( + user_id varchar(50), + date timestamp NOT NULL DEFAULT NOW() +); +``` + +``` +insert into users_test (user_id) values (1); +``` + +``` +pgbackrest --stanza=my-pg-pgbackrest-stanza --type=time --target="2024-10-05 12:53:55" restore +```