From 496c2649300fe74736cb8d850f01173abe28b31f Mon Sep 17 00:00:00 2001 From: Valentin Matton Date: Wed, 30 Aug 2023 14:11:04 +0200 Subject: [PATCH] wip --- .github/workflows/deployment.yml | 21 ++++++++++++++----- .../environments/staging/.terraform.lock.hcl | 20 ++++++++++++++++++ deployment/modules/stack_data/main.tf | 2 +- 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index e7e9f231..d2f8135a 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -107,16 +107,27 @@ jobs: airflow_conn_pg = TF_OUTPUTS["airflow_conn_pg"]["value"] public_ip = TF_OUTPUTS["public_ip"]["value"] - docker_host = f"ssh://root@{public_ip}" - print(f"AIRFLOW_CONN_S3={airflow_conn_s3}") print(f"AIRFLOW_CONN_PG={airflow_conn_pg}") - print(f"DOCKER_HOST_={docker_host}") + print(f"SERVER_PUBLIC_IP={public_ip}") EOF )" >> "${GITHUB_ENV}" + - name: set up ssh agent + env: + SSH_AUTH_SOCK: /tmp/ssh_agent.sock + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + run: | + mkdir -p /home/runner/.ssh + ssh-keyscan SERVER_PUBLIC_IP >> /home/runner/.ssh/known_hosts + echo "${SSH_PRIVATE_KEY}" >> /home/runner/.ssh/key + chmod 600 /home/runner/.ssh/key + ssh-agent -a $SSH_AUTH_SOCK > /dev/null + ssh-add /home/runner/.ssh/key + # - name: start services # env: + # SSH_AUTH_SOCK: /tmp/ssh_agent.sock # AIRFLOW_CONN_S3: ${{ env.AIRFLOW_CONN_S3 }} # AIRFLOW_CONN_PG: ${{ env.AIRFLOW_CONN_PG }} # BAN_API_URL: ${{ vars.BAN_API_URL }} @@ -128,9 +139,9 @@ jobs: # SIRENE_STOCK_ETAB_LIENS_SUCCESSION_URL: ${{ vars.SIRENE_STOCK_ETAB_LIENS_SUCCESSION_URL }} # SIRENE_STOCK_UNITE_LEGALE_FILE_URL: ${{ vars.SIRENE_STOCK_UNITE_LEGALE_FILE_URL }} # AIRFLOW_WWW_USER_PASSWORD: ${{ secrets.AIRFLOW_WWW_USER_PASSWORD }} - # DOCKER_HOST_: ${{ env.DOCKER_HOST_ }} + # SERVER_PUBLIC_IP: ${{ env.SERVER_PUBLIC_IP }} # run: | - # DOCKER_HOST="${DOCKER_HOST_}" docker compose up -d + # DOCKER_HOST="ssh://root@${SERVER_PUBLIC_IP}" docker compose up -d destroy: runs-on: ubuntu-20.04 diff --git a/deployment/environments/staging/.terraform.lock.hcl b/deployment/environments/staging/.terraform.lock.hcl index 4ab3b0bf..e5420566 100644 --- a/deployment/environments/staging/.terraform.lock.hcl +++ b/deployment/environments/staging/.terraform.lock.hcl @@ -1,6 +1,26 @@ # This file is maintained automatically by "terraform init". # Manual edits may be lost in future updates. +provider "registry.terraform.io/hashicorp/time" { + version = "0.9.1" + constraints = "0.9.1" + hashes = [ + "h1:NUv/YtEytDQncBQ2mTxnUZEy/rmDlPYmE9h2iokR0vk=", + "zh:00a1476ecf18c735cc08e27bfa835c33f8ac8fa6fa746b01cd3bcbad8ca84f7f", + "zh:3007f8fc4a4f8614c43e8ef1d4b0c773a5de1dcac50e701d8abc9fdc8fcb6bf5", + "zh:5f79d0730fdec8cb148b277de3f00485eff3e9cf1ff47fb715b1c969e5bbd9d4", + "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", + "zh:8c8094689a2bed4bb597d24a418bbbf846e15507f08be447d0a5acea67c2265a", + "zh:a6d9206e95d5681229429b406bc7a9ba4b2d9b67470bda7df88fa161508ace57", + "zh:aa299ec058f23ebe68976c7581017de50da6204883950de228ed9246f309e7f1", + "zh:b129f00f45fba1991db0aa954a6ba48d90f64a738629119bfb8e9a844b66e80b", + "zh:ef6cecf5f50cda971c1b215847938ced4cb4a30a18095509c068643b14030b00", + "zh:f1f46a4f6c65886d2dd27b66d92632232adc64f92145bf8403fe64d5ffa5caea", + "zh:f79d6155cda7d559c60d74883a24879a01c4d5f6fd7e8d1e3250f3cd215fb904", + "zh:fd59fa73074805c3575f08cd627eef7acda14ab6dac2c135a66e7a38d262201c", + ] +} + provider "registry.terraform.io/scaleway/scaleway" { version = "2.26.0" constraints = "2.26.0" diff --git a/deployment/modules/stack_data/main.tf b/deployment/modules/stack_data/main.tf index 805bdfdf..d58b1a41 100644 --- a/deployment/modules/stack_data/main.tf +++ b/deployment/modules/stack_data/main.tf @@ -68,7 +68,7 @@ resource "scaleway_object_bucket" "main" { resource "scaleway_iam_application" "main" { organization_id = data.scaleway_account_project.main.organization_id - name = "airflow" + name = "${var.environment_name}--airflow--tf" } data "scaleway_account_project" "main" {