From 3db6e788d3852c060b63df24a9f4beec8e527cdf Mon Sep 17 00:00:00 2001 From: JoLcte <62910435+JoLcte@users.noreply.github.com> Date: Thu, 18 Apr 2024 14:15:45 +0200 Subject: [PATCH] update(registry): terraform update with new registry for docker images (#81) Co-authored-by: jlecomte --- mnq/sns-instances-notification-system/README.md | 13 ++++++++----- .../terraform/main.tf | 8 ++++---- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/mnq/sns-instances-notification-system/README.md b/mnq/sns-instances-notification-system/README.md index d7d78ea..6e76e83 100644 --- a/mnq/sns-instances-notification-system/README.md +++ b/mnq/sns-instances-notification-system/README.md @@ -4,11 +4,13 @@ This repository contains the source code for the this tutorial: [Creating a noti ## Requirements -This example assumes that you are familiar with: +To complete the actions presented below, you must have: + +- A Scaleway account logged into the [console](https://console.scaleway.com) +- [Set up authentication for the Terraform provider](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs#authentication) +- An [SSH key](/identity-and-access-management/organizations-and-projects/how-to/create-ssh-key/) +- [Set up the Scaleway CLI](/developer-tools/scaleway-cli/quickstart/) -- how System Notification Service work. You can find out more in the [SNS Scaleway official documentation](https://www.scaleway.com/en/docs/serverless/messaging/quickstart/) -- how Instances work. If needed, you can visit the [Instances Quickstart documentation](https://www.scaleway.com/en/docs/compute/instances/quickstart/). -- how to create a SSH key. If not done already, you can follow the first 6 steps of [this walkthrough](https://www.scaleway.com/en/docs/identity-and-access-management/organizations-and-projects/how-to/create-ssh-key/#how-to-upload-the-public-ssh-key-to-the-scaleway-interface). ## Context @@ -25,6 +27,7 @@ export TF_VAR_public_ssh_key=$(cat ~/.ssh/id_ed25519.pub) Then you can run these commands: ```console +cd terraform terraform init terraform plan terraform apply @@ -38,4 +41,4 @@ terraform apply - Then connect to the publisher Instance with that URL ```http://:8081``` - Go to the home page of your publisher server: ```http://:8081``` - Click on a CPU behavior, and check the notification page of your subscriber server. A notification about the behavior should have appeared. -- Once you're done testing, you can apply `terraform destroy` to clean and remove the project. \ No newline at end of file +- Once you're done testing, you can apply `terraform destroy` to clean and remove the project. diff --git a/mnq/sns-instances-notification-system/terraform/main.tf b/mnq/sns-instances-notification-system/terraform/main.tf index d3022db..15875df 100644 --- a/mnq/sns-instances-notification-system/terraform/main.tf +++ b/mnq/sns-instances-notification-system/terraform/main.tf @@ -98,11 +98,11 @@ resource "scaleway_instance_server" "subscriber_sns_tuto_instance" { apt-get update && apt-get install -y docker.io systemctl start docker systemctl enable docker - docker pull rg.fr-par.scw.cloud/sns-x-instance-tutorial/subscriber-server:1.0 + docker pull rg.fr-par.scw.cloud/mnq-tutorials/sns-instances-subscriber-server:1.0 docker run -d --restart=always \ --name subscriber-server \ -p 8081:8081 \ - rg.fr-par.scw.cloud/sns-x-instance-tutorial/subscriber-server:1.0 + rg.fr-par.scw.cloud/mnq-tutorials/sns-instances-subscriber-server:1.0 EOF } } @@ -173,7 +173,7 @@ resource "scaleway_instance_server" "publisher_sns_tuto_instance" { - chmod +x /etc/profile.d/publisher-server_env.sh # Using 'source' command doesn't work in cloud-init runcmd because each command runs in a separate shell. # this is why environment variables will be passed directly in the docker run command - - docker pull rg.fr-par.scw.cloud/sns-x-instance-tutorial/publisher-server:1.0 + - docker pull rg.fr-par.scw.cloud/mnq-tutorials/sns-instances-publisher-server:1.0 - | . /etc/profile.d/publisher-server_env.sh docker run -d --restart=always \ @@ -182,7 +182,7 @@ resource "scaleway_instance_server" "publisher_sns_tuto_instance" { -e TOPIC_ARN=$TOPIC_ARN \ -e AWS_ACCESS_KEY=$AWS_ACCESS_KEY \ -e AWS_SECRET_KEY=$AWS_SECRET_KEY \ - rg.fr-par.scw.cloud/sns-x-instance-tutorial/publisher-server:1.0 + rg.fr-par.scw.cloud/mnq-tutorials/sns-instances-publisher-server:1.0 EOF } }