From 605fa8cbb389a21c5ba0d23d7d15864e6ea4f543 Mon Sep 17 00:00:00 2001 From: itepechi <72330683+itepechi@users.noreply.github.com> Date: Sun, 6 Aug 2023 04:38:46 +0900 Subject: [PATCH] Add instructions on how to activate PGroonga --- README.md | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/README.md b/README.md index bfc1cdd5e..b39a92f0f 100644 --- a/README.md +++ b/README.md @@ -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