--- # https://taskfile.dev version: "3" vars: LOCAL_COMPOSE_FILE: "deployments/compose.local.yaml" TEST_COMPOSE_FILE: "deployments/compose.test.yaml" GENERATE_COMPOSE_FILE: "deployments/compose.generate.yaml" AWS_COMPOSE_FILE: "deployments/compose.aws.yaml" tasks: build:test: desc: "Build containers using compose.test.yaml" cmds: - task: build vars: COMPOSE_FILE: "{{.TEST_COMPOSE_FILE}}" build:generate: desc: "Build containers using compose.generate.yaml (used by code generation)" cmds: - task: build vars: COMPOSE_FILE: "{{.GENERATE_COMPOSE_FILE}}" build: desc: "Build containers for the local compose stack (default: compose.local.yaml)" vars: COMPOSE_FILE: "{{.COMPOSE_FILE | default .LOCAL_COMPOSE_FILE}}" cmds: - docker compose -f {{.COMPOSE_FILE}} build up:cmd: internal: true vars: COMPOSE_FILE: "{{.COMPOSE_FILE | default .LOCAL_COMPOSE_FILE}}" cmds: - docker compose -f {{.COMPOSE_FILE}} up --no-recreate --wait -d up:infra: desc: "Start only infrastructure containers (localstack, db, prometheus)" internal: true vars: COMPOSE_FILE: "{{.COMPOSE_FILE | default .LOCAL_COMPOSE_FILE}}" cmds: - docker compose -f {{.COMPOSE_FILE}} up localstack db prometheus -d --wait up:test: desc: "Bring up the test compose stack in the background" cmds: - task: up:cmd vars: COMPOSE_FILE: "{{.TEST_COMPOSE_FILE}}" up:generate: desc: "Bring up the generate compose stack (postgres used by db:generate)" run: once cmd: | docker compose -f {{.GENERATE_COMPOSE_FILE}} up \ --wait -d up:aws: desc: "Build and start the local AWS-services compose stack (localstack-backed)" cmds: - task deps:tidy - task docker:build - task: build - task: up:cmd vars: COMPOSE_FILE: "{{.AWS_COMPOSE_FILE}}" - task: init up: desc: "Tidy deps, build images, and bring up the full local compose stack" cmds: - task deps:tidy - task docker:build - task: build - task: up:infra - task: init - task: up:cmd refresh: desc: "Rebuild images and recycle the local stack (down then up:infra + services)" cmds: - task deps:tidy - task docker:build - task docker:build:debug - task: build - task: down - task: up:infra - task: init - task: up:cmd init: internal: true cmds: - aws s3 mb s3://$BUCKET_IN - aws sqs create-queue --queue-name $QNAME_STORE_EVENT - aws sqs create-queue --queue-name $QNAME_DOCUMENT_INIT - aws sqs create-queue --queue-name $QNAME_DOCUMENT_SYNC - aws sqs create-queue --queue-name $QNAME_DOCUMENT_CLEAN - aws sqs create-queue --queue-name $QNAME_DOCUMENT_TEXT - aws sqs create-queue --queue-name $QNAME_QUERY_SYNC - aws sqs create-queue --queue-name $QNAME_QUERY_RUNNER - aws sqs create-queue --queue-name $QNAME_CLIENT_SYNC - aws sqs create-queue --queue-name $QNAME_QUERY_VERSION_SYNC - | aws s3api put-bucket-notification-configuration \ --bucket $BUCKET_IN \ --notification-configuration '{ "QueueConfigurations": [{ "QueueArn": "arn:aws:sqs:us-east-1:000000000000:store_event", "Events": ["s3:ObjectCreated:*"] }] }' down:test: desc: "Stop containers from the test compose stack" cmds: - task: down vars: COMPOSE_FILE: "{{.TEST_COMPOSE_FILE}}" down:aws: desc: "Stop containers from the AWS-services compose stack" cmds: - task: down vars: COMPOSE_FILE: "{{.AWS_COMPOSE_FILE}}" down: desc: "Stop containers for the local compose stack (run before fullsuite:ci)" vars: COMPOSE_FILE: "{{.COMPOSE_FILE | default .LOCAL_COMPOSE_FILE}}" cmds: - docker compose -f {{.COMPOSE_FILE}} down clean: desc: "Stop and remove containers AND volumes for the local compose stack" vars: COMPOSE_FILE: "{{.COMPOSE_FILE | default .LOCAL_COMPOSE_FILE}}" cmds: - docker compose -f {{.COMPOSE_FILE}} down -v clean:test: desc: "Stop and remove containers AND volumes for the test compose stack" cmds: - task: clean vars: COMPOSE_FILE: "{{.TEST_COMPOSE_FILE}}" clean:aws: desc: "Stop and remove containers AND volumes for the AWS compose stack" run: once cmds: - task: clean vars: COMPOSE_FILE: "{{.AWS_COMPOSE_FILE}}" lint:cmd: internal: true vars: COMPOSE_FILE: "{{.COMPOSE_FILE | default .LOCAL_COMPOSE_FILE}}" cmds: - docker compose -f {{.COMPOSE_FILE}} config -q lint: desc: "Validate all compose files (local, test, generate, aws) with `compose config`" deps: - task: lint:cmd vars: COMPOSE_FILE: "{{.AWS_COMPOSE_FILE}}" - task: lint:cmd vars: COMPOSE_FILE: "{{.LOCAL_COMPOSE_FILE}}" - task: lint:cmd vars: COMPOSE_FILE: "{{.GENERATE_COMPOSE_FILE}}" - task: lint:cmd vars: COMPOSE_FILE: "{{.TEST_COMPOSE_FILE}}" rebuild: desc: "Force complete rebuild of all containers (use when build cache causes issues)" cmds: - go clean -cache - docker rmi {{.IMAGE_NAME}}:latest {{.IMAGE_NAME}}:debug || true - task: refresh