diff --git a/.gitignore b/.gitignore index 66405b3c7..0716b95d8 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,8 @@ release.properties # VS Code .factorypath .vscode + +# User-provided and generated compose configurations +/compose-runtime.env +/console-config.yaml +/compose.env diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..16c2d0a79 --- /dev/null +++ b/Makefile @@ -0,0 +1,30 @@ + +.PHONY: container-image-api container-image-ui container-images + +include *compose.env + +CONSOLE_API_IMAGE ?= localhost/eyefloaters/console-api +CONSOLE_API_ACCOUNT ?= streams-console-service-account +CONSOLE_API_NS ?= default +CONSOLE_UI_IMAGE ?= localhost/eyefloaters/console-ui +CONSOLE_UI_NEXTAUTH_SECRET ?= $(shell openssl rand -base64 32) + +container-image-api: + mvn package -f api/pom.xml -Pdocker -DskipTests -Dquarkus.container-image.image=$(CONSOLE_API_IMAGE) + +container-image-ui: + docker build -t $(CONSOLE_UI_IMAGE) ./ui -f ./ui/Dockerfile + +container-images: container-image-api container-image-ui + +compose-up: container-images + > compose-runtime.env + echo "CONSOLE_API_IMAGE=$(CONSOLE_API_IMAGE)" >> compose-runtime.env + echo "CONSOLE_API_SERVICE_ACCOUNT_TOKEN=$(CONSOLE_API_SERVICE_ACCOUNT_TOKEN)" >> compose-runtime.env + echo "CONSOLE_API_KUBERNETES_API_SERVER_URL=$(CONSOLE_API_KUBERNETES_API_SERVER_URL)" >> compose-runtime.env + echo "CONSOLE_UI_IMAGE=$(CONSOLE_UI_IMAGE)" >> compose-runtime.env + echo "CONSOLE_UI_NEXTAUTH_SECRET=$(CONSOLE_UI_NEXTAUTH_SECRET)" >> compose-runtime.env + docker compose --env-file compose-runtime.env up -d + +compose-down: + docker compose --env-file compose-runtime.env down diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 000000000..f6422e33f --- /dev/null +++ b/compose.yaml @@ -0,0 +1,33 @@ +--- +version: '3.9' + +networks: + streams-console: + driver: bridge + +services: + console-api: + image: ${CONSOLE_API_IMAGE} + hostname: api + container_name: console-api + volumes: + - ${PWD}/console-config.yaml:/deployments/console-config.yaml:z + environment: + CONSOLE_CONFIG_PATH: /deployments/console-config.yaml + QUARKUS_KUBERNETES_CLIENT_API_SERVER_URL: ${CONSOLE_API_KUBERNETES_API_SERVER_URL} + QUARKUS_KUBERNETES_CLIENT_TOKEN: ${CONSOLE_API_SERVICE_ACCOUNT_TOKEN} + networks: + - streams-console + + console-ui: + image: ${CONSOLE_UI_IMAGE} + hostname: ui + container_name: console-ui + ports: + - "3000:3000" + environment: + NEXTAUTH_SECRET: ${CONSOLE_UI_NEXTAUTH_SECRET} + NEXTAUTH_URL: http://localhost:3000 + BACKEND_URL: http://api:8080/ + networks: + - streams-console