Skip to content

Commit

Permalink
Merge branch 'main' into patch-3
Browse files Browse the repository at this point in the history
  • Loading branch information
eveld committed Oct 31, 2023
2 parents b68b272 + 31c7512 commit eacaf11
Show file tree
Hide file tree
Showing 15 changed files with 256 additions and 41 deletions.
2 changes: 1 addition & 1 deletion public/latest
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.42
0.5.56
2 changes: 1 addition & 1 deletion src/components/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { ModeToggle } from '@/components/ModeToggle'
import { Navigation, TopLevelNavItem } from '@/components/Navigation'

const navigation = [
{ name: 'Docs', href: '/docs' },
{ name: 'Docs', href: '/docs/introduction/installation' },
]

export const Header = forwardRef(function Header({ className }, ref) {
Expand Down
9 changes: 1 addition & 8 deletions src/config/navigation.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
export const navigation = [
{
title: 'Index',
links: [
{ title: 'Index', href: '/docs' },
],
},
{
title: 'Introduction',
links: [
Expand Down Expand Up @@ -50,20 +44,19 @@ export const navigation = [
{ title: 'Container', href: '/docs/resources/container/container' },
{ title: 'Copy', href: '/docs/resources/copy' },
{ title: 'Docs', href: '/docs/resources/docs/docs' },
{ title: 'Exec', href: '/docs/resources/exec' },
{ title: 'Helm', href: '/docs/resources/helm' },
{ title: 'Ingress', href: '/docs/resources/ingress' },
{ title: 'Kubernetes Cluster', href: '/docs/resources/k8s/kubernetes_cluster' },
{ title: 'Kubernetes Config', href: '/docs/resources/k8s/kubernetes_config' },
{ title: 'Leaf Certificate', href: '/docs/resources/cert/certificate_leaf' },
{ title: 'Local Exec', href: '/docs/resources/exec/local_exec' },
{ title: 'Network', href: '/docs/resources/network' },
{ title: 'Nomad Cluster', href: '/docs/resources/nomad/nomad_cluster' },
{ title: 'Nomad Job', href: '/docs/resources/nomad/nomad_job' },
{ title: 'Random ID', href: '/docs/resources/random/random_id' },
{ title: 'Random Number', href: '/docs/resources/random/random_number' },
{ title: 'Random Password', href: '/docs/resources/random/random_password' },
{ title: 'Random UUID', href: '/docs/resources/random/random_uuid' },
{ title: 'Remote Exec', href: '/docs/resources/exec/remote_exec' },
{ title: 'Root Certificate', href: '/docs/resources/cert/certificate_ca' },
{ title: 'Sidecar', href: '/docs/resources/container/sidecar' },
{ title: 'Task', href: '/docs/resources/docs/task' },
Expand Down
2 changes: 1 addition & 1 deletion src/pages/docs/cli/dev.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jumppad dev ./config_folder
<Property name="vars-file" type="string" required="false" value="">
Load variables from a location other than *.vars files in the blueprint folder. E.g --vars-file=./file.vars
</Property>
<Property name="disable-tty" type="boolean" required="false" value="">
<Property name="disable-tty" type="bool" required="false" value="">
Disables the tty mode for dev creating a linea log output
</Property>
</Properties>
2 changes: 1 addition & 1 deletion src/pages/docs/cli/env.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Invoke-Expression "jumppad env --unset" | ForEach-Object { Remove-Item $_ }
## Flags

<Properties>
<Property name="unset" type="boolean" required="false" value="false">
<Property name="unset" type="bool" required="false" value="false">
When set to true Jumppad will print unset commands for environment variables defined by the blueprint.
</Property>
</Properties>
Expand Down
6 changes: 3 additions & 3 deletions src/pages/docs/cli/up.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jumppad up <file|directory|url> [flags]
## Flags

<Properties>
<Property name="force-update" type="boolean" required="false" value="false">
<Property name="force-update" type="bool" required="false" value="false">
Jumppad caches Docker images, Helm Charts, and Blueprints downloaded from external sources. In the instance you would like to force jumppad to redownload this resource, for example you have a docker container using the `latest` tag and would like to update it to the most recent checksum. You can use the `force-update` flag.
</Property>
<Property name="no-browser" type="boolean" required="false" value="false">
<Property name="no-browser" type="bool" required="false" value="false">
Jumppad allows you to optionally override the behavior of resources which have browser open parameters. Setting this flag to true stops Jumppad from opening browser windows.
</Property>
<Property name="var" type="string" required="true">
Expand All @@ -26,7 +26,7 @@ jumppad up <file|directory|url> [flags]
<Property name="vars-file" type="string" required="false">
Allows you to specify the location of a variable file. By default Jumppad will attempt to load a `*.vars` file from the Blueprint folder, this flag allows you to specify an additional variables value file.
</Property>
<Property name="y" type="boolean" required="false">
<Property name="y" type="bool" required="false">
When specified, answers `yes` to any confirmation prompts for the user.
</Property>
</Properties>
Expand Down
10 changes: 0 additions & 10 deletions src/pages/docs/index.mdx

This file was deleted.

6 changes: 3 additions & 3 deletions src/pages/docs/resources/container/container.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ The `container` resource allows you to create Docker containers.
```
</Property>

<Property name="privileged" type="boolean" required="false" value="false">
<Property name="privileged" type="bool" required="false" value="false">
Should the container run in Docker privileged mode?
</Property>

<Property name="max_restart_count" type="number" required="false" value="0">
<Property name="max_restart_count" type="int" required="false" value="0">
The maximum number of times a container will be restarted when it exits with a status code other than 0
</Property>

Expand Down Expand Up @@ -319,7 +319,7 @@ If the command or script receives an exit code `0` the check passes.
A resources type allows you to configure the maximum resources which can be consumed.

<Properties>
<Property name="cpu" type="number" required="false" value="">
<Property name="cpu" type="int" required="false" value="">
Set the maximum CPU which can be consumed by the container in MHz, 1 CPU == 1000MHz.
</Property>
<Property name="cpu_pin" type="[]number" required="false" value="">
Expand Down
8 changes: 4 additions & 4 deletions src/pages/docs/resources/container/sidecar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ to the target container.
```
</Property>

<Property name="privileged" type="boolean" required="false" value="false">
<Property name="privileged" type="bool" required="false" value="false">
Should the container run in Docker privileged mode?
</Property>

<Property name="max_restart_count" type="number" required="false" value="0">
<Property name="max_restart_count" type="int" required="false" value="0">
The maximum number of times a container will be restarted when it exits with a status code other than 0
</Property>

Expand Down Expand Up @@ -347,10 +347,10 @@ If the command or script receives an exit code `0` the check passes.
A resources type allows you to configure the maximum resources which can be consumed.

<Properties>
<Property name="cpu" type="number" required="false" value="">
<Property name="cpu" type="int" required="false" value="">
Set the maximum CPU which can be consumed by the container in MHz, 1 CPU == 1000MHz.
</Property>
<Property name="cpu_pin" type="[]number" required="false" value="">
<Property name="cpu_pin" type="[]int" required="false" value="">
Pin the container CPU consumption to one or more logical CPUs. For example to pin the container to the core 1 and 4.

```
Expand Down
232 changes: 232 additions & 0 deletions src/pages/docs/resources/exec/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
import MetaProperties from "../shared/meta.mdx"
import NetworkAttachment from "../shared/network_attachment.mdx"
import Image from "../shared/image.mdx"
import Volume from "../shared/volume.mdx"

# Exec

<Intro>
The `exec` resource allows the execution of arbitrary commands and scripts.
Depending on the parameters specified, the commands are executed either on the
local machine or inside of a container.

When either the `image` or `target` fields are specified, the command is executed
inside of a container. When neither of these fields are specified, the command is
executed on the local machine.
</Intro>

### Local execution

When running on the local machine, the command runs in the local user space, and
has access to all the environment variables that the user executing jumppad run
has access too. Additional environment variables, and the working directory for
the command can be specified as part of the resource.

Log files for an exec running on the local machine are written to `$HOME/.jumppad/logs/exec_[name].log`
and the rendered script can be found in the jumppad temp directory `$HOME/.jumppad/tmp/exec[name].sh`.

### Remote execution

Execution can either be in a stand alone container or can target an existing
and running container. When targeting an existing container, the `target` field
must be specified. When running in a stand alone container, the `image` block must
be specified.

## Properties

<Properties>
<Property name="script" type="string" required="true" value="">
The script to execute.

```hcl
resource "exec" "inline" {
script = <<-EOF
#!/bin/bash
ls -lha
EOF
}
resource "exec" "file" {
script = file("script.sh")
}
resource "exec" "template" {
script = template_file("script.sh.tpl", {
foo = "bar"
})
}
```
</Property>

<Property name="working_directory" type="string" required="optional" value="">
The working directory to execute the script in.
</Property>

<Property name="timeout" type="string" required="optional" value="0s">
The timeout for the script to execute as a duration e.g. 30s.
</Property>

<Property name="environment" type="map[string]string" required="optional" value="">
Environment variables to set for the script.

```hcl
resource "exec" "env" {
environment = {
FOO = "bar"
}
script = <<-EOF
#!/bin/bash
echo $${FOO}
EOF
}
```
</Property>
</Properties>

---

### The following properties are only valid for local execution.

<Properties>
<Property name="daemon" type="bool" required="false" value="false">
The process will be run as a daemon if set to true.
</Property>

<Property name="pid" type="int" readonly required="false" value="">
This is the pid of the parent process.
</Property>
</Properties>

---

### The following properties are only valid for remote execution in a target container.

<Properties>
<Property name="target" type="ref" required="false" value="">
A reference to a target `container` resource to execute the script in.

```hcl
resource "container" "alpine" {
image {
name = "alpine"
}
}
resource "exec" "uname" {
target = resource.container.alpine
script = <<-EOF
#!/bin/bash
uname -a
EOF
}
```
</Property>
</Properties>

---

### The following properties are only valid for remote execution in a standalone container.

<Properties>
<Property name="image" type="#image" required="false" value="">
The image to use for the container.
</Property>

<Property name="network" type="#network_attachment" required="false" value="">
The network to attach the container to.
</Property>

<Property name="volume" type="#volume" required="false" value="">
The volumes to mount to the container.
</Property>

<Property name="run_as" type="#user" required="false" value="">
The user to run the script as.
</Property>
</Properties>

<Image/>
<NetworkAttachment />
<Volume/>

---

### run_as

User and Group configuration to be used when running a container, by default Docker runs commands in the container as root id 0.

<Properties>
<Property name="user" type="string" required="false" value="">
Linux user ID or user name to run the container as, this overrides the default user configured in the container image.
</Property>
<Property name="group" type="string" required="false" value="">
Linux group ID or group name to run the container as, this overrides the default group configured in the container image.
</Property>
</Properties>

---

<MetaProperties/>

---

## Examples

```hcl
resource "exec" "install" {
script = <<-EOF
#!/bin/sh
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m | tr '[:upper:]' '[:lower:]')
if [ ! -f /tmp/consul ]; then
curl -L -o /tmp/consul.zip \
https://releases.hashicorp.com/consul/1.16.2/consul_1.16.2_$${OS}_$${ARCH}.zip
cd /tmp && unzip ./consul.zip
fi
EOF
}
resource "exec" "run" {
depends_on = ["resource.exec.install"]
script = <<-EOF
#!/bin/sh
/tmp/consul agent -dev
EOF
daemon = true
}
```

```hcl
resource "container" "alpine" {
image {
name = "alpine"
}
command = ["tail", "-f", "/dev/null"]
}
resource "exec" "in_container" {
target = resource.container.alpine
script = <<-EOF
#/bin/sh
ls -las
EOF
}
resource "exec" "standalone" {
image {
name = "alpine"
}
script = <<-EOF
#/bin/sh
ls -las
EOF
}
```
4 changes: 2 additions & 2 deletions src/pages/docs/resources/helm/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ resources.
Kubernetes namespace to apply the chart to.
</Property>

<Property name="create_namespace" type="boolean" required="optional" value="false">
<Property name="create_namespace" type="bool" required="optional" value="false">
If the namespace does not exist, should the helm resource attempt to create it.
</Property>

<Property name="skip_crds" type="boolean" required="optional" value="false">
<Property name="skip_crds" type="bool" required="optional" value="false">
If the chart defines custom resource definitions, should these be ignored.
</Property>

Expand Down
Loading

0 comments on commit eacaf11

Please sign in to comment.