diff --git a/govtool/status-service/Makefile b/govtool/status-service/Makefile new file mode 100644 index 000000000..07d975981 --- /dev/null +++ b/govtool/status-service/Makefile @@ -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) diff --git a/scripts/govtool/Makefile b/scripts/govtool/Makefile index b2f849b05..da8eb021e 100644 --- a/scripts/govtool/Makefile +++ b/scripts/govtool/Makefile @@ -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 @@ -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); \ @@ -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; \ @@ -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; \ @@ -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; \ diff --git a/scripts/govtool/config/templates/docker-compose.yml.tpl b/scripts/govtool/config/templates/docker-compose.yml.tpl index 789c66101..9eb8fca68 100644 --- a/scripts/govtool/config/templates/docker-compose.yml.tpl +++ b/scripts/govtool/config/templates/docker-compose.yml.tpl @@ -168,8 +168,7 @@ services: logging: *logging status-service: - build: - context: ../../govtool/status-service + image: /status-service:${STATUS_SERVICE_TAG} environment: - GRAFANA_USERNAME=admin - GRAFANA_PASSWORD=${GRAFANA_ADMIN_PASSWORD} diff --git a/scripts/govtool/info.mk b/scripts/govtool/info.mk index 128567307..f157f2df8 100644 --- a/scripts/govtool/info.mk +++ b/scripts/govtool/info.mk @@ -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)" @@ -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)\" }" diff --git a/scripts/govtool/utils.mk b/scripts/govtool/utils.mk index b69671472..958f3a131 100644 --- a/scripts/govtool/utils.mk +++ b/scripts/govtool/utils.mk @@ -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; \