diff --git a/servers/keymaker/docker-compose.d/custom/nginx/conf.d/ixvd-web.conf b/servers/keymaker/docker-compose.d/custom/nginx/conf.d/ixvd-web.conf index 0fad24e..258f573 100644 --- a/servers/keymaker/docker-compose.d/custom/nginx/conf.d/ixvd-web.conf +++ b/servers/keymaker/docker-compose.d/custom/nginx/conf.d/ixvd-web.conf @@ -5,4 +5,14 @@ server { location / { proxy_pass http://ixvd-web$request_uri; } + + # matrix + location /.well-known/matrix/server { + return 200 '{ "m.server": "matrix.ixvd.net:443" }'; + } + + location /.well-known/matrix/client { + add_header Access-Control-Allow-Origin '*'; + return 200 '{ "m.homeserver": { "base_url": "https://matrix.ixvd.net" } }'; + } } \ No newline at end of file diff --git a/servers/kid/README.md b/servers/kid/README.md new file mode 100644 index 0000000..70e3b87 --- /dev/null +++ b/servers/kid/README.md @@ -0,0 +1 @@ +server configuration for `kid`. diff --git a/servers/kid/docker-compose.d/README.md b/servers/kid/docker-compose.d/README.md new file mode 100644 index 0000000..26b9ae3 --- /dev/null +++ b/servers/kid/docker-compose.d/README.md @@ -0,0 +1 @@ +This folder houses all docker-compose files \ No newline at end of file diff --git a/servers/kid/docker-compose.d/custom/cinny/Dockerfile b/servers/kid/docker-compose.d/custom/cinny/Dockerfile new file mode 100644 index 0000000..96b9527 --- /dev/null +++ b/servers/kid/docker-compose.d/custom/cinny/Dockerfile @@ -0,0 +1,3 @@ +FROM ghcr.io/cinnyapp/cinny:latest + +COPY ./config.json /app/config.json \ No newline at end of file diff --git a/servers/kid/docker-compose.d/custom/cinny/config.json b/servers/kid/docker-compose.d/custom/cinny/config.json new file mode 100644 index 0000000..246663a --- /dev/null +++ b/servers/kid/docker-compose.d/custom/cinny/config.json @@ -0,0 +1,9 @@ +{ + "defaultHomeserver": 0, + "homeserverList": [ + "matrix.ixvd.net", + "matrix.org", + "mozilla.org" + ], + "allowCustomHomeservers": true +} \ No newline at end of file diff --git a/servers/kid/docker-compose.d/custom/firefish/Dockerfile b/servers/kid/docker-compose.d/custom/firefish/Dockerfile new file mode 100644 index 0000000..2cb6281 --- /dev/null +++ b/servers/kid/docker-compose.d/custom/firefish/Dockerfile @@ -0,0 +1,12 @@ +FROM registry.joinfirefish.org/firefish/firefish:latest + +RUN apk add \ + curl \ + jq + +COPY config/default.yml /firefish/.config/default.yml +COPY docker-entrypoint.d/ /docker-entrypoint.d/ +COPY docker-entrypoint.sh /docker-entrypoint.sh +RUN chmod +x /docker-entrypoint.sh + +ENTRYPOINT ["sh", "/docker-entrypoint.sh"] \ No newline at end of file diff --git a/servers/kid/docker-compose.d/custom/firefish/config/default.yml b/servers/kid/docker-compose.d/custom/firefish/config/default.yml new file mode 100644 index 0000000..89d92f1 --- /dev/null +++ b/servers/kid/docker-compose.d/custom/firefish/config/default.yml @@ -0,0 +1,253 @@ +#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +# Firefish configuration +#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +# After starting your server, please don't change the URL! Doing so will break federation. + +# ┌─────┐ +#───┘ URL └───────────────────────────────────────────────────── + +# Final accessible URL seen by a user. +url: https://fedi.ixvd.net + +# ┌───────────────────────┐ +#───┘ Port and TLS settings └─────────────────────────────────── + +# +# Firefish requires a reverse proxy to support HTTPS connections. +# +# +----- https://example.com/ ------------+ +# +------+ |+-------------+ +----------------+| +# | User | ---> || Proxy (443) | ---> | Firefish (3000) || +# +------+ |+-------------+ +----------------+| +# +---------------------------------------+ +# +# You need to set up a reverse proxy. (e.g. nginx, caddy) +# An encrypted connection with HTTPS is highly recommended +# because tokens may be transferred in GET requests. + +# The port that your Firefish server should listen on. +port: 3000 + +# ┌──────────────────────────┐ +#───┘ PostgreSQL configuration └──────────────────────────────── + +db: + host: firefish-db + port: 5432 + #ssl: false + # Database name + db: [POSTGRES_DB] + + # Auth + user: [POSTGRES_USER] + pass: [POSTGRES_PASSWORD] + + # Whether disable Caching queries + #disableCache: true + + # Extra Connection options + #extra: + # ssl: + # host: localhost + # rejectUnauthorized: false + +# ┌─────────────────────┐ +#───┘ Redis configuration └───────────────────────────────────── + +redis: + host: firefish-redis + port: 6379 + #tls: + # host: localhost + # rejectUnauthorized: false + #family: 0 # 0=Both, 4=IPv4, 6=IPv6 + #pass: example-pass + #prefix: example-prefix + #db: 1 + #user: default + + # ┌─────────────────────────────┐ + #───┘ Cache server configuration └───────────────────────────────────── + + # A Redis-compatible server (DragonflyDB, Keydb, Redis) for caching + # If left blank, it will use the Redis server from above + + #cacheServer: + #host: localhost + #port: 6379 + #family: 0 # 0=Both, 4=IPv4, 6=IPv6 + #pass: example-pass + #prefix: example-prefix + #db: 1 + +# Please configure either MeiliSearch *or* Sonic. +# If both MeiliSearch and Sonic configurations are present, MeiliSearch will take precedence. + +# ┌───────────────────────────┐ +#───┘ MeiliSearch configuration └───────────────────────────────────── +# meilisearch: + # host: meilisearch + # port: 7700 + # ssl: false + # apiKey: [MEILISEARCH_API_KEY] + +# ┌─────────────────────┐ +#───┘ Sonic configuration └───────────────────────────────────── + +sonic: + host: [SONIC_HOST] + port: [SONIC_PORT] + auth: [SONIC_SECRET] + collection: notes + bucket: default + + +# ┌───────────────┐ +#───┘ ID generation └─────────────────────────────────────────── + +# No need to uncomment in most cases, but you may want to change +# these settings if you plan to run a large and/or distributed server. + +# cuid: +# # Min 16, Max 24 +# length: 16 +# +# # Set this to a unique string across workers (e.g., machine's hostname) +# # if your workers are running in multiple hosts. +# fingerprint: my-fingerprint + + +# ┌─────────────────────┐ +#───┘ Other configuration └───────────────────────────────────── + +# Maximum length of a post (default 3000, max 100000) +#maxNoteLength: 3000 + +# Maximum length of an image caption (default 1500, max 8192) +#maxCaptionLength: 1500 + +# Reserved usernames that only the administrator can register with +reservedUsernames: [ + 'root', + 'admin', + 'administrator', + 'me', + 'system' +] + +# Whether disable HSTS +#disableHsts: true + +# Number of worker processes +#clusterLimit: 1 + +# Worker only mode +#onlyQueueProcessor: 1 + +# Job concurrency per worker +# deliverJobConcurrency: 128 +# inboxJobConcurrency: 16 + +# Job rate limiter +# deliverJobPerSec: 128 +# inboxJobPerSec: 16 + +# Job attempts +# deliverJobMaxAttempts: 12 +# inboxJobMaxAttempts: 8 + +# IP address family used for outgoing request (ipv4, ipv6 or dual) +#outgoingAddressFamily: ipv4 + +# Syslog option +#syslog: +# host: localhost +# port: 514 + +# Proxy for HTTP/HTTPS +#proxy: http://127.0.0.1:3128 + +#proxyBypassHosts: [ +# 'web.kaiteki.app', +# 'example.com', +# '192.0.2.8' +#] + +# Proxy for SMTP/SMTPS +#proxySmtp: http://127.0.0.1:3128 # use HTTP/1.1 CONNECT +#proxySmtp: socks4://127.0.0.1:1080 # use SOCKS4 +#proxySmtp: socks5://127.0.0.1:1080 # use SOCKS5 + +# Media Proxy +#mediaProxy: https://example.com/proxy + +# Proxy remote files (default: false) +#proxyRemoteFiles: true + +#allowedPrivateNetworks: [ +# '127.0.0.1/32' +#] + +# TWA +#twa: +# nameSpace: android_app +# packageName: tld.domain.twa +# sha256CertFingerprints: ['AB:CD:EF'] + +# Upload or download file size limits (bytes) +#maxFileSize: 262144000 + +#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +# Congrats, you've reached the end of the config file needed for most deployments! +# Enjoy your Firefish server! +#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + + + +#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +# Managed hosting settings +# >>> NORMAL SELF-HOSTERS, STAY AWAY! <<< +# >>> YOU DON'T NEED THIS! <<< +# Each category is optional, but if each item in each category is mandatory! +# If you mess this up, that's on you, you've been warned... +#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +#maxUserSignups: 100 +#isManagedHosting: true +#deepl: +# managed: true +# authKey: '' +# isPro: false +# +#email: +# managed: true +# address: 'example@email.com' +# host: 'email.com' +# port: 587 +# user: 'example@email.com' +# pass: '' +# useImplicitSslTls: false +# +#objectStorage: +# managed: true +# baseUrl: '' +# bucket: '' +# prefix: '' +# endpoint: '' +# region: '' +# accessKey: '' +# secretKey: '' +# useSsl: true +# connnectOverProxy: false +# setPublicReadOnUpload: true +# s3ForcePathStyle: true + +# !!!!!!!!!! +# >>>>>> AGAIN, NORMAL SELF-HOSTERS, STAY AWAY! <<<<<< +# >>>>>> YOU DON'T NEED THIS, ABOVE SETTINGS ARE FOR MANAGED HOSTING ONLY! <<<<<< +# !!!!!!!!!! + +# Seriously. Do NOT fill out the above settings if you're self-hosting. +# They're much better off being set from the control panel. diff --git a/servers/kid/docker-compose.d/custom/firefish/docker-entrypoint.d/50-replace-config-with-env.sh b/servers/kid/docker-compose.d/custom/firefish/docker-entrypoint.d/50-replace-config-with-env.sh new file mode 100644 index 0000000..51cf3c6 --- /dev/null +++ b/servers/kid/docker-compose.d/custom/firefish/docker-entrypoint.d/50-replace-config-with-env.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +POSTGRES_USER=${POSTGRES_USER:-} +POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-} +POSTGRES_DB=${POSTGRES_DB:-firefish} +SONIC_HOST=${SONIC_HOST:-} +SONIC_PORT=${SONIC_PORT:-1491} +SONIC_SECRET=${SONIC_SECRET:-} + +if [ -f /firefish/.config/default.yml ]; then + sed -i "s/\[POSTGRES_USER\]/$POSTGRES_USER/g" /firefish/.config/default.yml + sed -i "s/\[POSTGRES_PASSWORD\]/$POSTGRES_PASSWORD/g" /firefish/.config/default.yml + sed -i "s/\[POSTGRES_DB\]/$POSTGRES_DB/g" /firefish/.config/default.yml + sed -i "s/\[SONIC_HOST\]/$SONIC_HOST/g" /firefish/.config/default.yml + sed -i "s/\[SONIC_PORT\]/$SONIC_PORT/g" /firefish/.config/default.yml + sed -i "s/\[SONIC_SECRET\]/$SONIC_SECRET/g" /firefish/.config/default.yml +fi \ No newline at end of file diff --git a/servers/kid/docker-compose.d/custom/firefish/docker-entrypoint.d/90-start-firefish.sh b/servers/kid/docker-compose.d/custom/firefish/docker-entrypoint.d/90-start-firefish.sh new file mode 100644 index 0000000..ae4de19 --- /dev/null +++ b/servers/kid/docker-compose.d/custom/firefish/docker-entrypoint.d/90-start-firefish.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +echo "Starting firefish..." +/sbin/tini -- pnpm run migrateandstart \ No newline at end of file diff --git a/servers/kid/docker-compose.d/custom/firefish/docker-entrypoint.sh b/servers/kid/docker-compose.d/custom/firefish/docker-entrypoint.sh new file mode 100644 index 0000000..d731823 --- /dev/null +++ b/servers/kid/docker-compose.d/custom/firefish/docker-entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +for file in /docker-entrypoint.d/*; do + if [ -x "$file" ]; then + echo "Running $file" + "$file" + else + echo "Sourcing $file" + . "$file" + fi +done \ No newline at end of file diff --git a/servers/kid/docker-compose.d/custom/nginx/Dockerfile b/servers/kid/docker-compose.d/custom/nginx/Dockerfile new file mode 100644 index 0000000..6bb5b49 --- /dev/null +++ b/servers/kid/docker-compose.d/custom/nginx/Dockerfile @@ -0,0 +1,13 @@ +FROM nginx:alpine + +RUN apk add \ + certbot \ + certbot-nginx + +COPY content /usr/share/nginx/html +COPY conf.d/ /etc/nginx/conf.d/ +COPY nginx.conf /etc/nginx/nginx.conf + +COPY entrypoint.sh /entrypoint +ENTRYPOINT [ "sh", "/entrypoint" ] +CMD [ "nginx", "-g", "daemon off;" ] \ No newline at end of file diff --git a/servers/kid/docker-compose.d/custom/nginx/conf.d/default.conf b/servers/kid/docker-compose.d/custom/nginx/conf.d/default.conf new file mode 100644 index 0000000..b29324a --- /dev/null +++ b/servers/kid/docker-compose.d/custom/nginx/conf.d/default.conf @@ -0,0 +1,21 @@ +server { + listen 80; + server_name kid.ixvd.net; + + # SSL is managed by certbot, no need for a ssl listen; it will be generated automagically! + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + # default html page + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } +} diff --git a/servers/kid/docker-compose.d/custom/nginx/conf.d/firefish.conf b/servers/kid/docker-compose.d/custom/nginx/conf.d/firefish.conf new file mode 100644 index 0000000..decd93a --- /dev/null +++ b/servers/kid/docker-compose.d/custom/nginx/conf.d/firefish.conf @@ -0,0 +1,12 @@ +server { + listen 80; + server_name fedi.ixvd.net; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + location / { + proxy_pass http://firefish:3000$request_uri; + } +} diff --git a/servers/kid/docker-compose.d/custom/nginx/conf.d/matrix.conf b/servers/kid/docker-compose.d/custom/nginx/conf.d/matrix.conf new file mode 100644 index 0000000..24a4404 --- /dev/null +++ b/servers/kid/docker-compose.d/custom/nginx/conf.d/matrix.conf @@ -0,0 +1,27 @@ +server { + listen 80; + server_name matrix.ixvd.net; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_read_timeout 600; + + location = / { + return 302 https://cinny.ixvd.net; + } + + # matrix + location /.well-known/matrix/server { + return 200 '{ "m.server": "matrix.ixvd.net:443" }'; + } + + location /.well-known/matrix/client { + add_header Access-Control-Allow-Origin '*'; + return 200 '{ "m.homeserver": { "base_url": "https://matrix.ixvd.net" } }'; + } + + location /_matrix { + proxy_pass http://conduit:6167; + client_max_body_size 0; + } +} \ No newline at end of file diff --git a/servers/kid/docker-compose.d/custom/nginx/conf.d/search.conf b/servers/kid/docker-compose.d/custom/nginx/conf.d/search.conf new file mode 100644 index 0000000..a2a3ec3 --- /dev/null +++ b/servers/kid/docker-compose.d/custom/nginx/conf.d/search.conf @@ -0,0 +1,16 @@ +server { + listen 80; + server_name search.localhost; + access_log /dev/null; + error_log /dev/null; + + location / { + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Host $host; + proxy_set_header X-NginX-Proxy true; + proxy_pass http://whoogle:5000; + } + +} \ No newline at end of file diff --git a/servers/kid/docker-compose.d/custom/nginx/content/index.html b/servers/kid/docker-compose.d/custom/nginx/content/index.html new file mode 100644 index 0000000..c66cf70 --- /dev/null +++ b/servers/kid/docker-compose.d/custom/nginx/content/index.html @@ -0,0 +1,26 @@ + + + +
+