From 8b3b1df1c6da7067236432f84c2548dcf06cd84c Mon Sep 17 00:00:00 2001 From: thomas-tacquet Date: Fri, 18 Oct 2024 16:36:20 +0200 Subject: [PATCH 01/10] feat(containers): mdbook tutorial --- .../index.mdx | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 tutorials/deploy-mdbooks-serverless-containers/index.mdx diff --git a/tutorials/deploy-mdbooks-serverless-containers/index.mdx b/tutorials/deploy-mdbooks-serverless-containers/index.mdx new file mode 100644 index 0000000000..5fffff8859 --- /dev/null +++ b/tutorials/deploy-mdbooks-serverless-containers/index.mdx @@ -0,0 +1,106 @@ +onf--- +meta: + title: Fast deployment of documentation on Serverless Containers with mdbooks + description: Step-by-step guide to deploy mdbooks on Serverless Containers. +content: + h1: Deploying mdbooks on Serverless Containers + paragraph: +tags: docker container deploy serverless +hero: assets/scaleway-umami.webp +categories: + - containers + - container-registry +dates: + validation: + posted: +--- + +Publish modern online books, for product, API documentation, tutorials, course material or anything that requires a clean, easily navigable and customizable presentation. + + + +- A Scaleway account logged into the [console](https://console.scaleway.com) +- [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 +- Docker installed on your local machine + +## Why deploying on Serverless + +Serverless products are perfect for cost efficiency with a pay-as-you go model and scales very well. + +With zero infrastructure management a lot of tools to integrate in CI/CD environments, `mdbooks` can benefits a lot of Serverless Containers. + +## Local setup + +Follow [Istallation instructions](https://rust-lang.github.io/mdBook/guide/installation.html) of mdbooks. + +Run: +- `mdbook init my-first-book` in order to create a sample book. +- `cd my-first-book` + +Now you can edit the content of the book to publish. + +It's recommanded to test the book using the command: `mdbook test`. + +## Prepare Container Registry + + + We recommend using Scaleway Container Registry instead of external registries to avoid errors of rate limiting and risks regarding evolutions of CGU and pricing. + + +1. Create a file named `Dockerfile` in this folder containing the following code: + +```dockerfile +FROM debian:bookworm-slim + +WORKDIR /app + +# Copy necessary files (add if you have custom files) +COPY book.toml /app/ +COPY src/* /app/src/ + +# Install mdbooks binary +RUN apt-get -y update; apt-get -y install curl; +RUN mkdir /home/mdbooks +RUN curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.40/mdbook-v0.4.40-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=/home/mdbooks +ENV PATH="$PATH:/home/mdbooks" + +# Serve the book: +# 0.0.0.0 is required to listen on public interface, otherwise mdbook will only listen for localhost +# 8080 port is used to match the Serverless Container settings. +ENTRYPOINT ["mdbook", "serve", "-n", "0.0.0.0", "-p", "8080" ] +``` + +2. Open Container Registry product on Scaleway Console. +3. Click **Create namespace**. A namespace is used to hold the image. + + + A pop-up will appear with informations to log into your Container Registry Namespace. This will allow to push the image later. + + +4. Create the namespace and save the registry endpoint. It should be something like `rg.fr-par.scw.cloud/` + +## Build and Push + +1. Run the command `docker build -t rg..scw.cloud//: .` +* **region**: to get this information, check the namespace settings of the namespace you created. +* **image_name**: use the name you want to identify your image, for example `mdbook`. +* **tag_name**: use tags to identify the version of your image, for example `v1`. + +2. Push the image: +`docker push rg..scw.cloud//:` + +## Deploy the Serverless Container + +1. Create a Serverless Container Namespace. [Link to console](https://console.scaleway.com/containers/namespaces/create) +2. Configure the Serverless Containers. Important points are: +* **Image**: Select the Registry namespace, Container and Tag you created before using the dropdowns. +* **Name**: You can change the default name to use a more meaningful one. + +You can keep default values of other parameters and fine-tune them later at anytime without downtime. + +3. Click "Deploy container" button and wait few seconds for the deployment. +4. Congratulation you Serverless Container is deployed an ready :) + +## Going further + +- Integrate in CI/CD From 544a217d271e95f73ec03f75e28581b0c126a139 Mon Sep 17 00:00:00 2001 From: thomas-tacquet Date: Fri, 25 Oct 2024 16:36:17 +0200 Subject: [PATCH 02/10] polish text --- .../index.mdx | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/tutorials/deploy-mdbooks-serverless-containers/index.mdx b/tutorials/deploy-mdbooks-serverless-containers/index.mdx index 5fffff8859..1ad6453030 100644 --- a/tutorials/deploy-mdbooks-serverless-containers/index.mdx +++ b/tutorials/deploy-mdbooks-serverless-containers/index.mdx @@ -15,7 +15,10 @@ dates: posted: --- -Publish modern online books, for product, API documentation, tutorials, course material or anything that requires a clean, easily navigable and customizable presentation. +Publish modern online books, for product, API documentation, tutorials, course material or anything that requires a clean, easily navigable and customizable presentation. + +**Goal** this tutorial uses `mdbooks` to publish simple documentation but the main goal of this tutorial is to show how simple it is to +pick a project, package it inside an image and deploy it on Serverless Containers. @@ -31,15 +34,15 @@ With zero infrastructure management a lot of tools to integrate in CI/CD environ ## Local setup -Follow [Istallation instructions](https://rust-lang.github.io/mdBook/guide/installation.html) of mdbooks. +1. Follow [Istallation instructions](https://rust-lang.github.io/mdBook/guide/installation.html) of mdbooks. -Run: +2. Run commands: - `mdbook init my-first-book` in order to create a sample book. -- `cd my-first-book` +- `cd my-first-book` to open the directory created by init command. -Now you can edit the content of the book to publish. +3. *(optional)* Now you can edit the content of the book to publish. -It's recommanded to test the book using the command: `mdbook test`. +4. It's recommanded to test the book using the command: `mdbook test`. ## Prepare Container Registry @@ -74,10 +77,10 @@ ENTRYPOINT ["mdbook", "serve", "-n", "0.0.0.0", "-p", "8080" ] 3. Click **Create namespace**. A namespace is used to hold the image. - A pop-up will appear with informations to log into your Container Registry Namespace. This will allow to push the image later. + A pop-up will appear with informations to log into your Container Registry Namespace with `docker login`. This will allow to push the image later. -4. Create the namespace and save the registry endpoint. It should be something like `rg.fr-par.scw.cloud/` +4. Create the namespace and save the registry endpoint. The registry endpoint looks like `rg..scw.cloud/` ## Build and Push @@ -92,15 +95,17 @@ ENTRYPOINT ["mdbook", "serve", "-n", "0.0.0.0", "-p", "8080" ] ## Deploy the Serverless Container 1. Create a Serverless Container Namespace. [Link to console](https://console.scaleway.com/containers/namespaces/create) -2. Configure the Serverless Containers. Important points are: -* **Image**: Select the Registry namespace, Container and Tag you created before using the dropdowns. +2. Configure the Serverless Containers. **Important points are:** +* **Image**: Select the Registry namespace, Container and Tag you created before using the dropdown lists. * **Name**: You can change the default name to use a more meaningful one. You can keep default values of other parameters and fine-tune them later at anytime without downtime. -3. Click "Deploy container" button and wait few seconds for the deployment. -4. Congratulation you Serverless Container is deployed an ready :) +3. Click **Deploy container** button and wait few seconds for the deployment. +4. Congratulation you Serverless Container is deployed an ready. You can access it via it's **endpoint**. ## Going further -- Integrate in CI/CD +* [Monitor logs and metrics](/serverless/containers/how-to/monitor-container/) of your Container. +* [Add a custom domain](/serverless/containers/how-to/add-a-custom-domain-to-a-container/) to your Container. +* Explore [other methods](/serverless/containers/reference-content/deploy-container/) to deploy your Container. From 6f7343152f7f4d2672c0153b6672e6040208f107 Mon Sep 17 00:00:00 2001 From: thomas-tacquet Date: Fri, 25 Oct 2024 16:37:18 +0200 Subject: [PATCH 03/10] syntax --- tutorials/deploy-mdbooks-serverless-containers/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/deploy-mdbooks-serverless-containers/index.mdx b/tutorials/deploy-mdbooks-serverless-containers/index.mdx index 1ad6453030..7f3eb9a8e6 100644 --- a/tutorials/deploy-mdbooks-serverless-containers/index.mdx +++ b/tutorials/deploy-mdbooks-serverless-containers/index.mdx @@ -1,4 +1,4 @@ -onf--- +--- meta: title: Fast deployment of documentation on Serverless Containers with mdbooks description: Step-by-step guide to deploy mdbooks on Serverless Containers. From 567b5094cc2e0903435a12a1c81777df2ca1c61c Mon Sep 17 00:00:00 2001 From: Thomas TACQUET Date: Mon, 28 Oct 2024 18:07:48 +0100 Subject: [PATCH 04/10] Apply suggestions from code review Co-authored-by: Benedikt Rollik --- .../index.mdx | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/tutorials/deploy-mdbooks-serverless-containers/index.mdx b/tutorials/deploy-mdbooks-serverless-containers/index.mdx index 7f3eb9a8e6..9115341b7a 100644 --- a/tutorials/deploy-mdbooks-serverless-containers/index.mdx +++ b/tutorials/deploy-mdbooks-serverless-containers/index.mdx @@ -1,10 +1,10 @@ --- meta: title: Fast deployment of documentation on Serverless Containers with mdbooks - description: Step-by-step guide to deploy mdbooks on Serverless Containers. + description: Step-by-step guide to deploy mdbooks on Scaleway Serverless Containers. content: - h1: Deploying mdbooks on Serverless Containers - paragraph: + h1: Fast deployment of documentation on Serverless Containers with mdbooks + paragraph: Step-by-step guide to deploy mdbooks on Scaleway Serverless Containers. tags: docker container deploy serverless hero: assets/scaleway-umami.webp categories: @@ -17,7 +17,7 @@ dates: Publish modern online books, for product, API documentation, tutorials, course material or anything that requires a clean, easily navigable and customizable presentation. -**Goal** this tutorial uses `mdbooks` to publish simple documentation but the main goal of this tutorial is to show how simple it is to +This tutorial uses `mdbooks` to publish simple documentation but the main goal of this tutorial is to show how simple it is to pick a project, package it inside an image and deploy it on Serverless Containers. @@ -28,13 +28,13 @@ pick a project, package it inside an image and deploy it on Serverless Container ## Why deploying on Serverless -Serverless products are perfect for cost efficiency with a pay-as-you go model and scales very well. +Serverless products are perfect for cost efficiency with a pay-as-you-go model and scale very well. -With zero infrastructure management a lot of tools to integrate in CI/CD environments, `mdbooks` can benefits a lot of Serverless Containers. +With zero infrastructure management and many tools to integrate in CI/CD environments, `mdbooks` can benefit a lot of Serverless Containers. ## Local setup -1. Follow [Istallation instructions](https://rust-lang.github.io/mdBook/guide/installation.html) of mdbooks. +1. Follow the [installation instructions](https://rust-lang.github.io/mdBook/guide/installation.html) of mdbooks. 2. Run commands: - `mdbook init my-first-book` in order to create a sample book. @@ -42,7 +42,7 @@ With zero infrastructure management a lot of tools to integrate in CI/CD environ 3. *(optional)* Now you can edit the content of the book to publish. -4. It's recommanded to test the book using the command: `mdbook test`. +4. It is recommended to test the book using the command: `mdbook test`. ## Prepare Container Registry @@ -73,7 +73,7 @@ ENV PATH="$PATH:/home/mdbooks" ENTRYPOINT ["mdbook", "serve", "-n", "0.0.0.0", "-p", "8080" ] ``` -2. Open Container Registry product on Scaleway Console. +2. Open a web browser on your computer and navigate to the [Container Registry](https://console.scaleway.com/containers/) product in the Scaleway Console. 3. Click **Create namespace**. A namespace is used to hold the image. @@ -82,7 +82,10 @@ ENTRYPOINT ["mdbook", "serve", "-n", "0.0.0.0", "-p", "8080" ] 4. Create the namespace and save the registry endpoint. The registry endpoint looks like `rg..scw.cloud/` -## Build and Push + + Refer to [How to create a namespace](/docs/containers/container-registry/how-to/create-namespace/) for detailed information about Container Registry namespace creation. + +## Build and push 1. Run the command `docker build -t rg..scw.cloud//: .` * **region**: to get this information, check the namespace settings of the namespace you created. @@ -94,7 +97,7 @@ ENTRYPOINT ["mdbook", "serve", "-n", "0.0.0.0", "-p", "8080" ] ## Deploy the Serverless Container -1. Create a Serverless Container Namespace. [Link to console](https://console.scaleway.com/containers/namespaces/create) +1. Create a [Serverless Container Namespace](https://console.scaleway.com/containers/namespaces/create) in the Scaleway console. 2. Configure the Serverless Containers. **Important points are:** * **Image**: Select the Registry namespace, Container and Tag you created before using the dropdown lists. * **Name**: You can change the default name to use a more meaningful one. From 667fdc88cd14ffbbb3cb05faa7d385943066f20d Mon Sep 17 00:00:00 2001 From: Thomas TACQUET Date: Wed, 30 Oct 2024 09:25:53 +0100 Subject: [PATCH 05/10] Apply suggestions from code review Co-authored-by: Rowena Jones <36301604+RoRoJ@users.noreply.github.com> --- .../index.mdx | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tutorials/deploy-mdbooks-serverless-containers/index.mdx b/tutorials/deploy-mdbooks-serverless-containers/index.mdx index 9115341b7a..4dead25db4 100644 --- a/tutorials/deploy-mdbooks-serverless-containers/index.mdx +++ b/tutorials/deploy-mdbooks-serverless-containers/index.mdx @@ -11,11 +11,11 @@ categories: - containers - container-registry dates: - validation: - posted: + validation: 2024-10-30 + posted: 2024-10-30 --- -Publish modern online books, for product, API documentation, tutorials, course material or anything that requires a clean, easily navigable and customizable presentation. +`mdBooks` lets you publish modern online books, for product, API documentation, tutorials, course material or anything that requires a clean, easily navigable and customizable presentation. This tutorial uses `mdbooks` to publish simple documentation but the main goal of this tutorial is to show how simple it is to pick a project, package it inside an image and deploy it on Serverless Containers. @@ -26,11 +26,11 @@ pick a project, package it inside an image and deploy it on Serverless Container - [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 - Docker installed on your local machine -## Why deploying on Serverless +## Why deploy on Serverless? -Serverless products are perfect for cost efficiency with a pay-as-you-go model and scale very well. +Serverless products are perfect for cost efficiency with a pay-as-you-go model, and scale very well. -With zero infrastructure management and many tools to integrate in CI/CD environments, `mdbooks` can benefit a lot of Serverless Containers. +With zero infrastructure management and many tools to integrate in CI/CD environments, an `mdbooks` deployment is well suited to Serverless Containers. ## Local setup @@ -40,9 +40,9 @@ With zero infrastructure management and many tools to integrate in CI/CD environ - `mdbook init my-first-book` in order to create a sample book. - `cd my-first-book` to open the directory created by init command. -3. *(optional)* Now you can edit the content of the book to publish. +3. *(Optional)* Edit the content of the book to publish. -4. It is recommended to test the book using the command: `mdbook test`. +4. Test the book using the command: `mdbook test`. ## Prepare Container Registry @@ -73,11 +73,11 @@ ENV PATH="$PATH:/home/mdbooks" ENTRYPOINT ["mdbook", "serve", "-n", "0.0.0.0", "-p", "8080" ] ``` -2. Open a web browser on your computer and navigate to the [Container Registry](https://console.scaleway.com/containers/) product in the Scaleway Console. +2. Open a web browser on your computer and navigate to the [Container Registry](https://console.scaleway.com/containers/) product in the Scaleway console. 3. Click **Create namespace**. A namespace is used to hold the image. - A pop-up will appear with informations to log into your Container Registry Namespace with `docker login`. This will allow to push the image later. + A pop-up will appear with information to log into your Container Registry Namespace with `docker login`. This will allow us to push the image later. 4. Create the namespace and save the registry endpoint. The registry endpoint looks like `rg..scw.cloud/` @@ -105,7 +105,7 @@ ENTRYPOINT ["mdbook", "serve", "-n", "0.0.0.0", "-p", "8080" ] You can keep default values of other parameters and fine-tune them later at anytime without downtime. 3. Click **Deploy container** button and wait few seconds for the deployment. -4. Congratulation you Serverless Container is deployed an ready. You can access it via it's **endpoint**. +Your Serverless Container is deployed and ready. You can access it via its **endpoint**. ## Going further From c167ce609655e5b891a98032845f30612aaff742 Mon Sep 17 00:00:00 2001 From: thomas-tacquet Date: Wed, 30 Oct 2024 16:01:21 +0100 Subject: [PATCH 06/10] indent --- .../index.mdx | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/tutorials/deploy-mdbooks-serverless-containers/index.mdx b/tutorials/deploy-mdbooks-serverless-containers/index.mdx index 4dead25db4..88f0c6a53d 100644 --- a/tutorials/deploy-mdbooks-serverless-containers/index.mdx +++ b/tutorials/deploy-mdbooks-serverless-containers/index.mdx @@ -37,8 +37,8 @@ With zero infrastructure management and many tools to integrate in CI/CD environ 1. Follow the [installation instructions](https://rust-lang.github.io/mdBook/guide/installation.html) of mdbooks. 2. Run commands: -- `mdbook init my-first-book` in order to create a sample book. -- `cd my-first-book` to open the directory created by init command. + - `mdbook init my-first-book` in order to create a sample book. + - `cd my-first-book` to open the directory created by init command. 3. *(Optional)* Edit the content of the book to publish. @@ -52,26 +52,26 @@ With zero infrastructure management and many tools to integrate in CI/CD environ 1. Create a file named `Dockerfile` in this folder containing the following code: -```dockerfile -FROM debian:bookworm-slim + ```dockerfile + FROM debian:bookworm-slim -WORKDIR /app + WORKDIR /app -# Copy necessary files (add if you have custom files) -COPY book.toml /app/ -COPY src/* /app/src/ + # Copy necessary files (add if you have custom files) + COPY book.toml /app/ + COPY src/* /app/src/ -# Install mdbooks binary -RUN apt-get -y update; apt-get -y install curl; -RUN mkdir /home/mdbooks -RUN curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.40/mdbook-v0.4.40-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=/home/mdbooks -ENV PATH="$PATH:/home/mdbooks" + # Install mdbooks binary + RUN apt-get -y update; apt-get -y install curl; + RUN mkdir /home/mdbooks + RUN curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.40/mdbook-v0.4.40-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=/home/mdbooks + ENV PATH="$PATH:/home/mdbooks" -# Serve the book: -# 0.0.0.0 is required to listen on public interface, otherwise mdbook will only listen for localhost -# 8080 port is used to match the Serverless Container settings. -ENTRYPOINT ["mdbook", "serve", "-n", "0.0.0.0", "-p", "8080" ] -``` + # Serve the book: + # 0.0.0.0 is required to listen on public interface, otherwise mdbook will only listen for localhost + # 8080 port is used to match the Serverless Container settings. + ENTRYPOINT ["mdbook", "serve", "-n", "0.0.0.0", "-p", "8080" ] + ``` 2. Open a web browser on your computer and navigate to the [Container Registry](https://console.scaleway.com/containers/) product in the Scaleway console. 3. Click **Create namespace**. A namespace is used to hold the image. @@ -88,24 +88,24 @@ ENTRYPOINT ["mdbook", "serve", "-n", "0.0.0.0", "-p", "8080" ] ## Build and push 1. Run the command `docker build -t rg..scw.cloud//: .` -* **region**: to get this information, check the namespace settings of the namespace you created. -* **image_name**: use the name you want to identify your image, for example `mdbook`. -* **tag_name**: use tags to identify the version of your image, for example `v1`. + * **region**: to get this information, check the namespace settings of the namespace you created. + * **image_name**: use the name you want to identify your image, for example `mdbook`. + * **tag_name**: use tags to identify the version of your image, for example `v1`. 2. Push the image: -`docker push rg..scw.cloud//:` + `docker push rg..scw.cloud//:` ## Deploy the Serverless Container 1. Create a [Serverless Container Namespace](https://console.scaleway.com/containers/namespaces/create) in the Scaleway console. 2. Configure the Serverless Containers. **Important points are:** -* **Image**: Select the Registry namespace, Container and Tag you created before using the dropdown lists. -* **Name**: You can change the default name to use a more meaningful one. + * **Image**: Select the Registry namespace, Container and Tag you created before using the dropdown lists. + * **Name**: You can change the default name to use a more meaningful one. You can keep default values of other parameters and fine-tune them later at anytime without downtime. 3. Click **Deploy container** button and wait few seconds for the deployment. -Your Serverless Container is deployed and ready. You can access it via its **endpoint**. + Your Serverless Container is deployed and ready. You can access it via its **endpoint**. ## Going further From fdb0b70e2c15526347311cb4a61ba29dad826dab Mon Sep 17 00:00:00 2001 From: SamyOubouaziz Date: Tue, 5 Nov 2024 11:40:42 +0100 Subject: [PATCH 07/10] docs(srv): documentation review --- .../index.mdx | 153 +++++++++++------- 1 file changed, 92 insertions(+), 61 deletions(-) diff --git a/tutorials/deploy-mdbooks-serverless-containers/index.mdx b/tutorials/deploy-mdbooks-serverless-containers/index.mdx index 88f0c6a53d..8e7b7cd789 100644 --- a/tutorials/deploy-mdbooks-serverless-containers/index.mdx +++ b/tutorials/deploy-mdbooks-serverless-containers/index.mdx @@ -1,12 +1,11 @@ --- meta: - title: Fast deployment of documentation on Serverless Containers with mdbooks - description: Step-by-step guide to deploy mdbooks on Scaleway Serverless Containers. + title: Fast deployment of documentation on Serverless Containers with mdBook + description: Step-by-step guide to deploy mdBooks on Scaleway Serverless Containers. content: - h1: Fast deployment of documentation on Serverless Containers with mdbooks - paragraph: Step-by-step guide to deploy mdbooks on Scaleway Serverless Containers. -tags: docker container deploy serverless -hero: assets/scaleway-umami.webp + h1: Fast deployment of documentation on Serverless Containers with mdBook + paragraph: Step-by-step guide to deploy mdBooks on Scaleway Serverless Containers. +tags: docker container deploy serverless mdbook documentation categories: - containers - container-registry @@ -15,100 +14,132 @@ dates: posted: 2024-10-30 --- -`mdBooks` lets you publish modern online books, for product, API documentation, tutorials, course material or anything that requires a clean, easily navigable and customizable presentation. +[mdBook](https://rust-lang.github.io/mdBook/) lets you publish modern online books, for product, API documentation, tutorials, course material or anything that requires a clean, easily navigable, and customizable presentation. -This tutorial uses `mdbooks` to publish simple documentation but the main goal of this tutorial is to show how simple it is to -pick a project, package it inside an image and deploy it on Serverless Containers. +This tutorial uses `mdbook` to publish simple documentation but the main goal of this tutorial is to show how simple it is to pick a project, package it inside an image, and deploy it on Serverless Containers. - A Scaleway account logged into the [console](https://console.scaleway.com) - [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 -- Docker installed on your local machine +- [Docker](https://docs.docker.com/engine/install/) installed on your local machine -## Why deploy on Serverless? +## Why deploy on a Serverless infrastructure? Serverless products are perfect for cost efficiency with a pay-as-you-go model, and scale very well. -With zero infrastructure management and many tools to integrate in CI/CD environments, an `mdbooks` deployment is well suited to Serverless Containers. +With zero infrastructure management and many tools to integrate in CI/CD environments, an `mdBook` deployment is well suited to Serverless Containers. -## Local setup +## Setting up mdBook locally -1. Follow the [installation instructions](https://rust-lang.github.io/mdBook/guide/installation.html) of mdbooks. +1. Follow the [installation instructions](https://rust-lang.github.io/mdBook/guide/installation.html) of mdBook. -2. Run commands: - - `mdbook init my-first-book` in order to create a sample book. - - `cd my-first-book` to open the directory created by init command. +2. Run the following command to create a sample book: + ``` + mdbook init my-first-books + ``` -3. *(Optional)* Edit the content of the book to publish. +3. Run the following command to access the folder created by the previous `init` command: + ``` + cd my-first-book + ``` -4. Test the book using the command: `mdbook test`. +4. Optionally, you can edit the content of the book to publish. -## Prepare Container Registry +5. Test the book using the command below: + ``` + mdbook test + ``` + +## Preparing the Container Registry - We recommend using Scaleway Container Registry instead of external registries to avoid errors of rate limiting and risks regarding evolutions of CGU and pricing. + We recommend using [Scaleway Container Registry](/containers/container-registry/) instead of external registries to avoid rate limiting errors, and risks linked to CGU and pricing changes. -1. Create a file named `Dockerfile` in this folder containing the following code: +1. Create a file named `Dockerfile` in the previously created folder, and add the following code to it: + + ```dockerfile + FROM debian:bookworm-slim + + WORKDIR /app - ```dockerfile - FROM debian:bookworm-slim + # Copy the necessary files (add your custom files here) + COPY book.toml /app/ + COPY src/* /app/src/ - WORKDIR /app + # Install the mdbooks binary + RUN apt-get -y update; apt-get -y install curl; + RUN mkdir /home/mdbooks + RUN curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.40/mdbook-v0.4.40-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=/home/mdbooks + ENV PATH="$PATH:/home/mdbooks" - # Copy necessary files (add if you have custom files) - COPY book.toml /app/ - COPY src/* /app/src/ + # Serve the book + # 0.0.0.0 is required to listen on public interface, otherwise mdbook will only listen for localhost + # 8080 port is used to match the Serverless Container settings. + ENTRYPOINT ["mdbook", "serve", "-n", "0.0.0.0", "-p", "8080" ] + ``` - # Install mdbooks binary - RUN apt-get -y update; apt-get -y install curl; - RUN mkdir /home/mdbooks - RUN curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.40/mdbook-v0.4.40-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=/home/mdbooks - ENV PATH="$PATH:/home/mdbooks" +2. Open the Scaleway console in a web browser, and navigate to the [Container Registry](https://console.scaleway.com/containers/). - # Serve the book: - # 0.0.0.0 is required to listen on public interface, otherwise mdbook will only listen for localhost - # 8080 port is used to match the Serverless Container settings. - ENTRYPOINT ["mdbook", "serve", "-n", "0.0.0.0", "-p", "8080" ] - ``` +3. Click **+ Create namespace**. [Namespaces](/containers/container-registry/concepts/#namespace) allow you to easily manage the images stored in your Container Registry. -2. Open a web browser on your computer and navigate to the [Container Registry](https://console.scaleway.com/containers/) product in the Scaleway console. -3. Click **Create namespace**. A namespace is used to hold the image. +4. Enter a name for your namespace, or keep the automatically generated one, then click **Create namespace**. - A pop-up will appear with information to log into your Container Registry Namespace with `docker login`. This will allow us to push the image later. + For more information on creating a Container Registry namespace, refer to [the dedicated documentation](/containers/container-registry/how-to/create-namespace/). -4. Create the namespace and save the registry endpoint. The registry endpoint looks like `rg..scw.cloud/` +## Building and pushing the image - Refer to [How to create a namespace](/docs/containers/container-registry/how-to/create-namespace/) for detailed information about Container Registry namespace creation. +Remember to replace the placeholders with the corresponding values in the steps below. -## Build and push -1. Run the command `docker build -t rg..scw.cloud//: .` - * **region**: to get this information, check the namespace settings of the namespace you created. - * **image_name**: use the name you want to identify your image, for example `mdbook`. - * **tag_name**: use tags to identify the version of your image, for example `v1`. +1. Run the following command in a terminal to sign in to your Container Registry namespace: + ``` + docker login rg.fr-par.scw.cloud/ -u nologin --password-stdin <<< "$SCW_SECRET_KEY" + ``` + The message `Login Succeeded` appears once you are signed in. + +2. Run the command below to build and tag your image locally. + + ``` + docker build -t rg..scw.cloud//: . + ``` + + * The **region** and **namespace_name** can be found in the **Namespace settings** tab of the namespace you created. + * **image_name**: use the name you want to identify your image, such as `my-mdbook`. + * **tag_name**: use tags to identify the version of your image, such as `v1`. + +3. Run the command below to push the image to the Scaleway Container Registry: + ``` + docker push rg..scw.cloud//: + ``` + +## Deploying the Serverless Container + +1. In the [Serverless Containers](https://console.scaleway.com/containers/namespaces/) section of the Scaleway console, click **+ Create namespace**. + +2. Enter a name for your namespace, or keep the automatically generated one, then click **Create namespace and add container**. -2. Push the image: - `docker push rg..scw.cloud//:` +3. Select your image from the registry: + * Select the **Scaleway Container Registry**. + * From the drop-down menu, select the **registry namespace** previously created. + * Enter the **port** previously configured in the Dockerfile (`8080` by default) + * From the drop-down menus, select the **container** and **tag** you created before using the dropdown lists. + * **Name**: You can change the default name to use a more meaningful one. -## Deploy the Serverless Container +4. Enter a name for your Serverless Container, or keep the automatically generated one. -1. Create a [Serverless Container Namespace](https://console.scaleway.com/containers/namespaces/create) in the Scaleway console. -2. Configure the Serverless Containers. **Important points are:** - * **Image**: Select the Registry namespace, Container and Tag you created before using the dropdown lists. - * **Name**: You can change the default name to use a more meaningful one. +5. Keep the default **resources** and **scaling** values. You can fine-tune them later without any downtime. -You can keep default values of other parameters and fine-tune them later at anytime without downtime. +3. Click **Deploy container** to proceed. The initial deployment of your container can take up to a few minutes. -3. Click **Deploy container** button and wait few seconds for the deployment. - Your Serverless Container is deployed and ready. You can access it via its **endpoint**. +Your Serverless Container is deployed and ready. You can access it via its **endpoint**. ## Going further -* [Monitor logs and metrics](/serverless/containers/how-to/monitor-container/) of your Container. -* [Add a custom domain](/serverless/containers/how-to/add-a-custom-domain-to-a-container/) to your Container. -* Explore [other methods](/serverless/containers/reference-content/deploy-container/) to deploy your Container. +* [Monitor logs and metrics](/serverless/containers/how-to/monitor-container/) of your container. +* [Add a custom domain](/serverless/containers/how-to/add-a-custom-domain-to-a-container/) to your container. +* Explore [other methods](/serverless/containers/reference-content/deploy-container/) to deploy your container. From 63611ee903f2aaa78639d193acb2e1a76ceb0432 Mon Sep 17 00:00:00 2001 From: SamyOubouaziz Date: Tue, 5 Nov 2024 11:41:27 +0100 Subject: [PATCH 08/10] docs(srv): update --- tutorials/deploy-mdbooks-serverless-containers/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/deploy-mdbooks-serverless-containers/index.mdx b/tutorials/deploy-mdbooks-serverless-containers/index.mdx index 8e7b7cd789..85871bd298 100644 --- a/tutorials/deploy-mdbooks-serverless-containers/index.mdx +++ b/tutorials/deploy-mdbooks-serverless-containers/index.mdx @@ -59,7 +59,7 @@ With zero infrastructure management and many tools to integrate in CI/CD environ 1. Create a file named `Dockerfile` in the previously created folder, and add the following code to it: - ```dockerfile + ``` FROM debian:bookworm-slim WORKDIR /app From 3bd83d9342a67609db495ed44aef9e8cff60181f Mon Sep 17 00:00:00 2001 From: SamyOubouaziz Date: Tue, 5 Nov 2024 11:42:04 +0100 Subject: [PATCH 09/10] docs(srv): update --- tutorials/deploy-mdbooks-serverless-containers/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/deploy-mdbooks-serverless-containers/index.mdx b/tutorials/deploy-mdbooks-serverless-containers/index.mdx index 85871bd298..2d3c1e9d6d 100644 --- a/tutorials/deploy-mdbooks-serverless-containers/index.mdx +++ b/tutorials/deploy-mdbooks-serverless-containers/index.mdx @@ -59,7 +59,7 @@ With zero infrastructure management and many tools to integrate in CI/CD environ 1. Create a file named `Dockerfile` in the previously created folder, and add the following code to it: - ``` + ```docker FROM debian:bookworm-slim WORKDIR /app From 537bd4175f01c82ec1fb888b636583432081c019 Mon Sep 17 00:00:00 2001 From: SamyOubouaziz Date: Tue, 5 Nov 2024 11:50:55 +0100 Subject: [PATCH 10/10] docs(srv): fix 404s --- macros/developer-tools/scaleway-configuration-file.mdx | 4 ++-- serverless/containers/how-to/monitor-container.mdx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/macros/developer-tools/scaleway-configuration-file.mdx b/macros/developer-tools/scaleway-configuration-file.mdx index 45b44043f9..f47e25d350 100644 --- a/macros/developer-tools/scaleway-configuration-file.mdx +++ b/macros/developer-tools/scaleway-configuration-file.mdx @@ -21,10 +21,10 @@ The configuration file contains the following elements: : The ID of the Scaleway Project to use by default **default_zone** -: The [availability zone](console/account/reference-content/products-availability/) to use by default +: The [availability zone](/console/account/reference-content/products-availability/) to use by default **default_region** -: The [region](console/account/reference-content/products-availability/) to use by default +: The [region](/console/account/reference-content/products-availability/) to use by default **api_url** : The API URL to use (`https://api.scaleway.com` by default) diff --git a/serverless/containers/how-to/monitor-container.mdx b/serverless/containers/how-to/monitor-container.mdx index f2d1a06fdf..ee9a0832f0 100644 --- a/serverless/containers/how-to/monitor-container.mdx +++ b/serverless/containers/how-to/monitor-container.mdx @@ -20,7 +20,7 @@ Scaleway Serverless Containers is fully integrated into [Cockpit](/observability - A Scaleway account logged into the [console](https://console.scaleway.com) - [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 -- [Created a Serverless Container](serverless/containers/how-to/deploy-a-container-from-scaleway-container-registry/) +- [Created a Serverless Container](/serverless/containers/how-to/deploy-a-container-from-scaleway-container-registry/) ## How to activate your Cockpit