diff --git a/wien_talks/wien_talks_server/.env.template b/wien_talks/wien_talks_server/.env.template new file mode 100644 index 0000000..f44571b --- /dev/null +++ b/wien_talks/wien_talks_server/.env.template @@ -0,0 +1,3 @@ +POSTGRES_USER=postgres +POSTGRES_DB=wien_talks +POSTGRES_PASSWORD=sergtsop diff --git a/wien_talks/wien_talks_server/.gitignore b/wien_talks/wien_talks_server/.gitignore index ee19b5d..c4bbf42 100644 --- a/wien_talks/wien_talks_server/.gitignore +++ b/wien_talks/wien_talks_server/.gitignore @@ -14,4 +14,5 @@ config/passwords.yaml # Firebase service account key for Firebase auth config/firebase_service_account_key.json -.env \ No newline at end of file +.env +*.env diff --git a/wien_talks/wien_talks_server/Makefile b/wien_talks/wien_talks_server/Makefile new file mode 100644 index 0000000..8f54d82 --- /dev/null +++ b/wien_talks/wien_talks_server/Makefile @@ -0,0 +1,25 @@ +include ../defines.mk + +COMPOSE_FILE_LOCAL = docker-compose.local.yaml +COMPOSE_FILE_DEPLOY = docker-compose.deploy.yaml + +# Basically the current directory's name, so wien_talks_server +COMPOSE_PROJECT := $(shell basename $(shell pwd)) + +.env: .env.template + cp -a .env.template .env + +.PHONY := local local-stop local-down local-clean +local: .env + docker compose -f $(COMPOSE_FILE_LOCAL) up -d + +local-stop: + docker compose -f $(COMPOSE_FILE_LOCAL) stop + +local-down: + docker compose -f $(COMPOSE_FILE_LOCAL) down + +local-clean: local-down + for VOLUME in $(shell docker compose -f $(COMPOSE_FILE_LOCAL) volumes -q); \ + do docker volume rm "$$VOLUME"; done + diff --git a/wien_talks/wien_talks_server/README.md b/wien_talks/wien_talks_server/README.md index f730d7e..daddc21 100644 --- a/wien_talks/wien_talks_server/README.md +++ b/wien_talks/wien_talks_server/README.md @@ -13,3 +13,17 @@ Then you can start the Serverpod server. When you are finished, you can shut down Serverpod with `Ctrl-C`, then stop Postgres and Redis. docker compose stop + +## Environments & Passwords + +Note that the password used in your environment files (`.env` for local +development and `env.d/postgres.env.template` for deployment) must correspond to +the password in `config/passwords.yaml`. + +The `config/passwords.yaml` file must be created manually, for example: + +```yaml +development: + database: your-password-here +``` + diff --git a/wien_talks/wien_talks_server/docker-compose.local.yaml b/wien_talks/wien_talks_server/docker-compose.local.yaml new file mode 100644 index 0000000..730d41c --- /dev/null +++ b/wien_talks/wien_talks_server/docker-compose.local.yaml @@ -0,0 +1,16 @@ +services: + postgres: + image: postgres:16-trixie + container_name: postgres-dev + environment: + - POSTGRES_USER=${POSTGRES_USER} + - POSTGRES_DB=${POSTGRES_DB} + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + volumes: + - db-local:/var/lib/postgresql/data + restart: unless-stopped + ports: + - "8090:5432" + +volumes: + db-local: diff --git a/wien_talks/wien_talks_server/docker-compose.yaml b/wien_talks/wien_talks_server/docker-compose.yaml deleted file mode 100644 index 09621fa..0000000 --- a/wien_talks/wien_talks_server/docker-compose.yaml +++ /dev/null @@ -1,16 +0,0 @@ -services: - # Development services - postgres: - image: pgvector/pgvector:pg16 - ports: - - "8090:5432" - environment: - POSTGRES_USER: - POSTGRES_DB: - POSTGRES_PASSWORD: - volumes: - - wien_talks_data:/var/lib/postgresql/data - -volumes: - wien_talks_data: - wien_talks_test_data: