Full document, spreadsheet, slideshow, and diagram tooling
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: runtime-configurable instance-info via env vars

Docker entrypoint generates /srv/instance-info.json from INSTANCE_*
environment variables at container startup. If no env vars are set,
the baked-in file (open access, no allowlist) is used as the default.

This moves the allowlist out of source code so it can be configured
per-deployment via Nomad env, docker-compose, or volume mount.

Env vars: INSTANCE_FLAVOR, INSTANCE_OPERATOR, INSTANCE_PDS,
INSTANCE_FEATURES, INSTANCE_ACCESS_MODE, INSTANCE_ALLOWLIST,
INSTANCE_NOTICE.

+64 -13
+3
Dockerfile
··· 12 12 LABEL org.opencontainers.image.source="https://tangled.org/scottlanoue.com/atmosphere-office" 13 13 LABEL org.opencontainers.image.licenses="AGPL-3.0" 14 14 COPY Caddyfile /etc/caddy/Caddyfile 15 + COPY docker-entrypoint.sh /docker-entrypoint.sh 15 16 COPY --from=builder /app/dist /srv 16 17 EXPOSE 8080 18 + ENTRYPOINT ["/docker-entrypoint.sh"] 19 + CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
+14 -7
docker-compose.yml
··· 5 5 ## 6 6 ## Then visit http://localhost:8080 7 7 ## 8 - ## Configure instance-info.json to match your deployment: 9 - ## - Set "flavor" to "pds-operator" or "self-hosted" 10 - ## - Set "operator" to your organization name 11 - ## - Set "pds" to your PDS hostname (if applicable) 12 - ## - Enable features as you deploy backend services 8 + ## Configure your instance via environment variables: 9 + ## INSTANCE_FLAVOR — public, pds-operator, or self-hosted 10 + ## INSTANCE_OPERATOR — your organization name 11 + ## INSTANCE_PDS — your PDS hostname 12 + ## INSTANCE_FEATURES — comma-separated: sync,sharing,ai 13 + ## INSTANCE_ACCESS_MODE — open or allowlist 14 + ## INSTANCE_ALLOWLIST — comma-separated DIDs (when mode=allowlist) 15 + ## INSTANCE_NOTICE — banner notice text 16 + ## 17 + ## Or mount a custom instance-info.json: 18 + ## volumes: 19 + ## - ./instance-info.json:/srv/instance-info.json:ro 13 20 14 21 services: 15 22 office: 16 23 image: atcr.io/scottlanoue.com/atmosphere-office:latest 17 24 ports: 18 25 - "8080:8080" 19 - volumes: 20 - - ./instance-info.json:/srv/instance-info.json:ro 26 + environment: 27 + - INSTANCE_FLAVOR=self-hosted 21 28 restart: unless-stopped
+46
docker-entrypoint.sh
··· 1 + #!/bin/sh 2 + set -e 3 + 4 + # Generate /srv/instance-info.json from environment variables. 5 + # If INSTANCE_FLAVOR is not set, the baked-in file from the build is used as-is. 6 + 7 + if [ -n "$INSTANCE_FLAVOR" ]; then 8 + SYNC=false; SHARING=false; AI=false 9 + case ",$INSTANCE_FEATURES," in *,sync,*) SYNC=true;; esac 10 + case ",$INSTANCE_FEATURES," in *,sharing,*) SHARING=true;; esac 11 + case ",$INSTANCE_FEATURES," in *,ai,*) AI=true;; esac 12 + 13 + OP=null 14 + [ -n "$INSTANCE_OPERATOR" ] && OP="\"$INSTANCE_OPERATOR\"" 15 + 16 + PDS=null 17 + [ -n "$INSTANCE_PDS" ] && PDS="\"$INSTANCE_PDS\"" 18 + 19 + NOTICE=null 20 + [ -n "$INSTANCE_NOTICE" ] && NOTICE="\"$INSTANCE_NOTICE\"" 21 + 22 + AC=null 23 + if [ "$INSTANCE_ACCESS_MODE" = "allowlist" ] && [ -n "$INSTANCE_ALLOWLIST" ]; then 24 + DIDS=$(printf '%s' "$INSTANCE_ALLOWLIST" | sed 's/,/","/g') 25 + AC="{\"mode\":\"allowlist\",\"allowlist\":[\"$DIDS\"]}" 26 + elif [ "$INSTANCE_ACCESS_MODE" = "open" ]; then 27 + AC="{\"mode\":\"open\"}" 28 + fi 29 + 30 + cat > /srv/instance-info.json <<EOF 31 + { 32 + "flavor": "$INSTANCE_FLAVOR", 33 + "operator": $OP, 34 + "pds": $PDS, 35 + "features": { 36 + "sync": $SYNC, 37 + "sharing": $SHARING, 38 + "ai": $AI 39 + }, 40 + "notice": $NOTICE, 41 + "accessControl": $AC 42 + } 43 + EOF 44 + fi 45 + 46 + exec "$@"
+1 -6
public/instance-info.json
··· 8 8 "ai": false 9 9 }, 10 10 "notice": null, 11 - "accessControl": { 12 - "mode": "allowlist", 13 - "allowlist": [ 14 - "did:plc:dy67wyyakm7u4v2lthy5zwbn" 15 - ] 16 - } 11 + "accessControl": null 17 12 }