Airgap installer changes in docs (#2301)

* Adding --from-dir flag in reference/cli/dapr-init.md

Signed-off-by: shivam <shivamkm07@gmail.com>

* Adding airgap installer docs in operations/hosting/self-hosted

Signed-off-by: shivam <shivamkm07@gmail.com>

* Formatting change

Signed-off-by: shivam <shivamkm07@gmail.com>

* Added missing word

Signed-off-by: shivam <shivamkm07@gmail.com>

* Incorporated reviews

Signed-off-by: shivam <shivamkm07@gmail.com>

* Update daprdocs/content/en/operations/hosting/self-hosted/self-hosted-airgap.md

Signed-off-by: shivam <shivamkm07@gmail.com>

* Adding comment if CLI is not moved

Signed-off-by: shivam <shivamkm07@gmail.com>

* Formatting changes

Signed-off-by: shivam <shivamkm07@gmail.com>

Co-authored-by: Mark Fussell <markfussell@gmail.com>
This commit is contained in:
Shivam Kumar 2022-04-05 09:55:02 +05:30 committed by GitHub
parent e0d6e215aa
commit 4faa0d790c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 92 additions and 1 deletions

View File

@ -0,0 +1,76 @@
---
type: docs
title: "How-To: Run Dapr in an offline or airgap environment"
linkTitle: "Run in offline or airgap"
weight: 30000
description: "How to deploy and run Dapr in self-hosted mode in an airgap environment"
---
## Overview
By default, Dapr initialization downloads binaries and pulls images from the network to setup the development environment. However, Dapr also supports offline or airgap installation using pre-downloaded artifacts, either with a Docker or slim environment. The artifacts for each Dapr release are built into a [Dapr Installer Bundle](https://github.com/dapr/installer-bundle) which can be downloaded. By using this installer bundle with the Dapr CLI `init` command, you can install Dapr into environments that do not have any network access.
## Setup
Before airgap initialization, it is required to download a Dapr Installer Bundle beforehand, containing the CLI, runtime and dashboard packaged together. This eliminates the need to download binaries as well as Docker images when initializing Dapr locally.
1. Download the [Dapr Installer Bundle](https://github.com/dapr/installer-bundle/releases) for the specific release version. For example, daprbundle_linux_amd64.tar.gz, daprbundle_windows_amd64.zip.
2. Unpack it.
3. To install Dapr CLI copy the `daprbundle/dapr (dapr.exe for Windows)` binary to the desired location:
* For Linux/MacOS - `/usr/local/bin`
* For Windows, create a directory and add this to your System PATH. For example create a directory called `c:\dapr` and add this directory to your path, by editing your system environment variable.
> Note: If Dapr CLI is not moved to the desired location, you can use local `dapr` CLI binary in the bundle. The steps above is to move it to the usual location and add it to the path.
## Initialize Dapr environment
Dapr can be initialized in an airgap environment with or without Docker containers.
### Initialize Dapr with Docker
([Prerequisite](#Prerequisites): Docker is available in the environment)
Move to the bundle directory and run the following command:
``` bash
dapr init --from-dir .
```
> For linux users, if you run your Docker cmds with sudo, you need to use "**sudo dapr init**"
> If you are not running the above cmd from the bundle directory, provide the full path to bundle directory as input. For example, assuming the bundle directory path is $HOME/daprbundle, run `dapr init --from-dir $HOME/daprbundle` to have the same behavior.
The output should look similar to the following:
```bash
Making the jump to hyperspace...
Installing runtime version latest
↘ Extracting binaries and setting up components... Loaded image: daprio/dapr:$version
✅ Extracting binaries and setting up components...
✅ Extracted binaries and completed components set up.
daprd binary has been installed to $HOME/.dapr/bin.
dapr_placement container is running.
Use `docker ps` to check running containers.
✅ Success! Dapr is up and running. To get started, go here: https://aka.ms/dapr-getting-started
```
> Note: To emulate *online* Dapr initialization using `dapr init`, you can also run Redis and Zipkin containers as follows:
```
1. docker run --name "dapr_zipkin" --restart always -d -p 9411:9411 openzipkin/zipkin
2. docker run --name "dapr_redis" --restart always -d -p 6379:6379 redislabs/rejson
```
### Initialize Dapr without Docker
Alternatively to have the CLI not install any default configuration files or run any Docker containers, use the `--slim` flag with the `init` command. Only the Dapr binaries will be installed.
``` bash
dapr init --slim --from-dir .
```
The output should look similar to the following:
```bash
⌛ Making the jump to hyperspace...
Installing runtime version latest
↙ Extracting binaries and setting up components...
✅ Extracting binaries and setting up components...
✅ Extracted binaries and completed components set up.
daprd binary has been installed to $HOME.dapr/bin.
placement binary has been installed to $HOME/.dapr/bin.
✅ Success! Dapr is up and running. To get started, go here: https://aka.ms/dapr-getting-started
```

View File

@ -12,7 +12,7 @@ Dapr can be configured to run in self-hosted mode on your local developer machin
## Initialization
Dapr can be initialized [with Docker]({{< ref self-hosted-with-docker.md >}}) (default) or in [slim-init mode]({{< ref self-hosted-no-docker.md >}}). The default Docker setup provides out of the box functionality with the following containers and configuration:
Dapr can be initialized [with Docker]({{< ref self-hosted-with-docker.md >}}) (default) or in [slim-init mode]({{< ref self-hosted-no-docker.md >}}). It can also be initialized and run in [offline or airgap environments]({{< ref self-hosted-airgap.md >}}). The default Docker setup provides out of the box functionality with the following containers and configuration:
- A Redis container configured to serve as the default component for both state management and publish/subscribe.
- A Zipkin container for diagnostics and tracing.
- A default Dapr configuration and components installed in `$HOME/.dapr/` (Mac/Linux) or `%USERPROFILE%\.dapr\` (Windows).

View File

@ -33,8 +33,10 @@ dapr init [flags]
| `--namespace`, `-n` | | `dapr-system` | The Kubernetes namespace to install Dapr in |
| `--runtime-version` | | `latest` | The version of the Dapr runtime to install, for example: `1.0.0` |
| `--slim`, `-s` | | `false` | Exclude placement service, Redis and Zipkin containers from self-hosted installation |
| `--from-dir` | | | Path to a local directory containing a downloaded "Dapr Installer Bundle" release which is used to `init` the airgap environment |
| `--image-registry` | | | Pulls container images required by Dapr from the given image registry |
| N/A |DAPR_DEFAULT_IMAGE_REGISTRY| | In self hosted mode, it is used to specify the default container registry to pull images from. When its value is set to `GHCR` or `ghcr` it pulls the required images from Github container registry. To default to Docker hub as default, just unset this env variable.|
### Examples
#### Self hosted environment
@ -57,6 +59,18 @@ Dapr can also run [Slim self-hosted mode]({{< ref self-hosted-no-docker.md >}})
dapr init -s
```
In an offline or airgap environment, you can [download a Dapr Installer Bundle](https://github.com/dapr/installer-bundle/releases) and use this to install Dapr instead of pulling images from the network.
```bash
dapr init --from-dir <path-to-installer-bundle-directory>
```
Dapr can also run in slim self-hosted mode without Docker in an airgap environment.
```bash
dapr init -s --from-dir <path-to-installer-bundle-directory>
```
You can also specify a private registry to pull container images from. These images need to be published to private registries as shown below to enable Dapr CLI to pull them successfully via the `dapr init` command -
1. Dapr runtime container image(dapr) (Used to run Placement) - dapr/dapr:<version>
@ -72,6 +86,7 @@ You can also specify a private registry to pull container images from. These ima
```bash
dapr init --image-registry docker.io/username
```
This command resolves the complete image URI as shown below -
1. Placement container image(dapr) - docker.io/username/dapr/dapr:<version>
2. Redis container image(rejson) - docker.io/username/dapr/3rdparty/rejson