Skip to content

Commit 30430ac

Browse files
committed
docs: explain JFrog integration 🐸
1 parent f295294 commit 30430ac

File tree

6 files changed

+173
-10
lines changed

6 files changed

+173
-10
lines changed

docs/manifest.json

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,28 @@
8585
"path": "./platforms/aws.md",
8686
"icon_path": "./images/aws.svg"
8787
},
88+
{
89+
"title": "Azure",
90+
"description": "Set up Coder on an Azure VM",
91+
"path": "./platforms/azure.md",
92+
"icon_path": "./images/azure.svg"
93+
},
94+
{
95+
"title": "Docker",
96+
"description": "Set up Coder with Docker",
97+
"path": "./platforms/docker.md",
98+
"icon_path": "./images/icons/docker.svg"
99+
},
88100
{
89101
"title": "GCP",
90102
"description": "Set up Coder on a GCP Compute Engine VM",
91103
"path": "./platforms/google-cloud-platform.md",
92104
"icon_path": "./images/google-cloud.svg"
93105
},
94106
{
95-
"title": "Azure",
96-
"description": "Set up Coder on an Azure VM",
97-
"path": "./platforms/azure.md",
98-
"icon_path": "./images/azure.svg"
107+
"title": "JFrog",
108+
"description": "Integrate Coder with JFrog",
109+
"path": "./platforms/jfrog.md"
99110
},
100111
{
101112
"title": "Kubernetes",
@@ -109,12 +120,6 @@
109120
}
110121
]
111122
},
112-
{
113-
"title": "Docker",
114-
"description": "Set up Coder with Docker",
115-
"path": "./platforms/docker.md",
116-
"icon_path": "./images/icons/docker.svg"
117-
},
118123
{
119124
"title": "Other platforms",
120125
"description": "Set up Coder on an another provider",

docs/platforms/jfrog.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# JFrog
2+
3+
Coder and JFrog work together to provide seamless security and compliance for
4+
your development environments. With Coder, you can automatically authenticate
5+
every workspace to use a central Artifactory.
6+
7+
In this page we will give examples in terms of a Docker template for simplicity,
8+
but the same concepts apply to any compute platform.
9+
10+
## Installing jf
11+
12+
The easiest way to install the JFrog CLI is to run the following command:
13+
14+
```sh
15+
curl -fL https://install-cli.jfrog.io | sh
16+
```
17+
18+
Other methods are listed [here](https://jfrog.com/help/r/jfrog-cli/download-and-installation).
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
name: JFrog and Docker
3+
description: Develop inside Docker containers using your local daemon
4+
tags: [local, docker, jfrog]
5+
icon: /icon/docker.png
6+
---
7+
8+
# jfrog-docker
9+
10+
To get started, run `coder templates init`. When prompted, select this template.
11+
Follow the on-screen instructions to proceed.
12+
13+
## Editing the image
14+
15+
Edit the `Dockerfile` and run `coder templates push` to update workspaces.
16+
17+
## code-server
18+
19+
`code-server` is installed via the `startup_script` argument in the `coder_agent`
20+
resource block. The `coder_app` resource is defined to access `code-server` through
21+
the dashboard UI over `localhost:13337`.
22+
23+
# Next steps
24+
25+
Check out our [Docker](../docker/) template for a more fully featured Docker
26+
example.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM ubuntu
2+
3+
RUN apt-get update \
4+
&& apt-get install -y \
5+
curl \
6+
git \
7+
golang \
8+
sudo \
9+
vim \
10+
wget \
11+
&& rm -rf /var/lib/apt/lists/*
12+
13+
ARG USER=coder
14+
RUN useradd --groups sudo --no-create-home --shell /bin/bash ${USER} \
15+
&& echo "${USER} ALL=(ALL) NOPASSWD:ALL" >/etc/sudoers.d/${USER} \
16+
&& chmod 0440 /etc/sudoers.d/${USER}
17+
USER ${USER}
18+
WORKDIR /home/${USER}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
terraform {
2+
required_providers {
3+
coder = {
4+
source = "coder/coder"
5+
version = "~> 0.8.3"
6+
}
7+
docker = {
8+
source = "kreuzwerker/docker"
9+
version = "~> 3.0.1"
10+
}
11+
}
12+
}
13+
14+
locals {
15+
username = data.coder_workspace.me.owner
16+
}
17+
18+
data "coder_provisioner" "me" {
19+
}
20+
21+
provider "docker" {
22+
}
23+
24+
data "coder_workspace" "me" {
25+
}
26+
27+
resource "coder_agent" "main" {
28+
arch = data.coder_provisioner.me.arch
29+
os = "linux"
30+
startup_script_timeout = 180
31+
startup_script = <<-EOT
32+
set -e
33+
34+
# install and start code-server
35+
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server --version 4.11.0
36+
/tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &
37+
EOT
38+
}
39+
40+
resource "coder_app" "code-server" {
41+
agent_id = coder_agent.main.id
42+
slug = "code-server"
43+
display_name = "code-server"
44+
url = "http://localhost:13337/?folder=/home/${local.username}"
45+
icon = "/icon/code.svg"
46+
subdomain = false
47+
share = "owner"
48+
49+
healthcheck {
50+
url = "http://localhost:13337/healthz"
51+
interval = 5
52+
threshold = 6
53+
}
54+
}
55+
56+
resource "docker_volume" "home_volume" {
57+
name = "coder-${data.coder_workspace.me.id}-home"
58+
# Protect the volume from being deleted due to changes in attributes.
59+
lifecycle {
60+
ignore_changes = all
61+
}
62+
}
63+
64+
resource "docker_image" "main" {
65+
name = "coder-${data.coder_workspace.me.id}"
66+
build {
67+
context = "./build"
68+
build_args = {
69+
USER = local.username
70+
}
71+
}
72+
triggers = {
73+
dir_sha1 = sha1(join("", [for f in fileset(path.module, "build/*") : filesha1(f)]))
74+
}
75+
}
76+
77+
resource "docker_container" "workspace" {
78+
count = data.coder_workspace.me.start_count
79+
image = docker_image.main.name
80+
# Uses lower() to avoid Docker restriction on container names.
81+
name = "coder-${data.coder_workspace.me.owner}-${lower(data.coder_workspace.me.name)}"
82+
# Hostname makes the shell more user friendly: coder@my-workspace:~$
83+
hostname = data.coder_workspace.me.name
84+
entrypoint = ["sh", "-c", coder_agent.main.init_script]
85+
env = ["CODER_AGENT_TOKEN=${coder_agent.main.token}"]
86+
host {
87+
host = "host.docker.internal"
88+
ip = "host-gateway"
89+
}
90+
volumes {
91+
container_path = "/home/${local.username}"
92+
volume_name = docker_volume.home_volume.name
93+
read_only = false
94+
}
95+
}

site/static/icon/jfrog.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)