diff --git a/.gitignore b/.gitignore index 1edd4c6..34bbcf3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ pswd -.env \ No newline at end of file +.env* diff --git a/docker/fant0mib0t/akkoma/SETUP.md b/docker/fant0mib0t/akkoma/SETUP.md deleted file mode 100644 index 862daa4..0000000 --- a/docker/fant0mib0t/akkoma/SETUP.md +++ /dev/null @@ -1,73 +0,0 @@ -Source: https://docs.akkoma.dev/stable/installation/docker_en/ - -edited for paths and also not use the scripts, I can type commands myself smh - -```sh -cp git/docker-resources/env.example .env -echo "DOCKER_USER=$(id -u):$(id -g)" >> .env -``` - -```sh -docker compose build --build-arg UID=$(id -u) --build-arg GID=$(id -g) akkoma -docker compose build --build-arg UID=$(id -u) --build-arg GID=$(id -g) db -``` - -```sh -docker compose run --rm akkoma mix deps.get -docker compose run --rm akkoma mix compile -docker compose run --rm akkoma mix pleroma.instance gen -``` - -```txt -What domain will your instance use? (e.g akkoma.example.com) [] fedi.fantomitechno.dev -What base url will uploads use? (e.g https://media.example.com/media) - Generally this should NOT use the same domain as the instance [] https://fedi.m.fantomitechno.dev -What is the name of your instance? (e.g. The Corndog Emporium) [fedi.fantomitechno.dev] -What is your admin email address? [] mastodon@fantomitechno.dev -What email address do you want to use for sending email notifications? [mastodon@fantomitechno.dev] me@no-reply.fantomitechno.dev -Do you want search engines to index your site? (y/n) [y] n -Do you want to store the configuration in the database (allows controlling it from admin-fe)? (y/n) [n] -What is the hostname of your database? [localhost] db -What is the name of your database? [akkoma] -What is the user used to connect to your database? [akkoma] -What is the password used to connect to your database? [autogenerated] akkoma -Would you like to use RUM indices? [n] -What port will the app listen to (leave it if you are using the default setup with nginx)? [4000] -What ip will the app listen to (leave it if you are using the default setup with nginx)? [127.0.0.1] 0.0.0.0 -What directory should media uploads go in (when using the local uploader)? [uploads] -What directory should custom public files be read from (custom emojis, frontend bundle overrides, robots.txt, etc.)? [instance/static/] -Do you want to strip metadata from uploaded images? This requires exiftool, it was detected as installed. (y/n) [y] -Do you want to read data from uploaded files so clients can use it to prefill fields like image description? This requires exiftool, it was detected as installed. (y/n) [y] -Do you want to anonymize the filenames of uploads? (y/n) [n] -``` - -wtf is this bro - -```sh -cp git/config/generated_config.exs git/config/prod.secret.exs -``` - -```sh -docker compose run --rm --user akkoma -d db -# Note down the name it gives here, it will be something like akkoma_db_run -docker compose run --rm akkoma psql -h db -U akkoma -f git/config/setup_db.psql -docker stop akkoma_db_run # Replace with the name you noted down -``` - -```sh -docker compose run --rm akkoma mix ecto.migrate -``` - -then start and create first used - -```sh -docker compose up -d -docker compose run --rm akkoma mix pleroma.user new fantomitechno me@fantomitechno.dev --admin -``` - -install frontend - -```sh -docker compose run --rm akkoma mix pleroma.frontend install pleroma-fe --ref stable -docker compose run --rm akkoma mix pleroma.frontend install admin-fe --ref stable -``` diff --git a/docker/fant0mib0t/akkoma/docker-compose.yml b/docker/fant0mib0t/akkoma/docker-compose.yml deleted file mode 100644 index 8cba24c..0000000 --- a/docker/fant0mib0t/akkoma/docker-compose.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: akkoma -services: - db: - image: akkoma-db:latest - build: ./git/docker-resources/database - shm_size: 4gb - restart: unless-stopped - user: ${DOCKER_USER} - environment: - # This might seem insecure but is usually not a problem. - # You should leave this at the "akkoma" default. - # The DB is only reachable by containers in the same docker network, - # and is not exposed to the open internet. - # - # If you do change this, remember to update "config.exs". - POSTGRES_DB: akkoma - POSTGRES_USER: akkoma - POSTGRES_PASSWORD: akkoma - - env_file: - - .env - volumes: - - pg_data:/var/lib/postgresql - - akkoma: - image: akkoma:latest - build: ./git - restart: unless-stopped - env_file: - - .env - links: - - db - ports: - - "127.0.0.1:2020:4000" - - volumes: - - ./git:/opt/akkoma - ulimits: - # Maximum number of open file descriptors. The default should work well for most, - # but can be bumped for very large instances or if seeing FD-related errors. - nofile: 524288 - -volumes: - pg_data: \ No newline at end of file diff --git a/docker/fant0mib0t/akkoma/git b/docker/fant0mib0t/akkoma/git deleted file mode 160000 index 98dd958..0000000 --- a/docker/fant0mib0t/akkoma/git +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 98dd958886a8b0ef65d5bd827aba3789f1dc5116 diff --git a/docker/fant0mib0t/mastodon/docker-compose.yml b/docker/fant0mib0t/mastodon/docker-compose.yml new file mode 100644 index 0000000..aec6931 --- /dev/null +++ b/docker/fant0mib0t/mastodon/docker-compose.yml @@ -0,0 +1,140 @@ +# This file is designed for production server deployment, not local development work +# For a containerized local dev environment, see: https://github.com/mastodon/mastodon/blob/main/docs/DEVELOPMENT.md#docker + +services: + db: + restart: always + image: postgres:14-alpine + shm_size: 256mb + networks: + - internal_network + healthcheck: + test: ['CMD', 'pg_isready', '-U', 'postgres'] + volumes: + - /var/mastodon/postgres14:/var/lib/postgresql/data + environment: + - 'POSTGRES_HOST_AUTH_METHOD=trust' + + redis: + restart: always + image: redis:7-alpine + networks: + - internal_network + healthcheck: + test: ['CMD', 'redis-cli', 'ping'] + volumes: + - /var/mastodon/redis:/data + + # es: + # restart: always + # image: docker.elastic.co/elasticsearch/elasticsearch:8.19.15 + # environment: + # - "ELASTIC_PASSWORD=password" # Username is elastic. Do not change the username. + # - "ES_JAVA_OPTS=-Xms512m -Xmx512m -Des.enforce.bootstrap.checks=true" # Please update the memory to suit your environment or you will have wasted memory. both -Xms & -Xmx must be the same size. 1g for GB. + # - "xpack.license.self_generated.type=basic" + # - "xpack.security.enabled=false" + # - "xpack.watcher.enabled=false" + # - "xpack.graph.enabled=false" + # - "xpack.ml.enabled=false" + # - "bootstrap.memory_lock=true" + # - "cluster.name=es-mastodon" + # - "discovery.type=single-node" + # networks: + # - external_network + # - internal_network + # healthcheck: + # test: ["CMD-SHELL", "curl --silent --fail localhost:9200/_cluster/health || exit 1"] + # volumes: + # - ./elasticsearch:/usr/share/elasticsearch/data + # ulimits: + # memlock: + # soft: -1 + # hard: -1 + # nofile: + # soft: 65536 + # hard: 65536 + # ports: + # - '127.0.0.1:9200:9200' + + web: + # You can uncomment the following line if you want to not use the prebuilt image, for example if you have local code changes + # build: . + image: ghcr.io/mastodon/mastodon:v4.7.3 + restart: always + env_file: .env.production + command: bundle exec puma -C config/puma.rb + networks: + - external_network + - internal_network + healthcheck: + # prettier-ignore + test: ['CMD-SHELL',"curl -s --noproxy localhost localhost:3000/health | grep -q 'OK' || exit 1"] + ports: + - '127.0.0.1:2020:3000' + depends_on: + - db + - redis + # - es + volumes: + - /var/mastodon/public/system:/mastodon/public/system + + streaming: + # You can uncomment the following lines if you want to not use the prebuilt image, for example if you have local code changes + # build: + # dockerfile: ./streaming/Dockerfile + # context: . + image: ghcr.io/mastodon/mastodon-streaming:v4.7.3 + restart: always + env_file: .env.production + command: node ./streaming/index.js + networks: + - external_network + - internal_network + healthcheck: + # prettier-ignore + test: ['CMD-SHELL', "curl -s --noproxy localhost localhost:4000/api/v1/streaming/health | grep -q 'OK' || exit 1"] + ports: + - '127.0.0.1:2021:4000' + depends_on: + - db + - redis + + sidekiq: + # You can uncomment the following line if you want to not use the prebuilt image, for example if you have local code changes + # build: . + image: ghcr.io/mastodon/mastodon:v4.7.3 + restart: always + env_file: .env.production + command: bundle exec sidekiq + depends_on: + - db + - redis + networks: + - external_network + - internal_network + volumes: + - /var/mastodon/public/system:/mastodon/public/system + healthcheck: + test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 8' || false"] + + ## Uncomment to enable federation with tor instances along with adding the following ENV variables + ## http_hidden_proxy=http://privoxy:8118 + ## ALLOW_ACCESS_TO_HIDDEN_SERVICE=true + # tor: + # image: sirboops/tor + # networks: + # - external_network + # - internal_network + # + # privoxy: + # image: sirboops/privoxy + # volumes: + # - ./priv-config:/opt/config + # networks: + # - external_network + # - internal_network + +networks: + external_network: + internal_network: + internal: true diff --git a/modules/caddy/fant0mib0t b/modules/caddy/fant0mib0t index 1c810bc..9daca1e 100644 --- a/modules/caddy/fant0mib0t +++ b/modules/caddy/fant0mib0t @@ -141,27 +141,56 @@ graph.fantom.home { tls internal } -fedi.fantomitechno.dev { - import logging akkoma +fedi.fantomitechno.dev { + root * /var/mastodon/public - reverse_proxy 127.0.0.1:2020 + # gzip + zstd compression (replaces the gzip_* block) + encode zstd gzip - @mediaproxy path /media/* /proxy/* - handle @mediaproxy { - redir https://fedi.m.fantomitechno.dev{uri} permanent - } -} + # HSTS on every response (nginx repeated this per location) + header Strict-Transport-Security "max-age=63072000; includeSubDomains" -fedi.m.fantomitechno.dev { - @mediaproxy path /media/* /proxy/* - reverse_proxy @mediaproxy 127.0.0.1:2020 { - transport http { - response_header_timeout 10s - read_timeout 15s - } - } -} + # client_max_body_size 80m + request_body { + max_size 80MB + } + + # --- Cache-Control headers --- + @cache_week path /sw.js + header @cache_week Cache-Control "public, max-age=604800, must-revalidate" + + @cache_month path /assets/* /avatars/* /emoji/* /headers/* /packs/* /shortcuts/* /sounds/* + header @cache_month Cache-Control "public, max-age=2419200, must-revalidate" + @cache_system path /system/* + header @cache_system Cache-Control "public, max-age=2419200, immutable" + + # --- Streaming API (WebSockets are handled automatically) --- + handle /api/v1/streaming* { + reverse_proxy 127.0.0.1:2021 { + flush_interval -1 # proxy_buffering off + header_up X-Real-IP {remote_host} + header_up -Proxy + } + } + + # --- Everything else: try static file, fall back to Rails --- + handle { + file_server { + pass_thru # try_files $uri @proxy + } + reverse_proxy 127.0.0.1:2020 { + header_up X-Real-IP {remote_host} + header_up -Proxy + } + } + + # error_page 404 500 501 502 503 504 /500.html + handle_errors { + rewrite * /500.html + file_server + } +} jellyfin.fantom.home { import logging jellyfin @@ -251,4 +280,4 @@ bazarr.fantom.home { reverse_proxy 127.0.0.1:4096 tls internal -} \ No newline at end of file +}