diff --git a/CloudronManifest.json b/CloudronManifest.json index 4c07ec7..34fa470 100644 --- a/CloudronManifest.json +++ b/CloudronManifest.json @@ -5,18 +5,20 @@ "healthCheckPath": "/health", "multiDomain": true, "httpPort": 3900, - "httpPorts": { + "tcpPorts": { "GARAGE_WEB": { - "title": "Garage web server domain", - "description": "Buckets as static sites can be found here", - "containerPort": 3902, - "defaultValue": "web" + "title": "Garage web server domain", + "description": "Web port", + "defaultValue": 3902, + "containerPort": 3902, + "portCount": 1 }, - "GARAGE_ADMIN": { - "title": "Garage Admin API Domain", - "description": "For administering the Garage instance remotely", - "containerPort": 3903, - "defaultValue": "admin" + "GARAGE_ADMIN": { + "title": "Admin port", + "description": "Admin port", + "defaultValue": 3903, + "containerPort": 3903, + "portCount": 1 } }, "addons": { diff --git a/Dockerfile b/Dockerfile index a97334a..d49aab0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,8 @@ FROM cloudron/base:5.0.0 +RUN apt-get update ; apt-get install -y \ + caddy + # Garage wants these directories for storing stuff. # We want it here so that /app/data gets backed up. RUN mkdir -p /app/data/garage/data /app/data/garage/meta @@ -8,6 +11,8 @@ ADD https://garagehq.deuxfleurs.fr/_releases/v2.1.0/x86_64-unknown-linux-musl/ga RUN chmod 755 /usr/bin/garage COPY garage.toml /garage/garage.toml +COPY caddyfile /garage/caddyfile + # Create a symlink that will become dead; we'll fill it again # with the startup script. RUN ln -s /app/data/garage.toml /etc/garage.toml diff --git a/Dockerfile.template b/Dockerfile.template deleted file mode 100644 index e4ff5ee..0000000 --- a/Dockerfile.template +++ /dev/null @@ -1,19 +0,0 @@ -FROM cloudron/base:5.0.0 - -# Garage wants these directories for storing stuff. -# We want it here so that /app/data gets backed up. -RUN mkdir -p /app/data/garage/data /app/data/garage/meta - -ADD https://garagehq.deuxfleurs.fr/_releases/VERSION/x86_64-unknown-linux-musl/garage /usr/bin/garage -RUN chmod 755 /usr/bin/garage - -COPY garage.toml /garage/garage.toml -# Create a symlink that will become dead; we'll fill it again -# with the startup script. -RUN ln -s /app/data/garage.toml /etc/garage.toml - -COPY start.bash /garage/start.bash -RUN chmod 755 /garage/start.bash - - -CMD [ "/garage/start.bash" ] \ No newline at end of file diff --git a/Makefile b/Makefile index 2cc29b9..7bce27d 100644 --- a/Makefile +++ b/Makefile @@ -3,8 +3,8 @@ VERSION?=v2.1.0 IMAGE?=garage:latest DOMAIN?=garage -templates: - VERSION="${VERSION}" DOMAIN="${DOMAIN}" ./process-templates.bash +test-build: + docker build -t garage:latest . build: templates cloudron build @@ -15,5 +15,8 @@ install: build uninstall --secondary-domains \ GARAGE_WEB="web.${DOMAIN}",GARAGE_ADMIN="admin.${DOMAIN}" +update: + cloudron update + uninstall: cloudron uninstall --app "${DOMAIN}" diff --git a/README.md b/README.md index 1b2c918..b7d1987 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,14 @@ make build DOMAIN= This runs `cloudron build`, and may (on first run) request a path to a registry. You can configure a private registry on your own Cloudron for this purpose. You need to pass the Cloudron domain here, so that the manifest can be set up correctly. +For extended iteration + +``` +export DOMAIN= +``` + +will allow `make build ; make update` as a repeated sequence. + ``` // diff --git a/caddyfile b/caddyfile new file mode 100644 index 0000000..d9365ca --- /dev/null +++ b/caddyfile @@ -0,0 +1,38 @@ +{ + debug +} + +# 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. + +# 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 + } +} + +# 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.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/process-templates.bash b/process-templates.bash deleted file mode 100755 index 8f60d68..0000000 --- a/process-templates.bash +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -sed -e 's/VERSION/'"${VERSION}"'/g' Dockerfile.template > Dockerfile diff --git a/start.bash b/start.bash index 54a3120..6c8172d 100644 --- a/start.bash +++ b/start.bash @@ -19,6 +19,9 @@ if [[ ! -f /app/data/.initialized ]]; then # 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 + # 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. @@ -30,4 +33,6 @@ 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 /usr/bin/garage server diff --git a/test-script.txt b/test-script.txt index aeb784c..03b63b8 100644 --- a/test-script.txt +++ b/test-script.txt @@ -1,5 +1,5 @@ garage status -garage layout assign -z home -c 1G d785aad03f42dd47 +garage layout assign -z home -c 1G 8e20b876358d1f32 garage layout show garage layout apply --version 1 garage bucket create site