Skip to content

Commit

Permalink
update(registry): terraform update with new registry for docker images (
Browse files Browse the repository at this point in the history
#81)

Co-authored-by: jlecomte <[email protected]>
  • Loading branch information
JoLcte and jlecomte authored Apr 18, 2024
1 parent e8c374d commit 3db6e78
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
13 changes: 8 additions & 5 deletions mnq/sns-instances-notification-system/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -38,4 +41,4 @@ terraform apply
- Then connect to the publisher Instance with that URL ```http://<your_subscriber_ip_address>:8081```
- Go to the home page of your publisher server: ```http://<your_publisher_ip_address>: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.
- Once you're done testing, you can apply `terraform destroy` to clean and remove the project.
8 changes: 4 additions & 4 deletions mnq/sns-instances-notification-system/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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 \
Expand All @@ -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
}
}

0 comments on commit 3db6e78

Please sign in to comment.