Skip to content

Commit

Permalink
ci(Makefile): fix make stop and start (#365)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
pinglin authored Sep 27, 2023
1 parent 2d4eab0 commit 04c9b9c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
28 changes: 15 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 04c9b9c

Please sign in to comment.