Skip to content

Commit

Permalink
Merge pull request #819 from IntersectMBO/fix/742-missing-context-for…
Browse files Browse the repository at this point in the history
…-the-status-service-fails-deploy-to-dev

[#742] Missing context for the status service fails deploy to dev
  • Loading branch information
placek authored Apr 22, 2024
2 parents ecd4cc9 + 553fa0e commit c6d5469
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 11 deletions.
21 changes: 21 additions & 0 deletions govtool/metadata-validation/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-metadata-validation

# image tags
metadata_validation_image_tag := $(shell git log -n 1 --format="%H" -- $(root_dir)/govtool/metadata-validation)

.PHONY: build-metadata-validation
build-metadata-validation: docker-login
$(call check_image_on_ecr,metadata-validation,$(metadata_validation_image_tag)) || \
$(docker) build --tag "$(repo_url)/metadata-validation:$(metadata_validation_image_tag)" \
$(root_dir)/govtool/metadata-validation

.PHONY: push-metadata-validation
push-metadata-validation: build-metadata-validation
$(call check_image_on_ecr,metadata-validation,$(metadata_validation_image_tag)) || \
$(docker) push $(repo_url)/metadata-validation:$(metadata_validation_image_tag)
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)
22 changes: 21 additions & 1 deletion infra/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ module "govtool-ecr-frontend" {
repo_name = "frontend"
}

module "govtool-ecr-status-service" {
source = "./modules/ecr"
repo_name = "status-service"
}

module "govtool-ecr-metadata-validation" {
source = "./modules/ecr"
repo_name = "metadata-validation"
}

resource "aws_iam_policy" "cicd_ecr" {
name = "CICD_ECR"
policy = jsonencode({
Expand All @@ -39,7 +49,9 @@ resource "aws_iam_policy" "cicd_ecr" {
Resource = [
module.govtool-ecr-backend.repo_arn,
module.govtool-ecr-backend-base.repo_arn,
module.govtool-ecr-frontend.repo_arn
module.govtool-ecr-frontend.repo_arn,
module.govtool-ecr-status-service.repo_arn,
module.govtool-ecr-metadata-validation.repo_arn
]
},
{
Expand Down Expand Up @@ -105,6 +117,14 @@ output "govtool-ecr-frontend-url" {
value = module.govtool-ecr-frontend.repo_url
}

output "govtool-ecr-status-service-url" {
value = module.govtool-ecr-status-service.repo_url
}

output "govtool-ecr-metadata-validation-url" {
value = module.govtool-ecr-metadata-validation.repo_url
}

output "govtool-dev-sanchonet-frontend-domain" {
value = module.govtool-dev-sanchonet.frontend_domain
}
Expand Down
10 changes: 9 additions & 1 deletion scripts/govtool/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
include ../../govtool/backend/Makefile
include ../../govtool/frontend/Makefile
include ../../govtool/status-service/Makefile
include ../../govtool/metadata-validation/Makefile
include utils.mk
include info.mk
include config.mk
Expand All @@ -14,7 +16,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 push-metadata-validation
@:$(call check_defined, cardano_network)
@:$(call check_defined, env)
export CARDANO_NETWORK=$(cardano_network); \
Expand All @@ -23,6 +25,8 @@ 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 METADATA_VALIDATION_TAG=$(metadata_validation_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 +41,8 @@ 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 METADATA_VALIDATION_TAG=$(metadata_validation_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 +62,8 @@ 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 METADATA_VALIDATION_TAG=$(metadata_validation_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
6 changes: 2 additions & 4 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 All @@ -183,8 +182,7 @@ services:
- "traefik.http.services.status-service.loadbalancer.server.port=8000"

metadata-validation:
build:
context: ../../govtool/metadata-validation
image: <REPO_URL>/metadata-validation:${METADATA_VALIDATION_TAG}
environment:
- PORT=3000
logging: *logging
Expand Down
12 changes: 7 additions & 5 deletions scripts/govtool/info.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ 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 "| METADATA $(repo_url)/metadata-validation:$(metadata_validation_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 +40,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- using *Govtool metadata-validation* version \`$(metadata_validation_image_tag)\`.\n$(pipeline_info)\" }"
2 changes: 2 additions & 0 deletions scripts/govtool/utils.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ 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 METADATA_VALIDATION_TAG=$(metadata_validation_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 c6d5469

Please sign in to comment.