From bc9d71d6666556c08e94414aec5ab6e977942018 Mon Sep 17 00:00:00 2001 From: Daniel Vallance Date: Thu, 28 May 2026 09:45:21 +0100 Subject: [PATCH 1/2] feat: Do not raise multiple sync PRs This changes the sync workflow to push changes to a single, fixed, branch name. This means that there will only ever be a single open sync PR. Closes: FIELD-510 Signed-off-by: Daniel Vallance --- .github/workflows/sync.yaml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/sync.yaml b/.github/workflows/sync.yaml index 81e99651..495aba4f 100644 --- a/.github/workflows/sync.yaml +++ b/.github/workflows/sync.yaml @@ -45,12 +45,6 @@ jobs: run: | git diff pages/guides/ - - name: Generate branch ID - id: id - run: | - BRANCH="sync/examples-$(date +'%Y%m%d%H%M%S')" - echo "name=${BRANCH}" >>"${GITHUB_OUTPUT}" - - name: Generate timestamp id: timestamp run: | @@ -73,7 +67,7 @@ jobs: **Branch:** `${{ inputs.examples_branch || 'main' }}` **Timestamp:** ${{ steps.timestamp.outputs.value }} - branch: ${{ steps.id.outputs.name }} + branch: sync/examples committer: Unikraft Bot author: Unikraft Bot add-paths: | From 32f773a07606f86a18129483fe21393372e228c7 Mon Sep 17 00:00:00 2001 From: Unikraft Bot Date: Mon, 1 Jun 2026 12:34:21 +0000 Subject: [PATCH 2/2] chore: Update guides from examples repository Signed-off-by: Unikraft Bot --- pages/guides/caddy2.7-go1.21.mdx | 7 +- pages/guides/debian-ssh.mdx | 7 +- pages/guides/dragonflydb.mdx | 7 +- pages/guides/duckdb-go1.21.mdx | 7 +- pages/guides/github-webhook-node.mdx | 7 +- pages/guides/grafana.mdx | 7 +- pages/guides/haproxy.mdx | 7 +- pages/guides/httpserver-boost1.74-gpp13.2.mdx | 7 +- pages/guides/httpserver-bun.mdx | 7 +- pages/guides/httpserver-c-debug.mdx | 7 +- pages/guides/httpserver-dotnet10.0.mdx | 7 +- pages/guides/httpserver-elixir1.16.mdx | 7 +- pages/guides/httpserver-erlang26.2.mdx | 7 +- .../httpserver-expressjs4.18-node21.mdx | 7 +- pages/guides/httpserver-flask-redis.mdx | 7 +- pages/guides/httpserver-gcc13.2.mdx | 7 +- pages/guides/httpserver-go1.21.mdx | 7 +- pages/guides/httpserver-go1.22-redis.mdx | 273 +++++++++++++ pages/guides/httpserver-gpp13.2.mdx | 7 +- .../httpserver-java17-spring-petclinic.mdx | 7 +- .../httpserver-java17-springboot3.5.x.mdx | 7 +- pages/guides/httpserver-java21.mdx | 7 +- pages/guides/httpserver-lua5.1.mdx | 7 +- .../guides/httpserver-nginx-vite-vanilla.mdx | 7 +- .../httpserver-node-express-puppeteer.mdx | 7 +- .../httpserver-node-vite-ssr-vanilla.mdx | 7 +- pages/guides/httpserver-node-vite-vanilla.mdx | 7 +- pages/guides/httpserver-node21-nextjs.mdx | 7 +- .../guides/httpserver-node21-solid-start.mdx | 7 +- .../guides/httpserver-node22-react-router.mdx | 7 +- pages/guides/httpserver-node22-sveltekit.mdx | 7 +- pages/guides/httpserver-node26.mdx | 7 +- pages/guides/httpserver-perl5.42.mdx | 7 +- pages/guides/httpserver-php8.2.mdx | 7 +- ...httpserver-prisma-expressjs4.19-node18.mdx | 7 +- .../httpserver-python3.12-django5.0.mdx | 7 +- .../httpserver-python3.12-fastapi-0.121.3.mdx | 7 +- .../httpserver-python3.12-flask3.0-sqlite.mdx | 7 +- .../guides/httpserver-python3.12-flask3.0.mdx | 7 +- pages/guides/httpserver-python3.12.mdx | 7 +- pages/guides/httpserver-ruby3.2.mdx | 7 +- .../guides/httpserver-rust-trunkrs-leptos.mdx | 7 +- pages/guides/httpserver-rust1.75-tokio.mdx | 7 +- .../guides/httpserver-rust1.88-actix-web4.mdx | 7 +- .../guides/httpserver-rust1.88-rocket0.5.mdx | 7 +- pages/guides/httpserver-rust1.91.mdx | 7 +- pages/guides/hugo0.122.mdx | 7 +- pages/guides/imaginary.mdx | 7 +- pages/guides/mariadb.mdx | 7 +- pages/guides/mcp-server-arxiv.mdx | 7 +- pages/guides/mcp-server-simple.mdx | 7 +- pages/guides/memcached1.6.mdx | 7 +- pages/guides/minio.mdx | 7 +- pages/guides/mongodb.mdx | 7 +- pages/guides/nginx-flask-mongo.mdx | 381 ++++++++++++++++++ pages/guides/nginx.mdx | 7 +- pages/guides/node-playwright-chromium.mdx | 7 +- pages/guides/node-playwright-firefox.mdx | 7 +- pages/guides/node-playwright-webkit.mdx | 7 +- pages/guides/node18-agario.mdx | 7 +- pages/guides/node18-wingsio.mdx | 7 +- pages/guides/node21-websocket.mdx | 7 +- pages/guides/node24-karaoke.mdx | 7 +- pages/guides/novnc-browser.mdx | 7 +- pages/guides/opentelemetry-collector.mdx | 7 +- pages/guides/phoenix-postgres.mdx | 327 +++++++++++++++ pages/guides/postgres.mdx | 7 +- pages/guides/python-playwright-chromium.mdx | 7 +- pages/guides/redis7.2.mdx | 7 +- pages/guides/ruby3.2-rails.mdx | 7 +- pages/guides/skipper0.18.mdx | 7 +- pages/guides/spin-wagi-http.mdx | 7 +- pages/guides/traefik.mdx | 7 +- pages/guides/tyk.mdx | 257 ++++++++++++ pages/guides/visual-studio-code-server.mdx | 7 +- pages/guides/vsftpd.mdx | 7 +- pages/guides/wazero-import-go.mdx | 7 +- pages/guides/wordpress-all-in-one.mdx | 7 +- pages/guides/wordpress.mdx | 322 +++++++++++++++ zudoku.config.tsx | 5 + 80 files changed, 1787 insertions(+), 296 deletions(-) create mode 100644 pages/guides/httpserver-go1.22-redis.mdx create mode 100644 pages/guides/nginx-flask-mongo.mdx create mode 100644 pages/guides/phoenix-postgres.mdx create mode 100644 pages/guides/tyk.mdx create mode 100644 pages/guides/wordpress.mdx diff --git a/pages/guides/caddy2.7-go1.21.mdx b/pages/guides/caddy2.7-go1.21.mdx index d7b581e3..cbcae077 100644 --- a/pages/guides/caddy2.7-go1.21.mdx +++ b/pages/guides/caddy2.7-go1.21.mdx @@ -18,10 +18,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/caddy2.7-go1.21/` directory: diff --git a/pages/guides/debian-ssh.mdx b/pages/guides/debian-ssh.mdx index 85ac063b..bed0a366 100644 --- a/pages/guides/debian-ssh.mdx +++ b/pages/guides/debian-ssh.mdx @@ -16,10 +16,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/debian-ssh` directory: diff --git a/pages/guides/dragonflydb.mdx b/pages/guides/dragonflydb.mdx index 477c0dad..6852fea8 100644 --- a/pages/guides/dragonflydb.mdx +++ b/pages/guides/dragonflydb.mdx @@ -17,10 +17,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/dragonflydb/` directory: diff --git a/pages/guides/duckdb-go1.21.mdx b/pages/guides/duckdb-go1.21.mdx index 3f63f2fc..ec143655 100644 --- a/pages/guides/duckdb-go1.21.mdx +++ b/pages/guides/duckdb-go1.21.mdx @@ -17,10 +17,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/duckdb-go1.21/` directory: diff --git a/pages/guides/github-webhook-node.mdx b/pages/guides/github-webhook-node.mdx index 96fb44b0..06de524b 100644 --- a/pages/guides/github-webhook-node.mdx +++ b/pages/guides/github-webhook-node.mdx @@ -19,10 +19,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/github-webhook-node/` directory: diff --git a/pages/guides/grafana.mdx b/pages/guides/grafana.mdx index 214cd24f..3814f0bf 100644 --- a/pages/guides/grafana.mdx +++ b/pages/guides/grafana.mdx @@ -17,10 +17,9 @@ To run it, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/grafana/` directory: diff --git a/pages/guides/haproxy.mdx b/pages/guides/haproxy.mdx index a3e29882..859d4ee1 100644 --- a/pages/guides/haproxy.mdx +++ b/pages/guides/haproxy.mdx @@ -18,10 +18,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/haproxy/` directory: diff --git a/pages/guides/httpserver-boost1.74-gpp13.2.mdx b/pages/guides/httpserver-boost1.74-gpp13.2.mdx index 94d0e99f..f815a618 100644 --- a/pages/guides/httpserver-boost1.74-gpp13.2.mdx +++ b/pages/guides/httpserver-boost1.74-gpp13.2.mdx @@ -16,10 +16,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [example repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-boost1.74-gpp13.2/` directory: diff --git a/pages/guides/httpserver-bun.mdx b/pages/guides/httpserver-bun.mdx index df612cdb..4918ced0 100644 --- a/pages/guides/httpserver-bun.mdx +++ b/pages/guides/httpserver-bun.mdx @@ -16,10 +16,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-bun` directory: diff --git a/pages/guides/httpserver-c-debug.mdx b/pages/guides/httpserver-c-debug.mdx index 5ad70af1..badcfb3d 100644 --- a/pages/guides/httpserver-c-debug.mdx +++ b/pages/guides/httpserver-c-debug.mdx @@ -16,10 +16,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-c-debug` directory: diff --git a/pages/guides/httpserver-dotnet10.0.mdx b/pages/guides/httpserver-dotnet10.0.mdx index 05ec8e53..b5e9c2a9 100644 --- a/pages/guides/httpserver-dotnet10.0.mdx +++ b/pages/guides/httpserver-dotnet10.0.mdx @@ -16,10 +16,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-dotnet10.0/` directory: diff --git a/pages/guides/httpserver-elixir1.16.mdx b/pages/guides/httpserver-elixir1.16.mdx index 28e33b02..2cf6f962 100644 --- a/pages/guides/httpserver-elixir1.16.mdx +++ b/pages/guides/httpserver-elixir1.16.mdx @@ -16,10 +16,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-elixir1.16/` directory: diff --git a/pages/guides/httpserver-erlang26.2.mdx b/pages/guides/httpserver-erlang26.2.mdx index 97e4c629..18413b7d 100644 --- a/pages/guides/httpserver-erlang26.2.mdx +++ b/pages/guides/httpserver-erlang26.2.mdx @@ -16,10 +16,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-erlang26.2/` directory: diff --git a/pages/guides/httpserver-expressjs4.18-node21.mdx b/pages/guides/httpserver-expressjs4.18-node21.mdx index dba30296..6eb3f64b 100644 --- a/pages/guides/httpserver-expressjs4.18-node21.mdx +++ b/pages/guides/httpserver-expressjs4.18-node21.mdx @@ -17,10 +17,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-expressjs4.18-node21` directory: diff --git a/pages/guides/httpserver-flask-redis.mdx b/pages/guides/httpserver-flask-redis.mdx index d368ead9..918a9908 100644 --- a/pages/guides/httpserver-flask-redis.mdx +++ b/pages/guides/httpserver-flask-redis.mdx @@ -18,10 +18,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-flask-redis` directory: diff --git a/pages/guides/httpserver-gcc13.2.mdx b/pages/guides/httpserver-gcc13.2.mdx index 84165d9b..ded6ea2e 100644 --- a/pages/guides/httpserver-gcc13.2.mdx +++ b/pages/guides/httpserver-gcc13.2.mdx @@ -16,10 +16,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-gcc13.2` directory: diff --git a/pages/guides/httpserver-go1.21.mdx b/pages/guides/httpserver-go1.21.mdx index ebccf2fc..45b9c6b6 100644 --- a/pages/guides/httpserver-go1.21.mdx +++ b/pages/guides/httpserver-go1.21.mdx @@ -16,10 +16,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-go1.21/` directory: diff --git a/pages/guides/httpserver-go1.22-redis.mdx b/pages/guides/httpserver-go1.22-redis.mdx new file mode 100644 index 00000000..f5d9a8d5 --- /dev/null +++ b/pages/guides/httpserver-go1.22-redis.mdx @@ -0,0 +1,273 @@ +--- +title: "Go and Redis HTTP Server" +--- + +import { Tabs, TabsContent, TabsList, TabsTrigger } from "zudoku/ui/Tabs" + +{/* vale off */} +{/* THIS FILE WAS AUTOGENERATED FROM THE PUBLIC EXAMPLE REPOSITORY. DO NOT EDIT THIS FILE DIRECTLY. */} + + +This guide explains how to create and deploy a Go app with a Redis database. +To run this example, follow these steps: + +1. Install the CLI. + Use the [unikraft CLI](/cli/unikraft) or the legacy [kraft CLI](https://unikraft.org/docs/cli/install). + You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). + Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). + + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. + +2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-go1.22-redis` directory: + +```bash +git clone https://github.com/unikraft-cloud/examples +cd examples/httpserver-go1.22-redis/ +``` + +Make sure to log into Unikraft Cloud and pick a [metro](/platform/metros) close to you. +This guide uses `fra` (Frankfurt, 🇩🇪): + + + +```bash title="unikraft" +unikraft login +``` + +```bash title="kraft" +# Set Unikraft Cloud access token +export UKC_TOKEN=token +# Set metro to Frankfurt, DE +export UKC_METRO=fra +``` + + + +## Deploy Redis + +First, deploy the Redis instance. +Redis is an internal service (not publicly accessible), reached via the `go122-redis.internal` domain. +The Redis password is set at runtime via the `REDIS_PASSWORD` environment variable (defaults to `unikraft` if not provided). + + + +```bash title="unikraft" +unikraft build ./redis --output /httpserver-go-122-redis-db:latest +unikraft run --scale-to-zero policy=idle,cooldown-time=1000,stateful=true --metro fra -m 256M --image /httpserver-go-122-redis-db:latest --domain go122-redis.internal -e REDIS_PASSWORD=unikraft +``` + +```bash title="kraft" +kraft cloud deploy --scale-to-zero idle --scale-to-zero-stateful --scale-to-zero-cooldown 1s -M 256Mi --domain go122-redis.internal --env REDIS_PASSWORD=unikraft ./redis/ +``` + + + +Make sure to replace `` with your username / org-name. + +The output shows the Redis instance details: + + + +```ansi title="unikraft" +metro: fra +name: httpserver-go-122-redis-db-2xc9u +uuid: 8abe24f6-5670-4e9b-8955-8ec10f3bad21 +state: starting +image: /httpserver-go-122-redis-db +resources: + memory: 256MiB + vcpus: 1 +service: + name: late-sound-rhboe98o + uuid: 01953c15-8a2e-4c1a-ac24-98a9417c5aa2 + domains: + - fqdn: go122-redis.internal +networks: +- uuid: e76ae319-d210-4566-ad75-baed32fc3d2b + private-ip: 10.0.0.85 + mac: 12:b0:0a:00:00:55 +timestamps: + created: just now +scale-to-zero: + enabled: true + policy: idle + stateful: true + cooldown-time: 1s +``` + +```ansi title="kraft" +[●] Deployed successfully! + │ + ├───────── name: httpserver-go-122-redis-db-2xc9u + ├───────── uuid: 8abe24f6-5670-4e9b-8955-8ec10f3bad21 + ├──────── metro: https://api.fra.unikraft.cloud/v1 + ├──────── state: starting + ├─────── domain: go122-redis.internal + ├──────── image: oci://unikraft.io//httpserver-go-122-redis-db@sha256:0b007ec2f56194da3a468aa93f4a2b8f267b1726ef3780355fbadb228fdf5c23 + ├─────── memory: 256 MiB + ├────── service: late-sound-rhboe98o + ├─ private fqdn: httpserver-go-122-redis-db-2xc9u.internal + └─── private ip: 10.0.0.85 +``` + + + +## Deploy Go HTTP Server + +Next, deploy the Go HTTP server. +It connects to Redis using the `REDIS_ADDR` and `REDIS_PASS` environment variables: + + + +```bash title="unikraft" +unikraft build ./httpserver-go --output /httpserver-go-122-redis-app:latest +unikraft run --scale-to-zero policy=on,cooldown-time=1000 --metro fra -p 443:8080/tls+http -m 256M --image /httpserver-go-122-redis-app:latest --env REDIS_ADDR=go122-redis.internal:6379 --env REDIS_PASS=unikraft +``` + +```bash title="kraft" +kraft cloud deploy --scale-to-zero on --scale-to-zero-cooldown 1s -p 443:8080/tls+http -M 256Mi ./httpserver-go/ --env REDIS_ADDR=go122-redis.internal:6379 --env REDIS_PASS=unikraft +``` + + + +The output shows the instance address and other details: + + + +```ansi title="unikraft" +metro: fra +name: httpserver-go-122-redis-app-bnnnc +uuid: 82093bcf-fc4c-471c-89c8-4d0b7810e280 +state: starting +image: /httpserver-go-122-redis-app +runtime: + env: + REDIS_ADDR: go122-redis.internal:6379 + REDIS_PASS: unikraft +resources: + memory: 256MiB + vcpus: 1 +service: + name: frosty-cherry-32qs6na2 + uuid: bcb9a2af-cfce-4731-9844-5a368696ee7d + domains: + - fqdn: frosty-cherry-32qs6na2.fra.unikraft.app +networks: +- uuid: f9030f74-4e85-445b-a57e-36ec76137c88 + private-ip: 10.0.0.173 + mac: 12:b0:0a:00:00:ad +timestamps: + created: just now +scale-to-zero: + enabled: true + policy: on + cooldown-time: 1s +``` + +```ansi title="kraft" +[●] Deployed successfully! + │ + ├───────── name: httpserver-go-122-redis-app-bnnnc + ├───────── uuid: 82093bcf-fc4c-471c-89c8-4d0b7810e280 + ├──────── metro: https://api.fra.unikraft.cloud/v1 + ├──────── state: starting + ├─────── domain: https://frosty-cherry-32qs6na2.fra.unikraft.app + ├──────── image: oci://unikraft.io//httpserver-go-122-redis-app@sha256:b923ac1ea60f83bdc61564aff95b11bac8a9e084f62532d0e882484d26e99da9 + ├─────── memory: 256 MiB + ├────── service: frosty-cherry-32qs6na2 + ├─ private fqdn: httpserver-go-122-redis-app-bnnnc.internal + └─── private ip: 10.0.0.173 +``` + + + +In this case, the instance names are `httpserver-go-122-redis-db-2xc9u` and `httpserver-go-122-redis-app-bnnnc`. +They're different for each run. + +To set a value in Redis via the Go server, use the URL from the `fqdn` field: + +```bash +curl -X POST -d "key=my-key" -d "value=my-value" https:// +``` + +``` +Success! +``` + +You can then retrieve the value: + +```bash +curl https:///?key=my-key +``` + +``` +Key "my-key" has value "my-value" +``` + +You can list information about the instances by running: + + + +```bash title="unikraft" +unikraft instances list +``` + +```bash title="kraft" +kraft cloud instance list +``` + + + + + +```ansi title="unikraft" +METRO NAME STATE IMAGE ARGS MEMORY VCPUS FQDN CREATED +fra httpserver-go-122-redis-app-bnnnc standby /httpserver-go-122-redis-app 256MiB 1 frosty-cherry-32qs6na2.fra.unikraft.app 4 minutes ago +fra httpserver-go-122-redis-db-2xc9u standby /httpserver-go-122-redis-db 256MiB 1 go122-redis.internal 5 minutes ago +``` + +```ansi title="kraft" +NAME FQDN STATE STATUS IMAGE MEMORY VCPUS ARGS BOOT TIME +httpserver-go-122-redis-app-bnnnc frosty-cherry-32qs6na2.fra.unikraft.app running since 3secs oci://unikraft.io//httpserver-go-122-redis-a... 256 MiB 1 968.01 ms +httpserver-go-122-redis-db-2xc9u go122-redis.internal running since 35secs oci://unikraft.io//httpserver-go-122-redis-... 256 MiB 1 1707.20 ms +``` + + + +## Clean up + +When done, remove the instances: + + + +```bash title="unikraft" +unikraft instances delete httpserver-go-122-redis-db-2xc9u httpserver-go-122-redis-app-bnnnc +``` + +```bash title="kraft" +kraft cloud instance remove httpserver-go-122-redis-db-2xc9u +kraft cloud instance remove httpserver-go-122-redis-app-bnnnc +``` + + + +## Learn more + +Use the `--help` option for detailed information on using Unikraft Cloud: + + + +```bash title="unikraft" +unikraft --help +``` + +```bash title="kraft" +kraft cloud --help +``` + + + +Or visit the [CLI Reference](/cli/unikraft) or the [legacy CLI Reference](/cli/kraft/overview). +{/* vale on */} diff --git a/pages/guides/httpserver-gpp13.2.mdx b/pages/guides/httpserver-gpp13.2.mdx index 7ba2ad82..3e489e82 100644 --- a/pages/guides/httpserver-gpp13.2.mdx +++ b/pages/guides/httpserver-gpp13.2.mdx @@ -16,10 +16,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [example repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-gpp13.2/` directory: diff --git a/pages/guides/httpserver-java17-spring-petclinic.mdx b/pages/guides/httpserver-java17-spring-petclinic.mdx index 66e6ebf2..2606d871 100644 --- a/pages/guides/httpserver-java17-spring-petclinic.mdx +++ b/pages/guides/httpserver-java17-spring-petclinic.mdx @@ -17,10 +17,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-java17-spring-petclinic/` directory: diff --git a/pages/guides/httpserver-java17-springboot3.5.x.mdx b/pages/guides/httpserver-java17-springboot3.5.x.mdx index 3e46117b..e62be847 100644 --- a/pages/guides/httpserver-java17-springboot3.5.x.mdx +++ b/pages/guides/httpserver-java17-springboot3.5.x.mdx @@ -16,10 +16,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-java17-springboot3.5.x/` directory: diff --git a/pages/guides/httpserver-java21.mdx b/pages/guides/httpserver-java21.mdx index 1c6acd65..8a898a80 100644 --- a/pages/guides/httpserver-java21.mdx +++ b/pages/guides/httpserver-java21.mdx @@ -17,10 +17,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-java21` directory: diff --git a/pages/guides/httpserver-lua5.1.mdx b/pages/guides/httpserver-lua5.1.mdx index 410c8a36..71f3771e 100644 --- a/pages/guides/httpserver-lua5.1.mdx +++ b/pages/guides/httpserver-lua5.1.mdx @@ -16,10 +16,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-lua5.1/` directory: diff --git a/pages/guides/httpserver-nginx-vite-vanilla.mdx b/pages/guides/httpserver-nginx-vite-vanilla.mdx index 42defaa8..ac8c9ab1 100644 --- a/pages/guides/httpserver-nginx-vite-vanilla.mdx +++ b/pages/guides/httpserver-nginx-vite-vanilla.mdx @@ -19,10 +19,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-nginx-vite-vanilla` directory: diff --git a/pages/guides/httpserver-node-express-puppeteer.mdx b/pages/guides/httpserver-node-express-puppeteer.mdx index 8a42ea0e..3106a31e 100644 --- a/pages/guides/httpserver-node-express-puppeteer.mdx +++ b/pages/guides/httpserver-node-express-puppeteer.mdx @@ -17,10 +17,9 @@ To run it, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-node-express-puppeteer/` directory: diff --git a/pages/guides/httpserver-node-vite-ssr-vanilla.mdx b/pages/guides/httpserver-node-vite-ssr-vanilla.mdx index 448fb6d1..a53e8719 100644 --- a/pages/guides/httpserver-node-vite-ssr-vanilla.mdx +++ b/pages/guides/httpserver-node-vite-ssr-vanilla.mdx @@ -33,10 +33,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-node-vite-ssr-vanilla/` directory: diff --git a/pages/guides/httpserver-node-vite-vanilla.mdx b/pages/guides/httpserver-node-vite-vanilla.mdx index 6f616116..d940def2 100644 --- a/pages/guides/httpserver-node-vite-vanilla.mdx +++ b/pages/guides/httpserver-node-vite-vanilla.mdx @@ -37,10 +37,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-node-vite-vanilla/` directory: diff --git a/pages/guides/httpserver-node21-nextjs.mdx b/pages/guides/httpserver-node21-nextjs.mdx index 603e1583..88756c63 100644 --- a/pages/guides/httpserver-node21-nextjs.mdx +++ b/pages/guides/httpserver-node21-nextjs.mdx @@ -16,10 +16,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-node21-nextjs` directory: diff --git a/pages/guides/httpserver-node21-solid-start.mdx b/pages/guides/httpserver-node21-solid-start.mdx index 6874ccf4..20f4fa42 100644 --- a/pages/guides/httpserver-node21-solid-start.mdx +++ b/pages/guides/httpserver-node21-solid-start.mdx @@ -16,10 +16,9 @@ To do so, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-node21-solid-start/` directory: diff --git a/pages/guides/httpserver-node22-react-router.mdx b/pages/guides/httpserver-node22-react-router.mdx index ac8a13d0..7d7527a8 100644 --- a/pages/guides/httpserver-node22-react-router.mdx +++ b/pages/guides/httpserver-node22-react-router.mdx @@ -17,10 +17,9 @@ To do so, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-node22-react-router/` directory: diff --git a/pages/guides/httpserver-node22-sveltekit.mdx b/pages/guides/httpserver-node22-sveltekit.mdx index 55115c49..92feed41 100644 --- a/pages/guides/httpserver-node22-sveltekit.mdx +++ b/pages/guides/httpserver-node22-sveltekit.mdx @@ -18,10 +18,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-node22-sveltekit/` directory: diff --git a/pages/guides/httpserver-node26.mdx b/pages/guides/httpserver-node26.mdx index f8b38a09..8e631731 100644 --- a/pages/guides/httpserver-node26.mdx +++ b/pages/guides/httpserver-node26.mdx @@ -17,10 +17,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-node26` directory: diff --git a/pages/guides/httpserver-perl5.42.mdx b/pages/guides/httpserver-perl5.42.mdx index 3b3dc92c..0a9ac3c7 100644 --- a/pages/guides/httpserver-perl5.42.mdx +++ b/pages/guides/httpserver-perl5.42.mdx @@ -16,10 +16,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-perl5.42/` directory: diff --git a/pages/guides/httpserver-php8.2.mdx b/pages/guides/httpserver-php8.2.mdx index 1bf3637e..01e5828a 100644 --- a/pages/guides/httpserver-php8.2.mdx +++ b/pages/guides/httpserver-php8.2.mdx @@ -16,10 +16,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-php8.2/` directory: diff --git a/pages/guides/httpserver-prisma-expressjs4.19-node18.mdx b/pages/guides/httpserver-prisma-expressjs4.19-node18.mdx index 4aa13f7d..e735a760 100644 --- a/pages/guides/httpserver-prisma-expressjs4.19-node18.mdx +++ b/pages/guides/httpserver-prisma-expressjs4.19-node18.mdx @@ -18,10 +18,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-prisma-expressjs4.19-node18/` directory: diff --git a/pages/guides/httpserver-python3.12-django5.0.mdx b/pages/guides/httpserver-python3.12-django5.0.mdx index 82e34ead..e62d64fe 100644 --- a/pages/guides/httpserver-python3.12-django5.0.mdx +++ b/pages/guides/httpserver-python3.12-django5.0.mdx @@ -16,10 +16,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-python3.12-django5.0/` directory: diff --git a/pages/guides/httpserver-python3.12-fastapi-0.121.3.mdx b/pages/guides/httpserver-python3.12-fastapi-0.121.3.mdx index d8747346..99dd7450 100644 --- a/pages/guides/httpserver-python3.12-fastapi-0.121.3.mdx +++ b/pages/guides/httpserver-python3.12-fastapi-0.121.3.mdx @@ -16,10 +16,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 1. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-python3.12-fastapi-0.121.3/` directory: diff --git a/pages/guides/httpserver-python3.12-flask3.0-sqlite.mdx b/pages/guides/httpserver-python3.12-flask3.0-sqlite.mdx index d464105e..464b6412 100644 --- a/pages/guides/httpserver-python3.12-flask3.0-sqlite.mdx +++ b/pages/guides/httpserver-python3.12-flask3.0-sqlite.mdx @@ -16,10 +16,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-python3.12-flask3.0-sqlite/` directory: diff --git a/pages/guides/httpserver-python3.12-flask3.0.mdx b/pages/guides/httpserver-python3.12-flask3.0.mdx index e2c677e7..91589153 100644 --- a/pages/guides/httpserver-python3.12-flask3.0.mdx +++ b/pages/guides/httpserver-python3.12-flask3.0.mdx @@ -16,10 +16,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-python3.12-flask3.0/` directory: diff --git a/pages/guides/httpserver-python3.12.mdx b/pages/guides/httpserver-python3.12.mdx index a8b0d853..8c33b3fd 100644 --- a/pages/guides/httpserver-python3.12.mdx +++ b/pages/guides/httpserver-python3.12.mdx @@ -16,10 +16,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-python3.12/` directory: diff --git a/pages/guides/httpserver-ruby3.2.mdx b/pages/guides/httpserver-ruby3.2.mdx index 5c2e1068..2ee8d208 100644 --- a/pages/guides/httpserver-ruby3.2.mdx +++ b/pages/guides/httpserver-ruby3.2.mdx @@ -16,10 +16,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-ruby3.2/` directory: diff --git a/pages/guides/httpserver-rust-trunkrs-leptos.mdx b/pages/guides/httpserver-rust-trunkrs-leptos.mdx index 08860dcd..d44a5db5 100644 --- a/pages/guides/httpserver-rust-trunkrs-leptos.mdx +++ b/pages/guides/httpserver-rust-trunkrs-leptos.mdx @@ -16,10 +16,9 @@ To run it, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-rust-trunkrs-leptos/` directory: diff --git a/pages/guides/httpserver-rust1.75-tokio.mdx b/pages/guides/httpserver-rust1.75-tokio.mdx index bfddcc6f..3be4759e 100644 --- a/pages/guides/httpserver-rust1.75-tokio.mdx +++ b/pages/guides/httpserver-rust1.75-tokio.mdx @@ -16,10 +16,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 1. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-rust1.75-tokio/` directory: diff --git a/pages/guides/httpserver-rust1.88-actix-web4.mdx b/pages/guides/httpserver-rust1.88-actix-web4.mdx index 7e500310..3f8cea99 100644 --- a/pages/guides/httpserver-rust1.88-actix-web4.mdx +++ b/pages/guides/httpserver-rust1.88-actix-web4.mdx @@ -16,10 +16,9 @@ To run it, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 1. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-rust1.88-actix-web4/` directory: diff --git a/pages/guides/httpserver-rust1.88-rocket0.5.mdx b/pages/guides/httpserver-rust1.88-rocket0.5.mdx index 90f6b97d..d837845e 100644 --- a/pages/guides/httpserver-rust1.88-rocket0.5.mdx +++ b/pages/guides/httpserver-rust1.88-rocket0.5.mdx @@ -16,10 +16,9 @@ To run it, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-rust1.88-rocket0.5/` directory: diff --git a/pages/guides/httpserver-rust1.91.mdx b/pages/guides/httpserver-rust1.91.mdx index c810dd9b..63ca3797 100644 --- a/pages/guides/httpserver-rust1.91.mdx +++ b/pages/guides/httpserver-rust1.91.mdx @@ -16,10 +16,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/httpserver-rust1.91` directory: diff --git a/pages/guides/hugo0.122.mdx b/pages/guides/hugo0.122.mdx index be61c6d3..d99b1895 100644 --- a/pages/guides/hugo0.122.mdx +++ b/pages/guides/hugo0.122.mdx @@ -17,10 +17,9 @@ To run it, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/hugo0.122/` directory: diff --git a/pages/guides/imaginary.mdx b/pages/guides/imaginary.mdx index f742d9a6..1ea21c2f 100644 --- a/pages/guides/imaginary.mdx +++ b/pages/guides/imaginary.mdx @@ -17,10 +17,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/imaginary/` directory: diff --git a/pages/guides/mariadb.mdx b/pages/guides/mariadb.mdx index 85e9e63b..437b50b9 100644 --- a/pages/guides/mariadb.mdx +++ b/pages/guides/mariadb.mdx @@ -16,10 +16,9 @@ To run it, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/mariadb/` directory: diff --git a/pages/guides/mcp-server-arxiv.mdx b/pages/guides/mcp-server-arxiv.mdx index 7885a279..d84a9eef 100644 --- a/pages/guides/mcp-server-arxiv.mdx +++ b/pages/guides/mcp-server-arxiv.mdx @@ -29,10 +29,9 @@ To run this MCP server on Unikraft Cloud: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 1. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/mcp-server-arxiv/` directory: diff --git a/pages/guides/mcp-server-simple.mdx b/pages/guides/mcp-server-simple.mdx index c52d7d34..b4e7d399 100644 --- a/pages/guides/mcp-server-simple.mdx +++ b/pages/guides/mcp-server-simple.mdx @@ -21,10 +21,9 @@ To run this MCP server on Unikraft Cloud: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 1. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/mcp-server-simple/` directory: diff --git a/pages/guides/memcached1.6.mdx b/pages/guides/memcached1.6.mdx index 9df47911..49de7a42 100644 --- a/pages/guides/memcached1.6.mdx +++ b/pages/guides/memcached1.6.mdx @@ -18,10 +18,9 @@ To run it, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/memcached1.6/` directory: diff --git a/pages/guides/minio.mdx b/pages/guides/minio.mdx index 7b6b998d..674beefb 100644 --- a/pages/guides/minio.mdx +++ b/pages/guides/minio.mdx @@ -18,10 +18,9 @@ To run it, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/minio/` directory: diff --git a/pages/guides/mongodb.mdx b/pages/guides/mongodb.mdx index 7e3bc5bf..61467144 100644 --- a/pages/guides/mongodb.mdx +++ b/pages/guides/mongodb.mdx @@ -17,10 +17,9 @@ To run it, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/mongodb/` directory: diff --git a/pages/guides/nginx-flask-mongo.mdx b/pages/guides/nginx-flask-mongo.mdx new file mode 100644 index 00000000..174ef088 --- /dev/null +++ b/pages/guides/nginx-flask-mongo.mdx @@ -0,0 +1,381 @@ +--- +title: "Flask with MongoDB" +--- + +import { Tabs, TabsContent, TabsList, TabsTrigger } from "zudoku/ui/Tabs" + +{/* vale off */} +{/* THIS FILE WAS AUTOGENERATED FROM THE PUBLIC EXAMPLE REPOSITORY. DO NOT EDIT THIS FILE DIRECTLY. */} + + +[Flask](https://flask.palletsprojects.com/en/stable/) is a lightweight WSGI web application framework in Python, and [MongoDB](https://www.mongodb.com/) is a NoSQL database that stores data in JSON-like documents. +This example deploys three services on Unikraft Cloud: Nginx (reverse proxy), Flask (backend), and MongoDB (database). + +**Credits**: This example is based on this [Awesome Compose example](https://github.com/docker/awesome-compose/tree/master/nginx-flask-mongo). + +## Deployment + +To run this example, follow these steps: + +1. Install the CLI. + Use the [unikraft CLI](/cli/unikraft) or the legacy [kraft CLI](https://unikraft.org/docs/cli/install). + You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). + Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). + + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. + +2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/nginx-flask-mongo` directory: + +```bash +git clone https://github.com/unikraft-cloud/examples +cd examples/nginx-flask-mongo/ +``` + +Make sure to log into Unikraft Cloud and pick a [metro](/platform/metros) close to you. +This guide uses `fra` (Frankfurt, 🇩🇪): + + + +```bash title="unikraft" +unikraft login +``` + +```bash title="kraft" +# Set Unikraft Cloud access token +export UKC_TOKEN=token +# Set metro to Frankfurt, DE +export UKC_METRO=fra +``` + + + +## Create the volume + +Create a volume for MongoDB data persistence: + + + +```bash title="unikraft" +unikraft volume create --metro=fra --name=mongo-data --size=1G +``` + +```bash title="kraft" +kraft cloud volume create --name mongo-data --size 1Gi +``` + + + +The output shows the volume details: + + + +```text title="unikraft" +metro: fra +name: mongo-data +uuid: 9c7723f3-7e1f-4e06-afe6-c811240faf5a +state: available +size: 1GiB +filesystem: ext4 +quota-policy: static +persistent: true +timestamps: + created: just now +``` + +```ansi title="kraft" +NAME CREATED AT SIZE ATTACHED TO MOUNTED BY STATE PERSISTENT +mongo-data now 1.0 GiB available true +``` + + + +## Deploy MongoDB + +First, deploy the MongoDB instance. +MongoDB is an internal service (not publicly accessible), reached via the `mongo.internal` domain: + + + +```bash title="unikraft" +unikraft build ./mongo --output /mongo:latest +unikraft run --scale-to-zero policy=idle,cooldown-time=1000,stateful=true --metro fra -m 1024M --image /mongo:latest --domain mongo.internal --volume mongo-data:/data/db +``` + +```bash title="kraft" +kraft cloud deploy --scale-to-zero idle --scale-to-zero-stateful --scale-to-zero-cooldown 1s -M 1024Mi --domain mongo.internal --volume mongo-data:/data/db ./mongo +``` + + + +The output shows the MongoDB instance details: + + + +```text title="unikraft" +metro: fra +name: mongo-o3qhq +uuid: 90158c53-6654-4e73-bad1-1d6ab4452001 +state: starting +image: /mongo +resources: + memory: 1GiB + vcpus: 1 +service: + name: restless-glade-l8pu2mf0 + uuid: 77a04441-2479-433a-b468-32f23e475f58 + domains: + - fqdn: mongo.internal +volumes: +- name: mongo-data + uuid: 9c7723f3-7e1f-4e06-afe6-c811240faf5a + at: /data/db +networks: +- uuid: 4f891227-d381-42f4-88a4-25a97b95a9e3 + private-ip: 10.0.15.21 + mac: 12:b0:0a:00:0f:15 +timestamps: + created: just now +scale-to-zero: + enabled: true + policy: idle + stateful: true + cooldown-time: 1s +``` + +```ansi title="kraft" +[●] Deployed successfully! + │ + ├───────── name: mongo-hwoaz + ├───────── uuid: 56d43696-af3e-4ccb-aa81-9ae872b7bf43 + ├──────── metro: https://api.fra.unikraft.cloud/v1 + ├──────── state: starting + ├─────── domain: mongo.internal + ├──────── image: oci://unikraft.io//mongo@sha256:68894454735e0e5b07d61aad19b1c03355f415ec33c050daeaa419d931962657 + ├─────── memory: 1024 MiB + ├────── service: shy-field-y89vrq32 + ├─ private fqdn: mongo-hwoaz.internal + └─── private ip: 10.0.0.29 +``` + + + +## Deploy Flask + +Next, deploy the Flask backend. +It connects to MongoDB using the `MONGO_SERVER_URL` environment variable and is reached internally via `backend.internal`: + + + +```bash title="unikraft" +unikraft build ./flask --output /flask:latest +unikraft run --scale-to-zero policy=on,cooldown-time=1000 --metro fra -m 1024M --image /flask:latest --domain backend.internal --env FLASK_SERVER_PORT=9091 --env MONGO_SERVER_URL=mongo.internal:27017 +``` + +```bash title="kraft" +kraft cloud deploy --scale-to-zero on --scale-to-zero-cooldown 1s -M 1024Mi --domain backend.internal --env FLASK_SERVER_PORT=9091 --env MONGO_SERVER_URL=mongo.internal:27017 ./flask +``` + + + +The output shows the Flask instance details: + + + +```text title="unikraft" +metro: fra +name: flask-9a68z +uuid: bb6d91f7-0714-45e5-b14a-ec82a5dac36e +state: starting +image: /flask +runtime: + env: + FLASK_SERVER_PORT: 9091 + MONGO_SERVER_URL: mongo.internal:27017 +resources: + memory: 1GiB + vcpus: 1 +service: + name: broken-bird-8isa6q21 + uuid: cd9fe757-784a-49d4-8936-1b6859b3a72d + domains: + - fqdn: backend.internal +networks: +- uuid: 2da7f679-7067-4fb5-908b-853607d383f2 + private-ip: 10.0.17.97 + mac: 12:b0:0a:00:11:61 +timestamps: + created: just now +scale-to-zero: + enabled: true + policy: on + cooldown-time: 1s +``` + +```ansi title="kraft" +[●] Deployed successfully! + │ + ├───────── name: flask-1xnsj + ├───────── uuid: edc8e61d-ef6c-4c05-9de3-6983539a47d2 + ├──────── metro: https://api.fra.unikraft.cloud/v1 + ├──────── state: starting + ├─────── domain: backend.internal + ├──────── image: oci://unikraft.io//flask@sha256:f23b3368cd777acae68ad8f35713a4cf55f901d6c266017bf6f0679ffc7a8172 + ├─────── memory: 1024 MiB + ├────── service: falling-mountain-pcx804jx + ├─ private fqdn: flask-1xnsj.internal + └─── private ip: 10.0.0.17 +``` + + + +## Deploy Nginx + +Finally, deploy Nginx as the public-facing reverse proxy. +It forwards requests to the Flask backend at `backend.internal:9091`: + + + +```bash title="unikraft" +unikraft build ./nginx --output /nginx:latest +unikraft run --scale-to-zero policy=on,cooldown-time=1000 --metro fra -p 443:80/tls+http -m 512M --image /nginx:latest +``` + +```bash title="kraft" +kraft cloud deploy --scale-to-zero on --scale-to-zero-cooldown 1s -p 443:80/tls+http -M 512Mi ./nginx +``` + + + +The output shows the Nginx instance details including its public FQDN: + + + +```text title="unikraft" +metro: fra +name: nginx-jnpwi +uuid: 57f64e99-bd06-46fd-98f4-26b64751623e +state: starting +image: /nginx +resources: + memory: 512MiB + vcpus: 1 +service: + name: snowy-river-gotjeojl + uuid: 287ee3b8-43bc-47d1-a88e-4d6c72d2d682 + domains: + - fqdn: snowy-river-gotjeojl.fra.unikraft.app +networks: +- uuid: 107e4a03-e285-4d1d-84cb-24f86d7af875 + private-ip: 10.0.14.201 + mac: 12:b0:0a:00:0e:c9 +timestamps: + created: just now +scale-to-zero: + enabled: true + policy: on + cooldown-time: 1s +``` + +```ansi title="kraft" +[●] Deployed successfully! + │ + ├───────── name: nginx-psndr + ├───────── uuid: 5ca29c9b-24de-4fa7-800e-a13175a909b1 + ├──────── metro: https://api.fra.unikraft.cloud/v1 + ├──────── state: starting + ├─────── domain: https://nameless-shadow-f7ywg1l4.fra.unikraft.app + ├──────── image: oci://unikraft.io//nginx@sha256:8cff54392eeead80bafe33538866b04bfd076f2052d65cb3751a938a22368bc0 + ├─────── memory: 512 MiB + ├────── service: nameless-shadow-f7ywg1l4 + ├─ private fqdn: nginx-psndr.internal + └─── private ip: 10.0.0.1 +``` + + + +You can list all deployed instances with: + + + +```bash title="unikraft" +unikraft instances list +``` + +```text title="unikraft" +METRO NAME STATE IMAGE MEMORY VCPUS FQDN CREATED +fra nginx-jnpwi standby /nginx 512MiB 1 snowy-river-gotjeojl.fra.unikraft.app 11 minutes ago +fra flask-9a68z standby /flask 1GiB 1 backend.internal 12 minutes ago +fra mongo-o3qhq standby /mongo 1GiB 1 mongo.internal 14 minutes ago +``` + +```bash title="kraft" +kraft cloud instance list +``` + +```ansi title="kraft" +NAME FQDN STATE STATUS IMAGE MEMORY VCPUS ARGS BOOT TIME +nginx-psndr nameless-shadow-f7ywg1l4.fra.unikraft.app standby standby oci://unikraft.io//nginx@sha256:... 512 MiB 1 83.87 ms +flask-1xnsj backend.internal running since 2mins oci://unikraft.io//flask@sha256:... 1.0 GiB 1 1916.54 ms +mongo-hwoaz mongo.internal running since 5mins oci://unikraft.io//mongo@sha256:... 1.0 GiB 1 2776.86 ms +``` + + + +## Test the deployment + +The FQDN of the Nginx instance can be found in the `FQDN` column of the `unikraft instances list` output above. +Use `curl` to query it (replace with your actual FQDN): + +```bash +curl https:// +``` + +```text +Hello from the MongoDB client! +``` + +## Clean up + +When done, remove the instances and volume: + + + +```bash title="unikraft" +unikraft instances delete mongo-o3qhq flask-9a68z nginx-jnpwi +unikraft volume delete mongo-data +``` + +```bash title="kraft" +kraft cloud instance remove mongo-hwoaz flask-1xnsj nginx-psndr +kraft cloud volume remove mongo-data +``` + + + +## Learn more + +Use the `--help` option for detailed information on using Unikraft Cloud: + + + +```bash title="unikraft" +unikraft --help +``` + +```bash title="kraft" +kraft cloud --help +``` + + + +Or visit the [CLI Reference](/cli/unikraft) or the [legacy CLI Reference](/cli/kraft/overview). + +- [Flask Documentation](https://flask.palletsprojects.com/en/stable/) +- [MongoDB Documentation](https://www.mongodb.com/docs/) +- [Nginx Documentation](https://nginx.org/en/docs/) +- [Awesome Compose](https://github.com/docker/awesome-compose) +- [Unikraft Cloud's Documentation](https://unikraft.cloud/docs/) +- [Building `Dockerfile` Images with `Buildkit`](https://unikraft.org/guides/building-dockerfile-images-with-buildkit) +{/* vale on */} diff --git a/pages/guides/nginx.mdx b/pages/guides/nginx.mdx index b6dafe1e..a3ee7d4f 100644 --- a/pages/guides/nginx.mdx +++ b/pages/guides/nginx.mdx @@ -18,10 +18,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/nginx/` directory: diff --git a/pages/guides/node-playwright-chromium.mdx b/pages/guides/node-playwright-chromium.mdx index e18ec561..8f79f4a9 100644 --- a/pages/guides/node-playwright-chromium.mdx +++ b/pages/guides/node-playwright-chromium.mdx @@ -17,10 +17,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/node-playwright-chromium/` directory: diff --git a/pages/guides/node-playwright-firefox.mdx b/pages/guides/node-playwright-firefox.mdx index 9d1ffd0a..30babd74 100644 --- a/pages/guides/node-playwright-firefox.mdx +++ b/pages/guides/node-playwright-firefox.mdx @@ -17,10 +17,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/node-playwright-firefox/` directory: diff --git a/pages/guides/node-playwright-webkit.mdx b/pages/guides/node-playwright-webkit.mdx index 0cc74003..8e65a026 100644 --- a/pages/guides/node-playwright-webkit.mdx +++ b/pages/guides/node-playwright-webkit.mdx @@ -17,10 +17,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/node-playwright-webkit/` directory: diff --git a/pages/guides/node18-agario.mdx b/pages/guides/node18-agario.mdx index fddd7b64..c9ca36e4 100644 --- a/pages/guides/node18-agario.mdx +++ b/pages/guides/node18-agario.mdx @@ -18,10 +18,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/node18-agario/` directory: diff --git a/pages/guides/node18-wingsio.mdx b/pages/guides/node18-wingsio.mdx index 1ec38e98..9296716f 100644 --- a/pages/guides/node18-wingsio.mdx +++ b/pages/guides/node18-wingsio.mdx @@ -18,10 +18,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/node18-wingsio/` directory: diff --git a/pages/guides/node21-websocket.mdx b/pages/guides/node21-websocket.mdx index cac2444a..67ff29a1 100644 --- a/pages/guides/node21-websocket.mdx +++ b/pages/guides/node21-websocket.mdx @@ -18,10 +18,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/node21-websocket/` directory: diff --git a/pages/guides/node24-karaoke.mdx b/pages/guides/node24-karaoke.mdx index d79b6108..7b9f9d09 100644 --- a/pages/guides/node24-karaoke.mdx +++ b/pages/guides/node24-karaoke.mdx @@ -17,10 +17,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/node24-karaoke` directory: diff --git a/pages/guides/novnc-browser.mdx b/pages/guides/novnc-browser.mdx index 77dc3d6d..20839a10 100644 --- a/pages/guides/novnc-browser.mdx +++ b/pages/guides/novnc-browser.mdx @@ -20,10 +20,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/novnc-browser` directory: diff --git a/pages/guides/opentelemetry-collector.mdx b/pages/guides/opentelemetry-collector.mdx index 6a4a8c57..ea605435 100644 --- a/pages/guides/opentelemetry-collector.mdx +++ b/pages/guides/opentelemetry-collector.mdx @@ -19,10 +19,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/opentelemetry-collector/` directory: diff --git a/pages/guides/phoenix-postgres.mdx b/pages/guides/phoenix-postgres.mdx new file mode 100644 index 00000000..64eaf875 --- /dev/null +++ b/pages/guides/phoenix-postgres.mdx @@ -0,0 +1,327 @@ +--- +title: "Phoenix with PostgreSQL" +--- + +import { Tabs, TabsContent, TabsList, TabsTrigger } from "zudoku/ui/Tabs" + +{/* vale off */} +{/* THIS FILE WAS AUTOGENERATED FROM THE PUBLIC EXAMPLE REPOSITORY. DO NOT EDIT THIS FILE DIRECTLY. */} + + +[Phoenix](https://phoenixframework.org/) is a web development framework written in Elixir, designed for building scalable and maintainable applications. This example demonstrates how to deploy a Phoenix application with a PostgreSQL database on [Unikraft Cloud](https://unikraft.cloud/). + +This example app has been generated using [Phoenix Express](https://hexdocs.pm/phoenix/up_and_running.html#phoenix-express), and the Dockerfile +used for building the rootfs was generated following the instructions [here](https://hexdocs.pm/phoenix/releases.html). + +To run this example, follow these steps: + +1. Install the CLI. + Use the [unikraft CLI](/cli/unikraft) or the legacy [kraft CLI](https://unikraft.org/docs/cli/install). + You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). + Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). + + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. + +2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/phoenix-postgres` directory: + +```bash +git clone https://github.com/unikraft-cloud/examples +cd examples/phoenix-postgres/ +``` + +Make sure to log into Unikraft Cloud and pick a [metro](/platform/metros) close to you. +This guide uses `fra` (Frankfurt, 🇩🇪): + + + +```bash title="unikraft" +unikraft login +``` + +```bash title="kraft" +# Set Unikraft Cloud access token +export UKC_TOKEN=token +# Set metro to Frankfurt, DE +export UKC_METRO=fra +``` + + + +Create a volume for PostgreSQL data persistence: + + + +```bash title="unikraft" +unikraft volume create --metro fra --name db-data --size 512M +``` + +```bash title="kraft" +kraft cloud volume create --name db-data --size 512 +``` + + + + + +```ansi title="unikraft" +metro: fra +name: db-data +uuid: 0efda5f6-21d2-48c7-84f5-8efe87e33090 +state: available +size: 512MiB +filesystem: ext4 +quota-policy: static +persistent: true +timestamps: + created: just now +``` + +```ansi title="kraft" +[+] Created volume 'db-data' (512 MiB) +``` + + + +## Build and deploy the PostgreSQL instance. + +Update `POSTGRES_PASSWORD` with a secure password: + + + +```bash title="unikraft" +unikraft build ./postgres --output /postgres:latest +unikraft run --scale-to-zero policy=idle,cooldown-time=1000,stateful=true --metro fra -m 2G --volume db-data:/var/lib/postgresql/data --image /postgres:latest --domain postgres.internal --env POSTGRES_USER=postgres --env POSTGRES_PASSWORD=example_123 --env POSTGRES_DB=myapp_prod --env PGDATA=/var/lib/postgresql/data/pgdata +``` + +```bash title="kraft" +kraft cloud deploy --scale-to-zero idle --scale-to-zero-stateful --scale-to-zero-cooldown 1s -M 2Gi --volume db-data:/var/lib/postgresql/data --domain postgres.internal --env POSTGRES_USER=postgres --env POSTGRES_PASSWORD=example_123 --env POSTGRES_DB=myapp_prod --env PGDATA=/var/lib/postgresql/data/pgdata postgres/ +``` + + + +Make sure to replace `` with your username / org-name. + +The output shows the PostgreSQL instance details: + + + +```ansi title="unikraft" +metro: fra +name: postgres-ik5at +uuid: 3776dbfe-2937-45e7-8079-c54275ef3cff +state: starting +image: /postgres +runtime: + env: + PGDATA: /var/lib/postgresql/data/pgdata + POSTGRES_DB: myapp_prod + POSTGRES_PASSWORD: * + POSTGRES_USER: postgres +resources: + memory: 2GiB + vcpus: 1 +service: + name: dry-cloud-q8u7yjkl + uuid: cf364e60-46b0-4031-bace-296fa8e24ac4 + domains: + - fqdn: postgres.internal +volumes: +- name: db-data + uuid: 0efda5f6-21d2-48c7-84f5-8efe87e33090 + at: /var/lib/postgresql/data +networks: +- uuid: cab79d9f-08a8-4741-8efd-58d9a1faa35d + private-ip: 10.0.14.117 + mac: 12:b0:0a:00:0e:75 +timestamps: + created: just now +scale-to-zero: + enabled: true + policy: idle + stateful: true + cooldown-time: 1s +``` + +```ansi title="kraft" +[●] Deployed successfully! + │ + ├───────── name: postgres-ik5at + ├───────── uuid: 3776dbfe-2937-45e7-8079-c54275ef3cff + ├──────── metro: https://api.fra.unikraft.cloud/v1 + ├──────── state: starting + ├─────── domain: postgres.internal + ├──────── image: oci://unikraft.io//postgres@sha256:... + ├─────── memory: 2048 MiB + ├────── service: dry-cloud-q8u7yjkl + ├─ private fqdn: postgres-ik5at.internal + └─── private ip: 10.0.14.117 +``` + + + +## Build and deploy the Phoenix instance. + +Generate a secret key for Phoenix: + +```bash +openssl rand -base64 48 +``` + +Replace `` in the commands below with the generated value, and update the password in `DATABASE_URL` to match the one set for PostgreSQL: + + + +```bash title="unikraft" +unikraft build ./phoenix --output /phoenix:latest +unikraft run --scale-to-zero policy=on,cooldown-time=1000 --metro fra -p 443:4000/tls+http -m 2G --image /phoenix:latest --env SECRET_KEY_BASE= --env DATABASE_URL=ecto://postgres:example_123@postgres.internal:5432/myapp_prod +``` + +```bash title="kraft" +kraft cloud deploy --scale-to-zero on --scale-to-zero-cooldown 1s -p 443:4000/tls+http -M 2Gi --env SECRET_KEY_BASE= --env DATABASE_URL=ecto://postgres:example_123@postgres.internal:5432/myapp_prod phoenix/ +``` + + + +The output shows the instance address and other details: + + + +```ansi title="unikraft" +metro: fra +name: phoenix-hd29m +uuid: fa4db9cf-f7b5-4b8b-b007-8fd1ce87c7e1 +state: starting +image: /phoenix +runtime: + env: + DATABASE_URL: ecto://postgres:example_123@postgres.internal:5432/myapp_prod + SECRET_KEY_BASE: +resources: + memory: 2GiB + vcpus: 1 +service: + name: wild-moon-pkwsqc49 + uuid: 1d1b8732-d2d5-41ab-ab8f-1b19fc27c14d + domains: + - fqdn: wild-moon-pkwsqc49.fra.unikraft.app +networks: +- uuid: d14f07de-1c81-4309-bbf3-ab8ab6aeefe6 + private-ip: 10.0.14.53 + mac: 12:b0:0a:00:0e:35 +timestamps: + created: just now +scale-to-zero: + enabled: true + policy: on + cooldown-time: 1s +``` + +```ansi title="kraft" +[●] Deployed successfully! + │ + ├───────── name: phoenix-hd29m + ├───────── uuid: fa4db9cf-f7b5-4b8b-b007-8fd1ce87c7e1 + ├──────── metro: https://api.fra.unikraft.cloud/v1 + ├──────── state: starting + ├─────── domain: https://wild-moon-pkwsqc49.fra.unikraft.app + ├──────── image: oci://unikraft.io//phoenix@sha256:... + ├─────── memory: 2048 MiB + ├────── service: wild-moon-pkwsqc49 + ├─ private fqdn: phoenix-hd29m.internal + └─── private ip: 10.0.14.53 +``` + + + +In this case, the instance names are `postgres-ik5at` and `phoenix-hd29m`. +They're different for each run. + +Use a browser to access the Phoenix application using the URL from the `fqdn` field in the output. + +You can list information about the instances by running: + + + +```bash title="unikraft" +unikraft instances list +``` + +```bash title="kraft" +kraft cloud instance list +``` + + + + + +```ansi title="unikraft" +METRO NAME STATE IMAGE MEMORY VCPUS FQDN CREATED +fra phoenix-hd29m running /phoenix 2GiB 1 wild-moon-pkwsqc49.fra.unikraft.app just now +fra postgres-ik5at standby /postgres 2GiB 1 postgres.internal 3 minutes ago +``` + +```ansi title="kraft" +NAME FQDN STATE STATUS IMAGE MEMORY VCPUS ARGS BOOT TIME +phoenix-hd29m wild-moon-pkwsqc49.fra.unikraft.app running since now oci://unikraft.io//phoenix@sha256:... 2048 MiB 1 158.32 ms +postgres-ik5at postgres.internal standby since 3min oci://unikraft.io//postgres@sha256:... 2048 MiB 1 1811.99 ms +``` + + + +When done, you can remove the instances: + + + +```bash title="unikraft" +unikraft instances delete postgres-ik5at phoenix-hd29m +``` + +```bash title="kraft" +kraft cloud instance remove postgres-ik5at phoenix-hd29m +``` + + + +## Volume + +This deployment creates a volume (`db-data`) for PostgreSQL data persistence. +The volume persists after removing instances, allowing you to redeploy without losing data. +To remove the volume: + + + +```bash title="unikraft" +unikraft volume delete db-data +``` + +```bash title="kraft" +kraft cloud volume remove db-data +``` + + + +## Learn more + +- [Phoenix's Documentation](https://hexdocs.pm/phoenix/) +- [PostgreSQL's Documentation](https://www.postgresql.org/docs/) +- [Unikraft Cloud's Documentation](https://unikraft.cloud/docs/) +- [Building `Dockerfile` Images with `Buildkit`](https://unikraft.org/guides/building-dockerfile-images-with-buildkit) + +Use the `--help` option for detailed information on using Unikraft Cloud: + + + +```bash title="unikraft" +unikraft --help +``` + +```bash title="kraft" +kraft cloud --help +``` + + + +Or visit the [CLI Reference](/cli/unikraft) or the [legacy CLI Reference](/cli/kraft/overview). +{/* vale on */} diff --git a/pages/guides/postgres.mdx b/pages/guides/postgres.mdx index 677b2753..1896b77b 100644 --- a/pages/guides/postgres.mdx +++ b/pages/guides/postgres.mdx @@ -17,10 +17,9 @@ To run it, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/postgres/` directory: diff --git a/pages/guides/python-playwright-chromium.mdx b/pages/guides/python-playwright-chromium.mdx index 939632f8..93de9e9e 100644 --- a/pages/guides/python-playwright-chromium.mdx +++ b/pages/guides/python-playwright-chromium.mdx @@ -17,10 +17,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/python-playwright-chromium/` directory: diff --git a/pages/guides/redis7.2.mdx b/pages/guides/redis7.2.mdx index a218fe94..a11916f7 100644 --- a/pages/guides/redis7.2.mdx +++ b/pages/guides/redis7.2.mdx @@ -17,10 +17,9 @@ To run it, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/redis7.2/` directory: diff --git a/pages/guides/ruby3.2-rails.mdx b/pages/guides/ruby3.2-rails.mdx index 32554df6..6fdfa5fb 100644 --- a/pages/guides/ruby3.2-rails.mdx +++ b/pages/guides/ruby3.2-rails.mdx @@ -16,10 +16,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/ruby3.2-rails/` directory: diff --git a/pages/guides/skipper0.18.mdx b/pages/guides/skipper0.18.mdx index 2f62b833..f966e651 100644 --- a/pages/guides/skipper0.18.mdx +++ b/pages/guides/skipper0.18.mdx @@ -17,10 +17,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/skipper0.18/` directory: diff --git a/pages/guides/spin-wagi-http.mdx b/pages/guides/spin-wagi-http.mdx index 14b24851..ab8d1c55 100644 --- a/pages/guides/spin-wagi-http.mdx +++ b/pages/guides/spin-wagi-http.mdx @@ -19,10 +19,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/spin-wagi-http/` directory: diff --git a/pages/guides/traefik.mdx b/pages/guides/traefik.mdx index f117b26e..b35152dd 100644 --- a/pages/guides/traefik.mdx +++ b/pages/guides/traefik.mdx @@ -16,10 +16,9 @@ To run it, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/traefik/` directory: diff --git a/pages/guides/tyk.mdx b/pages/guides/tyk.mdx new file mode 100644 index 00000000..fd6c340a --- /dev/null +++ b/pages/guides/tyk.mdx @@ -0,0 +1,257 @@ +--- +title: "Tyk" +--- + +import { Tabs, TabsContent, TabsList, TabsTrigger } from "zudoku/ui/Tabs" + +{/* vale off */} +{/* THIS FILE WAS AUTOGENERATED FROM THE PUBLIC EXAMPLE REPOSITORY. DO NOT EDIT THIS FILE DIRECTLY. */} + + +This example uses [`Tyk`](https://tyk.io/), an API gateway and management platform. +Tyk is used together with Redis to store API tokens and OAuth clients. + +To run this example, follow these steps: + +1. Install the CLI. + Use the [unikraft CLI](/cli/unikraft) or the legacy [kraft CLI](https://unikraft.org/docs/cli/install). + You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). + Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). + + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. + +2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/tyk/` directory: + +```bash +git clone https://github.com/unikraft-cloud/examples +cd examples/tyk/ +``` + +Make sure to log into Unikraft Cloud and pick a [metro](/platform/metros) close to you. +This guide uses `fra` (Frankfurt, 🇩🇪): + + + +```bash title="unikraft" +unikraft login +``` + +```bash title="kraft" +# Set Unikraft Cloud access token +export UKC_TOKEN=token +# Set metro to Frankfurt, DE +export UKC_METRO=fra +``` + + + +## Build and deploy the Redis instance (used internally by Tyk): + +The `REDIS_PASSWORD` environment variable sets the Redis `requirepass` directive. +If not provided, it defaults to `unikraft`. + +```bash title="unikraft" +unikraft build ./redis --output /redis:latest +unikraft run --scale-to-zero policy=idle,cooldown-time=1000,stateful=true --metro fra -m 256M --image /redis:latest --domain tyk-redis.internal -e REDIS_PASSWORD=unikraft +``` + +Make sure to replace `` with your username / org-name in the unikraft CLI commands above. + +The output shows the Redis instance details: + +```ansi title="unikraft" +metro: fra +name: redis-6vgvc +uuid: 63b86d17-06ca-4f95-b921-56e5b3245554 +state: starting +image: /redis +resources: + memory: 256MiB + vcpus: 1 +service: + name: snowy-water-wivk1i4r + uuid: 6612de91-d639-4b5a-95d1-b7ae6e91e3c1 + domains: + - fqdn: tyk-redis.internal +networks: +- uuid: 19e4b80a-9501-448d-99a6-ec3f7b90805e + private-ip: 10.0.0.29 + mac: 12:b0:0a:00:01:49 +timestamps: + created: just now +scale-to-zero: + enabled: true + policy: idle + stateful: true + cooldown-time: 1s +``` + +or + +```bash title="kraft" +kraft cloud deploy --scale-to-zero idle --scale-to-zero-stateful --scale-to-zero-cooldown 1s -M 256Mi --domain tyk-redis.internal --env REDIS_PASSWORD=unikraft ./redis/ +``` + +The output shows the Redis instance details: + +```ansi title="kraft" +[●] Deployed successfully! + │ + ├───────── name: redis-6vgvc + ├───────── uuid: 63b86d17-06ca-4f95-b921-56e5b3245554 + ├──────── metro: https://api.fra.unikraft.cloud/v1 + ├──────── state: starting + ├─────── domain: tyk-redis.internal + ├──────── image: oci://unikraft.io//redis@sha256:933b8b7714924eb2de880e0f32792698b14a13c83d5aee0f52dddcab5c97099d + ├─────── memory: 256 MiB + ├────── service: snowy-water-wivk1i4r + ├─ private fqdn: redis-6vgvc.internal + └─── private ip: 10.0.0.29 +``` + +## Build and deploy the Tyk instance: + +```bash title="unikraft" +unikraft build ./tyk --output /tyk:latest +unikraft run --scale-to-zero policy=on,cooldown-time=1000 --metro fra -p 443:8080/tls+http -m 256M --image /tyk:latest +``` + +Make sure to replace `` with your username / org-name in the unikraft CLI commands above. + +The output shows the Tyk instance details: + +```ansi title="unikraft" +metro: fra +name: tyk-s9ixd +uuid: 4e8a5e56-2d0b-4ca4-88b4-aa816129a66d +state: starting +image: /tyk +resources: + memory: 256MiB + vcpus: 1 +service: + name: icy-haze-8ph4u8cz + uuid: 89079646-353a-4a19-99ac-5498c7d626ad + domains: + - fqdn: icy-haze-8ph4u8cz.fra.unikraft.app +networks: +- uuid: 8085804f-0fe0-4847-ad6e-8518edba126e + private-ip: 10.0.0.1 + mac: 12:b0:0a:00:0e:b1 +timestamps: + created: just now +``` + +or + +```bash title="kraft" +kraft cloud deploy --scale-to-zero on --scale-to-zero-cooldown 1s -p 443:8080/tls+http -M 256Mi ./tyk/ +``` + +The output shows the Tyk instance details: + +```ansi title="kraft" +[●] Deployed successfully! + │ + ├───────── name: tyk-s9ixd + ├───────── uuid: 4e8a5e56-2d0b-4ca4-88b4-aa816129a66d + ├──────── metro: https://api.fra.unikraft.cloud/v1 + ├──────── state: starting + ├─────── domain: https://icy-haze-8ph4u8cz.fra.unikraft.app + ├──────── image: oci://unikraft.io//tyk@sha256:4954033ada90f980f279e5d825dd7971111a429578ce38be764893ba0d1f358d + ├─────── memory: 256 MiB + ├────── service: icy-haze-8ph4u8cz + ├─ private fqdn: tyk-s9ixd.internal + └─── private ip: 10.0.0.1 +``` + +In this case, the instance names are `redis-6vgvc` and `tyk-s9ixd`, and the Tyk address is `https://icy-haze-8ph4u8cz.fra.unikraft.app`. +They're different for each run. + +Use `curl` to query the Tyk instance on Unikraft Cloud: + +```bash +curl https://icy-haze-8ph4u8cz.fra.unikraft.app/hello +``` + +```text +{"status":"pass","version":"v5.3.0-dev","description":"Tyk GW","details":{"redis":{"status":"pass","componentType":"datastore","time":"2026-05-25T12:26:07Z"}}} +``` + +You can list information about the instances by running: + + + +```bash title="unikraft" +unikraft instances list +``` + +```bash title="kraft" +kraft cloud instance list +``` + + + + + +```ansi title="unikraft" +METRO NAME STATE IMAGE MEMORY VCPUS FQDN CREATED +fra tyk-s9ixd standby /tyk 256MiB 1 icy-haze-8ph4u8cz.fra.unikraft.app just now +fra redis-6vgvc running /redis 256MiB 1 tyk-redis.internal 1 minute ago +``` + +```ansi title="kraft" +NAME FQDN STATE STATUS IMAGE MEMORY VCPUS ARGS BOOT TIME +tyk-s9ixd icy-haze-8ph4u8cz.fra.unikraft.app standby standby oci://unikraft.io//tyk@sha256:4954033... 256 MiB 1 158.32 ms +redis-6vgvc tyk-redis.internal running since 1min oci://unikraft.io//redis@sha256:933b8... 256 MiB 1 1811.99 ms +``` + + + +When done, you can remove the instances: + + + +```bash title="unikraft" +unikraft instances delete redis-6vgvc tyk-s9ixd +``` + +```bash title="kraft" +kraft cloud instance remove redis-6vgvc tyk-s9ixd +``` + + + +## Customize your app + +To customize the Tyk app, you can update: + +* `Kraftfile`: the Unikraft Cloud specification +* `Dockerfile` / `rootfs/`: the Tyk filesystem (in this case the configuration file `/etc/tyk.conf`) + +It's unlikely you will have to update the `Kraftfile` specification. + +Update the contents of the `rootfs/etc/tyk.conf` file for a different configuration. + +You can also update the `Dockerfile` in order to extend the Tyk filesystem with extra data files or configuration files. + +## Learn more + +Use the `--help` option for detailed information on using Unikraft Cloud: + + + +```bash title="unikraft" +unikraft --help +``` + +```bash title="kraft" +kraft cloud --help +``` + + + +Or visit the [CLI Reference](/cli/unikraft) or the [legacy CLI Reference](/cli/kraft/overview). +{/* vale on */} diff --git a/pages/guides/visual-studio-code-server.mdx b/pages/guides/visual-studio-code-server.mdx index 518bd44e..07c4512b 100644 --- a/pages/guides/visual-studio-code-server.mdx +++ b/pages/guides/visual-studio-code-server.mdx @@ -20,10 +20,9 @@ To run it, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/visual-studio-code-server` directory: diff --git a/pages/guides/vsftpd.mdx b/pages/guides/vsftpd.mdx index a0b42e1e..72df384a 100644 --- a/pages/guides/vsftpd.mdx +++ b/pages/guides/vsftpd.mdx @@ -16,10 +16,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/vsftpd` directory: diff --git a/pages/guides/wazero-import-go.mdx b/pages/guides/wazero-import-go.mdx index f46c6ac9..d1e08819 100644 --- a/pages/guides/wazero-import-go.mdx +++ b/pages/guides/wazero-import-go.mdx @@ -18,10 +18,9 @@ To run this example, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/wazero-import-go/` directory: diff --git a/pages/guides/wordpress-all-in-one.mdx b/pages/guides/wordpress-all-in-one.mdx index bbea8ef4..6d4db1fc 100644 --- a/pages/guides/wordpress-all-in-one.mdx +++ b/pages/guides/wordpress-all-in-one.mdx @@ -17,10 +17,9 @@ To run it, follow these steps: You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). -:::note -The unikraft CLI is the current standard, while kraft is the legacy version. -Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. -::: + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. 2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/wordpress-all-in-one/` directory: diff --git a/pages/guides/wordpress.mdx b/pages/guides/wordpress.mdx new file mode 100644 index 00000000..77fa648d --- /dev/null +++ b/pages/guides/wordpress.mdx @@ -0,0 +1,322 @@ +--- +title: "Wordpress with Nginx and MariaDB" +--- + +import { Tabs, TabsContent, TabsList, TabsTrigger } from "zudoku/ui/Tabs" + +{/* vale off */} +{/* THIS FILE WAS AUTOGENERATED FROM THE PUBLIC EXAMPLE REPOSITORY. DO NOT EDIT THIS FILE DIRECTLY. */} + + +This guide explains how to create and deploy a Wordpress app with Nginx and MariaDB. +To run this example, follow these steps: + +1. Install the CLI. + Use the [unikraft CLI](/cli/unikraft) or the legacy [kraft CLI](https://unikraft.org/docs/cli/install). + You need a [BuildKit](https://github.com/moby/buildkit) builder. The easiest way to get one is via [Docker](https://docs.docker.com/engine/install/). + Alternatively, you can also directly set up and use BuildKit, see the [quick start](https://github.com/moby/buildkit#quick-start). + + > **Note**: + > The unikraft CLI is the current standard, while kraft is the legacy version. + > Choose one of the CLIs below and only run the commands associated with it for the rest of this guide. + +2. Clone the [`examples` repository](https://github.com/unikraft-cloud/examples) and `cd` into the `examples/wordpress` directory: + +```bash +git clone https://github.com/unikraft-cloud/examples +cd examples/wordpress/ +``` + +Make sure to log into Unikraft Cloud and pick a [metro](/platform/metros) close to you. +This guide uses `fra` (Frankfurt, 🇩🇪): + + + +```bash title="unikraft" +unikraft login +``` + +```bash title="kraft" +# Set Unikraft Cloud access token +export UKC_TOKEN=token +# Set metro to Frankfurt, DE +export UKC_METRO=fra +``` + + + +## Create Volumes + +Create the volumes for the Wordpress and MariaDB data: + +```bash title="unikraft" +unikraft volume create --metro fra --name wordpress-wordpress-data --size 512M +unikraft volume create --metro fra --name wordpress-db-data --size 512M +``` + +The output for each volume shows its details: + +```ansi title="unikraft" +metro: fra +name: wordpress-wordpress-data +uuid: 0bec8b93-0691-43b6-b188-4ac170a3d0c7 +state: available +size: 512MiB +filesystem: ext4 +quota-policy: static +persistent: true +timestamps: + created: just now +``` + +or + +```bash title="kraft" +kraft cloud volume create --name wordpress-wordpress-data --size 512Mi +kraft cloud volume create --name wordpress-db-data --size 512Mi +``` + +The output for each volume shows its details: + +```ansi title="kraft" +NAME CREATED AT SIZE ATTACHED TO MOUNTED BY STATE PERSISTENT +wordpress-wordpress-data now 512 MiB available true +``` + +You can list the created volumes by running: + + + +```bash title="unikraft" +unikraft volume ls +``` + +```bash title="kraft" +kraft cloud volume ls +``` + + + + + +```ansi title="unikraft" +METRO NAME STATE SIZE CREATED +fra0-fe-test wordpress-db-data available 512MiB just now +fra0-fe-test wordpress-wordpress-data available 512MiB just now +``` + +```ansi title="kraft" +NAME CREATED AT SIZE ATTACHED TO MOUNTED BY STATE PERSISTENT +wordpress-db-data 36 seconds ago 512 MiB available true +wordpress-wordpress-data 52 seconds ago 512 MiB available true +``` + + + +## Deploy MariaDB + +Build and deploy the MariaDB instance. +MariaDB is an internal service (not publicly accessible), reached via the `wordpress-mariadb.internal` domain: + +```bash title="unikraft" +unikraft build ./mariadb --output /mariadb:latest +unikraft run --name mariadb --scale-to-zero policy=idle,cooldown-time=1000,stateful=true --metro fra -m 1G --volume wordpress-db-data:/var/lib/mysql --image /mariadb:latest --domain wordpress-mariadb.internal --env MARIADB_ROOT_PASSWORD=unikraft +``` + +Make sure to replace `` with your username / org-name. + +The output shows the instance details: + +```ansi title="unikraft" +metro: fra +name: mariadb +uuid: 3af0eefb-29a8-4634-9b94-abf62d2fb90a +state: starting +image: /mariadb +runtime: + env: + MARIADB_ROOT_PASSWORD: * +resources: + memory: 1GiB + vcpus: 1 +service: + name: snowy-glitter-3uylzbqk + uuid: 0b3303d0-1a2e-4353-a9c7-29151263ef9f + domains: + - fqdn: wordpress-mariadb.internal +volumes: +- name: wordpress-db-data + uuid: 7b232d0f-dfbf-4ff7-9208-106b5d92bbe3 + at: /var/lib/mysql +networks: +- uuid: 8cad0682-a700-4303-af8c-ebd18465ed32 + private-ip: 10.0.1.73 + mac: 12:b0:0a:00:01:49 +timestamps: + created: just now +scale-to-zero: + enabled: true + policy: idle + stateful: true + cooldown-time: 1s +``` + +or + +```bash title="kraft" +kraft cloud deploy --name mariadb --scale-to-zero idle --scale-to-zero-stateful --scale-to-zero-cooldown 1s -M 1Gi --volume wordpress-db-data:/var/lib/mysql --domain wordpress-mariadb.internal --env MARIADB_ROOT_PASSWORD=unikraft ./mariadb/ +``` + +Make sure to replace `` with your username / org-name. + +The output shows the instance details: + +```ansi title="kraft" +[●] Deployed successfully! + │ + ├───────── name: mariadb + ├───────── uuid: cbf0dab4-238f-49cc-8bad-e6ebb7f5e9d2 + ├──────── metro: https://api.fra.unikraft.cloud/v1 + ├──────── state: starting + ├─────── domain: wordpress-mariadb.internal + ├──────── image: oci://unikraft.io//mariadb@sha256:cf1... + ├─────── memory: 1024 MiB + ├────── service: fragrant-bonobo-u5j0ddw1 + ├─ private fqdn: mariadb.internal + └─── private ip: 10.0.0.17 +``` + +## Deploy Wordpress + +Build and deploy the Wordpress instance: + +```bash title="unikraft" +unikraft build ./wordpress --output /wordpress:latest +unikraft run --name wordpress --scale-to-zero policy=on,cooldown-time=1000 --metro fra -p 443:8080/tls+http -m 2G --volume wordpress-wordpress-data:/var/www/html --image /wordpress:latest --env WORDPRESS_DB_HOST=wordpress-mariadb.internal +``` + +The output shows the instance address and other details: + +```ansi title="unikraft" +metro: fra +name: wordpress +uuid: ee9f5599-b33b-44f1-ab57-3871b440e810 +state: starting +image: /wordpress +runtime: + env: + WORDPRESS_DB_HOST: wordpress-mariadb.internal +resources: + memory: 2GiB + vcpus: 1 +service: + name: damp-lake-n09gzguc + uuid: 7f21d778-487f-4130-a94a-34b86862c3dd + domains: + - fqdn: damp-lake-n09gzguc.fra.unikraft.app +volumes: +- name: wordpress-wordpress-data + uuid: 0bec8b93-0691-43b6-b188-4ac170a3d0c7 + at: /var/www/html +networks: +- uuid: e0f13623-fd04-4a69-9caf-47142ce47c4c + private-ip: 10.0.0.33 + mac: 12:b0:0a:00:00:21 +timestamps: + created: just now +scale-to-zero: + enabled: true + policy: on + cooldown-time: 1s +``` + +or + +```bash title="kraft" +kraft cloud deploy --name wordpress --scale-to-zero on --scale-to-zero-cooldown 1s -p 443:8080/tls+http -M 2Gi --volume wordpress-wordpress-data:/var/www/html --env WORDPRESS_DB_HOST=wordpress-mariadb.internal ./wordpress/ +``` + +The output shows the instance address and other details: + +```ansi title="kraft" +[●] Deployed successfully! + │ + ├───────── name: wordpress + ├───────── uuid: aa8b6bad-f30a-4231-b6ea-e8afd4df43b8 + ├──────── metro: https://api.fra.unikraft.cloud/v1 + ├──────── state: starting + ├─────── domain: https://floral-sound-2i6zurr6.fra.unikraft.app + ├──────── image: oci://unikraft.io//wordpress@sha256:b43... + ├─────── memory: 2048 MiB + ├────── service: floral-sound-2i6zurr6 + ├─ private fqdn: wordpress.internal + └─── private ip: 10.0.0.29 +``` + +Use a browser to access the install page of Wordpress using the URL from the `fqdn` field in the output. +Fill out the form and complete the Wordpress install. + +You can list information about the instances by running: + + + +```bash title="unikraft" +unikraft instance ls +``` + +```bash title="kraft" +kraft cloud instance list +``` + + + + + +```ansi title="unikraft" +METRO NAME STATE IMAGE ARGS MEMORY VCPUS FQDN CREATED +fra mariadb standby /mariadb 1GiB 1 wordpress-mariadb.internal 5 minutes ago +fra wordpress running /wordpress 2GiB 1 damp-lake-n09gzguc.fra.unikraft.app 1 minute ago +``` + +```ansi title="kraft" +NAME FQDN STATE STATUS IMAGE MEMORY VCPUS ARGS BOOT TIME +wordpress floral-sound-2i6zurr6.fra.unikraft.app running since 1min oci://unikraft.io//wordpress@sha256:b... 2.0 GiB 1 6873.49 ms +mariadb wordpress-mariadb.internal running since 7mins oci://unikraft.io//mariadb@sha256:cf1... 1.0 GiB 1 2505.65 ms +``` + + + +When done, you can remove the instances and volumes: + + + +```bash title="unikraft" +unikraft instances delete mariadb wordpress +unikraft volume delete wordpress-wordpress-data wordpress-db-data +``` + +```bash title="kraft" +kraft cloud instance remove mariadb wordpress +kraft cloud volume remove wordpress-wordpress-data wordpress-db-data +``` + + + +## Learn more + +Use the `--help` option for detailed information on using Unikraft Cloud: + + + +```bash title="unikraft" +unikraft --help +``` + +```bash title="kraft" +kraft cloud --help +``` + + + +Or visit the [CLI Reference](/cli/unikraft) or the [legacy CLI Reference](/cli/kraft/overview). +{/* vale on */} diff --git a/zudoku.config.tsx b/zudoku.config.tsx index acb4faeb..4b73aa91 100644 --- a/zudoku.config.tsx +++ b/zudoku.config.tsx @@ -157,7 +157,9 @@ const config: ZudokuConfig = { "/guides/httpserver-flask-redis", // Flask + Redis HTTP Server "/guides/httpserver-python3.12-flask3.0-sqlite", // Flask and SQLite HTTP Server "/guides/httpserver-python3.12-flask3.0", // Flask HTTP Server + "/guides/nginx-flask-mongo", // Flask with MongoDB "/guides/github-webhook-node", // GitHub Webhook receiver + "/guides/httpserver-go1.22-redis", // Go and Redis HTTP Server "/guides/httpserver-go1.21", // Go HTTP Server "/guides/grafana", // Grafana "/guides/haproxy", // HAProxy @@ -177,6 +179,7 @@ const config: ZudokuConfig = { "/guides/novnc-browser", // noVNC "/guides/opentelemetry-collector", // OpenTelemetry Collector "/guides/httpserver-perl5.42", // Perl HTTP Server + "/guides/phoenix-postgres", // Phoenix with PostgreSQL "/guides/httpserver-php8.2", // PHP HTTP Server "/guides/node-playwright-chromium", // Playwright (Chromium) with Node.js "/guides/python-playwright-chromium", // Playwright (Chromium) with Python FastAPI @@ -204,6 +207,7 @@ const config: ZudokuConfig = { "/guides/httpserver-c-debug", // SSH and HTTP Server with C and Debugging Tools "/guides/httpserver-node22-sveltekit", // SvelteKit HTTP Server "/guides/traefik", // Traefik + "/guides/tyk", // Tyk "/guides/visual-studio-code-server", // Visual Studio Code Server "/guides/httpserver-node-vite-vanilla", // Vite (vanilla) "/guides/httpserver-node-vite-ssr-vanilla", // Vite (vanilla) SSR @@ -212,6 +216,7 @@ const config: ZudokuConfig = { "/guides/wazero-import-go", // Wazero "/guides/node18-wingsio", // Wings.io (Node) "/guides/wordpress-all-in-one", // Wordpress + "/guides/wordpress", // Wordpress with Nginx and MariaDB ] }, {