Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
move dev to dev.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Androz2091 committed Oct 7, 2024
1 parent 5885507 commit a8f6b01
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 35 deletions.
36 changes: 1 addition & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
```
33 changes: 33 additions & 0 deletions dev.md
Original file line number Diff line number Diff line change
@@ -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
```

0 comments on commit a8f6b01

Please sign in to comment.