Update Source to OTP migration guide

This commit is contained in:
Norm 2022-07-02 15:24:56 -04:00
parent 14410e494a
commit 2f1061f8ef

View file

@ -28,57 +28,57 @@ Akkoma should be stopped before proceeding.
```sh
# Create uploads directory and set proper permissions (skip if using a remote uploader)
# Note: It does not have to be `/var/lib/pleroma/uploads`, you can configure it to be something else later
mkdir -p /var/lib/pleroma/uploads
chown -R pleroma /var/lib/pleroma
# Note: It does not have to be `/var/lib/akkoma/uploads`, you can configure it to be something else later
mkdir -p /var/lib/akkoma/uploads
chown -R akkoma /var/lib/akkoma
# Create custom public files directory
# Note: It does not have to be `/var/lib/pleroma/static`, you can configure it to be something else later
mkdir -p /var/lib/pleroma/static
chown -R pleroma /var/lib/pleroma
# Note: It does not have to be `/var/lib/akkoma/static`, you can configure it to be something else later
mkdir -p /var/lib/akkoma/static
chown -R akkoma /var/lib/akkoma
# If you use the local uploader with default settings your uploads should be located in `~pleroma/uploads`
mv ~pleroma/uploads/* /var/lib/pleroma/uploads
# If you use the local uploader with default settings your uploads should be located in `~akkoma/uploads`
mv ~akkoma/uploads/* /var/lib/akkoma/uploads
# If you have created the custom public files directory with default settings it should be located in `~pleroma/instance/static`
mv ~pleroma/instance/static /var/lib/pleroma/static
# If you have created the custom public files directory with default settings it should be located in `~akkoma/instance/static`
mv ~akkoma/instance/static /var/lib/akkoma/static
```
### Moving emoji
Assuming you have all emojis in subdirectories of `priv/static/emoji` moving them can be done with
```sh
mkdir /var/lib/pleroma/static/emoji
ls -d ~pleroma/priv/static/emoji/*/ | xargs -i sh -c 'mv "{}" "/var/lib/pleroma/static/emoji/$(basename {})"'
mkdir /var/lib/akkoma/static/emoji
ls -d ~akkoma/priv/static/emoji/*/ | xargs -i sh -c 'mv "{}" "/var/lib/akkoma/static/emoji/$(basename {})"'
```
But, if for some reason you have custom emojis in the root directory you should copy the whole directory instead.
```sh
mv ~pleroma/priv/static/emoji /var/lib/pleroma/static/emoji
mv ~akkoma/priv/static/emoji /var/lib/akkoma/static/emoji
```
and then copy custom emojis to `/var/lib/pleroma/static/emoji/custom`.
and then copy custom emojis to `/var/lib/akkoma/static/emoji/custom`.
This is needed because storing custom emojis in the root directory is deprecated, but if you just move them to `/var/lib/pleroma/static/emoji/custom` it will break emoji urls on old posts.
This is needed because storing custom emojis in the root directory is deprecated, but if you just move them to `/var/lib/akkoma/static/emoji/custom` it will break emoji urls on old posts.
Note that globs have been replaced with `pack_extensions`, so if your emojis are not in png/gif you should [modify the default value](../configuration/cheatsheet.md#emoji).
### Moving the config
```sh
# Create the config directory
# The default path for Akkoma config is /etc/pleroma/config.exs
# The default path for Akkoma config is /etc/akkoma/config.exs
# but it can be set via PLEROMA_CONFIG_PATH environment variable
mkdir -p /etc/pleroma
mkdir -p /etc/akkoma
# Move the config file
mv ~pleroma/config/prod.secret.exs /etc/pleroma/config.exs
mv ~akkoma/config/prod.secret.exs /etc/akkoma/config.exs
# Change `use Mix.Config` at the top to `import Config`
$EDITOR /etc/pleroma/config.exs
$EDITOR /etc/akkoma/config.exs
```
## Installing the release
Before proceeding, get the flavour from [Detecting flavour](otp_en.md#detecting-flavour) section in OTP installation guide.
```sh
# Delete all files in pleroma user's directory
rm -r ~pleroma/*
# Delete all files in akkoma user's directory
rm -r ~akkoma/*
# Set the flavour environment variable to the string you got in Detecting flavour section.
# For example if the flavour is `amd64-musl` the command will be
@ -86,55 +86,55 @@ export FLAVOUR="amd64-musl"
# Clone the release build into a temporary directory and unpack it
# Replace `stable` with `unstable` if you want to run the unstable branch
su pleroma -s $SHELL -lc "
curl 'https://git.pleroma.social/api/v4/projects/2/jobs/artifacts/stable/download?job=$FLAVOUR' -o /tmp/pleroma.zip
unzip /tmp/pleroma.zip -d /tmp/
su akkoma -s $SHELL -lc "
curl 'https://akkoma-updates.s3-website.fr-par.scw.cloud/develop/akkoma-$FLAVOUR.zip' -o /tmp/akkoma.zip
unzip /tmp/akkoma.zip -d /tmp/
"
# Move the release to the home directory and delete temporary files
su pleroma -s $SHELL -lc "
mv /tmp/release/* ~pleroma/
su akkoma -s $SHELL -lc "
mv /tmp/release/* ~akkoma/
rmdir /tmp/release
rm /tmp/pleroma.zip
rm /tmp/akkoma.zip
"
# Start the instance to verify that everything is working as expected
su pleroma -s $SHELL -lc "./bin/pleroma daemon"
su akkoma -s $SHELL -lc "./bin/pleroma daemon"
# Wait for about 20 seconds and query the instance endpoint, if it shows your uri, name and email correctly, you are configured correctly
sleep 20 && curl http://localhost:4000/api/v1/instance
# Stop the instance
su pleroma -s $SHELL -lc "./bin/pleroma stop"
su akkoma -s $SHELL -lc "./bin/pleroma stop"
```
## Setting up a system service
OTP releases have different service files than from-source installs so they need to be copied over again.
**Warning:** The service files assume pleroma user's home directory is `/opt/pleroma`, please make sure all paths fit your installation.
**Warning:** The service files assume akkoma user's home directory is `/opt/akkoma`, please make sure all paths fit your installation.
=== "Alpine"
```sh
# Copy the service into a proper directory
cp -f ~pleroma/installation/init.d/pleroma /etc/init.d/pleroma
cp -f ~akkoma/installation/init.d/akkoma /etc/init.d/akkoma
# Start pleroma
rc-service pleroma start
# Start akkoma
rc-service akkoma start
```
=== "Debian/Ubuntu"
```sh
# Copy the service into a proper directory
cp ~pleroma/installation/pleroma.service /etc/systemd/system/pleroma.service
cp ~akkoma/installation/akkoma.service /etc/systemd/system/akkoma.service
# Reload service files
systemctl daemon-reload
# Reenable pleroma to start on boot
systemctl reenable pleroma
# Reenable akkoma to start on boot
systemctl reenable akkoma
# Start pleroma
systemctl start pleroma
# Start akkoma
systemctl start akkoma
```
## Running mix tasks