Skip to content

Commit

Permalink
[#742] Add status service docker image utilization to the deploy stack
Browse files Browse the repository at this point in the history
The user story highlighted the issue of a failed deployment to the dev
environment due to a missing context for the status-service. The
expected behavior was for the deploy to succeed. To address this,
changes were made to incorporate the status-service docker image
utilization into the deploy stack. The addition of the status-service
AWS registry now ensures that the necessary context is available for the
deployment process, moving the build process to the machine where the
deploy is performed, allowing for a successful deployment to the dev
environment.
  • Loading branch information
placek committed Apr 22, 2024
1 parent 9aa6ab9 commit 928a0db
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 8 deletions.
21 changes: 21 additions & 0 deletions govtool/status-service/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
common_mk := ../../scripts/govtool/common.mk
ifeq ($(origin $(common_mk)), undefined)
$(eval $(common_mk) := included)
include $(common_mk)
endif

.DEFAULT_GOAL := push-status-service

# image tags
status_service_image_tag := $(shell git log -n 1 --format="%H" -- $(root_dir)/govtool/status-service)

.PHONY: build-status-service
build-status-service: docker-login
$(call check_image_on_ecr,status-service,$(status_service_image_tag)) || \
$(docker) build --tag "$(repo_url)/status-service:$(status_service_image_tag)" \
$(root_dir)/govtool/status-service

.PHONY: push-status-service
push-status-service: build-status-service
$(call check_image_on_ecr,status-service,$(status_service_image_tag)) || \
$(docker) push $(repo_url)/status-service:$(status_service_image_tag)
6 changes: 5 additions & 1 deletion scripts/govtool/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
include ../../govtool/backend/Makefile
include ../../govtool/frontend/Makefile
include ../../govtool/status-service/Makefile
include utils.mk
include info.mk
include config.mk
Expand All @@ -14,7 +15,7 @@ cardano_db_sync_image_tag := sancho-4-2-1
all: deploy-stack notify

.PHONY: deploy-stack
deploy-stack: upload-config push-backend push-frontend
deploy-stack: upload-config push-backend push-frontend push-status-service
@:$(call check_defined, cardano_network)
@:$(call check_defined, env)
export CARDANO_NETWORK=$(cardano_network); \
Expand All @@ -23,6 +24,7 @@ deploy-stack: upload-config push-backend push-frontend
export GRAFANA_ADMIN_PASSWORD=$${GRAFANA_ADMIN_PASSWORD}; \
export BACKEND_TAG=$(backend_image_tag); \
export FRONTEND_TAG=$(frontend_image_tag); \
export STATUS_SERVICE_TAG=$(status_service_image_tag); \
export CARDANO_NODE_TAG=$(cardano_node_image_tag); \
export CARDANO_DB_SYNC_TAG=$(cardano_db_sync_image_tag); \
$(ssh-keyscan) $(docker_host) 2>/dev/null >> ~/.ssh/known_hosts; \
Expand All @@ -37,6 +39,7 @@ destroy-cardano-node-and-dbsync: prepare-config
export ENVIRONMENT=$(env); \
export BACKEND_TAG=$(backend_image_tag); \
export FRONTEND_TAG=$(frontend_image_tag); \
export STATUS_SERVICE_TAG=$(status_service_image_tag); \
export CARDANO_NODE_TAG=$(cardano_node_image_tag); \
export CARDANO_DB_SYNC_TAG=$(cardano_db_sync_image_tag); \
$(ssh-keyscan) $(docker_host) 2>/dev/null >> ~/.ssh/known_hosts; \
Expand All @@ -56,6 +59,7 @@ toggle-maintenance: docker-login prepare-config
export DOCKER_HOST=ssh://$(ssh_url); \
export BACKEND_TAG=$(backend_image_tag); \
export FRONTEND_TAG=$(frontend_image_tag); \
export STATUS_SERVICE_TAG=$(status_service_image_tag); \
export CARDANO_NODE_TAG=$(cardano_node_image_tag); \
export CARDANO_DB_SYNC_TAG=$(cardano_db_sync_image_tag); \
$(ssh-keyscan) $(docker_host) 2>/dev/null >> ~/.ssh/known_hosts; \
Expand Down
3 changes: 1 addition & 2 deletions scripts/govtool/config/templates/docker-compose.yml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ services:
logging: *logging

status-service:
build:
context: ../../govtool/status-service
image: <REPO_URL>/status-service:${STATUS_SERVICE_TAG}
environment:
- GRAFANA_USERNAME=admin
- GRAFANA_PASSWORD=${GRAFANA_ADMIN_PASSWORD}
Expand Down
11 changes: 6 additions & 5 deletions scripts/govtool/info.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ info:
@echo "| TIME $(shell date +'%Y-%m-%d %H:%M:%S%z')"
@echo "| BRANCH $(branch) [$(commit)]"
@echo "| ENV $(env)"
@echo "I NETWORK $(cardano_network)"
@echo "N BACKEND $(repo_url)/backend:$(backend_image_tag)"
@echo "F FRONTEND $(repo_url)/frontend:$(frontend_image_tag)"
@echo "O NODE ghcr.io/intersectmbo/cardano-node:$(cardano_node_image_tag)"
@echo "| NETWORK $(cardano_network)"
@echo "| BACKEND $(repo_url)/backend:$(backend_image_tag)"
@echo "| FRONTEND $(repo_url)/frontend:$(frontend_image_tag)"
@echo "| STATUS $(repo_url)/status-service:$(status_service_image_tag)"
@echo "| NODE ghcr.io/intersectmbo/cardano-node:$(cardano_node_image_tag)"
@echo "| DBSYNC ghcr.io/intersectmbo/cardano-db-sync:$(cardano_db_sync_image_tag)"
@echo "| SSH $(ssh_url)"
@echo "| URL https://$(docker_host)"
Expand All @@ -38,4 +39,4 @@ notify: info log-deployment
$(curl) -X POST https://slack.com/api/chat.postMessage\
-H "Authorization: Bearer $${GRAFANA_SLACK_OAUTH_TOKEN}" \
-H "Content-Type: application/json; charset=utf-8" \
--data "{ \"channel\":\"$${GRAFANA_SLACK_RECIPIENT}\", \"text\":\":rocket: *Deploy performed on \`$(env)\`*\n- from *branch* \`$(branch)\` (\`$(commit)\`),\n- using *Cardano Node* version \`$(cardano_node_image_tag)\`,\n- using *Cardano DB Sync* version \`$(cardano_db_sync_image_tag)\`,\n- using *GovTool backend* version \`$(backend_image_tag)\`,\n- using *Govtool frontend* version \`$(frontend_image_tag)\`.\n$(pipeline_info)\" }"
--data "{ \"channel\":\"$${GRAFANA_SLACK_RECIPIENT}\", \"text\":\":rocket: *Deploy performed on \`$(env)\`*\n- from *branch* \`$(branch)\` (\`$(commit)\`),\n- using *Cardano Node* version \`$(cardano_node_image_tag)\`,\n- using *Cardano DB Sync* version \`$(cardano_db_sync_image_tag)\`,\n- using *GovTool backend* version \`$(backend_image_tag)\`,\n- using *Govtool frontend* version \`$(frontend_image_tag)\`,\n- using *Govtool status-service version \`$(status_service_image_tag)\`.\n$(pipeline_info)\" }"
1 change: 1 addition & 0 deletions scripts/govtool/utils.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ docker-compose:
export GRAFANA_ADMIN_PASSWORD=$${GRAFANA_ADMIN_PASSWORD}; \
export BACKEND_TAG=$(backend_image_tag); \
export FRONTEND_TAG=$(frontend_image_tag); \
export STATUS_SERVICE_TAG=$(status_service_image_tag); \
export CARDANO_NODE_TAG=$(cardano_node_image_tag); \
export CARDANO_DB_SYNC_TAG=$(cardano_db_sync_image_tag); \
$(ssh-keyscan) $(docker_host) 2>/dev/null >> ~/.ssh/known_hosts; \
Expand Down

0 comments on commit 928a0db

Please sign in to comment.