From bbda943304fda76ab211be60f62163608bf6f261 Mon Sep 17 00:00:00 2001 From: mo khan Date: Wed, 10 Sep 2025 17:42:13 -0600 Subject: chore: split the Procfile for each environment --- .gitignore | 5 ----- Dockerfile | 2 +- Makefile | 18 ++++++------------ Procfile.development | 5 +++++ Procfile.production | 4 ++++ Procfile.template | 5 ----- Procfile.test | 4 ++++ test/integration/container.go | 1 + 8 files changed, 21 insertions(+), 23 deletions(-) create mode 100644 Procfile.development create mode 100644 Procfile.production delete mode 100644 Procfile.template create mode 100644 Procfile.test diff --git a/.gitignore b/.gitignore index 65ba73b..b6cfd39 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,3 @@ .env.* /tmp /log -.claude/ - -# Generated Procfiles (use Procfile.template as source) -Procfile -Procfile.dev diff --git a/Dockerfile b/Dockerfile index cb053a0..cd22c48 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,7 +29,7 @@ USER nonroot COPY --from=dumb-init-builder /usr/bin/dumb-init /bin/dumb-init COPY --from=envoy-binary /usr/local/bin/envoy /bin/envoy COPY --from=spicedb-binary /usr/local/bin/spicedb /bin/spicedb -COPY --from=build /app/Procfile /Procfile +COPY --from=build /app/Procfile.production /Procfile COPY --from=build /app/bin/envoy-shim /bin/envoy-shim COPY --from=build /app/etc/envoy /etc/envoy COPY --from=build /app/etc/authzd /etc/authzd diff --git a/Makefile b/Makefile index 467479a..a25c683 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ SPICEDB := bin/spicedb TOOL := bin/tool ZED := bin/zed -.PHONY: clean setup build test run db-setup db-create db-stop db-reset +.PHONY: db-clean clean setup build test-schema test-unit test-race test-integration test build-image run run-image lint tidy db-schema-load db-seed db-stop db-reset db-init db-create db-migrate db-console db-setup $(AUTHZD_BIN): $(shell find . -name "*.go" 2>/dev/null) go.sum @$(GO) build -mod=vendor -o $(AUTHZD_BIN) ./cmd/authzd/main.go @@ -22,7 +22,7 @@ db-clean: @rm -rf tmp/postgres tmp/postgres.log clean: db-clean - @rm -f $(AUTHZD_BIN) $(SPARKLED_BIN) Procfile Procfile.dev + @rm -f $(AUTHZD_BIN) $(SPARKLED_BIN) @$(GO) clean -testcache setup: @@ -32,12 +32,6 @@ setup: fi @$(MISE) exec python -- pip install dumb-init -Procfile: Procfile.template - @grep -v "# DEV_ONLY:" Procfile.template > Procfile - -Procfile.dev: Procfile.template - @sed 's/# DEV_ONLY: //' Procfile.template > Procfile.dev - build: $(AUTHZD_BIN) $(SPARKLED_BIN) test-schema: @@ -54,14 +48,14 @@ test-integration: build-image test: clean test-unit test-race test-integration test-schema -build-image: Procfile +build-image: @$(DOCKER) build --network=host --tag $(IMAGE_TAG) . -run: clean build Procfile.dev db-init - @$(TOOL) godotenv -f .env.local,.env $(TOOL) minit -f Procfile.dev +run: clean build db-init + @$(TOOL) godotenv -f .env.local,.env $(TOOL) minit -f Procfile.development run-image: clean build-image - @$(DOCKER) run --rm --network host --env-file .env.local -p 10000:10000 -it $(IMAGE_TAG) + @$(DOCKER) run --rm --network host --env-file .env.local -v $(PWD)/Procfile.development:/Procfile -p 10000:10000 -it $(IMAGE_TAG) lint: @$(TOOL) yamlfmt -lint -exclude vendor . diff --git a/Procfile.development b/Procfile.development new file mode 100644 index 0000000..9481a58 --- /dev/null +++ b/Procfile.development @@ -0,0 +1,5 @@ +postgres: ./bin/postgres -D tmp/postgres -c config_file=etc/postgres/postgresql.conf +spicedb: ./bin/spicedb serve --grpc-preshared-key $ZED_TOKEN --http-addr :8081 --grpc-addr :50051 --datastore-engine postgres --datastore-conn-uri $DATABASE_URL --log-level $LOG_LEVEL --log-format json --telemetry-endpoint "" --skip-release-check +authzd: ./bin/authzd +envoy: ./bin/envoy-shim +sparkled: ./bin/sparkled diff --git a/Procfile.production b/Procfile.production new file mode 100644 index 0000000..41fc5e1 --- /dev/null +++ b/Procfile.production @@ -0,0 +1,4 @@ +spicedb: ./bin/spicedb serve --grpc-preshared-key $ZED_TOKEN --http-addr :8081 --grpc-addr :50051 --datastore-engine memory --log-level $LOG_LEVEL --log-format json --telemetry-endpoint "" --skip-release-check +authzd: ./bin/authzd +envoy: ./bin/envoy-shim +sparkled: ./bin/sparkled diff --git a/Procfile.template b/Procfile.template deleted file mode 100644 index 60d609e..0000000 --- a/Procfile.template +++ /dev/null @@ -1,5 +0,0 @@ -# DEV_ONLY: postgres: ./bin/postgres -D tmp/postgres -c config_file=etc/postgres/postgresql.conf -spicedb: ./bin/spicedb serve --grpc-preshared-key $ZED_TOKEN --http-addr :8081 --grpc-addr :50051 --datastore-engine postgres --datastore-conn-uri $DATABASE_URL --log-level $LOG_LEVEL --log-format json --telemetry-endpoint "" --skip-release-check -authzd: ./bin/authzd -envoy: ./bin/envoy-shim -sparkled: ./bin/sparkled diff --git a/Procfile.test b/Procfile.test new file mode 100644 index 0000000..b4d272e --- /dev/null +++ b/Procfile.test @@ -0,0 +1,4 @@ +spicedb: ./bin/spicedb serve --grpc-preshared-key $ZED_TOKEN --http-addr :8081 --grpc-addr :50051 --datastore-engine postgres --datastore-conn-uri $DATABASE_URL --log-level $LOG_LEVEL --log-format json --telemetry-endpoint "" --skip-release-check +authzd: ./bin/authzd +envoy: ./bin/envoy-shim +sparkled: ./bin/sparkled diff --git a/test/integration/container.go b/test/integration/container.go index c95bdfd..b385e18 100644 --- a/test/integration/container.go +++ b/test/integration/container.go @@ -23,6 +23,7 @@ func NewContainer(t *testing.T, ctx context.Context, envVars map[string]string) testcontainers.WithEnv(envVars), testcontainers.WithLogConsumers(&Logger{TB: t}), testcontainers.WithLogger(log.TestLogger(t)), + testcontainers.WithMounts(testcontainers.BindMount("Procfile.test", "/Procfile")), testcontainers.WithWaitStrategy( wait.ForHTTP("/").WithPort("10000"), ), -- cgit v1.2.3