You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23-62Lines changed: 23 additions & 62 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,79 +65,53 @@ graph TD
65
65
**Note on Physical Replication Slot:** A physical replication slot (`laterbase_standby_slot` in this setup) is a feature on the primary PostgreSQL server. It ensures that the primary server retains the necessary transaction logs (WAL segments) required by the standby server, even if the standby disconnects temporarily. This prevents the standby from falling too far behind and needing a full resynchronization.
66
66
67
67
## Configuration
68
-
1.**`.env` File:**
69
-
* Open the `.env` file.
70
-
* Set `PRIMARY_HOST` to the hostname or IP address of your main **DaVinci Resolve** PostgreSQL server.
71
-
* Set `REPL_PASSWORD` to the password for the `postgres` user (or your designated replication user) on the primary DaVinci Resolve server.
72
-
***Crucially:** Set `PRIMARY_DBS` to a comma-separated list of the **actual names** of your main **DaVinci Resolve** database(s) on the primary server (e.g., `ResolveProjects`, `AnotherResolveDB`).
73
-
* Set `PGADMIN_EMAIL` to the email address you want to use for the pgAdmin login.
74
-
* Set `PGADMIN_PASSWORD` to the password you want for the pgAdmin login.
75
-
* Adjust `PRIMARY_PORT` or `PRIMARY_USER` if they differ from the defaults (5432, postgres).
76
-
* Optionally, uncomment and set `POSTGRES_USER`, `POSTGRES_DB`, or `PGDATA` under the "Standby Server Configuration" section to override the defaults used by the standby service.
77
-
***Backup Agent & Duplicati Configuration:**
78
-
* Set `LOCAL_BACKUP_PATH` to the path on the host machine where the hourly `.sql.gz` backup files should be stored (default: `./backups`). This directory is mounted into both the `backup-agent` (writeable) and `duplicati` (read-only) containers as `/backups`.
79
-
* Set `BACKUP_RETENTION_DAYS` to the number of days you want to keep local `.sql.gz` backups in the `LOCAL_BACKUP_PATH` directory. This cleanup is done by the `backup.sh` script (run by the scheduler). Defaults to 7 if not set.
80
-
* Set `TZ` to the desired timezone for the Duplicati container (e.g., `Europe/London`, `America/New_York`, `Etc/UTC`).
81
-
* Optionally, uncomment and set `DUPLICATI_WEBSERVICE_PASSWORD` to password-protect the Duplicati Web UI.
82
-
***Duplicati Job Configuration:** Cloud destination, remote retention, and schedule are configured via the Duplicati Web UI after starting the containers (see Usage section).
68
+
1.**Configure `.env` File:**
69
+
* Copy the `.env.example` file to `.env`.
70
+
* Edit the `.env` file and fill in the required values (database connection details, pgAdmin credentials, backup settings) according to the comments within the file.
83
71
84
72
2.**Primary PostgreSQL Server Preparation (`PRIMARY_HOST`):**
85
73
86
74
***Ensure DaVinci Resolve Database is Accessible:** Make sure your DaVinci Resolve database is configured to allow network connections if Laterbase is running on a different machine. Check the DaVinci Resolve Project Server settings if applicable.
87
75
***Primary Server Configuration Steps (macOS Example):**
88
-
**VERY IMPORTANT:** Configuring the primary server involves **both** manual file editing and running an automated script. These steps **must** be completed on your **primary macOS server** (`PRIMARY_HOST`) *before* you attempt to start the main Laterbase Docker containers (`docker-compose up`). Laterbase only configures the standby replica; it does **not** automatically configure your primary server.
89
-
90
-
**Step 1: Manually Edit `pg_hba.conf` (Requires `sudo` on Primary Server)**
91
-
* This step **must** be done manually on the primary server.
92
-
* Open `Terminal.app` on the primary Mac where DaVinci Resolve's PostgreSQL is running.
93
-
* **Find the `pg_hba.conf` file:** For a standard DaVinci Resolve installation on macOS, the path is usually:
(Replace `<VERSION>` with your PostgreSQL version number, e.g., `13`. You can find it by running `ls "/Library/Application Support/PostgreSQL/"` in Terminal).
96
-
* **Edit the file:** Use `nano` with `sudo`:
76
+
**VERY IMPORTANT:** Configuring the primary server involves both manual file editing and running an automated script. These steps must be completed on your primary macOS (this is usually the machine your resolve is on) (`PRIMARY_HOST`) *before* you attempt to start the main Laterbase Docker containers (`docker-compose up`). Laterbase only configures the standby replica; it does **not** automatically configure your primary server.
77
+
78
+
**Step 1: Edit Primary Server's `pg_hba.conf` (Manual Step on Primary)**
79
+
* On the primary Mac (where DaVinci Resolve's PostgreSQL runs), open Terminal and run the following command. Replace `<VERSION>` with your PostgreSQL version (e.g., 13):
(Again, replace `<VERSION>` with the correct number).
101
-
* **Add the replication line:** Add the following line to the end of the file. **Adjust the IP address/subnet (`192.168.1.0/24`)** to match the network of your Docker host running Laterbase, allowing it to connect. Use the correct `PRIMARY_USER` if it's not `postgres`.
* Add the following line at the end of the file. **Important:** Replace `192.168.1.123/32` with the actual IP address of your Laterbase Docker host. Use the correct `PRIMARY_USER` if it's not `postgres`.
84
+
```conf
103
85
# Allow replication connections from the Laterbase Docker host
104
-
host replication postgres 192.168.1.0/24 md5
86
+
host replication postgres 192.168.1.123/32 md5
105
87
```
106
-
* **Save and Exit:** Press `Ctrl+O`, then `Enter` to save. Press `Ctrl+X` to exit `nano`.
88
+
* Save the file (`Ctrl+O`, Enter) and exit (`Ctrl+X`).
107
89
108
-
**Step 2: Run the Preparation Script (Requires Docker & `.env` on Laterbase Host)**
109
-
* This script automates granting replication privileges, creating the replication slot, and attempting a configuration reload via SQL.
110
-
* Ensure your `.env` file in the Laterbase project directory is correctly configured with`PRIMARY_HOST`, `PRIMARY_PORT`, `PRIMARY_USER`, and `REPL_PASSWORD`.
111
-
* From the Laterbase project directory (where `docker-compose.yml` is), run the script using `docker-compose run`:
90
+
**Step 2: Prepare Primary Database (Run Script on Laterbase Host)**
91
+
* This script prepares the primary database by granting permissions and creating the necessary replication slot (`laterbase_standby_slot`).
92
+
* Ensure your `.env` file in the Laterbase project directory is correctly configured (especially`PRIMARY_HOST`, `PRIMARY_USER`, `REPL_PASSWORD`).
93
+
* From the Laterbase project directory (where `docker-compose.yml` is), run this command:
112
94
```bash
113
95
docker-compose run --rm --no-deps app bash /app/prepare_primary_db.sh
114
96
```
115
-
* `--rm`: Removes the temporary container after execution.
116
-
* `--no-deps`: Prevents starting linked services (like the standby DB itself).
117
-
* `app`: The service name defined in `docker-compose.yml` that has `psql` and the script.
118
-
* The script uses the `REPL_PASSWORD` from your `.env` file to connect.
119
-
* Review the script's output for any errors (e.g., connection refused, authentication failed).
120
-
121
-
**Step 3: Manually Reload/Restart Primary PostgreSQL Server (on Primary Server)**
122
-
* **Crucial:** Changes to `pg_hba.conf` (Step 1) require the primary PostgreSQL server configuration to be reloaded or the server restarted. The script (Step 2) attempts `SELECT pg_reload_conf();`, but this **may not be sufficient** for `pg_hba.conf` changes or might fail due to permissions.
123
-
* You **must** ensure the configuration is reloaded on the primary server. Choose **one** of the following methods on the primary Mac:
97
+
* Check the output for any errors. If this script fails, replication will not work.
124
98
125
-
* **Method A (Full Server Restart - Use if unsure):** If methods A or B don't work or you're unsure, a full restart of the Mac hosting the primary database will ensure the changes are applied, although it's less ideal.
126
-
127
-
* **Method B ** Quit and restart the **DaVinci Resolve Project Server** application. This usually restarts the underlying PostgreSQL server gracefully.
99
+
**Step 3: Reload Primary Server Config (Manual Step on Primary)**
100
+
* After editing `pg_hba.conf` (Step 1), the primary PostgreSQL server needs to reload its configuration.
101
+
* On the primary Mac, the easiest way is usually to **quit and restart the DaVinci Resolve Project Server application**.
102
+
* Alternatively, restarting the primary Mac will also work.
128
103
129
104
**Step 4: Verify Primary Server is Running**
130
-
* After reloading/restarting, ensure your primary PostgreSQL server (and the DaVinci Resolve Project Server application, if used) is running and accessible before proceeding to start the Laterbase services.
105
+
* Make sure the primary PostgreSQL server (and DaVinci Resolve Project Server, if used) is running before starting Laterbase.
131
106
132
107
3.**Create Backup Directory:**
133
108
* In the same directory as the `docker-compose.yml` file on your Docker host, create the backups directory (if using the default `LOCAL_BACKUP_PATH`):
134
109
```bash
135
110
mkdir backups
136
111
```
137
112
138
-
4. **(Removed)** Rclone configuration is no longer needed. Duplicati is configured via its Web UI.
139
113
140
-
## Usage
114
+
## Usage & configuration of duplicati and pgadmin,
141
115
142
116
1. **Build and Start Containers:**
143
117
* Navigate to the project directory in your terminal.
@@ -176,16 +150,3 @@ graph TD
176
150
```bash
177
151
docker-compose down
178
152
```
179
-
180
-
## Files
181
-
182
-
*`docker-compose.yml`: Defines the services (`standby`, `backup-agent`, `duplicati`, `pgadmin`, `scheduler`), their configurations, volumes, and network.
183
-
*`app/Dockerfile`: Instructions to build the PostgreSQL standby server image (based on `postgres:15`).
184
-
*`backup/Dockerfile.backup`: Instructions to build the `backup-agent` image (based on Debian, includes only `postgresql-client`).
185
-
*`.env`: Configuration file for environment variables (database credentials, pgAdmin login, etc.). **Requires user configuration.**
186
-
*`app/prepare_primary_db.sh`: **(New)** Script to automate granting replication role and creating the replication slot on the primary server via `psql`. Run manually before starting services.
187
-
*`app/setup_standby.sh`: Script run inside the standby container on first start to perform the initial base backup and configure replication.
188
-
*`backup/backup.sh`: Script run hourly (via Ofelia scheduler) inside the backup agent container to perform `pg_dump` backups into the `/backups` volume and manage local`.sql.gz` file retention.
189
-
*`backup/entrypoint.sh`: (Removed/Unused) No longer needed for the simplified `backup-agent`.
190
-
*`./backups/` (Directory to be created, or path setin`LOCAL_BACKUP_PATH`): Host directory where local backup files (`.sql.gz`) are stored by `backup-agent` and read by `duplicati`.
191
-
*`duplicati_data` (Docker Volume): Stores Duplicati's configuration database and local state.
0 commit comments