Add _app generic and use it for thug template
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
bea85542a6
commit
77ac3b8982
@ -9,6 +9,11 @@ SPLUNK_VERSIONS = ("9.1", "9.2", "9.3")
|
|||||||
UBUNTU_VERSIONS = ("24.04",)
|
UBUNTU_VERSIONS = ("24.04",)
|
||||||
|
|
||||||
TEMPLATES = {
|
TEMPLATES = {
|
||||||
|
"_app": {
|
||||||
|
"thug": {
|
||||||
|
"image": "cr.smcm.xyz/coder-images/thug",
|
||||||
|
}
|
||||||
|
},
|
||||||
"_distro": {
|
"_distro": {
|
||||||
"alpine": {
|
"alpine": {
|
||||||
"distro_name": "Alpine Linux",
|
"distro_name": "Alpine Linux",
|
||||||
|
|||||||
121
_app.tf.j2
Normal file
121
_app.tf.j2
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
{% extends "base.tf.j2" %}
|
||||||
|
|
||||||
|
{% block parameters %}
|
||||||
|
{{ super() }}
|
||||||
|
|
||||||
|
{% if coder_parameters %}
|
||||||
|
{% for param in coder_parameters %}
|
||||||
|
data "coder_parameter" "{{ param.name }}" {
|
||||||
|
name = "{{ param.display_name | default(param.name) }}"
|
||||||
|
ephemeral = {{ param.ephemeral | default("false", true) }}
|
||||||
|
mutable = {{ param.mutable | default("true", true) }}
|
||||||
|
type = "{{ param.type | default("string")}}"
|
||||||
|
|
||||||
|
{% if param.default %}
|
||||||
|
default = "{{ param.default }}"
|
||||||
|
{% endif %}
|
||||||
|
{% if param.description %}
|
||||||
|
description = "{{ param.description }}"
|
||||||
|
{% endif %}
|
||||||
|
{% if param.display_name %}
|
||||||
|
display_name = "{{ param.display_name }}"
|
||||||
|
{% endif %}
|
||||||
|
{% if param.form_type %}
|
||||||
|
form_type = "{{ param.form_type }}"
|
||||||
|
{% endif %}
|
||||||
|
{% if param.icon %}
|
||||||
|
icon = "{{ param.icon }}"
|
||||||
|
{% endif %}
|
||||||
|
{% if param.order %}
|
||||||
|
order = {{ param.order }}
|
||||||
|
{% endif %}
|
||||||
|
{% if param.styling %}
|
||||||
|
styling = "{{ param.styling }}"
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% for option in param.options %}
|
||||||
|
option {
|
||||||
|
{% if hasattr(option, "items") %}
|
||||||
|
name = "{{ option.name }}"
|
||||||
|
value = "{{ option.value | default(option.name) }}"
|
||||||
|
{% if option.description %}
|
||||||
|
description = "{{ option.description }}"
|
||||||
|
{% endif %}
|
||||||
|
{% if option.icon %}
|
||||||
|
icon = "{{ option.icon }}"
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
name = "{{ option }}"
|
||||||
|
value = "{{ option }}"
|
||||||
|
{% endif %}
|
||||||
|
}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{% if param.validation %}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block coder_apps %}
|
||||||
|
{% if coder_apps %}
|
||||||
|
{% for app in coder_apps %}
|
||||||
|
resource "coder_app" "jupyter" {
|
||||||
|
agent_id = coder_agent.main.id
|
||||||
|
display_name = {{ app.display_name }}
|
||||||
|
slug = {{ app.slug }}
|
||||||
|
icon = {{ app.icon }}
|
||||||
|
url = {{ app.url }}
|
||||||
|
subdomain = true
|
||||||
|
share = "owner"
|
||||||
|
|
||||||
|
{% if app.healthcheck %}
|
||||||
|
healthcheck {
|
||||||
|
url = {{ app.healthcheck.url }}
|
||||||
|
interval = {{ app.healthcheck.interval | default(3) }}
|
||||||
|
threshold = {{ app.healthcheck.threshold | default (10) }}
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
|
}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block kubernetes_pod_extra_env %}
|
||||||
|
{% if envvars %}
|
||||||
|
{% for envvar in envvars %}
|
||||||
|
env {
|
||||||
|
name = "{{ envvar.name | upper() }}"
|
||||||
|
value = "{{ envvar.value }}"
|
||||||
|
}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block kubernetes_pod_main_volume_mount %}
|
||||||
|
{% if main_volume_mount_path %}
|
||||||
|
volume_mount {
|
||||||
|
mount_path = "{{ main_volume_mount_path }}"
|
||||||
|
name = "home"
|
||||||
|
read_only = false
|
||||||
|
}
|
||||||
|
{% else %}
|
||||||
|
{{ super() }}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block post_startup_script_setup_home %}
|
||||||
|
{% if startup_script %}
|
||||||
|
{{ startup_script }}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block kubernetes_pod_main_image %}
|
||||||
|
{% if ":" in image %}
|
||||||
|
image = "{{image}}"
|
||||||
|
{% else %}
|
||||||
|
image = "{{image}}:latest"
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
@ -1,39 +0,0 @@
|
|||||||
{% extends "base.tf.j2" %}
|
|
||||||
|
|
||||||
{% block coder_apps %}
|
|
||||||
resource "coder_app" "jupyter" {
|
|
||||||
agent_id = coder_agent.main.id
|
|
||||||
display_name = "Jupyter lab"
|
|
||||||
slug = "jupyter"
|
|
||||||
icon = "/icon/jupyter.svg"
|
|
||||||
url = "http://localhost:8888/"
|
|
||||||
subdomain = true
|
|
||||||
share = "owner"
|
|
||||||
|
|
||||||
healthcheck {
|
|
||||||
url = "http://localhost:8888/api"
|
|
||||||
interval = 3
|
|
||||||
threshold = 10
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block kubernetes_pod_main_env %}
|
|
||||||
env {
|
|
||||||
name = "CONDA_ENVS_PATH"
|
|
||||||
value = "/home/jovyan/envs"
|
|
||||||
}
|
|
||||||
env {
|
|
||||||
name = "DOCKER_STACKS_JUPYTER_CMD"
|
|
||||||
value = "lab"
|
|
||||||
}
|
|
||||||
env {
|
|
||||||
name = "NOTEBOOK_ARGS"
|
|
||||||
value = "--no-browser --ServerApp.token='' --ip='*'"
|
|
||||||
}
|
|
||||||
{{ super() }}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block post_startup_script_setup_home %}
|
|
||||||
/usr/local/bin/start-notebook.sh | tee jupyter-startup.log &
|
|
||||||
{% endblock %}
|
|
||||||
Reference in New Issue
Block a user