Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit 56fdf09

Browse files
committed
Apache Airflow
1 parent d8102e6 commit 56fdf09

File tree

4 files changed

+151
-0
lines changed

4 files changed

+151
-0
lines changed

.images/airflow.png

603 KB
Loading

apache-airflow/README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
display_name: airflow
3+
description: A module that adds Apache Airflow in your Coder template
4+
icon: ../.icons/airflow.svg
5+
maintainer_github: nataindata
6+
verified: false
7+
tags: [airflow, idea, web, helper]
8+
---
9+
10+
# airflow
11+
12+
A module that adds Apache Airflow in your Coder template.
13+
14+
15+
```tf
16+
module "airflow" {
17+
source = "registry.coder.com/modules/airflow/coder"
18+
version = "1.0.2"
19+
}
20+
```
21+
22+
![Airflow](../.images/airflow.png)
23+
24+
## Examples
25+
26+
### Example 1
27+
28+
Install the Dracula theme from [OpenVSX](https://open-vsx.org/):
29+
30+
```tf
31+
module "airflow" {
32+
source = "registry.coder.com/modules/airflow/coder"
33+
version = "1.0.2"
34+
agent_id = coder_agent.example.id
35+
extensions = [
36+
"dracula-theme.theme-dracula"
37+
]
38+
}
39+
```
40+
41+
Enter the `<author>.<name>` into the extensions array and code-server will automatically install on start.
42+
43+
### Example 2
44+
45+
Configure VS Code's [settings.json](https://code.visualstudio.com/docs/getstarted/settings#_settingsjson) file:
46+
47+
```tf
48+
module "airflow" {
49+
source = "registry.coder.com/modules/airflow/coder"
50+
version = "1.0.2"
51+
agent_id = coder_agent.example.id
52+
extensions = [ "dracula-theme.theme-dracula" ]
53+
settings = {
54+
"workbench.colorTheme" = "Dracula"
55+
}
56+
}
57+
```
58+
59+
### Example 3
60+
61+
Run code-server in the background, don't fetch it from GitHub:
62+
63+
```tf
64+
module "airflow" {
65+
source = "registry.coder.com/modules/airflow/coder"
66+
version = "1.0.2"
67+
agent_id = coder_agent.example.id
68+
offline = true
69+
}
70+
```

apache-airflow/main.tf

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
terraform {
2+
required_version = ">= 1.0"
3+
4+
required_providers {
5+
coder = {
6+
source = "coder/coder"
7+
version = ">= 0.17"
8+
}
9+
}
10+
}
11+
12+
# Add required variables for your modules and remove any unneeded variables
13+
variable "agent_id" {
14+
type = string
15+
description = "The ID of a Coder agent."
16+
}
17+
18+
variable "log_path" {
19+
type = string
20+
description = "The path to log airflow to."
21+
default = "/tmp/airflow.log"
22+
}
23+
24+
variable "port" {
25+
type = number
26+
description = "The port to run airflow on."
27+
default = 8080
28+
}
29+
30+
variable "share" {
31+
type = string
32+
default = "owner"
33+
validation {
34+
condition = var.share == "owner" || var.share == "authenticated" || var.share == "public"
35+
error_message = "Incorrect value. Please set either 'owner', 'authenticated', or 'public'."
36+
}
37+
}
38+
39+
variable "order" {
40+
type = number
41+
description = "The order determines the position of app in the UI presentation. The lowest order is shown first and apps with equal order are sorted by name (ascending order)."
42+
default = null
43+
}
44+
45+
resource "coder_script" "airflow" {
46+
agent_id = var.agent_id
47+
display_name = "airflow"
48+
icon = "/icon/apache-guacamole.svg"
49+
script = templatefile("${path.module}/run.sh", {
50+
LOG_PATH : var.log_path,
51+
PORT : var.port
52+
})
53+
run_on_start = true
54+
}
55+
56+
resource "coder_app" "airflow" {
57+
agent_id = var.agent_id
58+
slug = "airflow"
59+
display_name = "airflow"
60+
url = "http://localhost:${var.port}"
61+
icon = "/icon/apache-guacamole.svg"
62+
subdomain = true
63+
share = var.share
64+
order = var.order
65+
}

apache-airflow/run.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env sh
2+
3+
BOLD='\033[0;1m'
4+
5+
PATH=$PATH:~/.local/bin
6+
pip install --upgrade apache-airflow
7+
8+
filename=~/airflow/airflow.db
9+
if ! [ -f $filename ] || ! [ -s $filename ]
10+
then
11+
airflow db init
12+
fi
13+
14+
airflow webserver >${LOG_PATH} 2>&1 &
15+
16+
airflow users create -u admin -p admin -r Admin -e [email protected] -f Coder -l User

0 commit comments

Comments
 (0)