Skip to content

Commit

Permalink
Merge pull request #51 from devzero-inc/staging
Browse files Browse the repository at this point in the history
Friday 19.07
  • Loading branch information
mishushakov authored Jul 19, 2024
2 parents 857225d + 2551f92 commit f96b241
Show file tree
Hide file tree
Showing 30 changed files with 347 additions and 122 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .gitbook/assets/documentdb-access.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .gitbook/assets/documentdb-architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .gitbook/assets/documentdb-cluster.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .gitbook/assets/mongodb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .gitbook/assets/rds-access.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/rds-arch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .gitbook/assets/rds-architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .gitbook/assets/rds-devzero.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .gitbook/assets/rds-endpoint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .gitbook/assets/rds-secrets.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
## 🔩 Environment Variables

* [Overview](environment-variables/env-vars.md)
* [Personal](environment-variables/personal.md)
* [Team](environment-variables/team.md)
* [User-scoped](environment-variables/personal.md)
* [Team-scoped](environment-variables/team.md)
* [Secrets](environment-variables/secrets.md)

## 🌐 DevZero Network
Expand All @@ -50,6 +50,7 @@
* [Cloud Services](how-to-guides/cloud-services/README.md)
* [AWS](how-to-guides/cloud-services/aws/README.md)
* [ECS](how-to-guides/cloud-services/aws/ecs.md)
* [ECS (local)](how-to-guides/cloud-services/aws/ecs-local.md)
* [RDS](how-to-guides/cloud-services/aws/connect-to-an-rds-instance.md)
* [SQS](how-to-guides/cloud-services/aws/connect-to-sqs.md)
* [S3](how-to-guides/cloud-services/aws/connect-to-an-s3-bucket.md)
Expand Down Expand Up @@ -98,6 +99,7 @@
* [Docker](references/starter-templates/build-tools/docker.md)
* [Nix](references/starter-templates/build-tools/nix.md)
* [Database Templates](references/starter-templates/databases/README.md)
* [MongoDB](references/starter-templates/databases/mongodb.md)
* [Postgres](references/starter-templates/databases/postgres.md)
* [Infra Templates](references/starter-templates/infra/README.md)
* [Helm](references/starter-templates/infra/helm.md)
Expand Down
2 changes: 1 addition & 1 deletion environment-variables/env-vars.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Overview

Environment variables are materially public in nature. If you want to store something sensitive, see [Secrets](secrets.md).
Environment variables are materially public in nature. If you want to store or reference a secret value, see [Secrets](secrets.md).

These are usually used by when:

Expand Down
16 changes: 8 additions & 8 deletions environment-variables/personal.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# Personal
# User-scoped

Saving an environment variable
### Saving an user-scoped environment variable

Visit the Environment Variables section at [https://www.devzero.io/dashboard/environment-variables/personal](https://www.devzero.io/dashboard/environment-variables/personal) to add, remove, or update your environment personal environment variables and secrets. Personal environment variables can only be seen, managed, and used by you.
Visit the Environment Variables section at [https://www.devzero.io/dashboard/environment-variables/u](https://www.devzero.io/dashboard/environment-variables/personal)[ser](https://www.devzero.dev/dashboard/environment-variables/user) to add, remove, or update your user-scoped environment variables and secrets. User-scoped environment variables can only be seen, managed, and used by you.

{% hint style="info" %}
Personal environment variables are automatically made available on each of your running workspaces by default.
User-scoped environment variables are automatically made available on each of your running workspaces by default.
{% endhint %}

<figure><img src="../.gitbook/assets/Personal variables.gif" alt=""><figcaption><p>pkjujuiuytreAdding personal environment variables</p></figcaption></figure>
<figure><img src="../.gitbook/assets/Personal variables.gif" alt=""><figcaption><p>Adding personal environment variables</p></figcaption></figure>

## Using an environment variable
### Using an environment variable

<figure><img src="../.gitbook/assets/Update environment variables (1).png" alt=""><figcaption><p>Personal Environment Variables</p></figcaption></figure>

## Using an environment variable
### Using an environment variable

Using an environment variable within your workspace is how you would normally use any environment variable (eg: `echo $NOT_SO_SECRET_KEY`).

To use it in a build, you can reference it the same way. If your environment variable is called `MY_KEY`:

<figure><img src="../.gitbook/assets/env-var-in-build.png" alt=""><figcaption><p>Environment Variables during build-stage</p></figcaption></figure>

Need to store a sensitive environment variable or secret? Check out the [secrets.md](secrets.md "mention") page.
Need to store a secret environment variable? Check out the [secrets.md](secrets.md "mention") page.
8 changes: 4 additions & 4 deletions environment-variables/secrets.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Secrets

Secrets are used to store and reference sensitive values.&#x20;
Secrets are used to store and reference secret values.

{% hint style="info" %}
To store a secret, navigate to the environment variables page and add a new key-value pair. Before saving, be sure to check "Sensitive". This stores the environment variable as a secret with the additional protections described below.&#x20;
To store a secret, navigate to the environment variables page and add a new key-value pair. Before saving, be sure to check "Secret". This stores the environment variable as a secret with the additional protections described below.
{% endhint %}

<figure><img src="../.gitbook/assets/CleanShot 2024-06-21 at 10.18.33@2x.png" alt=""><figcaption><p>Sensitive value checkbox for environment variables</p></figcaption></figure>
<figure><img src="../.gitbook/assets/Screenshot 2024-07-18 at 15.36.52.png" alt=""><figcaption></figcaption></figure>

Once a secret is saved, its value cannot be viewed or modified. You can only replace or delete the value. Otherwise, secrets work just like other environment variables.&#x20;
Once a secret is saved, its value cannot be viewed or modified. You can only replace or delete the value. Otherwise, secrets work just like other environment variables.

You can access secrets within builds or at build or launch time, just like you would access any environment variable. If your secret is called `MY_SECRET_KEY`, to access its value anywhere, use `$MY_SECRET_KEY`. At runtime, you can use the `env` binary to verify that the secrets are present within that context.

Expand Down
12 changes: 6 additions & 6 deletions environment-variables/team.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# Team
# Team-scoped

## Saving a team environment variable
### Saving a team-scoped environment variable

Visit the Environment Variables section at [https://www.devzero.io/dashboard/environment-variables/team](https://www.devzero.io/dashboard/environment-variables/team) to add, remove or update your environment variables for your team. Team environment variables can be referenced and used by anyone within your DevZero team.
Visit the Environment Variables section at [https://www.devzero.io/dashboard/environment-variables/team](https://www.devzero.io/dashboard/environment-variables/team) to add, remove or update your team-scoped environment variables. Team-scoped environment variables can be referenced and used by anyone within your DevZero team.

<figure><img src="../.gitbook/assets/Update environment variables (1).png" alt=""><figcaption><p>Team environment variables</p></figcaption></figure>

{% hint style="info" %}
Team-scoped environment variables and secrets must be directly referenced in your recipe template steps. Unlike personal environment variables, they are **not** automatically added to every workspace.
Team-scoped environment variables and secrets must be directly referenced in your recipe template steps. Unlike user-scoped environment variables, they are **not** automatically added to every workspace.
{% endhint %}

<figure><img src="../.gitbook/assets/Update environment variables.png" alt=""><figcaption><p>Team Environment Variables</p></figcaption></figure>

## Using a team environment variable
### Using a team-scoped environment variable

Using an environment variable within your workspace is how you would normally use any environment variable (eg: `echo $NOT_SO_SECRET_KEY`).

To use it in a build, you can reference it the same way. If your environment variable is called `MY_KEY`:

<figure><img src="../.gitbook/assets/env-var-in-build.png" alt=""><figcaption><p>Environment Variables during build-stage</p></figcaption></figure>

Need to store a sensitive environment variable or secret? Check out the [secrets.md](secrets.md "mention") page.
Need to store a secret environment variable? Check out the [secrets.md](secrets.md "mention") page.
3 changes: 3 additions & 0 deletions how-to-guides/ci/run-github-actions-in-a-devbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ helm install "${INSTALLATION_NAME}" \
--create-namespace \
--set githubConfigUrl="${GITHUB_CONFIG_URL}" \
--set githubConfigSecret.github_token="${GITHUB_PAT}" \
--set template.spec.containers[0].image=ghcr.io/devzero-inc/dz-runner:latest \
--set template.spec.containers[0].name=runner \
--set template.spec.containers[0].command={"/home/runner/run.sh"} \
oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set
```
Expand Down
9 changes: 9 additions & 0 deletions how-to-guides/cloud-services/aws/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@
<a href="../../../.gitbook/assets/aws-ecs.png">aws-ecs.png</a>
</td>
</tr>
<tr>
<td>Running ECS services/tasks "locally"</td>
<td>
<a href="ecs.md">ecs.md</a>
</td>
<td>
<a href="../../../.gitbook/assets/aws-ecs.png">aws-ecs.png</a>
</td>
</tr>
<tr>
<td>Connect to RDS</td>
<td>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Amazon DocumentDB
Connecting to DocumentDB running in the private subnet of AWS VPC from your DevBox.

## Architecture Diagram:

![image](../../../.gitbook/assets/documentdb-architecture.png)

## Existing Database

### Step 1: Accessing DocumentDB from a DevBox

1. Follow the [Connecting to AWS](../../existing-network/connecting-to-aws.md) guide.
2. Go to **Amazon DocumentDB > Clusters > Your Cluster**.
3. Select **Connectivity & Security**. You will see the commands and DocumentDB hostname for accessing it.

![image](../../../.gitbook/assets/documentDB-connectivity-and-security.png)

4. In your **DevBox**, import the MongoDB public GPG key:\
`
curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | \
sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \
--dearmor
`
5. Add MongoDB package repository source:\
`
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
`
6. Reload local package database:\
`
sudo apt-get update
`
7. Install MongoDB:\
`
sudo apt-get install -y mongodb-org
`
8. Download the certificate:\
`
wget https://truststore.pki.rds.amazonaws.com/global/global-bundle.pem
`
9. Connect to the database:\
`
mongosh --tls --host <your-cluster-endpoint>:27017 --tlsCAFile /path/to/global-bundle.pem --username <your-username> --password <your-password>
`\
where the cluster endpoint will be available in **Connectivity & Security** section.

![image](../../../.gitbook/assets/documentdb-access.png)


## New Database

### Step 1: Creating a DocumentDB Instance

1. Follow the [Connecting to AWS](../../existing-network/connecting-to-aws.md) guide.
2. Go to **Amazon DocumentDB > Create Cluster**.
3. Select **Instance Based Cluster**.
4. In the **Configuration** section choose **Instance Class**, number of instances for your cluster.
5. Set **Username and Password**.
6. Turn on **Show advanced settings**.
7. In the **Network settings** , choose the VPC where your bastion host is running, subnet group and assign a security group which has inbound access to only VPC.
8. Click **Create cluster**.

![image](../../../.gitbook/assets/documentdb-cluster.png)

### Step 2: Accessing DocumentDB from a DevBox

1. In your **DevBox**, import the MongoDB public GPG key:\
`
curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | \
sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \
--dearmor
`
2. Add MongoDB package repository source:\
`
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
`
3. Reload local package database:\
`
sudo apt-get update
`
4. Install MongoDB:\
`
sudo apt-get install -y mongodb-org
`
5. Download the certificate:\
`
wget https://truststore.pki.rds.amazonaws.com/global/global-bundle.pem
`
6. Connect to the database:\
`
mongosh --tls --host <your-cluster-endpoint>:27017 --tlsCAFile /path/to/global-bundle.pem --username <your-username> --password <your-password>
`\
where the cluster endpoint will be available in **Connectivity & Security** section.

![image](../../../.gitbook/assets/documentdb-access.png)
Loading

0 comments on commit f96b241

Please sign in to comment.