Close to a fully working package

This commit is contained in:
Matt Jadud
2025-12-07 16:40:45 -05:00
parent 9f25c1cb09
commit 696b73fce6
7 changed files with 70 additions and 83 deletions

3
.gitignore vendored
View File

@@ -1 +1,2 @@
garage/* garage/*
.ignore/**

View File

@@ -1,34 +1,19 @@
{ {
"id": "com.jadud.garage", "addons": {
"title": "Garage", "localstorage": {
"version": "0.0.1", "sqlite": {
"healthCheckPath": "/health", "paths": [
"multiDomain": true, "/app/data/garage/meta/db.sqlite"
"httpPort": 3900, ]
"tcpPorts": { }
"GARAGE_WEB": {
"title": "Garage web server domain",
"description": "Web port",
"defaultValue": 3902,
"containerPort": 3902,
"portCount": 1
},
"GARAGE_ADMIN": {
"title": "Admin port",
"description": "Admin port",
"defaultValue": 3903,
"containerPort": 3903,
"portCount": 1
}
},
"addons": {
"localstorage": {
"sqlite": {
"paths": ["/app/data/garage/meta/db.sqlite"],
"_documentation": "https://garagehq.deuxfleurs.fr/documentation/reference-manual/configuration/#:~:text=%3Cmetadata_dir%3E/db.sqlite"
} }
} },
}, "healthCheckPath": "/health",
"manifestVersion": 2, "httpPort": 80,
"icon": "" "icon": "",
"id": "com.jadud.garage",
"manifestVersion": 2,
"multiDomain": true,
"title": "Garage",
"version": "0.0.1"
} }

17
CloudronManifest.jsonnet Normal file
View File

@@ -0,0 +1,17 @@
{
"id": "com.jadud.garage",
"title": "Garage",
"version": "0.0.1",
"healthCheckPath": "/health",
"multiDomain": true,
"httpPort": 80,
"addons": {
"localstorage": {
"sqlite": {
"paths": ["/app/data/garage/meta/db.sqlite"],
}
}
},
"manifestVersion": 2,
"icon": ""
}

View File

@@ -6,17 +6,21 @@ DOMAIN?=garage
test-build: test-build:
docker build -t garage:latest . docker build -t garage:latest .
build: templates build:
cloudron build cloudron build
jsonnet CloudronManifest.jsonnet > CloudronManifest.json
install: build uninstall install: build uninstall
cloudron install \ cloudron install \
--location "${DOMAIN}" \ --location "${DOMAIN}" \
--secondary-domains \ --alias-domains "*.web.${DOMAIN}","admin.${DOMAIN}","api.${DOMAIN}"
GARAGE_WEB="web.${DOMAIN}",GARAGE_ADMIN="admin.${DOMAIN}"
# install: build uninstall
# cloudron install \
# --location "${DOMAIN}"
update: update:
cloudron update cloudron update
uninstall: uninstall:
cloudron uninstall --app "${DOMAIN}" - cloudron uninstall --app "${DOMAIN}"

View File

@@ -1,38 +1,33 @@
{ {
debug admin off
auto_https off
} }
# I feel like a proxy in front of Garage (within the container) # caddy run --watch --config /app/data/caddyfile --adapter caddyfile
# would let me redirect `/health` from the TLD through to the admin API,
# which is the only place the healthcheck URL exists. But, Cloudron has no notion
# of the healthcheck being somewhere else.
# https://garagehq.deuxfleurs.fr/documentation/cookbook/reverse-proxy/ api.{$CLOUDRON_APP_DOMAIN}:80 {
s3.garage.tld, *.s3.garage.tld { respond /health 200 {
reverse_proxy localhost:3900 { body "OK API"
health_uri /health }
health_port 3903 reverse_proxy localhost:3900
#health_interval 15s
#health_timeout 5s
}
} }
# These would need to be templated, I think, so they match the domain admin.{$CLOUDRON_APP_DOMAIN}:80 {
# that is coming in to the container. respond /health 200 {
*.web.garage.tld { body "OK ADMIN"
reverse_proxy localhost:3902 { }
health_uri /health reverse_proxy localhost:3903
health_port 3903 }
#health_interval 15s
#health_timeout 5s {$CLOUDRON_APP_DOMAIN}:80 {
} respond /health 200 {
body "OK S3"
}
reverse_proxy localhost:3900
}
*.web.{$CLOUDRON_APP_DOMAIN}:80 {
reverse_proxy localhost:3902
} }
admin.garage.tld {
reverse_proxy localhost:3903 {
health_uri /health
health_port 3903
#health_interval 15s
#health_timeout 5s
}
}

View File

@@ -18,10 +18,8 @@ if [[ ! -f /app/data/.initialized ]]; then
# Note: it templates in the domain, which needs to be substituted at this point. # Note: it templates in the domain, which needs to be substituted at this point.
# If the end-user moves the domain... this will break. # If the end-user moves the domain... this will break.
sed -e 's/CLOUDRON_APP_DOMAIN/'"${CLOUDRON_APP_DOMAIN}"'/g' /garage/garage.toml > /app/data/garage.toml sed -e 's/CLOUDRON_APP_DOMAIN/'"${CLOUDRON_APP_DOMAIN}"'/g' /garage/garage.toml > /app/data/garage.toml
cp /garage/caddyfile /app/data/caddyfile
# For redirecting /health to admin.DOMAIN/health
sed -e 's/CLOUDRON_APP_DOMAIN/'"${CLOUDRON_APP_DOMAIN}"'/g' /garage/caddyfile > /app/data/caddyfile
# Generate an RPC secret file. This is used for clusters. # Generate an RPC secret file. This is used for clusters.
# We don't have clusters, but garage wantses it. # We don't have clusters, but garage wantses it.
# It is precious to garage. # It is precious to garage.
@@ -34,5 +32,5 @@ fi
# Chown the things and run. # Chown the things and run.
chown -R cloudron:cloudron /app/data/garage chown -R cloudron:cloudron /app/data/garage
# gosu cloudron:cloudron caddy run --config /app/data/caddyfile --adapter caddyfile & gosu cloudron:cloudron caddy run --watch --config /app/data/caddyfile --adapter caddyfile &
gosu cloudron:cloudron /usr/bin/garage server gosu cloudron:cloudron /usr/bin/garage server

View File

@@ -1,13 +0,0 @@
garage status
garage layout assign -z home -c 1G 8e20b876358d1f32
garage layout show
garage layout apply --version 1
garage bucket create site
garage key create site-key
garage bucket allow \
--read \
--write \
--owner \
site \
--key site-key
garage bucket website --allow site