disable caddy

This commit is contained in:
CJ_Clippy 2025-02-21 23:32:48 -08:00
parent 694dc89f03
commit 30be956029
38 changed files with 94 additions and 61 deletions
.gitea/workflows
apps
aquatic/docker
bright
tracker
Dockerfile
root
etc
aquatic
caddy
s6-overlay/s6-rc.d
aquatic
caddy
dependencies.d
runtype
tracker-helper
dependencies.d
runtype
user/contents.d
tracker
usr/src/tracker-helper
var/lib/aquatic
config
services/tracker-helper

@ -30,14 +30,27 @@ jobs:
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
context: ./apps/aquatic context: ./apps/aquatic
file: ./apps/aquatic/docker/aquatic_udp.Dockerfile file: ./apps/aquatic/docker/aquatic_udp_futureporn.Dockerfile
push: true push: true
tags: gitea.futureporn.net/futureporn/aquatic:latest tags: gitea.futureporn.net/futureporn/aquatic:latest
- name: Build futureporn/tracker-helper
uses: docker/build-push-action@v6
with:
context: ./services/tracker-helper
push: true
tags: gitea.futureporn.net/futureporn/tracker-helper:latest
labels: |
org.opencontainers.image.description=Custom Aquatic helper service, adding info_hash accesslist operations via HTTP
org.opencontainers.image.title=tracker-helper
org.opencontainers.image.licenses=unlicense
org.opencontainers.image.source=https://gitea.futureporn.net/futureporn/fp
org.opencontainers.image.url=https://gitea.futureporn.net/futureporn/-/packages/container/tracker-helper
- name: Build futureporn/tracker - name: Build futureporn/tracker
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
context: ./services/tracker context: ./apps/tracker
push: true push: true
tags: gitea.futureporn.net/futureporn/tracker:latest tags: gitea.futureporn.net/futureporn/tracker:latest
labels: | labels: |
@ -50,19 +63,19 @@ jobs:
TRACKER_HELPER_USERNAME=${{ secrets.TRACKER_HELPER_USERNAME }} TRACKER_HELPER_USERNAME=${{ secrets.TRACKER_HELPER_USERNAME }}
TRACKER_HELPER_PASSWORD=${{ secrets.TRACKER_HELPER_PASSWORD }} TRACKER_HELPER_PASSWORD=${{ secrets.TRACKER_HELPER_PASSWORD }}
- name: Build futureporn/bright # - name: Build futureporn/bright
uses: docker/build-push-action@v6 # uses: docker/build-push-action@v6
with: # with:
context: ./apps/bright # context: ./apps/bright
push: true # push: true
tags: gitea.futureporn.net/futureporn/bright:latest # tags: gitea.futureporn.net/futureporn/bright:latest
build-args: | # build-args: |
MIX_ENV=prod # MIX_ENV=prod
labels: | # labels: |
org.opencontainers.image.description=The Galaxy's Best VTuber hentai site # org.opencontainers.image.description=The Galaxy's Best VTuber hentai site
org.opencontainers.image.title=bright # org.opencontainers.image.title=bright
org.opencontainers.image.created={{commit_date 'YYYY-MM-DDTHH:mm:ss.SSS[Z]'}} # org.opencontainers.image.created={{commit_date 'YYYY-MM-DDTHH:mm:ss.SSS[Z]'}}
org.opencontainers.image.version={{version}} # org.opencontainers.image.version={{version}}
org.opencontainers.image.licenses=unlicense # org.opencontainers.image.licenses=unlicense
org.opencontainers.image.source=https://gitea.futureporn.net/futureporn/fp # org.opencontainers.image.source=https://gitea.futureporn.net/futureporn/fp
org.opencontainers.image.url=https://gitea.futureporn.net/futureporn/-/packages/container/bright # org.opencontainers.image.url=https://gitea.futureporn.net/futureporn/-/packages/container/bright

@ -37,6 +37,9 @@ jobs:
TRACKER_HELPER_URL: ${{ vars.TRACKER_HELPER_URL }} TRACKER_HELPER_URL: ${{ vars.TRACKER_HELPER_URL }}
TRACKER_HELPER_USERNAME: ${{ secrets.TRACKER_HELPER_USERNAME }} TRACKER_HELPER_USERNAME: ${{ secrets.TRACKER_HELPER_USERNAME }}
TRACKER_HELPER_PASSWORD: ${{ secrets.TRACKER_HELPER_PASSWORD }} TRACKER_HELPER_PASSWORD: ${{ secrets.TRACKER_HELPER_PASSWORD }}
TRACKER_HELPER_ACCESSLIST_URL: ${{ vars.TRACKER_HELPER_ACCESSLIST_URL }}
TRACKER_HELPER_ACCESSLIST_PATH: /var/lib/aquatic/accesslist
DB_NAME: ${{ vars.DB_NAME }} DB_NAME: ${{ vars.DB_NAME }}
DB_HOST: ${{ vars.DB_HOST }} DB_HOST: ${{ vars.DB_HOST }}
DB_PORT: ${{ vars.DB_PORT }} DB_PORT: ${{ vars.DB_PORT }}
@ -79,7 +82,8 @@ jobs:
- 3003:3003 - 3003:3003
- 9000:9000 - 9000:9000
env: env:
TRACKER_HELPER_ACCESSLIST_PATH: /var/lib/aquatic/whitelist TRACKER_HELPER_ACCESSLIST_PATH: /var/lib/aquatic/accesslist
TRACKER_HELPER_ACCESSLIST_URL: http://localhost:5063/accesslist
TRACKER_HELPER_USERNAME: ${{ secrets.TRACKER_HELPER_USERNAME }} TRACKER_HELPER_USERNAME: ${{ secrets.TRACKER_HELPER_USERNAME }}
TRACKER_HELPER_PASSWORD: ${{ secrets.TRACKER_HELPER_PASSWORD }} TRACKER_HELPER_PASSWORD: ${{ secrets.TRACKER_HELPER_PASSWORD }}
TRACKER_HELPER_PORT: 5063 TRACKER_HELPER_PORT: 5063

@ -0,0 +1,40 @@
# syntax=docker/dockerfile:1
FROM rust:latest AS builder
WORKDIR /usr/src/aquatic
COPY . .
RUN . ./scripts/env-native-cpu-without-avx-512 && cargo build --release -p aquatic_udp
FROM debian:stable-slim
ENV CONFIG_FILE_CONTENTS "[statistics]\ninterval = 5\nprint_to_stdout = true"
ENV ACCESS_LIST_CONTENTS ""
WORKDIR /etc/aquatic/
COPY --from=builder /usr/src/aquatic/target/release/aquatic_udp /usr/local/bin/aquatic_udp
COPY <<-"EOT" /usr/local/bin/entrypoint.sh
#!/bin/bash
echo -e "$CONFIG_FILE_CONTENTS" > /etc/aquatic/config.toml
echo -e "$ACCESS_LIST_CONTENTS" > /var/lib/aquatic/whitelist
exec /usr/local/bin/aquatic_udp -c /etc/aquatic/config.toml "$@"
EOT
RUN mkdir -p /var/lib/aquatic && \
touch /var/lib/aquatic/whitelist && \
chmod 0666 /var/lib/aquatic/whitelist && \
chmod +x /usr/local/bin/entrypoint.sh
HEALTHCHECK --interval=5s --timeout=3s --retries=3 \
CMD pidof aquatic_udp || exit 1
## we cd before running to workaround nektos/act behavior which overrides WORKDIR
ENTRYPOINT ["sh", "-c", "cd /etc/aquatic && /usr/local/bin/entrypoint.sh"]
# ENTRYPOINT ["tail", "-f", "/dev/null"] # for debugging

@ -32,7 +32,7 @@ config :bright,
config :bright, :torrent, config :bright, :torrent,
tracker_url: System.get_env("TRACKER_URL"), tracker_url: System.get_env("TRACKER_URL"),
tracker_helper_url: System.get_env("TRACKER_HELPER_URL"), tracker_helper_accesslist_url: System.get_env("TRACKER_HELPER_ACCESSLIST_URL"),
tracker_helper_username: System.get_env("TRACKER_HELPER_USERNAME"), tracker_helper_username: System.get_env("TRACKER_HELPER_USERNAME"),
tracker_helper_password: System.get_env("TRACKER_HELPER_PASSWORD") tracker_helper_password: System.get_env("TRACKER_HELPER_PASSWORD")

@ -17,16 +17,16 @@ defmodule Bright.Tracker do
This is where we send infohashes that end up in aquatic's accesslist This is where we send infohashes that end up in aquatic's accesslist
Usually it's port 5063, path /accesslist Usually it's port 5063, path /accesslist
""" """
@spec accesslist_url() :: binary() @spec tracker_helper_accesslist_url() :: binary()
def accesslist_url do def tracker_helper_accesslist_url do
url = url =
case Application.fetch_env!(:bright, :torrent)[:tracker_helper_accesslist_url] do case Application.fetch_env!(:bright, :torrent)[:tracker_helper_accesslist_url] do
nil -> raise "accesslist_url missing or empty in app config" nil -> raise "tracker_helper_accesslist_url missing or empty in app config"
"" -> raise "accesslist_url missing or empty in app config" "" -> raise "tracker_helper_accesslist_url missing or empty in app config"
url -> url url -> url
end end
Logger.debug("accesslist_url=#{url}") Logger.debug("tracker_helper_accesslist_url=#{url}")
url url
end end
@ -49,7 +49,7 @@ defmodule Bright.Tracker do
end end
def accesslist_info_hash(info_hash) do def accesslist_info_hash(info_hash) do
accesslist_url = accesslist_url() accesslist_url = tracker_helper_accesslist_url()
username = tracker_helper_username() username = tracker_helper_username()
password = tracker_helper_password() password = tracker_helper_password()

@ -13,7 +13,7 @@ defmodule Bright.ImagesTest do
{:ok, filename} = {:ok, filename} =
Images.create_thumbnail(@test_mp4_fixture) Images.create_thumbnail(@test_mp4_fixture)
assert Regex.match?(~r/^\/root\/\.cache\/futureporn\/[^\/]+\/[^\/]+\.png$/, filename) assert Regex.match?(~r/\.cache\/futureporn\/[^\/]+\/[^\/]+\.png$/, filename)
assert File.exists?(filename) assert File.exists?(filename)
assert File.stat!(filename).size > 0, "thumbnail file is empty" assert File.stat!(filename).size > 0, "thumbnail file is empty"
end end

@ -3,24 +3,22 @@ defmodule Bright.TrackerTest do
use Bright.DataCase use Bright.DataCase
alias Bright.Tracker alias Bright.Tracker
alias Bright.URLEncoder
describe "tracker" do describe "tracker" do
use ExUnit.Case, async: false use ExUnit.Case, async: false
import Bright.StreamsFixtures
# tails-amd64-6.10-img (BT info_hash v1) # tails-amd64-6.10-img (BT info_hash v1)
@info_hash_v1_fixture "07b4516336e4afe9232c73bc312642590a7d7e95" @info_hash_v1_fixture "07b4516336e4afe9232c73bc312642590a7d7e95"
@tag :integration @tag :integration
test "whitelist_info_hash/1 using a string info_hash" do test "accesslist_info_hash/1 using a string info_hash" do
case Tracker.whitelist_info_hash(@info_hash_v1_fixture) do case Tracker.accesslist_info_hash(@info_hash_v1_fixture) do
{:ok, info_hash} -> {:ok, info_hash} ->
assert :ok assert :ok
assert info_hash === @info_hash_v1_fixture assert info_hash === @info_hash_v1_fixture
{:error, :closed} -> {:error, :closed} ->
flunk("The connection to opentracker was closed. Is opentracker running?") flunk("The connection to tracker was closed. Is tracker running?")
other -> other ->
flunk("Unexpected result: #{inspect(other)}") flunk("Unexpected result: #{inspect(other)}")

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
pidof aquatic_udp || exit 111 pidof aquatic_udp || exit 111
curl -f http://localhost:5063/helper || exit 112 curl -f http://localhost:5063/health || exit 112
curl -f http://localhost:9000/metrics || exit 113 curl -f http://localhost:9000/metrics || exit 113

@ -89,39 +89,21 @@ ssh:
# Use accessory services (secrets come from .kamal/secrets). # Use accessory services (secrets come from .kamal/secrets).
# #
accessories: accessories:
tracker-helper:
image: gitea.futureporn.net/futureporn/opentracker:latest
host: 45.76.57.101
port: "127.0.0.1:3000:3000"
env:
secret:
- WL_CREDENTIALS
proxy:
ssl: true
forward_headers: true
app_port: 3000
host: tracker-helper.futureporn.net
healthcheck:
path: /health
volumes:
- opentracker-etc:/etc/opentracker
- opentracker-var:/var/run/opentracker
tracker: tracker:
image: gitea.futureporn.net/futureporn/tracker:latest image: gitea.futureporn.net/futureporn/tracker:latest
host: 45.76.57.101 host: 45.76.57.101
port: "0.0.0.0:5063:5063" port: "0.0.0.0:5063:5063"
env: env:
clear: clear:
HELPER_ACCESSLIST_PATH: "/var/lib/aquatic/accesslist" TRACKER_HELPER_ACCESSLIST_PATH: "/var/lib/aquatic/accesslist"
secret: secret:
- HELPER_USERNAME - TRACKER_HELPER_USERNAME
- HELPER_PASSWORD - TRACKER_HELPER_PASSWORD
proxy: proxy:
ssl: true ssl: true
forward_headers: true forward_headers: false
app_port: 5063 # note: tracker also uses port 6969/udp and 9000/tcp, but the api at 5063/tcp is what we specify here. # @todo @blocking https://github.com/basecamp/kamal-proxy/issues/48 # note: tracker also uses port 6969/udp and 9000/tcp, but the api at 5063/tcp is what we specify here. # @todo @blocking https://github.com/basecamp/kamal-proxy/issues/48
app_port: 5063
host: tracker.futureporn.net host: tracker.futureporn.net
healthcheck: healthcheck:
path: /health path: /health

@ -1,4 +0,0 @@
b22ea43e4c0a7f73fc706b5faf1c35bb078d3722
3aa5ad5e62eaffd148cff3dbe93ff2e1e9cbcf01
3aa5ad5e62eaffd148cff3dbe93ff2e1e9cbcf01
3aa5ad5e62eaffd148cff3dbe93ff2e1e9cbcf01