2022-11-04 21:03:23 +00:00
|
|
|
{ pkgs, lib, ... }:
|
|
|
|
let vhost = "akko.within.website";
|
|
|
|
in {
|
|
|
|
services.akkoma = {
|
2022-11-04 22:18:06 +00:00
|
|
|
enable = true;
|
2022-11-04 21:03:23 +00:00
|
|
|
config = let inherit ((pkgs.formats.elixirConf { }).lib) mkRaw mkMap;
|
|
|
|
in {
|
|
|
|
":pleroma"."Pleroma.Web.Endpoint".url.host = vhost;
|
2022-11-05 00:33:36 +00:00
|
|
|
":pleroma".":media_proxy" = {
|
2022-11-27 17:11:45 +00:00
|
|
|
enabled = false;
|
2022-11-05 00:33:36 +00:00
|
|
|
base_url = "https://cache.akko.within.website";
|
|
|
|
proxy_opts.redirect_on_failure = true;
|
|
|
|
};
|
2022-11-27 18:25:03 +00:00
|
|
|
":prometheus"."Pleroma.Web.Endpoint.MetricsExporter" = {
|
2022-11-27 18:19:30 +00:00
|
|
|
enabled = true;
|
2023-01-07 05:46:06 +00:00
|
|
|
auth = false;
|
2022-11-27 18:19:30 +00:00
|
|
|
format = mkRaw ":text";
|
|
|
|
path = "/api/pleroma/app_metrics";
|
|
|
|
};
|
2022-11-04 21:03:23 +00:00
|
|
|
":pleroma".":instance" = {
|
|
|
|
name = "Within's Bot Zone";
|
|
|
|
description =
|
|
|
|
"Within's akkoma server for testing and bot deployment, antifash edition";
|
|
|
|
email = "akko@xeserv.us";
|
|
|
|
notify_email = "akko@xeserv.us";
|
|
|
|
|
2022-11-04 22:48:46 +00:00
|
|
|
registrations_open = false;
|
2022-11-04 21:03:23 +00:00
|
|
|
invites_enabled = true;
|
|
|
|
|
|
|
|
limit = 69420;
|
|
|
|
remote_limit = 100000;
|
|
|
|
max_pinned_statuses = 10;
|
|
|
|
max_account_fields = 100;
|
|
|
|
|
2023-02-02 19:09:51 +00:00
|
|
|
upload_limit = 67108864;
|
|
|
|
|
2022-11-04 21:03:23 +00:00
|
|
|
limit_to_local_content = mkRaw ":unauthenticated";
|
|
|
|
healthcheck = true;
|
|
|
|
cleanup_attachments = true;
|
|
|
|
allow_relay = true;
|
2023-02-02 19:09:51 +00:00
|
|
|
safe_dm_mentions = true;
|
|
|
|
external_user_synchronization = true;
|
2022-11-04 21:03:23 +00:00
|
|
|
};
|
|
|
|
":pleroma".":mrf".policies =
|
|
|
|
map mkRaw [ "Pleroma.Web.ActivityPub.MRF.SimplePolicy" ];
|
|
|
|
|
|
|
|
# To allow configuration from admin-fe
|
2022-11-05 02:45:03 +00:00
|
|
|
":pleroma".":configurable_from_database" = false;
|
2022-11-04 21:03:23 +00:00
|
|
|
|
2022-11-04 22:45:37 +00:00
|
|
|
":pleroma"."Pleroma.Captcha" = {
|
|
|
|
enabled = false;
|
|
|
|
};
|
|
|
|
|
2022-11-04 21:03:23 +00:00
|
|
|
# S3 setup
|
|
|
|
":pleroma"."Pleroma.Upload" = {
|
|
|
|
uploader = mkRaw "Pleroma.Uploaders.S3";
|
2022-11-27 17:11:45 +00:00
|
|
|
base_url = "https://cdn.xeiaso.net/file/";
|
2022-11-04 21:03:23 +00:00
|
|
|
strip_exif = false;
|
|
|
|
};
|
|
|
|
":pleroma"."Pleroma.Uploaders.S3".bucket = "xeserv-akko";
|
|
|
|
":ex_aws".":s3" = {
|
|
|
|
access_key_id._secret = "/var/lib/secrets/akkoma/b2_key_id";
|
|
|
|
secret_access_key._secret = "/var/lib/secrets/akkoma/b2_app_key";
|
|
|
|
host = "s3.us-west-001.backblazeb2.com";
|
|
|
|
};
|
|
|
|
|
|
|
|
# Automated moderation settings
|
|
|
|
# Borrowed from https://github.com/chaossocial/about/blob/master/blocked_instances.md
|
|
|
|
":pleroma".":mrf_simple" = let blocklist = import ./blocklist.nix;
|
|
|
|
in {
|
|
|
|
media_nsfw = mkMap blocklist.media_nsfw;
|
|
|
|
reject = mkMap blocklist.reject;
|
|
|
|
followers_only = mkMap blocklist.followers_only;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
nginx = {
|
2022-11-04 22:21:59 +00:00
|
|
|
useACMEHost = "akko.within.website";
|
2022-11-04 22:18:06 +00:00
|
|
|
forceSSL = true;
|
2022-11-04 21:03:23 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.postgresql.enable = true;
|
2022-11-04 21:57:56 +00:00
|
|
|
services.postgresql.package = pkgs.postgresql_15;
|
2022-12-29 18:15:48 +00:00
|
|
|
services.postgresql.settings = {
|
2022-12-29 18:23:45 +00:00
|
|
|
listen_addresses = lib.mkForce "100.106.53.73,fd7a:115c:a1e0:ab12:4843:cd96:626a:3549,localhost";
|
2022-12-29 18:15:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
services.postgresqlBackup.enable = true;
|
2022-11-04 21:03:23 +00:00
|
|
|
|
2022-11-05 00:33:36 +00:00
|
|
|
services.nginx.commonHttpConfig = ''
|
2022-11-05 00:45:32 +00:00
|
|
|
proxy_cache_path /var/cache/nginx/akkoma-media-cache
|
2022-11-05 00:33:36 +00:00
|
|
|
levels= keys_zone=akkoma_media_cache:16m max_size=2g
|
|
|
|
inactive=1y use_temp_path=off;
|
|
|
|
'';
|
|
|
|
|
|
|
|
services.nginx.virtualHosts."cache.akko.within.website" = {
|
2022-11-05 01:21:24 +00:00
|
|
|
locations."/" = {
|
2022-11-05 00:33:36 +00:00
|
|
|
proxyPass = "http://unix:/run/akkoma/socket";
|
|
|
|
|
|
|
|
extraConfig = ''
|
|
|
|
proxy_cache akkoma_media_cache;
|
|
|
|
|
2022-11-05 00:41:10 +00:00
|
|
|
proxy_cache_key $host$uri$is_args$args;
|
2022-11-05 00:33:36 +00:00
|
|
|
|
|
|
|
# Decouple client and upstream requests
|
|
|
|
proxy_buffering on;
|
|
|
|
proxy_cache_lock on;
|
|
|
|
proxy_ignore_client_abort on;
|
|
|
|
|
|
|
|
# Default cache times for various responses
|
|
|
|
proxy_cache_valid 200 1y;
|
|
|
|
proxy_cache_valid 206 301 304 1h;
|
|
|
|
|
|
|
|
# Allow serving of stale items
|
|
|
|
proxy_cache_use_stale error timeout invalid_header updating;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-11-27 17:11:45 +00:00
|
|
|
# services.nginx.virtualHosts."media.akko.within.website" = {
|
|
|
|
# locations."~ /file/xeserv-akko/" = {
|
|
|
|
# proxyPass = "https://b2";
|
2022-11-05 00:33:36 +00:00
|
|
|
|
2022-11-27 17:11:45 +00:00
|
|
|
# extraConfig = ''
|
|
|
|
# proxy_cache akkoma_media_cache;
|
2022-11-05 00:33:36 +00:00
|
|
|
|
2022-11-27 17:11:45 +00:00
|
|
|
# # Cache objects in slices of 1 MiB
|
|
|
|
# proxy_cache_key $host$uri$is_args$args;
|
2022-11-05 00:33:36 +00:00
|
|
|
|
2022-11-27 17:11:45 +00:00
|
|
|
# # Decouple client and upstream requests
|
|
|
|
# proxy_buffering on;
|
|
|
|
# proxy_cache_lock on;
|
|
|
|
# proxy_ignore_client_abort on;
|
2022-11-05 00:33:36 +00:00
|
|
|
|
2022-11-27 17:11:45 +00:00
|
|
|
# # Default cache times for various responses
|
|
|
|
# proxy_cache_valid 200 1y;
|
|
|
|
# proxy_cache_valid 206 301 304 1h;
|
2022-11-05 00:33:36 +00:00
|
|
|
|
2022-11-27 17:11:45 +00:00
|
|
|
# # Allow serving of stale items
|
|
|
|
# proxy_cache_use_stale error timeout invalid_header updating;
|
|
|
|
|
|
|
|
# proxy_set_header Host f001.backblazeb2.com;
|
|
|
|
# '';
|
|
|
|
# };
|
|
|
|
# };
|
2022-11-05 00:33:36 +00:00
|
|
|
|
2022-11-04 21:34:14 +00:00
|
|
|
security.acme = {
|
|
|
|
defaults.email = "me@xeiaso.net";
|
|
|
|
|
|
|
|
certs."akko.within.website" = {
|
|
|
|
group = "nginx";
|
|
|
|
dnsProvider = "route53";
|
|
|
|
credentialsFile = "/run/keys/aws-within.website";
|
2022-11-05 00:33:36 +00:00
|
|
|
extraDomainNames = [ "*.akko.within.website" ];
|
2022-11-04 21:34:14 +00:00
|
|
|
extraLegoFlags = [ "--dns.resolvers=8.8.8.8:53" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-11-04 21:03:23 +00:00
|
|
|
age.secrets = {
|
2022-11-04 21:34:14 +00:00
|
|
|
"aws-within.website" = {
|
|
|
|
file = ../../secret/aws-within.website.age;
|
|
|
|
path = "/run/keys/aws-within.website";
|
|
|
|
owner = "acme";
|
|
|
|
group = "nginx";
|
|
|
|
};
|
2022-11-04 22:33:42 +00:00
|
|
|
akko-keyid = {
|
|
|
|
file = ../../secret/akko-keyid.age;
|
|
|
|
path = "/var/lib/secrets/akkoma/b2_key_id";
|
|
|
|
owner = "akkoma";
|
|
|
|
group = "akkoma";
|
|
|
|
};
|
|
|
|
akko-applicationkey = {
|
|
|
|
file = ../../secret/akko-applicationkey.age;
|
|
|
|
path = "/var/lib/secrets/akkoma/b2_app_key";
|
|
|
|
owner = "akkoma";
|
|
|
|
group = "akkoma";
|
|
|
|
};
|
2022-11-04 21:03:23 +00:00
|
|
|
};
|
|
|
|
}
|