Add instructions on how to activate PGroonga

This commit is contained in:
itepechi 2023-08-06 04:38:46 +09:00
parent 4116ad6692
commit 605fa8cbb3

View file

@ -63,6 +63,20 @@ podman run -d \
postgres:14-alpine
```
If you want to use PGroonga, run the command below instead.
```sh
podman run -d \
--pod akkoma \
--restart unless-stopped \
--name akkoma-db \
-e POSTGRES_DB=YOUR_DB_NAME \
-e POSTGRES_USER=YOUR_DB_USER \
-e POSTGRES_PASSWORD=YOUR_DB_PASS \
-v ${PWD}/docker-db/:/var/lib/postgresql/data/:Z \
groonga/pgroonga:3.1.1-alpine-14
```
### 4. Setting up the backend
```sh
@ -89,6 +103,22 @@ A few notes on setup
- Make sure your database hostname is set correctly (e.g. localhost)
- Make sure your database password is also set correctly (don't leave it auto-generated)
- You should set the IP to listen on to 0.0.0.0
### 4.1. Apply the optional PGroonga migration
Make sure you apply the migration **before** the first restart of the container, otherwise you will be stuck in a loop of restarts.
_To apply the migration after the first restart, please refer to [the guide down below](#switch-to-pgroonga)._
```sh
podman exec -it akkoma-web \
pleroma_ctl \
migrate \
--migrations-path priv/repo/optional_migrations/pgroonga
```
You can revert the applied changes anytime by replacing `migrate` with `rollback`.
### 5. Test your setup
```sh
@ -127,6 +157,51 @@ podman exec -it akkoma-web \
Follow the printed link to set your password.
### 8. Optional steps
#### Switch to PGroonga
Before moving forward, make sure you have stopped the backend for safety.
```sh
podman stop akkoma-web
```
After stopping the backend, change `config :pleroma, :database, pgroonga_enabled` to `true`.
```ex
config :pleroma, :database,
rum_enabled: false,
pgroonga_enabled: true # set this option to true
```
If you have command history enabled in your shell, all you need to do is remove the `--name NAME` option and add `pleroma_ctl migrate --migrations-path priv/repo/optional_migrations/pgroonga` to the end of the command.
```sh
podman run -d \
--pod akkoma-pod \
--restart unless-stopped \ # this option is optional (bruh)
# --name akkoma-web \ # make sure to remove this option to avoid name conflict
-e DB_NAME=YOUR_DB_NAME \
-e DB_USER=YOUR_DB_USER \
-e DB_PASS=YOUR_DB_PASS \
-v ${PWD}/static/:/var/lib/akkoma/static/:Z \
-v ${PWD}/uploads/:/var/lib/akkoma/uploads/:Z \
-v ${PWD}/etc/:/etc/akkoma/:Z \
akkoma \
pleroma_ctl \
migrate \
--migrations-path priv/repo/optional_migrations/pgroonga
```
You can revert the applied changes anytime by replacing `migrate` with `rollback`.
Don't forget to start the container you stopped at the beginning of this guide.
```sh
podman start akkoma-web
```
---
## Akkoma