mirror of
https://github.com/immich-app/immich.git
synced 2024-12-29 15:11:58 +00:00
docs: Add pgadmin4 to docker-compose.yml (#9556)
* docs: Add pgadmin4 to docker-compose.yml Motivation ---------- The current documentation encourages to install pgAdmin3 on the host system. It's much simpler to add `pgAdmin4` to the `docker-compose.yml`: 1. No configuration needs to be modified, just added. 2. Better security because no additional ports need to be opened on the host. 3. Easier installation. E.g. on Archlinux there is no package pgAdmin3 anymore. 4. `pgAdmin3` does not seem to be maintained. How to test ----------- 1. Follow the documentation. 2. See if you can connect to the immich database * docs: better use separate config file I assume most users will not edit the `docker-compose.yml` and forget about `pgAdmin` once they're done. So, `pgAdmin` might get exposed to the internet with default credentials, which is not good. Better to leave a hint to change the credentials and keep the configuration separate, so users start `pgAdmin` knowingly and turn it off once they're done.
This commit is contained in:
parent
1e56352b04
commit
e39ee8a16f
4 changed files with 38 additions and 34 deletions
|
@ -2,48 +2,52 @@
|
||||||
|
|
||||||
A short guide on connecting [pgAdmin](https://www.pgadmin.org/) to Immich.
|
A short guide on connecting [pgAdmin](https://www.pgadmin.org/) to Immich.
|
||||||
|
|
||||||
:::note
|
|
||||||
|
|
||||||
In order to connect to the database the immich_postgres container **must be running**.
|
|
||||||
|
|
||||||
The passwords and usernames used below match the ones specified in the example `.env` file. If changed, please use actual values instead.
|
|
||||||
|
|
||||||
**Optional:** To connect to the database **outside** of your Docker's network:
|
|
||||||
|
|
||||||
- Expose port 5432 in your `docker-compose.yml` file.
|
|
||||||
- Edit the PostgreSQL [`pg_hba.conf`](https://www.postgresql.org/docs/current/auth-pg-hba-conf.html) file.
|
|
||||||
- Make sure your firewall does not block access to port 5432.
|
|
||||||
Note that exposing the database port increases the risk of getting attacked by hackers.
|
|
||||||
Make sure to remove the binding port after finishing the database's tasks.
|
|
||||||
|
|
||||||
:::
|
|
||||||
|
|
||||||
## 1. Install pgAdmin
|
## 1. Install pgAdmin
|
||||||
|
|
||||||
Download and install [pgAdmin](https://www.pgadmin.org/download/) following the official documentation.
|
Add a file `docker-compose-pgadmin.yml` next to your `docker-compose.yml` with the following content:
|
||||||
|
|
||||||
|
```
|
||||||
|
name: immich
|
||||||
|
|
||||||
|
services:
|
||||||
|
pgadmin:
|
||||||
|
image: dpage/pgadmin4
|
||||||
|
container_name: pgadmin4_container
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "8888:80"
|
||||||
|
environment:
|
||||||
|
PGADMIN_DEFAULT_EMAIL: user-name@domain-name.com
|
||||||
|
PGADMIN_DEFAULT_PASSWORD: strong-password
|
||||||
|
volumes:
|
||||||
|
- pgadmin-data:/var/lib/pgadmin
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
pgadmin-data:
|
||||||
|
```
|
||||||
|
|
||||||
|
Change the values of `PGADMIN_DEFAULT_EMAIL` and `PGADMIN_DEFAULT_PASSWORD` in this file.
|
||||||
|
|
||||||
|
Run `docker compose -f docker-compose.yml -f docker-compose-pgadmin.yml up` to start immich along with `pgAdmin`.
|
||||||
|
|
||||||
## 2. Add a Server
|
## 2. Add a Server
|
||||||
|
|
||||||
Open pgAdmin and click "Add New Server".
|
Open [localhost:8888](http://localhost:8888) and login with the default credentials from above.
|
||||||
|
|
||||||
<img src={require('./img/add-new-server-option.png').default} width="50%" title="new server option" />
|
Right click on `Servers` and click on `Register >> Server..` then enter the values below in the `Connection` tab.
|
||||||
|
|
||||||
## 3. Enter Connection Details
|
<img src={require('./img/pgadmin-add-new-server.png').default} width="50%" title="new server option" />
|
||||||
|
|
||||||
| Name | Value |
|
:::note
|
||||||
| -------------------- | ----------- |
|
The parameters used here match those specified in the example `.env` file. If you have changed your `.env` file, you'll need to adjust accordingly.
|
||||||
| Host name/address | `localhost` |
|
:::
|
||||||
| Port | `5432` |
|
|
||||||
| Maintenance database | `immich` |
|
|
||||||
| Username | `postgres` |
|
|
||||||
| Password | `postgres` |
|
|
||||||
|
|
||||||
<img src={require('./img/Connection-Pgadmin.png').default} width="75%" title="Connection" />
|
| Name | Value |
|
||||||
|
| -------------------- | ----------------- |
|
||||||
## 4. Save Connection
|
| Host name/address | `immich_postgres` |
|
||||||
|
| Port | `5432` |
|
||||||
|
| Maintenance database | `immich` |
|
||||||
|
| Username | `postgres` |
|
||||||
|
| Password | `postgres` |
|
||||||
|
|
||||||
Click on "Save" to connect to the Immich database.
|
Click on "Save" to connect to the Immich database.
|
||||||
|
|
||||||
:::tip
|
|
||||||
View [Database Queries](/docs/guides/database-queries/) for common database queries.
|
|
||||||
:::
|
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 36 KiB |
Binary file not shown.
Before Width: | Height: | Size: 39 KiB |
BIN
docs/docs/guides/img/pgadmin-add-new-server.png
Normal file
BIN
docs/docs/guides/img/pgadmin-add-new-server.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 68 KiB |
Loading…
Reference in a new issue