diff --git a/.gitignore b/.gitignore index 27f44f6..9906692 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -garage/* \ No newline at end of file +garage/* +.ignore/** \ No newline at end of file diff --git a/CloudronManifest.json b/CloudronManifest.json index 34fa470..3fec08d 100644 --- a/CloudronManifest.json +++ b/CloudronManifest.json @@ -1,34 +1,19 @@ { - "id": "com.jadud.garage", - "title": "Garage", - "version": "0.0.1", - "healthCheckPath": "/health", - "multiDomain": true, - "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" + "addons": { + "localstorage": { + "sqlite": { + "paths": [ + "/app/data/garage/meta/db.sqlite" + ] + } } - } - }, - "manifestVersion": 2, - "icon": "" + }, + "healthCheckPath": "/health", + "httpPort": 80, + "icon": "", + "id": "com.jadud.garage", + "manifestVersion": 2, + "multiDomain": true, + "title": "Garage", + "version": "0.0.1" } diff --git a/CloudronManifest.jsonnet b/CloudronManifest.jsonnet new file mode 100644 index 0000000..f739504 --- /dev/null +++ b/CloudronManifest.jsonnet @@ -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": "" +} diff --git a/Makefile b/Makefile index 7bce27d..5cbd551 100644 --- a/Makefile +++ b/Makefile @@ -6,17 +6,21 @@ DOMAIN?=garage test-build: docker build -t garage:latest . -build: templates +build: cloudron build + jsonnet CloudronManifest.jsonnet > CloudronManifest.json install: build uninstall cloudron install \ --location "${DOMAIN}" \ - --secondary-domains \ - GARAGE_WEB="web.${DOMAIN}",GARAGE_ADMIN="admin.${DOMAIN}" + --alias-domains "*.web.${DOMAIN}","admin.${DOMAIN}","api.${DOMAIN}" + +# install: build uninstall +# cloudron install \ +# --location "${DOMAIN}" update: cloudron update uninstall: - cloudron uninstall --app "${DOMAIN}" + - cloudron uninstall --app "${DOMAIN}" diff --git a/caddyfile b/caddyfile index d9365ca..0701dd9 100644 --- a/caddyfile +++ b/caddyfile @@ -1,38 +1,33 @@ { - debug + admin off + auto_https off } -# I feel like a proxy in front of Garage (within the container) -# 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. +# caddy run --watch --config /app/data/caddyfile --adapter caddyfile -# https://garagehq.deuxfleurs.fr/documentation/cookbook/reverse-proxy/ -s3.garage.tld, *.s3.garage.tld { - reverse_proxy localhost:3900 { - health_uri /health - health_port 3903 - #health_interval 15s - #health_timeout 5s - } +api.{$CLOUDRON_APP_DOMAIN}:80 { + respond /health 200 { + body "OK API" + } + reverse_proxy localhost:3900 } -# These would need to be templated, I think, so they match the domain -# that is coming in to the container. -*.web.garage.tld { - reverse_proxy localhost:3902 { - health_uri /health - health_port 3903 - #health_interval 15s - #health_timeout 5s - } +admin.{$CLOUDRON_APP_DOMAIN}:80 { + respond /health 200 { + body "OK ADMIN" + } + reverse_proxy localhost:3903 +} + +{$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 - } -} \ No newline at end of file diff --git a/start.bash b/start.bash index 6c8172d..780a187 100644 --- a/start.bash +++ b/start.bash @@ -18,10 +18,8 @@ if [[ ! -f /app/data/.initialized ]]; then # Note: it templates in the domain, which needs to be substituted at this point. # 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 + 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. # We don't have clusters, but garage wantses it. # It is precious to garage. @@ -34,5 +32,5 @@ fi # Chown the things and run. 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 diff --git a/test-script.txt b/test-script.txt deleted file mode 100644 index 03b63b8..0000000 --- a/test-script.txt +++ /dev/null @@ -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