Skip to content

Commit 3c43f65

Browse files
feat(serverless): fix somesyntax highlighting
1 parent d9cf9dc commit 3c43f65

File tree

4 files changed

+39
-39
lines changed

4 files changed

+39
-39
lines changed

serverless/containers/how-to/secure-a-container.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ secret:
5757

5858
Add the following [resource description](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/container) in Terraform:
5959

60-
```
60+
```hcl
6161
secret_environment_variables = { "key" = "secret" }
6262
```
6363

tutorials/encode-videos-using-serverless-jobs/index.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This tutorial demonstrates the process of encoding videos retrieved from Object
2121

2222
- A Scaleway account logged into the [console](https://console.scaleway.com)
2323
- [Owner](/identity-and-access-management/iam/concepts/#owner) status or [IAM permissions](/identity-and-access-management/iam/concepts/#permission) allowing you to perform actions in the intended Organization
24-
- An [Object Storage bucket](/storage/object/how-to/create-a-bucket/)
24+
- An [Object Storage bucket](/storage/object/how-to/create-a-bucket/)
2525
- A valid [API key](/identity-and-access-management/iam/how-to/create-api-keys/)
2626
- Installed [Docker engine](https://docs.docker.com/engine/install/)
2727

@@ -72,7 +72,7 @@ The initial step involves defining a Docker image for interacting with the S3 Ob
7272
This Dockerfile uses `linuxserver/ffmpeg` as a base image bundled with FFMPEG along with a variety of encoding codecs and installs [MinIO](https://min.io/) as a command-line S3 client to copy files over Object Storage.
7373

7474
3. Build and [push the image](/containers/container-registry/how-to/push-images/) to your Container Registry:
75-
```
75+
```bash
7676
docker build . -t <registry and image name>
7777
docker push <registry and image name>
7878
```
@@ -125,7 +125,7 @@ Once the run status is **Succeeded**, the encoded video can be found in your S3
125125
<Message type="note">
126126
Your job can also be triggered through the [Scaleway API](https://www.scaleway.com/en/developers/api/serverless-jobs/#path-job-definitions-run-an-existing-job-definition-by-its-unique-identifier-this-will-create-a-new-job-run) using the same environment variables:
127127

128-
```
128+
```bash
129129
curl -X POST \
130130
-H "X-Auth-Token: <API Key>" \
131131
-H "Content-Type: application/json" \

tutorials/snapshot-instances-jobs/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ Serverless Jobs rely on containers to run in the cloud, and therefore require a
169169

170170
1. Create a `Dockerfile`, and add the following code to it:
171171

172-
```docker
172+
```dockerfile
173173
# Using apline/golang image
174174
FROM golang:1.22-alpine
175175

tutorials/strapi-app-serverless-containers-sqldb/index.mdx

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ You can either deploy your application:
4242
2. Run the command below to make sure the environment variables are properly set:
4343

4444
```sh
45-
scw info
45+
scw info
4646
```
4747

4848
This command displays your access key and secret key in the last two lines of the output. The `ORIGIN` column should display `env (SCW_ACCESS_KEY)` and `env (SCW_SECRET_KEY)`, and not `default profile`.
49-
49+
5050
```bash
5151
KEY VALUE ORIGIN
5252
(...)
@@ -77,16 +77,16 @@ You can either deploy your application:
7777
&& psql -h $DATABASE_HOST -p $DATABASE_PORT \
7878
-d $DATABASE_NAME -U $DATABASE_USERNAME
7979
```
80-
An input field with the name of your database should display:
80+
An input field with the name of your database should display:
8181
```
8282
psql (15.3, server 16.1 (Debian 16.1-1.pgdg120+1))
8383
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_128_GCM_SHA256, compression: off)
84-
Type "help" for help.
84+
Type "help" for help.
8585
8686
tutorial-strapi-blog-db=>
8787
```
8888
</Message>
89-
89+
9090
### Running Strapi locally
9191

9292
1. Create a Strapi blog template
@@ -95,7 +95,7 @@ You can either deploy your application:
9595
--dbclient=postgres --dbhost=$DATABASE_HOST \
9696
--dbport=$DATABASE_PORT --dbname=$DATABASE_NAME \
9797
--dbusername=$DATABASE_USERNAME \
98-
--dbpassword=$DATABASE_PASSWORD --dbssl=true
98+
--dbpassword=$DATABASE_PASSWORD --dbssl=true
9999
```
100100

101101
2. Access the folder you just created:
@@ -120,7 +120,7 @@ You can either deploy your application:
120120
touch Dockerfile
121121
```
122122
2. Add the code below to your file, save it, and exit.
123-
```bash
123+
```docker
124124
# Creating a multi-stage build for production
125125
FROM node:20-alpine as build
126126
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev vips-dev git > /dev/null 2>&1
@@ -189,12 +189,12 @@ You can either deploy your application:
189189
├── jsconfig.json
190190
├── package.json
191191
├── README.md
192-
└── yarn.lock
192+
└── yarn.lock
193193
```
194194

195195
5. Build your application container:
196196
```bash
197-
docker build -t my-strapi-blog .
197+
docker build -t my-strapi-blog .
198198
```
199199
<Message type="tip">
200200
The docker build image process can take a few minutes, particularly during the `npm install` step, since Strapi requires around 1 GB of node modules to be built.
@@ -281,7 +281,7 @@ You can either deploy your application:
281281
```
282282
When the status appears as `ready`, you can access the Strapi Administration Panel via your browser.
283283
</Message>
284-
284+
285285
3. Copy the endpoint URL displayed next to the `DomainName` property, and paste it into your browser. The main Strapi page displays. Click "Open the administration" or add `/admin` to your browser URL to access the Strapi Administration Panel.
286286

287287
4. (Optional) You can check that Strapi APIs are working with the following command, or by accessing `https://{container_url}/api/articles` in your browser:
@@ -319,7 +319,7 @@ However, your Strapi container currently connects to your database with your [us
319319

320320
To secure your deployment, we will now add a dedicated [IAM application](/identity-and-access-management/iam/concepts/#application), give it the minimum required permissions, and provide its credentials to your Strapi container.
321321

322-
1. Run the following command to create an [IAM application](/identity-and-access-management/iam/concepts/#application) and export it as a variable:
322+
1. Run the following command to create an [IAM application](/identity-and-access-management/iam/concepts/#application) and export it as a variable:
323323
```bash
324324
export SCW_APPLICATION_ID=$(scw iam application create name=tutorial-strapi-blog -o json | jq -r '.id')
325325
```
@@ -364,10 +364,10 @@ To secure your deployment, we will now add a dedicated [IAM application](/identi
364364
secret-environment-variables.5.value=$JWT_SECRET redeploy=true
365365
```
366366

367-
6. Refresh your browser page displaying the Strapi Administration Panel. An updated version displays.
367+
6. Refresh your browser page displaying the Strapi Administration Panel. An updated version displays.
368368

369369
You have now deployed a full serverless Strapi blog example!
370-
370+
371371
## Going further with containers
372372

373373
- Inspect your newly created resources in the Scaleway console:
@@ -399,11 +399,11 @@ To secure your deployment, we will now add a dedicated [IAM application](/identi
399399
2. Run the command below to make sure the environment variables are properly set:
400400

401401
```sh
402-
scw info
402+
scw info
403403
```
404404

405405
This command displays your access_key and secret_key in the two last lines of the output. The `ORIGIN` column should display `env (SCW_ACCESS_KEY)` and `env (SCW_SECRET_KEY)`, and not `default profile`.
406-
406+
407407
```bash
408408
KEY VALUE ORIGIN
409409
(...)
@@ -512,12 +512,12 @@ To secure your deployment, we will now add a dedicated [IAM application](/identi
512512
├── jsconfig.json
513513
├── package.json
514514
├── README.md
515-
└── yarn.lock
515+
└── yarn.lock
516516
```
517517

518518
8. Build your application container:
519519
```bash
520-
docker build -t my-strapi-blog .
520+
docker build -t my-strapi-blog .
521521
```
522522
<Message type="tip">
523523
The docker build image process can take a few minutes, particularly during the `npm install` step since Strapi requires around 1 GB of node modules to be built.
@@ -545,15 +545,15 @@ To secure your deployment, we will now add a dedicated [IAM application](/identi
545545
docker push $REGISTRY_ENDPOINT/my-strapi-blog:latest
546546
```
547547

548-
548+
549549
### Creating the Terraform configuration
550550

551551
1. Run the following command to create a new folder to store your Terraform files, and access it:
552552
```bash
553553
cd ..
554554
mkdir terraform-strapi-blog &&
555555
cd terraform-strapi-blog
556-
```
556+
```
557557

558558
2. Create an empty `main.tf` Terraform file inside the folder.
559559

@@ -565,7 +565,7 @@ To secure your deployment, we will now add a dedicated [IAM application](/identi
565565
```
566566

567567
3. Add the following code to your `main.tf` file:
568-
```json
568+
```hcl
569569
terraform {
570570
required_providers {
571571
scaleway = {
@@ -577,12 +577,12 @@ To secure your deployment, we will now add a dedicated [IAM application](/identi
577577
}
578578
required_version = ">= 0.13"
579579
}
580-
580+
581581
variable "REGISTRY_ENDPOINT" {
582582
type = string
583583
description = "Container Registry endpoint where your application container is stored"
584584
}
585-
585+
586586
variable "DEFAULT_PROJECT_ID" {
587587
type = string
588588
description = "Project ID where your resources will be created"
@@ -606,12 +606,12 @@ To secure your deployment, we will now add a dedicated [IAM application](/identi
606606
for_each = toset(local.secrets)
607607
length = 16
608608
}
609-
609+
610610
resource scaleway_container_namespace main {
611611
name = "tutorial-strapi-blog-tf"
612612
description = "Namespace created for full serverless Strapi blog deployment"
613613
}
614-
614+
615615
resource scaleway_container main {
616616
617617
name = "tutorial-strapi-blog-tf"
@@ -628,7 +628,7 @@ To secure your deployment, we will now add a dedicated [IAM application](/identi
628628
privacy = "public"
629629
protocol = "http1"
630630
deploy = true
631-
631+
632632
environment_variables = {
633633
"DATABASE_CLIENT"="postgres",
634634
"DATABASE_USERNAME" = scaleway_iam_application.app.id,
@@ -648,11 +648,11 @@ To secure your deployment, we will now add a dedicated [IAM application](/identi
648648
"JWT_SECRET" = random_bytes.generated_secrets["jwt_secret"].base64
649649
}
650650
}
651-
651+
652652
resource scaleway_iam_application "app" {
653653
name = "tutorial-strapi-blog-tf"
654654
}
655-
655+
656656
resource scaleway_iam_policy "db_access" {
657657
name = "tutorial-strapi-policy-tf"
658658
description = "Gives tutorial Strapi blog access to Serverless SQL Database"
@@ -662,17 +662,17 @@ To secure your deployment, we will now add a dedicated [IAM application](/identi
662662
permission_set_names = ["ServerlessSQLDatabaseReadWrite"]
663663
}
664664
}
665-
665+
666666
resource scaleway_iam_api_key "api_key" {
667667
application_id = scaleway_iam_application.app.id
668668
}
669-
669+
670670
resource scaleway_sdb_sql_database "database" {
671671
name = "tutorial-strapi-tf"
672672
min_cpu = 0
673673
max_cpu = 8
674674
}
675-
675+
676676
output "database_connection_string" {
677677
// Output as an example, you can give this string to your application
678678
value = format("postgres://%s:%s@%s",
@@ -682,7 +682,7 @@ To secure your deployment, we will now add a dedicated [IAM application](/identi
682682
)
683683
sensitive = true
684684
}
685-
685+
686686
output "container_url" {
687687
// Output as an example, you can give this string to your application
688688
value = scaleway_container.main.domain_name
@@ -718,7 +718,7 @@ The Terraform file creates several resources:
718718
```
719719
Edit the `ADMIN_EMAIL` and `ADMIN_PASSWORD` values with your own email and password. Optionally, you can also edit `ADMIN_FIRSTNAME` and `ADMIN_LASTNAME` values to change the default admin first and last name.
720720
<Message type="note">
721-
Strapi admin password requires at least 8 characters including one uppercase, one lowercase, one number, and one special character.
721+
Strapi admin password requires at least 8 characters including one uppercase, one lowercase, one number, and one special character.
722722
If the admin password or email does not meet the requirements, the container will not start.
723723
</Message>
724724

@@ -813,7 +813,7 @@ Once you are done, run the following command to stop all your resources:
813813
- **Fine-tune deployment options** such as autoscaling, targeted regions, and more. You can find more information by typing `scw container deploy --help` in your terminal, or by referring to the [dedicated documentation](/serverless/containers/how-to/manage-a-container/)
814814

815815
- Create a secondary production environment by duplicating your built container, building it in `NODE_ENV=production` environment, running `npm run start`, and plugging it onto another **Serverless SQL Database**. For instance, this will allow you to edit content-types which is not possible in production.
816-
816+
817817
## Troubleshooting
818818

819819
If you happen to encounter any issues, first check that you meet all the requirements.
@@ -827,7 +827,7 @@ If you happen to encounter any issues, first check that you meet all the require
827827
UpdatedAt 1 year ago
828828
Description -
829829
```
830-
<Message type="tip">
830+
<Message type="tip">
831831
You can also find and compare your Project and Organization ID in the [Scaleway console settings](https://console.scaleway.com/project/settings).
832832
</Message>
833833
- You have **Docker Engine** installed. Running the `docker -v` command in a terminal should display your currently installed docker version:

0 commit comments

Comments
 (0)