Files
SocialPub/tools/pasture/peers/decepub.sh
T

28 lines
1.3 KiB
Bash
Raw Normal View History

# decePubClient as tests/e2e/run.sh publishes it (environment Pasture: its API is https://privapub.test), served like the
# production vhost (deploy/nginx in decePubClient): static files, the SPA fallback, nothing cached that must not be.
DECEPUB_SITE=${DECEPUB_SITE:-$repo/../decePubClient/tests/e2e/.publish/wwwroot}
decepub_up() {
[ -f "$DECEPUB_SITE/index.html" ] || { echo "no published decePub in $DECEPUB_SITE (decePubClient/tests/e2e/run.sh publishes it)" >&2; return 1; }
mkdir -p "$here/.state"
cat > "$here/.state/decepub.Caddyfile" <<'CADDY'
:80 {
root * /srv
header {
X-Content-Type-Options nosniff
Referrer-Policy strict-origin-when-cross-origin
X-Frame-Options SAMEORIGIN
}
@fresh path /index.html /appsettings.json /appsettings.Pasture.json /service-worker.js /service-worker-assets.js /build.json
header @fresh Cache-Control no-cache
try_files {path} /index.html
file_server {
precompressed br gzip
}
}
CADDY
podman run -d --replace --name pasture-decepub --network $net -v "$DECEPUB_SITE:/srv:z,ro" \
-v "$here/.state/decepub.Caddyfile:/etc/caddy/Caddyfile:z,ro" docker.io/library/caddy:2 >/dev/null
podman exec pasture-caddy caddy reload --config /etc/caddy/Caddyfile >/dev/null 2>&1 || true
echo "decepub: https://decepub.test:6443"
}