Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(SRV): rework transform images tutorial MTA-4240 #2851

Merged
merged 4 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,19 @@ You will now learn how to deploy Serverless Functions and connect them using tri
```

5. Save the file and exit the editor.
6. Run the following command in the same terminal to download the required dependencies:

6. Run the following command in the same terminal to initialize a new NPM project and create an empty `package.json` file:

```sh
npm init --yes
```

7. Run the following command to download the required dependencies and packages:

```bash
npm i @aws-sdk/client-s3 @aws-sdk/client-sqs @scaleway/serverless-functions
```
7. Run the following command in the same terminal to zip the content of the folder:
8. Run the following command in the same terminal to zip the content of the folder:

```bash
zip -r BucketScan.zip .
Expand Down Expand Up @@ -277,14 +284,19 @@ You will now learn how to deploy Serverless Functions and connect them using tri
```

4. Save the file and exit the code editor.
5. Run the following command in the same terminal to download the required dependencies and packages:
5. Run the following command in the same terminal to initialize a new NPM project and create an empty `package.json` file:

```sh
npm init --yes
```
6. Run the following command to download the required dependencies and packages:

```bash
npm i @aws-sdk/client-s3 @aws-sdk/client-sqs @scaleway/serverless-functions
npm install sharp --platform=linuxmusl --arch=x64 sharp --ignore-script=false
```

6. Run the following command in the same terminal to zip the content of the folder:
7. Run the following command in the same terminal to zip the content of the folder:

```bash
zip -r ImageTransform.zip .
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,10 @@ dates:
posted: 2023-07-07
---

## Introduction

This tutorial is the first of a series of two. You will learn how to set up your environment, then [how to create and deploy functions](/tutorials/transform-bucket-images-triggers-functions-deploy/) to resize images stored in a bucket and push them to another bucket.

<Lightbox src="scaleway-faas-image-transform.webp" alt="" />

Serverless Functions are an asynchronous microservices architecture where event sources are decorrelated from event consumers.

They work best when they are triggered by events stored in queues, which means that they can be edited without having to modify every microservice in the process.
They work best when they are triggered by specific events, such as cron schedules, which means they can be edited without having to modify every microservice in the process.


In this tutorial, you will create the following resources to use your functions:

Expand All @@ -36,10 +31,10 @@ In this tutorial, you will create the following resources to use your functions:
<Macro id="requirements" />

- A Scaleway account logged into the [console](https://console.scaleway.com)
- Around 10 JPG or PNG images
- A code editor installed
- Installed [Node.js](https://nodejs.org/en/download) and [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
- At least 10 JPG or PNG images

## Creating a new Project
## Creating a Project

1. Click the **Projects** tab from the [Organization Dashboard](https://console.scaleway.com/organization). A list of your Projects displays.
2. Click **+ Create Project** on the right-hand side. A pop-up displays.
Expand Down Expand Up @@ -69,22 +64,22 @@ In this tutorial, you will create the following resources to use your functions:

Message queues allow functions to communicate with each other.

1. Click **Messaging** under **Serverless**.
1. Click **Messaging** under **Serverless** on the left side menu of the console.
2. Click **Activate** next to **SQS**.
3. Click **Activate SQS** to confirm when prompted.

## Generating credentials for Messaging and Queuing SQS

1. In **Messaging and Queuing** > **SQS**, click the **Credentials** tab.
2. Click **Generate credentials**.
1. Click **Messaging** under **Serverless** on the left side menu of the console, then select **SQS**.
2. Click **+ Generate credentials**.
3. Name your credentials `Function Push`.
4. Enable the **Write**, **Read** and **Manage** permissions.
5. Click **Generate credentials**.
6. Store the access key ID and the secret key securely, as you will not be able to access them later.

## Creating a Queue

1. Click the **Queues** tab of SQS.
1. Click **Messaging** under **Serverless** on the left side menu of the console, then select **SQS**.
2. Click **Create queue**.
3. Select **Standard** as a queue type.
4. Name it `image-queue`.
Expand Down
Loading