Skip to content

Commit

Permalink
docs(srv): add notes and troubleshooting on encoding secrets and env …
Browse files Browse the repository at this point in the history
…vars MTA-5183 (#3889)
  • Loading branch information
SamyOubouaziz authored Oct 28, 2024
1 parent e67acac commit 1fa4749
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ For now, Serverless Containers only supports public images.
- Set your [scaling](/serverless/containers/concepts/#scaling) preferences, or leave them at default values. The Scaleway platform autoscales the number of available instances of your container to match the incoming load, depending on the settings you define here.
- Click **Advanced options** to define any [environment variables](/serverless/containers/concepts/#environment-variables) you want to inject into your container. For each environment variable, click **+Add variable** and enter the key/value pair.
- Add [secrets](/serverless/containers/concepts/#secrets) for your container. Secrets are environment variables which are injected into your container, but the values are not retained or displayed by Scaleway after initial validation.
<Message type="note">
Encode your environment variables and secrets to `base64` if they are too large, and contain carriage returns.
</Message>
- Set the desired [privacy policy](/serverless/containers/concepts/#privacy-policy) for your container. This defines whether container invocation may be done anonymously (**public**) or only via an authentication mechanism provided by the [Scaleway API](https://www.scaleway.com/en/developers/api/serverless-containers/#authentication) (**private**).
- Set a custom [timeout](/serverless/containers/concepts/#timeout) for your container.
- Verify the **estimated cost**.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ You can deploy a container from the [Scaleway Container Registry](/containers/co
- Set your [scaling](/serverless/containers/concepts/#scaling) preferences, or leave them at default values. The Scaleway platform autoscales the number of available instances of your container to match the incoming load, depending on the settings you define here.
- Click **Advanced options** to define any [environment variables](/serverless/containers/concepts/#environment-variables) you want to inject into your container. For each environment variable, click **+Add variable** and enter the key/value pair.
- Add [secrets](/serverless/containers/concepts/#secrets) for your container. Secrets are environment variables which are injected into your container, but the values are not retained or displayed by Scaleway after initial validation.
<Message type="note">
Encode your environment variables and secrets to `base64` if they are too large, and contain carriage returns.
</Message>
- Set the desired [privacy policy](/serverless/containers/concepts/#privacy-policy) for your container. This defines whether container invocation may be done anonymously (**public**) or only via an authentication mechanism provided by the [Scaleway API](https://www.scaleway.com/en/developers/api/serverless-containers/#authentication) (**private**).
- Set a custom [timeout](/serverless/containers/concepts/#timeout) for your container.
- Verify the **estimated cost**.
Expand Down
19 changes: 18 additions & 1 deletion serverless/containers/troubleshooting/common-errors.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,21 @@ Serverless products support external public registries (such as [Docker Hub](htt

### Solution

We recommend using [Scaleway's Container Registry](/containers/container-registry/) instead, as it allows for a seamless integration with Serverless Containers and Jobs at a [competitive price](/faq/containerregistry/#how-am-i-billed-for-scaleway-container-registry).
We recommend using [Scaleway's Container Registry](/containers/container-registry/) instead, as it allows for a seamless integration with Serverless Containers and Jobs at a [competitive price](/faq/containerregistry/#how-am-i-billed-for-scaleway-container-registry).

## My environment variable or secret is not properly injected in my container

### Cause

Environment variables or secrets that are too large, contain carriage returns and spread over several lines, as shown below, will not be injected properly.

```
"hello
world
.
"
```

### Solution

To avoid issues while injecting environment variables and secrets, we recommend encoding them to `base64`.
3 changes: 3 additions & 0 deletions serverless/functions/how-to/create-a-function.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ This page shows you how to deploy a [function](/serverless/functions/concepts/#f
5. Click **+ Advanced options** and complete the following steps:
- Define any **environment variables** you want to inject into your function. For each environment variable, click **+ Add variable** and enter the key/value pair.
- Optionally, set secret environment variables. **Secrets** are environment variables which are injected into your function and stored securely, but not displayed in the console after initial validation. Add a **key** and a **value**.
<Message type="note">
Encode your environment variables and secrets to `base64` if they are too large, and contain carriage returns.
</Message>
- Set the desired **privacy policy** for your function. This defines whether a function can be executed anonymously (**public**) or only via an authentication mechanism provided by the [Scaleway API](https://www.scaleway.com/en/developers/api/serverless-functions/#authentication) (**private**).
- Set the desired timeout for your function.
<Message type="note">
Expand Down
17 changes: 17 additions & 0 deletions serverless/functions/troubleshooting/common-errors.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,20 @@ The new deploy failed, and the [fallback mechanism has been triggered](/serverle
### Possible solution

Identify the element that caused the deployment to fail, fix the error, and deploy the function again.

## My environment variable or secret is not properly injected in my function

### Cause

Environment variables or secrets that are too large, contain carriage returns and spread over several lines, as shown below, will not be injected properly.

```
"hello
world
.
"
```

### Solution

To avoid issues while injecting environment variables and secrets, we recommend encoding them to `base64`.
3 changes: 3 additions & 0 deletions serverless/jobs/how-to/create-job-from-external-registry.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ Private external container registries are currently not supported.
- Choose the **resources** to be allocated to your job at runtime. These define the performance characteristics of your job.
- Optionally, add a **cron schedule** in the `* * * * *` format, and select your time zone to run your job periodically. Refer to the [cron schedules documentation](/serverless/jobs/reference-content/cron-schedules/) for more information.
- Define any **environment variables** you want to inject into your job in the advanced options. For each environment variable, click **+Add new variable** and enter the key/value pair.
<Message type="note">
Encode your environment variables to `base64` if they are too large, and contain carriage returns.
</Message>
- Add a **startup command** to your job. It will be executed every time your job is run.
- Set a **maximum duration** to your job to stop it automatically if it does not complete within this limit.
- Verify the **estimated cost**.
Expand Down
3 changes: 3 additions & 0 deletions serverless/jobs/how-to/create-job-from-scaleway-registry.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ Scaleway's Serverless Jobs allows you to create jobs from several container [reg
- Choose the **resources** to be allocated to your job at runtime. These define the performance characteristics of your job.
- Add a **cron schedule** in the `* * * * *` format, and select your time zone to run your job periodically. Refer to the [cron schedules documentation](/serverless/jobs/reference-content/cron-schedules/) for more information.
- Define any **environment variables** you want to inject into your job in the advanced options. For each environment variable, click **+Add new variable** and enter the key/value pair.
<Message type="note">
Encode your environment variables to `base64` if they are too large, and contain carriage returns.
</Message>
- Add a **startup command** to your job. It will be executed every time your job is run.
- Set a **maximum duration** to your job to stop it automatically if it does not complete within this limit.
- Verify the **estimated cost**.
Expand Down
19 changes: 18 additions & 1 deletion serverless/jobs/troubleshooting/common-errors.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,21 @@ Serverless products support external public registries (such as [Docker Hub](htt

### Solution

We recommend using [Scaleway's Container Registry](/containers/container-registry/) instead, as it allows for a seamless integration with Serverless Containers and Jobs at a [competitive price](/faq/containerregistry/#how-am-i-billed-for-scaleway-container-registry).
We recommend using [Scaleway's Container Registry](/containers/container-registry/) instead, as it allows for a seamless integration with Serverless Containers and Jobs at a [competitive price](/faq/containerregistry/#how-am-i-billed-for-scaleway-container-registry).

## My environment variable or secret is not properly injected in my job

### Cause

Environment variables or secrets that are too large, contain carriage returns and spread over several lines, as shown below, will not be injected properly.

```
"hello
world
.
"
```

### Solution

To avoid issues while injecting environment variables and secrets, we recommend encoding them to `base64`.

0 comments on commit 1fa4749

Please sign in to comment.