Compare commits

..

4 commits

2 changed files with 85 additions and 5 deletions

View file

@ -8,10 +8,12 @@ The main differences between this and the upstream repository are
- Automatically builds the Akkoma backend when building the Docker image, instead of requiring complex commands after pulling/building images - Automatically builds the Akkoma backend when building the Docker image, instead of requiring complex commands after pulling/building images
- Files/directories to mount are minified and completely separated from the repository files, allowing better control over file permissions - Files/directories to mount are minified and completely separated from the repository files, allowing better control over file permissions
- Has an actual Docker entry point, rather than a command that pretends to be an entry point - Has an actual Docker entry point, rather than a command that pretends to be an entry point
- Has out-of-the-box support for PGroonga, the fast and accurate full-text search extension for PostgreSQL - Includes out-of-the-box support for [PGroonga](https://pgroonga.github.io/), the fast and accurate full-text search extension for PostgreSQL
- Supports Podman quite well - Supports Podman quite well
## How to Setup (Podman Rootless) ## How to setup (Podman Rootless)
_You don't need to replicate backslashes followed by line breaks. They mean "Ignore the next line break" and are only used for better readability. `a \<line break> b \<line break> c` is the same as `a b c`._
### 0. Requirements ### 0. Requirements
@ -61,6 +63,20 @@ podman run -d \
postgres:14-alpine 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 ### 4. Setting up the backend
```sh ```sh
@ -82,7 +98,26 @@ podman exec -it akkoma-web \
--output /etc/akkoma/config.exs --output /etc/akkoma/config.exs
``` ```
You will be asked a few questions. Make sure the database password is not `[autogenerated]`. 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 ### 5. Test your setup
@ -120,7 +155,52 @@ podman exec -it akkoma-web \
--admin --admin
``` ```
Open the printed link to set your password. 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
```
--- ---

View file

@ -8,7 +8,7 @@ if [ "$1" = 'pleroma' ] || [ "$1" = 'pleroma_ctl' ]; then
done done
fi fi
if [ "$1" = 'pleroma' ]; then if [ "$1" = 'pleroma' ] && [ "$2" = 'start' ]; then
echo "-- Running migrations..." echo "-- Running migrations..."
pleroma_ctl migrate pleroma_ctl migrate