From fd9670e250f06fb039884839f3bcc3680a020927 Mon Sep 17 00:00:00 2001 From: Norm Date: Tue, 5 Jul 2022 06:01:25 -0400 Subject: [PATCH 01/18] Add /etc/akkoma in the config search path Keeping /etc/pleroma to ease migration from Pleroma. --- lib/pleroma/config/release_runtime_provider.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/config/release_runtime_provider.ex b/lib/pleroma/config/release_runtime_provider.ex index e5e9d3dcd..567229196 100644 --- a/lib/pleroma/config/release_runtime_provider.ex +++ b/lib/pleroma/config/release_runtime_provider.ex @@ -12,7 +12,8 @@ def load(config, opts) do with_defaults = Config.Reader.merge(config, Pleroma.Config.Holder.release_defaults()) config_path = - opts[:config_path] || System.get_env("PLEROMA_CONFIG_PATH") || "/etc/pleroma/config.exs" + opts[:config_path] || System.get_env("PLEROMA_CONFIG_PATH") || "/etc/akkoma/config.exs" || + "/etc/pleroma/config.exs" with_runtime_config = if File.exists?(config_path) do -- 2.43.0 From 77f7d0de28e5042d41fad0fb431290d1c5d510c9 Mon Sep 17 00:00:00 2001 From: sleepycrow Date: Sun, 6 Mar 2022 14:24:32 +0100 Subject: [PATCH 02/18] Update Caddyfile to Caddy v2 --- installation/caddyfile-pleroma.example | 31 +++++--------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/installation/caddyfile-pleroma.example b/installation/caddyfile-pleroma.example index 7985d9c67..cc7dda011 100644 --- a/installation/caddyfile-pleroma.example +++ b/installation/caddyfile-pleroma.example @@ -5,34 +5,13 @@ # 2. Copy this section into your Caddyfile and restart Caddy. example.tld { - log /var/log/caddy/pleroma_access.log - errors /var/log/caddy/pleroma_error.log + log { + output file /var/log/caddy/pleroma.log + } - gzip + encode gzip # this is explicitly IPv4 since Pleroma.Web.Endpoint binds on IPv4 only # and `localhost.` resolves to [::0] on some systems: see issue #930 - proxy / 127.0.0.1:4000 { - websocket - transparent - } - - tls { - # Remove the rest of the lines in here, if you want to support older devices - key_type p256 - ciphers ECDHE-ECDSA-WITH-CHACHA20-POLY1305 ECDHE-RSA-WITH-CHACHA20-POLY1305 ECDHE-ECDSA-AES256-GCM-SHA384 ECDHE-RSA-AES256-GCM-SHA384 ECDHE-ECDSA-AES128-GCM-SHA256 ECDHE-RSA-AES128-GCM-SHA256 - } - - # If you do not want to use the mediaproxy function, remove these lines. - # To use this directive, you need the http.cache plugin for Caddy. - cache { - match_path /media - default_max_age 720m - } - - cache { - match_path /proxy - default_max_age 720m - } - # Stop removing lines here. + reverse_proxy 127.0.0.1:4000 } -- 2.43.0 From a1644003bbc555ccac4639c688203d1ffcfc74df Mon Sep 17 00:00:00 2001 From: Norm Date: Tue, 5 Jul 2022 06:14:40 -0400 Subject: [PATCH 03/18] Update caddyfile --- .../{caddyfile-pleroma.example => caddyfile-akkoma.example} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename installation/{caddyfile-pleroma.example => caddyfile-akkoma.example} (82%) diff --git a/installation/caddyfile-pleroma.example b/installation/caddyfile-akkoma.example similarity index 82% rename from installation/caddyfile-pleroma.example rename to installation/caddyfile-akkoma.example index cc7dda011..5cc75a1fc 100644 --- a/installation/caddyfile-pleroma.example +++ b/installation/caddyfile-akkoma.example @@ -1,4 +1,4 @@ -# default Caddyfile config for Pleroma +# default Caddyfile config for Akkoma # # Simple installation instructions: # 1. Replace 'example.tld' with your instance's domain wherever it appears. @@ -6,7 +6,7 @@ example.tld { log { - output file /var/log/caddy/pleroma.log + output file /var/log/caddy/akkoma.log } encode gzip -- 2.43.0 From 988f971c1bfc3397f7e5d86e6c01940515d68c3d Mon Sep 17 00:00:00 2001 From: Norm Date: Tue, 5 Jul 2022 06:15:46 -0400 Subject: [PATCH 04/18] Update nginx-cache-purge.sh --- installation/nginx-cache-purge.sh.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installation/nginx-cache-purge.sh.example b/installation/nginx-cache-purge.sh.example index 5f6cbb128..6cd01d1e7 100755 --- a/installation/nginx-cache-purge.sh.example +++ b/installation/nginx-cache-purge.sh.example @@ -5,7 +5,7 @@ SCRIPTNAME=${0##*/} # NGINX cache directory -CACHE_DIRECTORY="/tmp/pleroma-media-cache" +CACHE_DIRECTORY="/tmp/akkoma-media-cache" ## Return the files where the items are cached. ## $1 - the filename, can be a pattern . -- 2.43.0 From b389aa7bc1e10ae3852c7687bcbf70f68f415ce1 Mon Sep 17 00:00:00 2001 From: Norm Date: Tue, 5 Jul 2022 06:18:46 -0400 Subject: [PATCH 05/18] Update nginx config --- installation/{pleroma.nginx => akkoma.nginx} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename installation/{pleroma.nginx => akkoma.nginx} (94%) diff --git a/installation/pleroma.nginx b/installation/akkoma.nginx similarity index 94% rename from installation/pleroma.nginx rename to installation/akkoma.nginx index 9890cb2b1..772716677 100644 --- a/installation/pleroma.nginx +++ b/installation/akkoma.nginx @@ -1,4 +1,4 @@ -# default nginx site config for Pleroma +# default nginx site config for Akkoma # # Simple installation instructions: # 1. Install your TLS certificate, possibly using Let's Encrypt. @@ -6,7 +6,7 @@ # 3. Copy this file to /etc/nginx/sites-available/ and then add a symlink to it # in /etc/nginx/sites-enabled/ and run 'nginx -s reload' or restart nginx. -proxy_cache_path /tmp/pleroma-media-cache levels=1:2 keys_zone=pleroma_media_cache:10m max_size=10g +proxy_cache_path /tmp/akkoma-media-cache levels=1:2 keys_zone=akkoma_media_cache:10m max_size=10g inactive=720m use_temp_path=off; # this is explicitly IPv4 since Pleroma.Web.Endpoint binds on IPv4 only @@ -82,7 +82,7 @@ server { } location ~ ^/(media|proxy) { - proxy_cache pleroma_media_cache; + proxy_cache akkoma_media_cache; slice 1m; proxy_cache_key $host$uri$is_args$args$slice_range; proxy_set_header Range $slice_range; -- 2.43.0 From 23bdaae38b50b9627f70c3cdfae03f6da158a594 Mon Sep 17 00:00:00 2001 From: Norm Date: Tue, 5 Jul 2022 06:31:12 -0400 Subject: [PATCH 06/18] Update Apache configs --- .../{pleroma-apache.conf => akkoma-apache.conf} | 14 +++++++------- installation/apache-cache-purge.sh.example | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) rename installation/{pleroma-apache.conf => akkoma-apache.conf} (87%) diff --git a/installation/pleroma-apache.conf b/installation/akkoma-apache.conf similarity index 87% rename from installation/pleroma-apache.conf rename to installation/akkoma-apache.conf index 139abe9e1..c9f123532 100644 --- a/installation/pleroma-apache.conf +++ b/installation/akkoma-apache.conf @@ -1,14 +1,14 @@ -# Sample Apache config for Pleroma +# Sample Apache config for Akkoma # # Simple installation instructions: # 1. Install your TLS certificate. We recommend using Let's Encrypt via Certbot # 2. Replace 'example.tld' with your instance's domain. # 3. This assumes a Debian-style Apache config. Copy this file to # /etc/apache2/sites-available/ and then activate the site by running -# 'a2ensite pleroma-apache.conf', then restart Apache. +# 'a2ensite akkoma-apache.conf', then restart Apache. # # Optional: enable disk-based caching for the media proxy -# For details, see https://git.pleroma.social/pleroma/pleroma/wikis/How%20to%20activate%20mediaproxy +# For details, see https://docs.akkoma.dev/main/backend/configuration/howto_mediaproxy/ # # 1. Create a directory as shown below for the CacheRoot and make sure # the Apache user can write to it. @@ -42,9 +42,9 @@ Define servername example.tld ServerName ${servername} ServerTokens Prod -# If you want Pleroma-specific logs -#ErrorLog /var/log/httpd-pleroma-error.log -#CustomLog /var/log/httpd-pleroma-access.log combined +# If you want Akkoma-specific logs +#ErrorLog /var/log/httpd-akkoma-error.log +#CustomLog /var/log/httpd-akkoma-access.log combined RewriteEngine on @@ -60,7 +60,7 @@ ServerTokens Prod Include /etc/letsencrypt/options-ssl-apache.conf # Uncomment the following to enable MediaProxy caching on disk - #CacheRoot /tmp/pleroma-media-cache/ + #CacheRoot /tmp/akkoma-media-cache/ #CacheDirLevels 1 #CacheDirLength 2 #CacheEnable disk /proxy diff --git a/installation/apache-cache-purge.sh.example b/installation/apache-cache-purge.sh.example index 7b4262875..65df9cc11 100755 --- a/installation/apache-cache-purge.sh.example +++ b/installation/apache-cache-purge.sh.example @@ -4,7 +4,7 @@ # You will likely need to setup a sudo rule like the following: # # Cmnd_Alias HTCACHECLEAN = /usr/local/sbin/htcacheclean -# pleroma ALL=HTCACHECLEAN, NOPASSWD: HTCACHECLEAN +# akkoma ALL=HTCACHECLEAN, NOPASSWD: HTCACHECLEAN # # Please also ensure you have enabled: # @@ -16,7 +16,7 @@ SCRIPTNAME=${0##*/} # mod_disk_cache directory -CACHE_DIRECTORY="/tmp/pleroma-media-cache" +CACHE_DIRECTORY="/tmp/akkoma-media-cache" ## Removes an item via the htcacheclean utility ## $1 - the filename, can be a pattern . -- 2.43.0 From 155319f09eac483880f1832f8932e755e532afb0 Mon Sep 17 00:00:00 2001 From: Norm Date: Tue, 5 Jul 2022 06:33:49 -0400 Subject: [PATCH 07/18] Update systemd unit file --- .../{pleroma.service => akkoma.service} | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) rename installation/{pleroma.service => akkoma.service} (65%) diff --git a/installation/pleroma.service b/installation/akkoma.service similarity index 65% rename from installation/pleroma.service rename to installation/akkoma.service index 8338228d8..caddf7c4b 100644 --- a/installation/pleroma.service +++ b/installation/akkoma.service @@ -1,5 +1,5 @@ [Unit] -Description=Pleroma social network +Description=Akkoma social network After=network.target postgresql.service [Service] @@ -7,23 +7,23 @@ ExecReload=/bin/kill $MAINPID KillMode=process Restart=on-failure -; Name of the user that runs the Pleroma service. -User=pleroma -; Declares that Pleroma runs in production mode. +; Name of the user that runs the Akkoma service. +User=akkoma +; Declares that Akkoma runs in production mode. Environment="MIX_ENV=prod" ; Make sure that all paths fit your installation. -; Path to the home directory of the user running the Pleroma service. -Environment="HOME=/var/lib/pleroma" -; Path to the folder containing the Pleroma installation. -WorkingDirectory=/opt/pleroma +; Path to the home directory of the user running the Akkoma service. +Environment="HOME=/var/lib/akkoma" +; Path to the folder containing the Akkoma installation. +WorkingDirectory=/opt/akkoma ; Path to the Mix binary. ExecStart=/usr/bin/mix phx.server ; Some security directives. ; Use private /tmp and /var/tmp folders inside a new file system namespace, which are discarded after the process stops. PrivateTmp=true -; The /home, /root, and /run/user folders can not be accessed by this service anymore. If your Pleroma user has its home folder in one of the restricted places, or use one of these folders as its working directory, you have to set this to false. +; The /home, /root, and /run/user folders can not be accessed by this service anymore. If your Akkoma user has its home folder in one of the restricted places, or use one of these folders as its working directory, you have to set this to false. ProtectHome=true ; Mount /usr, /boot, and /etc as read-only for processes invoked by this service. ProtectSystem=full -- 2.43.0 From dffad1e07776fe08b1b04fe309fcefaec50f1e9d Mon Sep 17 00:00:00 2001 From: Norm Date: Tue, 5 Jul 2022 06:35:38 -0400 Subject: [PATCH 08/18] Update supervisord file --- installation/akkoma.supervisord | 21 +++++++++++++++++++++ installation/pleroma.supervisord | 21 --------------------- 2 files changed, 21 insertions(+), 21 deletions(-) create mode 100644 installation/akkoma.supervisord delete mode 100644 installation/pleroma.supervisord diff --git a/installation/akkoma.supervisord b/installation/akkoma.supervisord new file mode 100644 index 000000000..8fd5e8d42 --- /dev/null +++ b/installation/akkoma.supervisord @@ -0,0 +1,21 @@ +; Assumes akkoma is installed in /home/akkoma/akkoma and running as the akkoma user +; Also assumes mix is in /usr/bin, this might differ on BSDs or niche Linux distros +; Logs into /home/akkoma/logs +[program:akkoma] +command=/usr/bin/mix phx.server +directory=/home/akkoma/akkoma +autostart=true +autorestart=true +user=akkoma +environment = + MIX_ENV=prod, + HOME=/home/akkoma, + USER=akkoma, + PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/akkoma/bin:%(ENV_PATH)s", + PWD=/home/akkoma/akkoma +stdout_logfile=/home/akkoma/logs/stdout.log +stdout_logfile_maxbytes=50MB +stdout_logfile_backups=10 +stderr_logfile=/home/akkoma/logs/stderr.log +stderr_logfile_maxbytes=50MB +stderr_logfile_backups=10 \ No newline at end of file diff --git a/installation/pleroma.supervisord b/installation/pleroma.supervisord deleted file mode 100644 index 19efffd6e..000000000 --- a/installation/pleroma.supervisord +++ /dev/null @@ -1,21 +0,0 @@ -; Assumes pleroma is installed in /home/pleroma/pleroma and running as the pleroma user -; Also assumes mix is in /usr/bin, this might differ on BSDs or niche Linux distros -; Logs into /home/pleroma/logs -[program:pleroma] -command=/usr/bin/mix phx.server -directory=/home/pleroma/pleroma -autostart=true -autorestart=true -user=pleroma -environment = - MIX_ENV=prod, - HOME=/home/pleroma, - USER=pleroma, - PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/pleroma/bin:%(ENV_PATH)s", - PWD=/home/pleroma/pleroma -stdout_logfile=/home/pleroma/logs/stdout.log -stdout_logfile_maxbytes=50MB -stdout_logfile_backups=10 -stderr_logfile=/home/pleroma/logs/stderr.log -stderr_logfile_maxbytes=50MB -stderr_logfile_backups=10 \ No newline at end of file -- 2.43.0 From 283f6b169dc631eb113601d48cf0a832484fac87 Mon Sep 17 00:00:00 2001 From: Norm Date: Tue, 5 Jul 2022 06:37:14 -0400 Subject: [PATCH 09/18] Rename vcl and mongooseim config --- installation/{pleroma-mongooseim.cfg => akkoma-mongooseim.cfg} | 0 installation/{pleroma.vcl => akkoma.vcl} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename installation/{pleroma-mongooseim.cfg => akkoma-mongooseim.cfg} (100%) rename installation/{pleroma.vcl => akkoma.vcl} (100%) diff --git a/installation/pleroma-mongooseim.cfg b/installation/akkoma-mongooseim.cfg similarity index 100% rename from installation/pleroma-mongooseim.cfg rename to installation/akkoma-mongooseim.cfg diff --git a/installation/pleroma.vcl b/installation/akkoma.vcl similarity index 100% rename from installation/pleroma.vcl rename to installation/akkoma.vcl -- 2.43.0 From daf03b5178fdb62d7b54d20b85857742ad1aab6a Mon Sep 17 00:00:00 2001 From: Norm Date: Tue, 5 Jul 2022 06:39:51 -0400 Subject: [PATCH 10/18] Update FreeBSD files --- installation/freebsd/rc.d/akkoma | 27 +++++++++++++++++++++++++++ installation/freebsd/rc.d/pleroma | 27 --------------------------- 2 files changed, 27 insertions(+), 27 deletions(-) create mode 100755 installation/freebsd/rc.d/akkoma delete mode 100755 installation/freebsd/rc.d/pleroma diff --git a/installation/freebsd/rc.d/akkoma b/installation/freebsd/rc.d/akkoma new file mode 100755 index 000000000..38186522b --- /dev/null +++ b/installation/freebsd/rc.d/akkoma @@ -0,0 +1,27 @@ +#!/bin/sh +# $FreeBSD$ +# PROVIDE: akkoma +# REQUIRE: DAEMON postgresql +# KEYWORD: shutdown + +# sudo -u akkoma MIX_ENV=prod elixir --erl \"-detached\" -S mix phx.server + +. /etc/rc.subr + +name=akkoma +rcvar=akkoma_enable + +desc="Akkoma Social Media Platform" + +load_rc_config ${name} + +: ${akkoma_user:=akkoma} +: ${akkoma_home:=$(getent passwd ${akkoma_user} | awk -F: '{print $6}')} +: ${akkoma_chdir:="${akkoma_home}/akkoma"} +: ${akkoma_env:="HOME=${akkoma_home} MIX_ENV=prod"} + +command=/usr/local/bin/elixir +command_args="--erl \"-detached\" -S /usr/local/bin/mix phx.server" +procname="*beam.smp" + +run_rc_command "$1" diff --git a/installation/freebsd/rc.d/pleroma b/installation/freebsd/rc.d/pleroma deleted file mode 100755 index f62aef18d..000000000 --- a/installation/freebsd/rc.d/pleroma +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# $FreeBSD$ -# PROVIDE: pleroma -# REQUIRE: DAEMON postgresql -# KEYWORD: shutdown - -# sudo -u pleroma MIX_ENV=prod elixir --erl \"-detached\" -S mix phx.server - -. /etc/rc.subr - -name=pleroma -rcvar=pleroma_enable - -desc="Pleroma Social Media Platform" - -load_rc_config ${name} - -: ${pleroma_user:=pleroma} -: ${pleroma_home:=$(getent passwd ${pleroma_user} | awk -F: '{print $6}')} -: ${pleroma_chdir:="${pleroma_home}/pleroma"} -: ${pleroma_env:="HOME=${pleroma_home} MIX_ENV=prod"} - -command=/usr/local/bin/elixir -command_args="--erl \"-detached\" -S /usr/local/bin/mix phx.server" -procname="*beam.smp" - -run_rc_command "$1" -- 2.43.0 From a858006d1e20bde720121a96b60253e8c623d961 Mon Sep 17 00:00:00 2001 From: Norm Date: Tue, 5 Jul 2022 06:41:28 -0400 Subject: [PATCH 11/18] Move Apache and nginx files to subdirs --- installation/{ => apache}/akkoma-apache.conf | 0 installation/{ => apache}/apache-cache-purge.sh.example | 0 installation/{ => nginx}/akkoma.nginx | 0 installation/{ => nginx}/nginx-cache-purge.sh.example | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename installation/{ => apache}/akkoma-apache.conf (100%) rename installation/{ => apache}/apache-cache-purge.sh.example (100%) rename installation/{ => nginx}/akkoma.nginx (100%) rename installation/{ => nginx}/nginx-cache-purge.sh.example (100%) diff --git a/installation/akkoma-apache.conf b/installation/apache/akkoma-apache.conf similarity index 100% rename from installation/akkoma-apache.conf rename to installation/apache/akkoma-apache.conf diff --git a/installation/apache-cache-purge.sh.example b/installation/apache/apache-cache-purge.sh.example similarity index 100% rename from installation/apache-cache-purge.sh.example rename to installation/apache/apache-cache-purge.sh.example diff --git a/installation/akkoma.nginx b/installation/nginx/akkoma.nginx similarity index 100% rename from installation/akkoma.nginx rename to installation/nginx/akkoma.nginx diff --git a/installation/nginx-cache-purge.sh.example b/installation/nginx/nginx-cache-purge.sh.example similarity index 100% rename from installation/nginx-cache-purge.sh.example rename to installation/nginx/nginx-cache-purge.sh.example -- 2.43.0 From be001973ceea169265d91718f1fc613f7bbdba70 Mon Sep 17 00:00:00 2001 From: Norm Date: Tue, 5 Jul 2022 06:44:59 -0400 Subject: [PATCH 12/18] Update docs to mention new nginx conf location --- docs/configuration/howto_mediaproxy.md | 2 +- docs/installation/alpine_linux_en.md | 2 +- docs/installation/arch_linux_en.md | 2 +- docs/installation/debian_based_en.md | 2 +- docs/installation/debian_based_jp.md | 2 +- docs/installation/freebsd_en.md | 2 +- docs/installation/gentoo_en.md | 2 +- docs/installation/netbsd_en.md | 2 +- docs/installation/otp_en.md | 6 +++--- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/configuration/howto_mediaproxy.md b/docs/configuration/howto_mediaproxy.md index d28cf900a..8ad81bdfb 100644 --- a/docs/configuration/howto_mediaproxy.md +++ b/docs/configuration/howto_mediaproxy.md @@ -18,7 +18,7 @@ Also add the following on top of the configuration, outside of the `server` bloc ``` proxy_cache_path /tmp/akkoma-media-cache levels=1:2 keys_zone=akkoma_media_cache:10m max_size=10g inactive=720m use_temp_path=off; ``` -If you came here from one of the installation guides, take a look at the example configuration `/installation/akkoma.nginx`, where this part is already included. +If you came here from one of the installation guides, take a look at the example configuration `/installation/nginx/akkoma.nginx`, where this part is already included. * Append the following to your `prod.secret.exs` or `dev.secret.exs` (depends on which mode your instance is running): ``` diff --git a/docs/installation/alpine_linux_en.md b/docs/installation/alpine_linux_en.md index 2bed976a9..735b89901 100644 --- a/docs/installation/alpine_linux_en.md +++ b/docs/installation/alpine_linux_en.md @@ -161,7 +161,7 @@ If that doesn’t work, make sure, that nginx is not already running. If it stil * Copy the example nginx configuration to the nginx folder ```shell -sudo cp /opt/akkoma/installation/akkoma.nginx /etc/nginx/conf.d/akkoma.conf +sudo cp /opt/akkoma/installation/nginx/akkoma.nginx /etc/nginx/conf.d/akkoma.conf ``` * Before starting nginx edit the configuration and change it to your needs. You must change change `server_name` and the paths to the certificates. You can use `nano` (install with `apk add nano` if missing). diff --git a/docs/installation/arch_linux_en.md b/docs/installation/arch_linux_en.md index dfddfe23c..4c8110b66 100644 --- a/docs/installation/arch_linux_en.md +++ b/docs/installation/arch_linux_en.md @@ -168,7 +168,7 @@ If that doesn’t work, make sure, that nginx is not already running. If it stil * Copy the example nginx configuration and activate it: ```shell -sudo cp /opt/akkoma/installation/akkoma.nginx /etc/nginx/sites-available/akkoma.nginx +sudo cp /opt/akkoma/installation/nginx/akkoma.nginx /etc/nginx/sites-available/akkoma.nginx sudo ln -s /etc/nginx/sites-available/akkoma.nginx /etc/nginx/sites-enabled/akkoma.nginx ``` diff --git a/docs/installation/debian_based_en.md b/docs/installation/debian_based_en.md index b67c1edc2..86d371f1e 100644 --- a/docs/installation/debian_based_en.md +++ b/docs/installation/debian_based_en.md @@ -131,7 +131,7 @@ If that doesn’t work, make sure, that nginx is not already running. If it stil * Copy the example nginx configuration and activate it: ```shell -sudo cp /opt/akkoma/installation/akkoma.nginx /etc/nginx/sites-available/akkoma.nginx +sudo cp /opt/akkoma/installation/nginx/akkoma.nginx /etc/nginx/sites-available/akkoma.nginx sudo ln -s /etc/nginx/sites-available/akkoma.nginx /etc/nginx/sites-enabled/akkoma.nginx ``` diff --git a/docs/installation/debian_based_jp.md b/docs/installation/debian_based_jp.md index 5d38f43cf..51d24a2d7 100644 --- a/docs/installation/debian_based_jp.md +++ b/docs/installation/debian_based_jp.md @@ -143,7 +143,7 @@ sudo certbot certonly --email -d --standalone * nginxの設定ファイルサンプルをnginxフォルダーにコピーします。 ``` -sudo cp /opt/akkoma/installation/akkoma.nginx /etc/nginx/sites-available/akkoma.nginx +sudo cp /opt/akkoma/installation/nginx/akkoma.nginx /etc/nginx/sites-available/akkoma.nginx sudo ln -s /etc/nginx/sites-available/akkoma.nginx /etc/nginx/sites-enabled/akkoma.nginx ``` diff --git a/docs/installation/freebsd_en.md b/docs/installation/freebsd_en.md index 5d6779ed2..2b439a7df 100644 --- a/docs/installation/freebsd_en.md +++ b/docs/installation/freebsd_en.md @@ -163,7 +163,7 @@ http { } ``` -As root, copy `/home/akkoma/akkoma/installation/akkoma.nginx` to +As root, copy `/home/akkoma/akkoma/installation/nginx/akkoma.nginx` to `/usr/local/etc/nginx/sites-available/akkoma.nginx`. Edit the defaults of `/usr/local/etc/nginx/sites-available/akkoma.nginx`: diff --git a/docs/installation/gentoo_en.md b/docs/installation/gentoo_en.md index 176eaab47..6ca029720 100644 --- a/docs/installation/gentoo_en.md +++ b/docs/installation/gentoo_en.md @@ -217,7 +217,7 @@ If you are using any additional subdomains, such as for a media proxy, you can r * Copy the example nginx configuration and activate it: ```shell - # cp /home/akkoma/akkoma/installation/akkoma.nginx /etc/nginx/sites-available/ + # cp /home/akkoma/akkoma/installation/nginx/akkoma.nginx /etc/nginx/sites-available/ # ln -s /etc/nginx/sites-available/akkoma.nginx /etc/nginx/sites-enabled/akkoma.nginx ``` diff --git a/docs/installation/netbsd_en.md b/docs/installation/netbsd_en.md index df05f0e96..164ed6d77 100644 --- a/docs/installation/netbsd_en.md +++ b/docs/installation/netbsd_en.md @@ -101,7 +101,7 @@ $ MIX_ENV=prod mix ecto.migrate ## Configuring nginx Install the example configuration file -`/home/akkoma/akkoma/installation/akkoma.nginx` to +`/home/akkoma/akkoma/installation/nginx/akkoma.nginx` to `/usr/pkg/etc/nginx.conf`. Note that it will need to be wrapped in a `http {}` block. You should add diff --git a/docs/installation/otp_en.md b/docs/installation/otp_en.md index 0d433686e..05aab9a58 100644 --- a/docs/installation/otp_en.md +++ b/docs/installation/otp_en.md @@ -175,18 +175,18 @@ The location of nginx configs is dependent on the distro === "Alpine" ``` - cp /opt/akkoma/installation/akkoma.nginx /etc/nginx/conf.d/akkoma.conf + cp /opt/akkoma/installation/nginx/akkoma.nginx /etc/nginx/conf.d/akkoma.conf ``` === "Debian/Ubuntu" ``` - cp /opt/akkoma/installation/akkoma.nginx /etc/nginx/sites-available/akkoma.conf + cp /opt/akkoma/installation/nginx/akkoma.nginx /etc/nginx/sites-available/akkoma.conf ln -s /etc/nginx/sites-available/akkoma.conf /etc/nginx/sites-enabled/akkoma.conf ``` If your distro does not have either of those you can append `include /etc/nginx/akkoma.conf` to the end of the http section in /etc/nginx/nginx.conf and ```sh -cp /opt/akkoma/installation/akkoma.nginx /etc/nginx/akkoma.conf +cp /opt/akkoma/installation/nginx/akkoma.nginx /etc/nginx/akkoma.conf ``` #### Edit the nginx config -- 2.43.0 From dcf1b44ce51e8bd31271e1d22c9b9a0deb70d781 Mon Sep 17 00:00:00 2001 From: Norm Date: Tue, 5 Jul 2022 06:46:47 -0400 Subject: [PATCH 13/18] Update OpenRC service file --- installation/init.d/akkoma | 45 +++++++++++++++++++++++++++++++++++++ installation/init.d/pleroma | 45 ------------------------------------- 2 files changed, 45 insertions(+), 45 deletions(-) create mode 100755 installation/init.d/akkoma delete mode 100755 installation/init.d/pleroma diff --git a/installation/init.d/akkoma b/installation/init.d/akkoma new file mode 100755 index 000000000..bf70c34fb --- /dev/null +++ b/installation/init.d/akkoma @@ -0,0 +1,45 @@ +#!/sbin/openrc-run +supervisor=supervise-daemon +command_user=akkoma:akkoma +command_background=1 +# Ask process to terminate within 30 seconds, otherwise kill it +retry="SIGTERM/30/SIGKILL/5" +pidfile="/var/run/akkoma.pid" +directory=/opt/akkoma +healthcheck_delay=60 +healthcheck_timer=30 + +: ${akkoma_port:-4000} + +# Needs OpenRC >= 0.42 +#respawn_max=0 +#respawn_delay=5 + +# put akkoma_console=YES in /etc/conf.d/akkoma if you want to be able to +# connect to akkoma via an elixir console +if yesno "${akkoma_console}"; then + command=elixir + command_args="--name akkoma@127.0.0.1 --erl '-kernel inet_dist_listen_min 9001 inet_dist_listen_max 9001 inet_dist_use_interface {127,0,0,1}' -S mix phx.server" + + start_post() { + einfo "You can get a console by using this command as akkoma's user:" + einfo "iex --name console@127.0.0.1 --remsh akkoma@127.0.0.1" + } +else + command=/usr/bin/mix + command_args="phx.server" +fi + +export MIX_ENV=prod + +depend() { + need nginx postgresql +} + +healthcheck() { + # put akkoma_health=YES in /etc/conf.d/akkoma if you want healthchecking + # and make sure you have curl installed + yesno "$akkoma_health" || return 0 + + curl -q "localhost:${akkoma_port}/api/akkoma/healthcheck" +} diff --git a/installation/init.d/pleroma b/installation/init.d/pleroma deleted file mode 100755 index 384536f7e..000000000 --- a/installation/init.d/pleroma +++ /dev/null @@ -1,45 +0,0 @@ -#!/sbin/openrc-run -supervisor=supervise-daemon -command_user=pleroma:pleroma -command_background=1 -# Ask process to terminate within 30 seconds, otherwise kill it -retry="SIGTERM/30/SIGKILL/5" -pidfile="/var/run/pleroma.pid" -directory=/opt/pleroma -healthcheck_delay=60 -healthcheck_timer=30 - -: ${pleroma_port:-4000} - -# Needs OpenRC >= 0.42 -#respawn_max=0 -#respawn_delay=5 - -# put pleroma_console=YES in /etc/conf.d/pleroma if you want to be able to -# connect to pleroma via an elixir console -if yesno "${pleroma_console}"; then - command=elixir - command_args="--name pleroma@127.0.0.1 --erl '-kernel inet_dist_listen_min 9001 inet_dist_listen_max 9001 inet_dist_use_interface {127,0,0,1}' -S mix phx.server" - - start_post() { - einfo "You can get a console by using this command as pleroma's user:" - einfo "iex --name console@127.0.0.1 --remsh pleroma@127.0.0.1" - } -else - command=/usr/bin/mix - command_args="phx.server" -fi - -export MIX_ENV=prod - -depend() { - need nginx postgresql -} - -healthcheck() { - # put pleroma_health=YES in /etc/conf.d/pleroma if you want healthchecking - # and make sure you have curl installed - yesno "$pleroma_health" || return 0 - - curl -q "localhost:${pleroma_port}/api/pleroma/healthcheck" -} -- 2.43.0 From 1097c0cd3d5ab529909c682f665e81f427fad411 Mon Sep 17 00:00:00 2001 From: Norm Date: Tue, 5 Jul 2022 07:05:09 -0400 Subject: [PATCH 14/18] Update NetBSD and OpenBSD services --- installation/netbsd/rc.d/{pleroma => akkoma} | 10 +++--- installation/openbsd/rc.d/akkomad | 34 ++++++++++++++++++++ installation/openbsd/rc.d/pleromad | 34 -------------------- 3 files changed, 39 insertions(+), 39 deletions(-) rename installation/netbsd/rc.d/{pleroma => akkoma} (82%) create mode 100755 installation/openbsd/rc.d/akkomad delete mode 100755 installation/openbsd/rc.d/pleromad diff --git a/installation/netbsd/rc.d/pleroma b/installation/netbsd/rc.d/akkoma similarity index 82% rename from installation/netbsd/rc.d/pleroma rename to installation/netbsd/rc.d/akkoma index 1114668ee..7b80bc414 100755 --- a/installation/netbsd/rc.d/pleroma +++ b/installation/netbsd/rc.d/akkoma @@ -1,24 +1,24 @@ #!/bin/sh -# PROVIDE: pleroma +# PROVIDE: akkoma # REQUIRE: DAEMON pgsql if [ -f /etc/rc.subr ]; then . /etc/rc.subr fi -name="pleroma" +name="akkoma" rcvar=${name} command="/usr/pkg/bin/elixir" command_args="--detached -S /usr/pkg/bin/mix phx.server" start_precmd="ulimit -n unlimited" pidfile="/dev/null" -pleroma_chdir="${pleroma_home}/pleroma" -pleroma_env="HOME=${pleroma_home} MIX_ENV=prod" +akkoma_chdir="${akkoma_home}/akkoma" +akkoma_env="HOME=${akkoma_home} MIX_ENV=prod" check_pidfile() { - pid=$(pgrep -U "${pleroma_user}" /bin/beam.smp$) + pid=$(pgrep -U "${akkoma_user}" /bin/beam.smp$) echo -n "${pid}" } diff --git a/installation/openbsd/rc.d/akkomad b/installation/openbsd/rc.d/akkomad new file mode 100755 index 000000000..68be46c9a --- /dev/null +++ b/installation/openbsd/rc.d/akkomad @@ -0,0 +1,34 @@ +#!/bin/ksh +# +# Default init file for Akkoma on OpenBSD +# +# Simple installation instructions: +# 1. Install Akkoma per wiki instructions +# 2. Place this akkomad file in /etc/rc.d +# 3. Enable and start Akkoma +# # doas rcctl enable akkomad +# # doas rcctl start akkomad +# + +daemon="/usr/local/bin/elixir" +daemon_flags="--detached -S /usr/local/bin/mix phx.server" +daemon_user="_akkoma" + +. /etc/rc.d/rc.subr + +rc_reload=NO +pexp="phx.server" + +rc_check() { + pgrep -q -U _akkoma -f "phx.server" +} + +rc_start() { + ${rcexec} "cd akkoma; ${daemon} ${daemon_flags}" +} + +rc_stop() { + pkill -q -U _akkoma -f "phx.server" +} + +rc_cmd $1 diff --git a/installation/openbsd/rc.d/pleromad b/installation/openbsd/rc.d/pleromad deleted file mode 100755 index 19ac4bb51..000000000 --- a/installation/openbsd/rc.d/pleromad +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/ksh -# -# Default init file for Pleroma on OpenBSD -# -# Simple installation instructions: -# 1. Install Pleroma per wiki instructions -# 2. Place this pleromad file in /etc/rc.d -# 3. Enable and start Pleroma -# # doas rcctl enable pleromad -# # doas rcctl start pleromad -# - -daemon="/usr/local/bin/elixir" -daemon_flags="--detached -S /usr/local/bin/mix phx.server" -daemon_user="_pleroma" - -. /etc/rc.d/rc.subr - -rc_reload=NO -pexp="phx.server" - -rc_check() { - pgrep -q -U _pleroma -f "phx.server" -} - -rc_start() { - ${rcexec} "cd pleroma; ${daemon} ${daemon_flags}" -} - -rc_stop() { - pkill -q -U _pleroma -f "phx.server" -} - -rc_cmd $1 -- 2.43.0 From d79d4297f0933ce1ef23cdc67483cc9a11a6a5e1 Mon Sep 17 00:00:00 2001 From: Norm Date: Tue, 5 Jul 2022 07:05:25 -0400 Subject: [PATCH 15/18] Update rest of OpenBSD files --- installation/openbsd/httpd.conf | 2 +- installation/openbsd/relayd.conf | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/installation/openbsd/httpd.conf b/installation/openbsd/httpd.conf index 82f4803fd..ae33d29b7 100644 --- a/installation/openbsd/httpd.conf +++ b/installation/openbsd/httpd.conf @@ -1,5 +1,5 @@ # -# Default httpd.conf file for Pleroma on OpenBSD +# Default httpd.conf file for Akkoma on OpenBSD # Simple installation instructions # 1. Place file in /etc # 2. Replace with your public IP address diff --git a/installation/openbsd/relayd.conf b/installation/openbsd/relayd.conf index 31c2c1129..badd0336f 100644 --- a/installation/openbsd/relayd.conf +++ b/installation/openbsd/relayd.conf @@ -1,5 +1,5 @@ # -# Default relayd.conf file for Pleroma on OpenBSD +# Default relayd.conf file for Akkoma on OpenBSD # Simple installation instructions: # 1. Place in /etc # 2. Replace with your public IPv4 address @@ -13,19 +13,19 @@ ext_inet="" #ext_inet6="" -table { 127.0.0.1 } +table { 127.0.0.1 } table { 127.0.0.1 } -http protocol plerup { # Protocol for upstream pleroma server +http protocol plerup { # Protocol for upstream akkoma server #tcp { nodelay, sack, socket buffer 65536, backlog 128 } # Uncomment and adjust as you see fit tls ciphers "ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA0-POLY1305" tls ecdhe secp384r1 - # Forward some paths to the local server (as pleroma won't respond to them as you might want) + # Forward some paths to the local server (as akkoma won't respond to them as you might want) pass request quick path "/robots.txt" forward to # Append a bunch of headers - match request header append "X-Forwarded-For" value "$REMOTE_ADDR" # This two header and the next one are not strictl required by pleroma but adding them won't hurt + match request header append "X-Forwarded-For" value "$REMOTE_ADDR" # This two header and the next one are not strictl required by akkoma but adding them won't hurt match request header append "X-Forwarded-By" value "$SERVER_ADDR:$SERVER_PORT" match request header append "Connection" value "upgrade" @@ -38,7 +38,7 @@ relay wwwtls { protocol plerup - forward to port 4000 check http "/" code 200 + forward to port 4000 check http "/" code 200 forward to port 80 check http "/robots.txt" code 200 } -- 2.43.0 From 8a46daec4f3f230533b44196d75c4a3cd4f871d2 Mon Sep 17 00:00:00 2001 From: Norm Date: Tue, 5 Jul 2022 07:06:41 -0400 Subject: [PATCH 16/18] move caddyfile to caddy subdirectory --- installation/{caddyfile-akkoma.example => caddy/Caddyfile} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename installation/{caddyfile-akkoma.example => caddy/Caddyfile} (100%) diff --git a/installation/caddyfile-akkoma.example b/installation/caddy/Caddyfile similarity index 100% rename from installation/caddyfile-akkoma.example rename to installation/caddy/Caddyfile -- 2.43.0 From 271e08fa48a02900f12a72e4cacc8c04e2d34419 Mon Sep 17 00:00:00 2001 From: Norm Date: Tue, 5 Jul 2022 07:33:25 -0400 Subject: [PATCH 17/18] Fix config path lookup --- lib/pleroma/config/release_runtime_provider.ex | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/config/release_runtime_provider.ex b/lib/pleroma/config/release_runtime_provider.ex index 567229196..1e4bddc59 100644 --- a/lib/pleroma/config/release_runtime_provider.ex +++ b/lib/pleroma/config/release_runtime_provider.ex @@ -12,8 +12,13 @@ def load(config, opts) do with_defaults = Config.Reader.merge(config, Pleroma.Config.Holder.release_defaults()) config_path = - opts[:config_path] || System.get_env("PLEROMA_CONFIG_PATH") || "/etc/akkoma/config.exs" || - "/etc/pleroma/config.exs" + cond do + opts[:config_path] -> opts[:config_path] + System.get_env("PLEROMA_CONFIG_PATH") -> System.get_env("PLEROMA_CONFIG_PATH") + System.get_env("AKKOMA_CONFIG_PATH") -> System.get_env("AKKOMA_CONFIG_PATH") + File.exists?("/etc/akkoma/config.exs") -> "/etc/akkoma/config.exs" + true -> "/etc/pleroma/config.exs" + end with_runtime_config = if File.exists?(config_path) do -- 2.43.0 From 97657088e854bbf26ed5ba2eaf830be9f57fcef7 Mon Sep 17 00:00:00 2001 From: Norm Date: Wed, 6 Jul 2022 14:47:39 -0400 Subject: [PATCH 18/18] Fix typo in openbsd/relayd.conf --- installation/openbsd/relayd.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installation/openbsd/relayd.conf b/installation/openbsd/relayd.conf index badd0336f..b035ec69b 100644 --- a/installation/openbsd/relayd.conf +++ b/installation/openbsd/relayd.conf @@ -25,7 +25,7 @@ http protocol plerup { # Protocol for upstream akkoma server pass request quick path "/robots.txt" forward to # Append a bunch of headers - match request header append "X-Forwarded-For" value "$REMOTE_ADDR" # This two header and the next one are not strictl required by akkoma but adding them won't hurt + match request header append "X-Forwarded-For" value "$REMOTE_ADDR" # This two header and the next one are not strictly required by akkoma but adding them won't hurt match request header append "X-Forwarded-By" value "$SERVER_ADDR:$SERVER_PORT" match request header append "Connection" value "upgrade" -- 2.43.0