Add fixes, firefly

main
mat ess 2022-11-17 13:44:48 -05:00
parent 97b214e0ea
commit 69300cb426
5 changed files with 44 additions and 16 deletions

1
.envrc
View File

@ -1 +1,2 @@
use flake use flake
dotenv .env

3
.gitignore vendored
View File

@ -1 +1,2 @@
.direnv/ .env
.direnv

View File

@ -35,7 +35,10 @@ local mkService(name, svc) = svc {
}; };
local extractVolumes(cfg) = { local extractVolumes(cfg) = {
[name]: { external: true } [name]: {
// this is very ugly, a data driven approach would be better but very verbose
external: std.length(std.findSubstr('_', name)) >= 2,
}
for name in std.flattenArrays([ for name in std.flattenArrays([
std.objectFields(optional(svc, 'volumes')) std.objectFields(optional(svc, 'volumes'))
for svc in std.objectValues(cfg) for svc in std.objectValues(cfg)
@ -65,7 +68,7 @@ local mediaMounts(mounts) = {
MediaService(name, tag='latest', env={}, mounts={}, webPort, ports=[]):: { MediaService(name, tag='latest', env={}, mounts={}, webPort, ports=[]):: {
image: 'lscr.io/linuxserver/%s:%s' % [name, tag], image: 'lscr.io/linuxserver/%s:%s' % [name, tag],
environment: mediaEnv + env, environment: mediaEnv + env,
volumes: { ['%s_config' % name]: '/config' }, volumes: { ['media_%s_config' % name]: '/config' },
mounts:: mediaMounts(mounts), mounts:: mediaMounts(mounts),
webPort:: webPort, webPort:: webPort,
ports: ports, ports: ports,

View File

@ -14,11 +14,15 @@
to-docker-compose = pkgs.writeShellApplication { to-docker-compose = pkgs.writeShellApplication {
name = "to-docker-compose"; name = "to-docker-compose";
runtimeInputs = [ pkgs.jsonnet ]; runtimeInputs = [ pkgs.jsonnet ];
text = '' text =
let
vars = [ "PLEX_CLAIM" "PLEX_ADVERTISE_IP" "FIREFLY_APP_KEY" ];
varRow = var: "${var}: '\$${var}'";
in
''
jsonnet services.jsonnet \ jsonnet services.jsonnet \
--tla-code secrets="{ --tla-code secrets="{
PLEX_CLAIM: '$PLEX_CLAIM', ${pkgs.lib.concatMapStrings varRow vars}
ADVERTISE_IP: '$ADVERTISE_IP',
}" }"
''; '';
}; };

View File

@ -18,8 +18,8 @@ function(secrets={})
// 'entrypoints.websecure.address': ':443', // 'entrypoints.websecure.address': ':443',
}), }),
docker:: true, docker:: true,
webPort:: 80, webPort:: 8080,
ports: [Port(80), /* Port(443), */ Port(8080)], ports: [Port(80) /* Port(443) */],
traefik:: { traefik:: {
// 'traefik.http.routers.http-catchall.rule': 'hostregexp(`{host:.+}`)' // 'traefik.http.routers.http-catchall.rule': 'hostregexp(`{host:.+}`)'
// 'traefik.http.routers.http-catchall.entrypoints': 'web' // 'traefik.http.routers.http-catchall.entrypoints': 'web'
@ -30,7 +30,7 @@ function(secrets={})
portainer: { portainer: {
image: 'portainer/portainer-ce:latest', image: 'portainer/portainer-ce:latest',
docker:: true, docker:: true,
volumes: { portainer_data: '/data' }, volumes: { portainer_portainer_data: '/data' },
webPort:: 9000, webPort:: 9000,
ports: [Port(9443)], ports: [Port(9443)],
}, },
@ -82,9 +82,9 @@ function(secrets={})
environment: { environment: {
TZ: 'America/New_York', TZ: 'America/New_York',
PLEX_CLAIM: std.get(secrets, 'PLEX_CLAIM'), PLEX_CLAIM: std.get(secrets, 'PLEX_CLAIM'),
ADVERTISE_IP: std.get(secrets, 'ADVERTISE_IP'), ADVERTISE_IP: std.get(secrets, 'PLEX_ADVERTISE_IP'),
}, },
volumes: { plex_config: '/config' }, volumes: { media_plex_config: '/config' },
mounts:: MediaMounts({ mounts:: MediaMounts({
'torrents/plex-transcode': '/transcode', 'torrents/plex-transcode': '/transcode',
'passport-5tb': '/passport-5tb', 'passport-5tb': '/passport-5tb',
@ -106,7 +106,10 @@ function(secrets={})
}, },
archivebox: { archivebox: {
image: 'archivebox/archivebox:dev', image: 'archivebox/archivebox:dev',
command: 'server --quick-init 0.0.0.0:8000', // command: 'server --quick-init 0.0.0.0:8000',
// TODO: hack to workaround https://github.com/ArchiveBox/ArchiveBox/issues/1002
entrypoint: '/bin/bash',
command: '-c "chown -R archivebox:archivebox /app/archivebox/core/migrations && /app/bin/docker_entrypoint.sh server --quick-init 0.0.0.0:8000"',
environment: { environment: {
ALLOWED_HOSTS: '*', ALLOWED_HOSTS: '*',
MEDIA_MAX_SIZE: '750m', MEDIA_MAX_SIZE: '750m',
@ -116,4 +119,20 @@ function(secrets={})
webPort:: 8000, webPort:: 8000,
host:: 'archive', host:: 'archive',
}, },
firefly: {
image: 'fireflyiii/core:latest',
environment: {
DB_CONNECTION: 'sqlite',
APP_DEBUG: true,
SITE_OWNER: 'mat@mat.services',
APP_KEY: std.get(secrets, 'FIREFLY_APP_KEY'),
TZ: 'America/New_York',
TRUSTED_PROXIES: '**',
},
volumes: {
firefly_data: '/storage',
firefly_uploads: '/var/www/html/storage/upload',
},
webPort:: 8080,
},
}) })