This guide shows the shortest path to verify the repo locally:
- build the Docker image
- start the local services
- start the app container
- run the GraphQL smoke test
- Docker
- the repo
.envfile in place
The current .env is set up for local testing with:
DATABASE_URL=postgres://postgres:postgres@localhost:15432/calendarELASTICSEARCH_URL=http://localhost:9200
It also includes a demo calendar feed so the query smoke test returns an event.
docker build -t calendar-gql:test .docker network create calendar-netdocker run -d --name calendar-db --network calendar-net -p 15432:5432 \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DB=calendar \
postgres:15-alpinedocker run -d --name calendar-elastic --network calendar-net -p 9200:9200 \
-e discovery.type=single-node \
-e xpack.security.enabled=false \
docker.elastic.co/elasticsearch/elasticsearch:7.17.9Mount the repo .env so the app gets the calendar feed and credentials it expects.
docker run -d --name calendar-app-test --network calendar-net -p 4000:4000 \
-v "$PWD/.env":/app/.env \
-e DATABASE_URL=postgres://postgres:postgres@calendar-db:5432/calendar \
-e ELASTICSEARCH_URL=http://calendar-elastic:9200 \
calendar-gql:testdocker logs --tail 100 calendar-app-testYou should see a message similar to:
Server ready at http://localhost:5000/
docker run --rm -v "$PWD":/app -w /app --network calendar-net \
-e GRAPHQL_URL=http://calendar-app-test:5000/graphql \
node:20-alpine3.18 sh -lc "corepack enable && corepack prepare yarn@stable --activate && yarn install --network-timeout 100000 && yarn run test-queries"Expected result:
eventsreturns at least one demo eventevent(id: ...)returns the same event
docker rm -f calendar-app-test calendar-db calendar-elastic
docker network rm calendar-net- The app starts on port
4000in Docker, but the server itself listens on5000inside the container. - If you change
.env, restart the app container so the new values are loaded. - The repo uses Yarn via Corepack in the Docker-based test flow.