From 04c9b9c8c65fdcaee436439f019845281a6aade4 Mon Sep 17 00:00:00 2001 From: Ping-Lin Chang Date: Wed, 27 Sep 2023 04:38:32 +0100 Subject: [PATCH] ci(Makefile): fix make stop and start (#365) Because - `make stop/start` was broken due to the containers used in docker compose `depends_on` that are removed after spin-up This commit - remove `docker compose rm -f` in `make all/latest` - remove `make rm` and `make restart` (no use case) - revert EDITION setting logic --- Makefile | 28 +++++++++++++++------------- docker-compose.yml | 10 +++++----- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 9b090e7a..23c26a52 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,6 @@ all: ## Launch all services with their up-to-date release version rm -rf $${TMP_CONFIG_DIR}; \ fi @EDITION=$${EDITION:=local-ce} docker compose -f docker-compose.yml up -d --quiet-pull - @EDITION=$${EDITION:=local-ce} docker compose -f docker-compose.yml rm -f .PHONY: latest latest: ## Lunch all dependent services with their latest codebase @@ -62,7 +61,6 @@ latest: ## Lunch all dependent services with their latest codebase rm -rf $${TMP_CONFIG_DIR}; \ fi @COMPOSE_PROFILES=$(PROFILE) EDITION=$${EDITION:=local-ce:latest} docker compose -f docker-compose.yml -f docker-compose.latest.yml up -d --quiet-pull - @COMPOSE_PROFILES=$(PROFILE) EDITION=$${EDITION:=local-ce:latest} docker compose -f docker-compose.yml -f docker-compose.latest.yml rm -f .PHONY: logs logs: ## Tail all logs with -n 10 @@ -74,19 +72,23 @@ pull: ## Pull all service images .PHONY: stop stop: ## Stop all components - @docker compose stop + @EDITION= docker compose stop + @docker run --rm \ + -v /var/run/docker.sock:/var/run/docker.sock \ + --name ${CONTAINER_COMPOSE_NAME}-latest \ + ${CONTAINER_COMPOSE_IMAGE_NAME}:latest /bin/sh -c " \ + /bin/sh -c 'cd /instill-ai/base && make stop' \ + " .PHONY: start -start: ## Start all stopped services - @docker compose start - -.PHONY: restart -restart: ## Restart all services - @docker compose restart - -.PHONY: rm -rm: ## Remove all stopped service containers - @docker compose rm -f +start: ## Start all stopped components + @docker run --rm \ + -v /var/run/docker.sock:/var/run/docker.sock \ + --name ${CONTAINER_COMPOSE_NAME}-latest \ + ${CONTAINER_COMPOSE_IMAGE_NAME}:latest /bin/sh -c " \ + /bin/sh -c 'cd /instill-ai/base && make start' \ + " + @EDITION= docker compose start .PHONY: down down: ## Stop all services and remove all service containers and volumes diff --git a/docker-compose.yml b/docker-compose.yml index bb25b1b2..f348b987 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,7 +33,7 @@ services: CFG_SERVER_DEBUG: "false" CFG_SERVER_MAXDATASIZE: ${MAX_DATA_SIZE} CFG_SERVER_USAGE_ENABLED: ${USAGE_ENABLED} - CFG_SERVER_EDITION: ${EDITION:-} + CFG_SERVER_EDITION: ${EDITION} CFG_DATABASE_HOST: ${POSTGRESQL_HOST} CFG_DATABASE_PORT: ${POSTGRESQL_PORT} CFG_DATABASE_USERNAME: postgres @@ -62,7 +62,7 @@ services: CFG_SERVER_DEBUG: "false" CFG_SERVER_MAXDATASIZE: ${MAX_DATA_SIZE} CFG_SERVER_USAGE_ENABLED: ${USAGE_ENABLED} - CFG_SERVER_EDITION: ${EDITION:-} + CFG_SERVER_EDITION: ${EDITION} CFG_DATABASE_HOST: ${POSTGRESQL_HOST} CFG_DATABASE_PORT: ${POSTGRESQL_PORT} CFG_DATABASE_USERNAME: postgres @@ -121,7 +121,7 @@ services: CFG_SERVER_PUBLICPORT: ${CONNECTOR_BACKEND_PUBLICPORT} CFG_SERVER_DEBUG: "false" CFG_SERVER_USAGE_ENABLED: ${USAGE_ENABLED} - CFG_SERVER_EDITION: ${EDITION:-} + CFG_SERVER_EDITION: ${EDITION} CFG_DATABASE_HOST: ${POSTGRESQL_HOST} CFG_DATABASE_PORT: ${POSTGRESQL_PORT} CFG_DATABASE_USERNAME: postgres @@ -147,7 +147,7 @@ services: restart: unless-stopped environment: CFG_SERVER_DEBUG: "false" - CFG_SERVER_EDITION: ${EDITION:-} + CFG_SERVER_EDITION: ${EDITION} CFG_DATABASE_HOST: ${POSTGRESQL_HOST} CFG_DATABASE_PORT: ${POSTGRESQL_PORT} CFG_DATABASE_USERNAME: postgres @@ -169,7 +169,7 @@ services: target: /var/run/docker.sock temporal_admin_tools: - container_name: ${TEMPORAL_HOST}-admin-tools + container_name: temporal-admin-tools image: ${TEMPORAL_ADMIN_TOOLS_IMAGE}:${TEMPORAL_ADMIN_TOOLS_VERSION} restart: on-failure environment: