diff --git a/govtool/backend/Makefile b/govtool/backend/Makefile new file mode 100644 index 000000000..1919d4847 --- /dev/null +++ b/govtool/backend/Makefile @@ -0,0 +1,31 @@ +common_mk := ../../scripts/govtool/common.mk +ifeq ($(origin $(common_mk)), undefined) + $(eval $(common_mk) := included) + include $(common_mk) +endif + +.DEFAULT_GOAL := push-backend + +# image tags +base_backend_image_tag := $(shell git hash-object $(root_dir)/govtool/backend/vva-be.cabal) +backend_image_tag := $(shell git log -n 1 --format="%H" -- $(root_dir)/govtool/backend) + +.PHONY: build-backend-base +build-backend-base: docker-login + $(call check_image_on_ecr,backend-base,$(base_backend_image_tag)) || \ + $(docker) build --file $(root_dir)/govtool/backend/Dockerfile.base --tag "$(repo_url)/backend-base:$(base_backend_image_tag)" $(root_dir)/govtool/backend + +.PHONY: push-backend-base +push-backend-base: build-backend-base + $(call check_image_on_ecr,backend-base,$(base_backend_image_tag)) || \ + $(docker) push $(repo_url)/backend-base:$(base_backend_image_tag) + +.PHONY: build-backend +build-backend: build-backend-base + $(call check_image_on_ecr,backend,$(backend_image_tag)) || \ + $(docker) build --build-arg BASE_IMAGE_TAG=$(base_backend_image_tag) --tag "$(repo_url)/backend:$(backend_image_tag)" $(root_dir)/govtool/backend + +.PHONY: push-backend +push-backend: push-backend-base build-backend + $(call check_image_on_ecr,backend,$(backend_image_tag)) || \ + $(docker) push $(repo_url)/backend:$(backend_image_tag) diff --git a/govtool/frontend/Makefile b/govtool/frontend/Makefile new file mode 100644 index 000000000..4c5c964bd --- /dev/null +++ b/govtool/frontend/Makefile @@ -0,0 +1,33 @@ +common_mk := ../../scripts/govtool/common.mk +ifeq ($(origin $(common_mk)), undefined) + $(eval $(common_mk) := included) + include $(common_mk) +endif + +.DEFAULT_GOAL := push-frontend + +# environment variables +gtm_id := $(shell echo $${GTM_ID}) +sentry_dsn := $(shell echo $${SENTRY_DSN}) + +# image tags +frontend_image_tag := $(shell git log -n 1 --format="%H" -- $(root_dir)/govtool/frontend) + +.PHONY: build-frontend +build-frontend: docker-login + @:$(call check_defined, cardano_network) + @:$(call check_defined, gtm_id) + @:$(call check_defined, sentry_dsn) + if [[ "$(cardano_network)" = "mainnet" ]]; then NETWORK_FLAG=1; else NETWORK_FLAG=0; fi; \ + $(call check_image_on_ecr,frontend,$(frontend_image_tag)) || \ + $(docker) build --tag "$(repo_url)/frontend:$(frontend_image_tag)" \ + --build-arg VITE_BASE_URL="https://$(domain)/api" \ + --build-arg VITE_GTM_ID="$(gtm_id)" \ + --build-arg VITE_NETWORK_FLAG="$$NETWORK_FLAG" \ + --build-arg VITE_SENTRY_DSN="$(sentry_dsn)" \ + $(root_dir)/govtool/frontend + +.PHONY: push-frontend +push-frontend: build-frontend + $(call check_image_on_ecr,frontend,$(frontend_image_tag)) || \ + $(docker) push $(repo_url)/frontend:$(frontend_image_tag) diff --git a/scripts/govtool/Makefile b/scripts/govtool/Makefile index 9cf35b773..619d73d6b 100644 --- a/scripts/govtool/Makefile +++ b/scripts/govtool/Makefile @@ -1,77 +1,34 @@ -SHELL := bash -ONESHELL: -.SHELLFLAGS := -eu -o pipefail -c +include ../../govtool/backend/Makefile +include ../../govtool/frontend/Makefile +include utils.mk +include info.mk + +.DEFAULT_GOAL := info # tools -docker ?= docker curl ?= curl +rsync ?= rsync +ssh-keyscan ?= ssh-keyscan # environment variables -env := $(shell echo $${ENVIRONMENT}) -cardano_network := $(shell echo $${CARDANO_NETWORK}) grafana_admin_password := $(shell echo $${GRAFANA_ADMIN_PASSWORD}) grafana_slack_recipient := $(shell echo $${GRAFANA_SLACK_RECIPIENT}) grafana_slack_oauth_token := $(shell echo $${GRAFANA_SLACK_OAUTH_TOKEN}) -gtm_id := $(shell echo $${GTM_ID}) -sentry_dsn := $(shell echo $${SENTRY_DSN}) - -# git state -commit := $(shell git rev-parse HEAD) -branch := $(shell git rev-parse --abbrev-ref HEAD) # target addresses -domain := $(shell echo $${DOMAIN:-$(env)-$(cardano_network).govtool.byron.network}) -repo_url ?= 733019650473.dkr.ecr.eu-west-1.amazonaws.com docker_host := $(domain) docker_user := ubuntu ssh_url := $(docker_user)@$(docker_host) # stack configuration docker_compose_file := docker-compose.$(env).yml -compose_stack_name := govtool-$(env)-$(cardano_network) - -# pipeline information -pipeline_url := $(shell echo $${PIPELINE_URL:-}) -ifeq ($(PIPELINE_URL),) - pipeline_info := _Deployed from local machine._ -else - pipeline_info := _Deployed from <$(pipeline_url)|GitHub>._ -endif # image tags cardano_node_image_tag := 8.8.0-pre cardano_db_sync_image_tag := sancho-4-0-0-fix-config -base_backend_image_tag := $(shell ./utils/backend-base-version) -backend_image_tag := $(shell ./utils/backend-version) -frontend_image_tag := $(shell ./utils/frontend-version) - -# helper function for checking undefined variables -check_defined = \ - $(strip $(foreach 1,$1, \ - $(call __check_defined,$1,$(strip $(value 2))))) -__check_defined = \ - $(if $(value $1),, \ - $(error Undefined $1$(if $2, ($2)))) - -# helper function for checking if image exists on ECR -check_image_on_ecr = \ - $(docker) manifest inspect "$(repo_url)/$1:$2" > /dev/null 2>&1 .PHONY: all -all: docker-login prepare-config upload-config build-backend push-backend build-frontend push-frontend deploy-stack info notify - -.PHONY: check-env-defined -check-env-defined: - @:$(call check_defined, cardano_network) - @:$(call check_defined, env) - @grep -q "module \"$(compose_stack_name)\"" ../../infra/terraform/main.tf && \ - echo "Environment $(env) for network $(cardano_network) is defined in Terraform" || \ - { echo "Environment $(env) for network $(cardano_network) is NOT defined in Terraform, cannot deploy there"; exit 1; } - -.PHONY: docker-login -docker-login: - aws ecr get-login-password --region eu-west-1 | $(docker) login --username AWS --password-stdin $(repo_url)/backend - aws ecr get-login-password --region eu-west-1 | $(docker) login --username AWS --password-stdin $(repo_url)/frontend +all: deploy-stack info #notify .PHONY: prepare-config prepare-config: @@ -84,64 +41,13 @@ prepare-config: ./prepare-config.sh .PHONY: upload-config -upload-config: prepare-config - @:$(call check_defined, cardano_network) - @:$(call check_defined, env) - rsync -av -e 'ssh -o StrictHostKeyChecking=no' config/target/. $(ssh_url):config - -.PHONY: build-backend -build-backend: docker-login build-backend-base - @:$(call check_defined, cardano_network) - @:$(call check_defined, env) - $(call check_image_on_ecr,backend,$(backend_image_tag)) || \ - $(docker) build --build-arg BASE_IMAGE_TAG=$(base_backend_image_tag) --tag "$(repo_url)/backend:$(backend_image_tag)" ../../govtool/backend - -.PHONY: build-backend-base -build-backend-base: docker-login - @:$(call check_defined, cardano_network) - @:$(call check_defined, env) - $(call check_image_on_ecr,backend-base,$(base_backend_image_tag)) || \ - $(docker) build --file ../../govtool/backend/Dockerfile.base --tag "$(repo_url)/backend-base:$(base_backend_image_tag)" ../../govtool/backend - @echo "Using backend-base image: $(repo_url)/backend-base:$(base_backend_image_tag)" - -.PHONY: push-backend -push-backend: docker-login push-backend-base build-backend - @:$(call check_defined, cardano_network) - @:$(call check_defined, env) - $(call check_image_on_ecr,backend,$(backend_image_tag)) || \ - $(docker) push $(repo_url)/backend:$(backend_image_tag) - -.PHONY: push-backend-base -push-backend-base: docker-login build-backend-base - @:$(call check_defined, cardano_network) - @:$(call check_defined, env) - $(call check_image_on_ecr,backend-base,$(base_backend_image_tag)) || \ - $(docker) push $(repo_url)/backend-base:$(base_backend_image_tag) - -.PHONY: build-frontend -build-frontend: docker-login +upload-config: check-env-defined prepare-config @:$(call check_defined, cardano_network) @:$(call check_defined, env) - @:$(call check_defined, gtm_id) - @:$(call check_defined, sentry_dsn) - if [[ "$(cardano_network)" = "mainnet" ]]; then NETWORK_FLAG=1; else NETWORK_FLAG=0; fi; \ - $(call check_image_on_ecr,frontend,$(frontend_image_tag)) || \ - $(docker) build --tag "$(repo_url)/frontend:$(frontend_image_tag)" \ - --build-arg VITE_BASE_URL="https://$(domain)/api" \ - --build-arg VITE_GTM_ID="$(gtm_id)" \ - --build-arg VITE_NETWORK_FLAG="$$NETWORK_FLAG" \ - --build-arg VITE_SENTRY_DSN="$(sentry_dsn)" \ - ../../govtool/frontend - -.PHONY: push-frontend -push-frontend: docker-login build-frontend - @:$(call check_defined, cardano_network) - @:$(call check_defined, env) - $(call check_image_on_ecr,frontend,$(frontend_image_tag)) || \ - $(docker) push $(repo_url)/frontend:$(frontend_image_tag) + $(rsync) -av -e 'ssh -o StrictHostKeyChecking=no' config/target/. $(ssh_url):config .PHONY: deploy-stack -deploy-stack: docker-login +deploy-stack: upload-config push-backend push-frontend @:$(call check_defined, cardano_network) @:$(call check_defined, env) @:$(call check_defined, grafana_admin_password) @@ -153,12 +59,12 @@ deploy-stack: docker-login export FRONTEND_TAG=$(frontend_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; \ + $(ssh-keyscan) $(docker_host) 2>/dev/null >> ~/.ssh/known_hosts; \ $(docker) compose -f $(docker_compose_file) -p $(compose_stack_name) pull; \ $(docker) compose -f $(docker_compose_file) -p $(compose_stack_name) up -d .PHONY: destroy-cardano-node-and-dbsync -destroy-cardano-node-and-dbsync: +destroy-cardano-node-and-dbsync: check-env-defined @:$(call check_defined, cardano_network) @:$(call check_defined, env) export CARDANO_NETWORK=$(cardano_network); \ @@ -168,7 +74,7 @@ destroy-cardano-node-and-dbsync: export FRONTEND_TAG=$(frontend_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; \ + $(ssh-keyscan) $(docker_host) 2>/dev/null >> ~/.ssh/known_hosts; \ containers="$$(docker container ls --no-trunc --format '{{.Names}}' -f name=cardano-node -f name=cardano-db-sync -f name=postgres)"; \ volumes="$$(docker volume ls --format '{{.Name}}' -f name=db-sync-data -f name=node-db -f name=node-ipc -f name=postgres)"; \ $(docker) container stop $${containers}; \ @@ -176,7 +82,7 @@ destroy-cardano-node-and-dbsync: $(docker) volume rm $${volumes} .PHONY: toggle-maintenance -toggle-maintenance: +toggle-maintenance: check-env-defined @:$(call check_defined, cardano_network) @:$(call check_defined, env) @:$(call check_defined, maintenance) @@ -187,57 +93,6 @@ toggle-maintenance: export FRONTEND_TAG=$(frontend_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; \ + $(ssh-keyscan) $(docker_host) 2>/dev/null >> ~/.ssh/known_hosts; \ if [[ "$(maintenance)" = "enable" ]]; then $(docker) compose -f $(docker_compose_file) -p $(compose_stack_name) exec frontend touch /var/run/maintenance_enabled; \ else $(docker) compose -f $(docker_compose_file) -p $(compose_stack_name) exec frontend rm /var/run/maintenance_enabled; fi - -.DEFAULT_GOAL := info -.PHONY: info -info: - @:$(call check_defined, cardano_network) - @:$(call check_defined, env) - @echo "+-----------" - @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 "| DBSYNC ghcr.io/intersectmbo/cardano-db-sync:$(cardano_db_sync_image_tag)" - @echo "| SSH $(ssh_url)" - @echo "| URL https://$(docker_host)" - @echo "+-----------" - -.PHONY: notify -notify: - @:$(call check_defined, cardano_network) - @:$(call check_defined, env) - $(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)\" }" - -.PHONY: ssh -ssh: - @:$(call check_defined, cardano_network) - @:$(call check_defined, env) - export TERM=xterm-256color; \ - ssh $(ssh_url) - -.PHONY: docker -docker: - @:$(call check_defined, cardano_network) - @:$(call check_defined, env) - @:$(call check_defined, grafana_admin_password) - @:$(call check_defined, cmd) - export CARDANO_NETWORK=$(cardano_network); \ - export DOCKER_HOST=ssh://$(ssh_url); \ - export ENVIRONMENT=$(env); \ - export GRAFANA_ADMIN_PASSWORD=$(grafana_admin_password); \ - export BACKEND_TAG=$(backend_image_tag); \ - export FRONTEND_TAG=$(frontend_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; \ - $(docker) compose -f $(docker_compose_file) -p $(compose_stack_name) $(cmd) diff --git a/scripts/govtool/README.md b/scripts/govtool/README.md index 6e3d2b070..56d2059b4 100644 --- a/scripts/govtool/README.md +++ b/scripts/govtool/README.md @@ -51,15 +51,16 @@ files. For an example configuration, refer to the `.env.example` file. ## Deployment process -The deployment process is automated using a Makefile, which includes several -targets to streamline the deployment steps: +The deployment process is automated using a system of Makefiles, which include +several targets to streamline the deployment steps: -### `docker-login` +### [Deployment `Makefile`](./Makefile) -Ensures that the user is logged into the correct Docker account, providing -access to necessary Docker resources. +This is the main Makefile that provides full support for the deployment and +maintenance of the stack. It includes backend and frontend modules and uses +particular Makefiles for additional purposes. -### `prepare-config` +#### `prepare-config` Prepares the configuration files required for the application. This involves generating or fetching files, then placing them in the appropriate directory @@ -72,36 +73,79 @@ structure. Key components include: - `prometheus.yml` and `grafana-provisioning` for monitoring setup. - `nginx` configuration for basic authentication where necessary. -### `upload-config` +#### `upload-config` Uploads the generated configuration to the target server. -### `build-backend` +#### `deploy-stack` -Builds the backend image locally and a base image for the backend when changes -are detected in the Cabal file. +Updates the target server with the latest images and (re)launches the Docker +Compose stack. -### `push-backend` +#### `destroy-cardano-node-and-dbsync` -Pushes the backend and backend-base images to the Docker repository. +Removes the Cardano Node and Cardano DB Sync services, purges their volumes, and +removes PostgreSQL database files. This step ensures that the Cardano network's +state has been fully removed so the blockchain will be synchronized from the +beginning. -### `build-frontend` +#### `toggle-maintenance` -Handles the construction of the frontend image. +This step turns on the "maintenance page" that blocks users from usage of the +application and provides an explanation of that in form of the simple page with +error message. -### `push-frontend` +### Helpers, variables and targets in [`common.mk`](./common.mk) file -Pushes the frontend image to the Docker repository. +This Makefile defines some common variables and helpers, as well as highly +reused targets, such as: -### `deploy-stack` +#### `check-env-defined` -Updates the target server with the latest images and (re)launches the Docker -Compose stack. +Verifies the given environment value. When there is no definition for such +environment in Terraform configuration it stops the execution. + +#### `docker-login` + +Ensures that the user is logged into the correct Docker account, providing +access to necessary Docker resources. + +### Notifications in [`info.mk`](./info.mk) file + +This file is responsible for giving the proper notifications and feedback about +the current execution: -### `info` +#### `info` Displays deployment parameters for review and verification. -### `notify` +#### `notify` Sends a notification to stakeholders about the deployment status via Slack. + +### Building backend images steps in [backend `Makefile`](../../govtool/backend/Makefile) + +This file is responsible for generating images for backend and for pushing them +to the ECR repository. + +#### `build-backend` + +Builds the backend image locally and a base image for the backend when changes +are detected in the Cabal file. + +#### `push-backend` + +Pushes the backend and backend-base images to the Docker repository. + +### Building frontend images steps in [frontend `Makefile`](../../govtool/frontend/Makefile) + +This file is responsible for generating images for frontend and for pushing them +to the ECR repository. + +#### `build-frontend` + +Handles the construction of the frontend image. + +#### `push-frontend` + +Pushes the frontend image to the Docker repository. diff --git a/scripts/govtool/common.mk b/scripts/govtool/common.mk new file mode 100644 index 000000000..b80940a08 --- /dev/null +++ b/scripts/govtool/common.mk @@ -0,0 +1,47 @@ +SHELL := bash +ONESHELL: +.SHELLFLAGS := -eu -o pipefail -c + +# tools +docker ?= docker + +# environment variables +env := $(shell echo $${ENVIRONMENT}) +cardano_network := $(shell echo $${CARDANO_NETWORK}) + +# git state +commit := $(shell git rev-parse HEAD) +branch := $(shell git rev-parse --abbrev-ref HEAD) +root_dir := $(shell git rev-parse --show-toplevel) + +# target addresses +domain := $(shell echo $${DOMAIN}) +repo_url ?= 733019650473.dkr.ecr.eu-west-1.amazonaws.com + +# stack configuration +compose_stack_name := govtool-$(env)-$(cardano_network) + +# helper function for checking undefined variables +check_defined = \ + $(strip $(foreach 1,$1, \ + $(call __check_defined,$1,$(strip $(value 2))))) +__check_defined = \ + $(if $(value $1),, \ + $(error Undefined $1$(if $2, ($2)))) + +# helper function for checking if image exists on ECR +check_image_on_ecr = \ + $(docker) manifest inspect "$(repo_url)/$1:$2" > /dev/null 2>&1 + +.PHONY: check-env-defined +check-env-defined: + @:$(call check_defined, cardano_network) + @:$(call check_defined, env) + @grep -q "module \"$(compose_stack_name)\"" ../../infra/terraform/main.tf && \ + echo "Environment $(env) for network $(cardano_network) is defined in Terraform" || \ + { echo "Environment $(env) for network $(cardano_network) is NOT defined in Terraform, cannot deploy there"; exit 1; } + +.PHONY: docker-login +docker-login: + aws ecr get-login-password --region eu-west-1 | $(docker) login --username AWS --password-stdin $(repo_url)/backend + aws ecr get-login-password --region eu-west-1 | $(docker) login --username AWS --password-stdin $(repo_url)/frontend diff --git a/scripts/govtool/info.mk b/scripts/govtool/info.mk new file mode 100644 index 000000000..d3ac1d552 --- /dev/null +++ b/scripts/govtool/info.mk @@ -0,0 +1,34 @@ +# pipeline information +pipeline_url := $(shell echo $${PIPELINE_URL:-}) +ifeq ($(PIPELINE_URL),) + pipeline_info := _Deployed from local machine._ +else + pipeline_info := _Deployed from <$(pipeline_url)|GitHub>._ +endif + +.PHONY: info +info: + @:$(call check_defined, cardano_network) + @:$(call check_defined, env) + @echo "+-----------" + @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 "| DBSYNC ghcr.io/intersectmbo/cardano-db-sync:$(cardano_db_sync_image_tag)" + @echo "| SSH $(ssh_url)" + @echo "| URL https://$(docker_host)" + @echo "+-----------" + +.PHONY: notify +notify: + @:$(call check_defined, cardano_network) + @:$(call check_defined, env) + $(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)\" }" + diff --git a/scripts/govtool/utils.mk b/scripts/govtool/utils.mk new file mode 100644 index 000000000..37ccda6e6 --- /dev/null +++ b/scripts/govtool/utils.mk @@ -0,0 +1,23 @@ +.PHONY: ssh +ssh: + @:$(call check_defined, cardano_network) + @:$(call check_defined, env) + export TERM=xterm-256color; \ + ssh $(ssh_url) + +.PHONY: docker +docker: + @:$(call check_defined, cardano_network) + @:$(call check_defined, env) + @:$(call check_defined, grafana_admin_password) + @:$(call check_defined, cmd) + export CARDANO_NETWORK=$(cardano_network); \ + export DOCKER_HOST=ssh://$(ssh_url); \ + export ENVIRONMENT=$(env); \ + export GRAFANA_ADMIN_PASSWORD=$(grafana_admin_password); \ + export BACKEND_TAG=$(backend_image_tag); \ + export FRONTEND_TAG=$(frontend_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; \ + $(docker) compose -f $(docker_compose_file) -p $(compose_stack_name) $(cmd) diff --git a/scripts/govtool/utils/backend-base-version b/scripts/govtool/utils/backend-base-version deleted file mode 100755 index 85ffe5389..000000000 --- a/scripts/govtool/utils/backend-base-version +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -# This script returns a version string for the base image used to build the -# backend Docker image. The version string is the SHA1 hash of the vva-be.cabal -# file in the backend directory. This is used to tag the base image with the -# version of the backend code that it was built from. It means that any changes -# made in cabal file should result in building a new base docker image for -# backend. - -git hash-object $(git rev-parse --show-toplevel)/govtool/backend/vva-be.cabal diff --git a/scripts/govtool/utils/backend-version b/scripts/govtool/utils/backend-version deleted file mode 100755 index 2c96d3bf6..000000000 --- a/scripts/govtool/utils/backend-version +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash -# This script returns a version string for the backend code. The version string -# is the SHA1 hash of the most recent commit in the backend directory. This is -# used to tag the backend Docker image with the version of the backend code that -# it was built from. It means that any changes made in the backend code should -# result in building a new backend docker image. - -git log -n 1 --format="%H" -- $(git rev-parse --show-toplevel)/govtool/backend diff --git a/scripts/govtool/utils/frontend-version b/scripts/govtool/utils/frontend-version deleted file mode 100755 index 6eed4e906..000000000 --- a/scripts/govtool/utils/frontend-version +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -# This script returns a version string for the base image used to build the frontend Docker image. The version string is the SHA1 hash of the most recent commit in the frontend directory. This is used to tag the image with the version of the frontend code that it was built from. It means that any changes made in the frontend code should result in building a new docker image for frontend. - -git log -n 1 --format="%H" -- $(git rev-parse --show-toplevel)/govtool/frontend