Skip to content

Commit

Permalink
add bitmagnet
Browse files Browse the repository at this point in the history
  • Loading branch information
SaswatPadhi committed Jan 23, 2025
1 parent 07e3751 commit ba738f8
Show file tree
Hide file tree
Showing 9 changed files with 202 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/compose-test_bitmagnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: "Docker Compose Test (bitmagnet)"

on:
pull_request:
branches: master
push:
branches: master
schedule:
- cron: "0 8 * * *"

env:
TARGET_SERVICE: bitmagnet
TARGET_TIMEOUT: 45

jobs:
test:
strategy:
matrix:
platform: [ ubuntu-24.04 , ubuntu-24.04-arm ]
runs-on: ${{ matrix.platform }}
steps:
-
name: "Git: Checkout"
uses: actions/checkout@v4
-
name: "Service: Setup"
run: |
mkdir -p "openvpn/data/vpn"
cp -r .github/workflows/config/vpn "openvpn/data/vpn/config"
cp .github/workflows/config/meta.override.yml "openvpn/"
cp .github/workflows/config/meta.override.yml "${TARGET_SERVICE}/"
-
name: "Service: Start"
run: |
./comp up --skip-related --labels ignore ${TARGET_SERVICE}
-
name: "Service: Wait"
run: |
cd ${TARGET_SERVICE} ; cat .env
sleep ${TARGET_TIMEOUT}s
-
name: "Service: Test"
run: |
if ! ./comp status --skip-related ${TARGET_SERVICE}; then
docker ps
cd ${TARGET_SERVICE} ; docker compose logs
exit 1
fi
-
name: "Service: Restart with Traefik"
run: |
cp .github/workflows/config/meta.override.yml "traefik/"
./comp down,up ${TARGET_SERVICE}
-
name: "Service: Wait"
run: |
sleep ${TARGET_TIMEOUT}s ; sleep ${TARGET_TIMEOUT}s
-
name: "Service: Test with Traefik"
run: |
if ! ./comp status ${TARGET_SERVICE} ; then
docker ps
cd ${TARGET_SERVICE} ; docker compose logs
cd traefik ; docker compose logs
exit 1
fi
cd traefik
docker compose exec -T traefik wget --spider --no-check-certificate https://localhost:4443/webui/ \
|| (docker ps ; docker compose logs ; cd ../bitmagnet ; docker compose logs ; exit 1)
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,44 @@ for optionally customizing compositions via _overrides_.
:heavy_multiplication_x:
</td>
</tr>
<tr>
<th>
<a href='https://bitmagnet.io/'>bitmagnet</a>
<br>
<sub>:4443</sub>
<hr>
<a href='https://github.com/padhi-homelab/services/actions?query=workflow%3A%22Docker+Compose+Test+%28bitmagnet%29%22'><img src='https://img.shields.io/github/actions/workflow/status/padhi-homelab/services/compose-test_bitmagnet.yml?branch=master&logo=github&logoWidth=24&style=flat-square&label=tests'></img></a>
</th>
<th>
B <br> B
</th>
<th align='right'>
<a href='https://hub.docker.com/_/postgres'>
<sub>postgres</sub>
</a>
<br>
<a href='https://github.com/bitmagnet-io/bitmagnet/pkgs/container/bitmagnet'>
<sub>bitmagnet</sub>
</a>
</th>
<td align='center'>
<code><sub>17.2...ne</sub></code>
<br>
<code><sub>v0.10.0....5</sub></code>
</td>
<td align='center'>
:heavy_check_mark:
</td>
<td align='center'>
:heavy_check_mark:
</td>
<td align='center'>
:heavy_check_mark:
</td>
<td align='center'>
:heavy_check_mark:
</td>
</tr>
<tr>
<th>
<a href='https://certbot.eff.org/'>Certbot</a>
Expand Down
8 changes: 8 additions & 0 deletions bitmagnet/docker-compose.labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
bitmagnet:
labels:
traefik.enable: true
traefik.http.services.bitmagnet.loadBalancer.server.port: 3333
#
traefik.http.routers.bitmagnet.rule: Host(`${SERVER_LAN_FQDN:?}`)
traefik.http.routers.bitmagnet.entryPoints: lan-https-a
11 changes: 11 additions & 0 deletions bitmagnet/docker-compose.logging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
services:
postgres:
logging:
options:
max-size: "1m"
max-file: "1"
bitmagnet:
logging:
options:
max-size: "4m"
max-file: "1"
8 changes: 8 additions & 0 deletions bitmagnet/docker-compose.pre_hook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

set -Eumo pipefail

SELF_DIR="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
DATA_DIR="$SELF_DIR/data"

mkdir -p "$DATA_DIR/postgres/var/lib/postgresql/data"
52 changes: 52 additions & 0 deletions bitmagnet/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
services:
postgres:
image: postgres:${POSTGRES_VERSION:?}
restart: unless-stopped

security_opt:
# NOTE: Do NOT add a [space] before `true` below.
- no-new-privileges:true
user: "${USER_ID:?}:${GROUP_ID}"

network_mode: container:vpn
volumes:
- ./data/postgres/var/lib/postgresql/data:/var/lib/postgresql/data:rw

env_file:
- env/postgres

healthcheck:
test: "psql -U $$POSTGRES_USER -d $$POSTGRES_DB -c 'SELECT 1'"
interval: 15s
timeout: 3s
start_period: 30s

bitmagnet:
image: ghcr.io/bitmagnet-io/bitmagnet:${BITMAGNET_VERSION:?}
restart: unless-stopped

command: worker run --all

security_opt:
# NOTE: Do NOT add a [space] before `true` below.
- no-new-privileges:true
# FIXME: Run as non-root user

depends_on:
postgres:
condition: service_healthy

network_mode: container:vpn

env_file:
- env/postgres
environment:
POSTGRES_HOST: localhost
TMDB_ENABLED: false
DHT_SERVER_PORT: 44444
HTTP_SERVER_CORS_ALLOWED_ORIGINS: "${SERVER_LAN_FQDN:?}"

healthcheck:
test: ["CMD", "curl", "-o", "/dev/null", "-sS", "http://localhost:3333/status"]
interval: 15s
start_period: 30s
3 changes: 3 additions & 0 deletions bitmagnet/env/postgres
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
POSTGRES_DB: 'bitmagnet'
POSTGRES_USER: 'bm_pg_user'
POSTGRES_PASSWORD: 'bm.pg~p4ss'
12 changes: 12 additions & 0 deletions bitmagnet/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
messages:
up:
post:
- >-
${_THIS_COMPOSITION_} may now be accessed on
${_LINK_FONT_}https://${SERVER_LAN_FQDN}:${SERVER_LAN_HTTPS_PORT_A}/${_RESET_FONT_}
pre_reqs:
- openvpn

related:
- traefik
1 change: 1 addition & 0 deletions bitmagnet/static.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BITMAGNET_VERSION=v0.10.0-beta.5

0 comments on commit ba738f8

Please sign in to comment.