nomad
created pr with
1.1
cmds
checkout latest patchset:
ssh pr.in0rdr.ch print 1 | git am -3checkout any patchset in a patch request:
ssh pr.in0rdr.ch print 1.[rev] | git am -3add changes to patch request:
git format-patch main --stdout | ssh pr.in0rdr.ch pr add 1
Patchset
1.1
feat: add pico
Andreas Gruhler
2024-08-28This adds pico, a simplistic git collaboration service: * https://github.com/picosh/git-pr I hope that it is useful for other people that would like to contribute some part of code or documentation, but hesitate to open an account with any code "forge" or service like Github, Gitlab, etc..
Semantic diff summary
0 added,
0 modified,
0 signature changed,
0 removed
across 0 analyzed files
(5 files skipped: unsupported file type)
+135
-0
hcl/default/pico/pico.nomad
#
| ... | ... | @@ -0,0 +1,135 @@ | |
| 1 | + | # https://github.com/picosh/git-pr/blob/main/docker-compose.prod.yml | |
| 2 | + | job "pico" { | |
| 3 | + | datacenters = ["dc1"] | |
| 4 | + | ||
| 5 | + | priority = 80 | |
| 6 | + | ||
| 7 | + | group "server" { | |
| 8 | + | count = 1 | |
| 9 | + | ||
| 10 | + | volume "pico" { | |
| 11 | + | type = "csi" | |
| 12 | + | source = "pico" | |
| 13 | + | access_mode = "multi-node-multi-writer" | |
| 14 | + | attachment_mode = "file-system" | |
| 15 | + | } | |
| 16 | + | volume "tls" { | |
| 17 | + | type = "csi" | |
| 18 | + | source = "certbot" | |
| 19 | + | access_mode = "multi-node-multi-writer" | |
| 20 | + | attachment_mode = "file-system" | |
| 21 | + | } | |
| 22 | + | ||
| 23 | + | network { | |
| 24 | + | port "web" { | |
| 25 | + | to = 3000 | |
| 26 | + | } | |
| 27 | + | port "ssh" { | |
| 28 | + | to = 2222 | |
| 29 | + | static = 44405 | |
| 30 | + | } | |
| 31 | + | port "https" { | |
| 32 | + | static = 44406 | |
| 33 | + | } | |
| 34 | + | } | |
| 35 | + | ||
| 36 | + | task "web" { | |
| 37 | + | driver = "podman" | |
| 38 | + | ||
| 39 | + | config { | |
| 40 | + | image = "ghcr.io/picosh/pico/git-web:latest" | |
| 41 | + | ports = ["web"] | |
| 42 | + | volumes = [ | |
| 43 | + | # mount the templated config from the task directory to the container | |
| 44 | + | "local/git-pr.toml:/app/git-pr.toml", | |
| 45 | + | ] | |
| 46 | + | } | |
| 47 | + | ||
| 48 | + | template { | |
| 49 | + | destination = "${NOMAD_TASK_DIR}/.env" | |
| 50 | + | data = file("./templates/.env.tmpl") | |
| 51 | + | env = true | |
| 52 | + | } | |
| 53 | + | ||
| 54 | + | template { | |
| 55 | + | destination = "${NOMAD_TASK_DIR}/git-pr.toml" | |
| 56 | + | data = file("./templates/git-pr.toml.tmpl") | |
| 57 | + | } | |
| 58 | + | ||
| 59 | + | volume_mount { | |
| 60 | + | volume = "pico" | |
| 61 | + | destination = "/app/data" | |
| 62 | + | } | |
| 63 | + | ||
| 64 | + | resources { | |
| 65 | + | memory = 256 | |
| 66 | + | memory_max = 512 | |
| 67 | + | cpu = 250 | |
| 68 | + | } | |
| 69 | + | } | |
| 70 | + | ||
| 71 | + | task "ssh" { | |
| 72 | + | driver = "podman" | |
| 73 | + | ||
| 74 | + | config { | |
| 75 | + | image = "ghcr.io/picosh/pico/git-ssh:latest" | |
| 76 | + | ports = ["ssh"] | |
| 77 | + | volumes = [ | |
| 78 | + | # mount the templated config from the task directory to the container | |
| 79 | + | "local/git-pr.toml:/app/git-pr.toml", | |
| 80 | + | ] | |
| 81 | + | } | |
| 82 | + | ||
| 83 | + | template { | |
| 84 | + | destination = "${NOMAD_TASK_DIR}/.env" | |
| 85 | + | data = file("./templates/.env.tmpl") | |
| 86 | + | env = true | |
| 87 | + | } | |
| 88 | + | ||
| 89 | + | template { | |
| 90 | + | destination = "${NOMAD_TASK_DIR}/git-pr.toml" | |
| 91 | + | data = file("./templates/git-pr.toml.tmpl") | |
| 92 | + | } | |
| 93 | + | ||
| 94 | + | volume_mount { | |
| 95 | + | volume = "pico" | |
| 96 | + | destination = "/app/data" | |
| 97 | + | } | |
| 98 | + | ||
| 99 | + | resources { | |
| 100 | + | memory = 256 | |
| 101 | + | memory_max = 512 | |
| 102 | + | cpu = 250 | |
| 103 | + | } | |
| 104 | + | } | |
| 105 | + | ||
| 106 | + | task "nginx" { | |
| 107 | + | driver = "podman" | |
| 108 | + | ||
| 109 | + | config { | |
| 110 | + | image = "docker.io/library/nginx:stable-alpine" | |
| 111 | + | ports = ["https"] | |
| 112 | + | volumes = [ | |
| 113 | + | # mount the templated config from the task directory to the container | |
| 114 | + | "local/pico.conf:/etc/nginx/conf.d/pico.conf", | |
| 115 | + | ] | |
| 116 | + | } | |
| 117 | + | ||
| 118 | + | volume_mount { | |
| 119 | + | volume = "tls" | |
| 120 | + | destination = "/etc/letsencrypt" | |
| 121 | + | } | |
| 122 | + | ||
| 123 | + | template { | |
| 124 | + | destination = "${NOMAD_TASK_DIR}/pico.conf" | |
| 125 | + | data = file("./templates/nginx.conf.tmpl") | |
| 126 | + | } | |
| 127 | + | ||
| 128 | + | resources { | |
| 129 | + | memory = 50 | |
| 130 | + | memory_max = 128 | |
| 131 | + | cpu = 200 | |
| 132 | + | } | |
| 133 | + | } | |
| 134 | + | } | |
| 135 | + | } |
+14
-0
hcl/default/pico/templates/.env.tmpl
#
| ... | ... | @@ -0,0 +1,14 @@ | |
| 1 | + | # https://github.com/picosh/git-pr/blob/main/.env.example | |
| 2 | + | CF_API_TOKEN= | |
| 3 | + | ||
| 4 | + | GITPR_V4= | |
| 5 | + | GITPR_V6= | |
| 6 | + | GITPR_HTTP_V4=$GIT_V4:80 | |
| 7 | + | GITPR_HTTP_V6=[$GIT_V6]:80 | |
| 8 | + | GITPR_HTTPS_V4=$GIT_V4:443 | |
| 9 | + | GITPR_HTTPS_V6=[$GIT_V6]:443 | |
| 10 | + | GITPR_SSH_V4=$GIT_V4:22 | |
| 11 | + | GITPR_SSH_V6=[$GIT_V6]:22 | |
| 12 | + | GITPR_HOST= | |
| 13 | + | GITPR_SSH_PORT=2222 | |
| 14 | + | GITPR_WEB_PORT=3000 |
+15
-0
hcl/default/pico/templates/git-pr.toml.tmpl
#
| ... | ... | @@ -0,0 +1,15 @@ | |
| 1 | + | # url is used for help commands, exclude protocol | |
| 2 | + | url = "-p 2222 pr.in0rdr.ch" | |
| 3 | + | # where we store the sqlite db, this toml file, git repos, and ssh host keys | |
| 4 | + | data_dir = "./data" | |
| 5 | + | # this gives users the ability to submit reviews and other admin permissions | |
| 6 | + | admins = ["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC2SnNAxEnre9hcPD74wNAouuXMgfIzwsB7qr88xSb8WS8CKqZGXzaQgebc0YExfV7PGyV6KUfu4KUvS1xDboRbU6ZLU4HdGlAi+hdv8dVVzdzCgFmdv5BEGam0SMhlzReWRiDvae0pObAPvAFg5ab6B/t1LjOosBOpPo2JfEkR6zfjDrMCYdEjWB5To1p5AX0BJneTiIeiEqR/05mZUk5L8hMFmwvm8QThd+SzpLY3zgWlWG7TlUQwx78xvell9KC0GChhwlkeEAwE3q1tq/LbgzvtY140Fg0bbBGcYQI4UvG85xfTfpbHeQ1RkSB8Rb8pMkaN7mT+3qhe08cHT9v3"] | |
| 7 | + | # set datetime format for our clients | |
| 8 | + | time_format = "2006-01-02" | |
| 9 | + | ||
| 10 | + | # add as many repos as you want | |
| 11 | + | [[repo]] | |
| 12 | + | id = "nomad" | |
| 13 | + | default_branch = "master" | |
| 14 | + | clone_addr = "https://git.in0rdr.ch/nomad.git" | |
| 15 | + | desc = "HCL and Docker files for Nomad deployments" |
+10
-0
hcl/default/pico/templates/nginx.conf.tmpl
#
+31
-0
hcl/default/pico/volume-pico.hcl
#
| ... | ... | @@ -0,0 +1,31 @@ | |
| 1 | + | # Register external nfs volume with Nomad CSI | |
| 2 | + | # https://www.nomadproject.io/docs/commands/volume/register | |
| 3 | + | type = "csi" | |
| 4 | + | # Unique ID of the volume, volume.source field in a job | |
| 5 | + | id = "pico" | |
| 6 | + | # Display name of the volume. | |
| 7 | + | name = "pico" | |
| 8 | + | # ID of the physical volume from the storage provider | |
| 9 | + | external_id = "csi-pico" | |
| 10 | + | plugin_id = "nfs" | |
| 11 | + | ||
| 12 | + | # You must provide at least one capability block | |
| 13 | + | # You must provide a block for each capability | |
| 14 | + | # youintend to use in a job's volume block | |
| 15 | + | # https://www.nomadproject.io/docs/commands/volume/register | |
| 16 | + | capability { | |
| 17 | + | access_mode = "multi-node-multi-writer" | |
| 18 | + | attachment_mode = "file-system" | |
| 19 | + | } | |
| 20 | + | ||
| 21 | + | # https://github.com/kubernetes-csi/csi-driver-nfs/blob/master/docs/driver-parameters.md | |
| 22 | + | context { | |
| 23 | + | server = "turris" | |
| 24 | + | share = "csi-pico" | |
| 25 | + | } | |
| 26 | + | ||
| 27 | + | mount_options { | |
| 28 | + | # mount.nfs: Either use '-o nolock' to keep locks local, or start statd. | |
| 29 | + | mount_flags = ["nolock"] | |
| 30 | + | } | |
| 31 | + |