Openstatus www.openstatus.dev

🔥 ssh status (#1366)

* 🔥

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

authored by

Thibault Le Ouay
autofix-ci[bot]
and committed by
GitHub
40821c15 932c71e4

+201
+1
apps/ssh-server/.dockerignore
··· 1 + **/.ssh
+1
apps/ssh-server/.gitignore
··· 1 + .ssh/
+16
apps/ssh-server/Dockerfile
··· 1 + ARG GO_VERSION=1 2 + FROM golang:1.25.1-alpine as builder 3 + 4 + WORKDIR /usr/src/app 5 + COPY go.mod go.sum ./ 6 + RUN go mod download && go mod verify 7 + COPY . . 8 + RUN go build -v -o /ssh-status-server . 9 + 10 + 11 + FROM debian:bookworm 12 + 13 + COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ 14 + COPY --from=builder /ssh-status-server /app/ssh-status-server 15 + 16 + CMD ["/app/ssh-status-server"]
+8
apps/ssh-server/banner.txt
··· 1 + _ _ 2 + | | | | 3 + ___ _ __ ___ _ __ ___| |_ __ _| |_ _ _ ___ 4 + / _ \| '_ \ / _ \ '_ \/ __| __/ _` | __| | | / __| 5 + | (_) | |_) | __/ | | \__ \ || (_| | |_| |_| \__ \ 6 + \___/| .__/ \___|_| |_|___/\__\__,_|\__|\__,_|___/ 7 + | | 8 + |_|
+33
apps/ssh-server/fly.toml
··· 1 + # fly.toml app configuration file generated for ssh-server-status on 2025-09-16T08:46:39+02:00 2 + # 3 + # See https://fly.io/docs/reference/configuration/ for information about how to use this file. 4 + # 5 + 6 + app = 'ssh-server-status' 7 + primary_region = 'cdg' 8 + 9 + [build] 10 + dockerfile = './Dockerfile' 11 + 12 + 13 + 14 + [[services]] 15 + internal_port = 2222 16 + protocol = "tcp" 17 + auto_stop_machines = true 18 + auto_start_machines = true 19 + [[services.ports]] 20 + port = 22 21 + 22 + 23 + [env] 24 + PORT = "2222" 25 + 26 + [mounts] 27 + source = "ssh_key" 28 + destination = "/data" 29 + 30 + 31 + [[vm]] 32 + size = 'shared-cpu-1x' 33 + memory = '256MB'
+10
apps/ssh-server/go.mod
··· 1 + module github.com/openstatusHQ/openstatus/apps/ssh-server 2 + 3 + go 1.25.1 4 + 5 + require ( 6 + github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be // indirect 7 + github.com/gliderlabs/ssh v0.3.8 // indirect 8 + golang.org/x/crypto v0.42.0 // indirect 9 + golang.org/x/sys v0.36.0 // indirect 10 + )
+8
apps/ssh-server/go.sum
··· 1 + github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= 2 + github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= 3 + github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c= 4 + github.com/gliderlabs/ssh v0.3.8/go.mod h1:xYoytBv1sV0aL3CavoDuJIQNURXkkfPA/wxQ1pL1fAU= 5 + golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI= 6 + golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8= 7 + golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k= 8 + golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
+123
apps/ssh-server/main.go
··· 1 + package main 2 + 3 + import ( 4 + _ "embed" 5 + "encoding/json" 6 + "fmt" 7 + "io" 8 + "log" 9 + "net/http" 10 + 11 + "github.com/gliderlabs/ssh" 12 + ) 13 + 14 + //go:embed banner.txt 15 + var banner string 16 + 17 + func bannerfunc(ctx ssh.Context) string { 18 + return banner 19 + } 20 + 21 + var statusOk = ` 22 + +----------------------------------+ 23 + | | 24 + | All Systems Operational | 25 + | | 26 + +----------------------------------+ 27 + ` 28 + var statusDegraded = ` 29 + +----------------------------------+ 30 + | | 31 + | System is degraded | 32 + | | 33 + +----------------------------------+ 34 + ` 35 + var statusPartialOutage = ` 36 + +----------------------------------+ 37 + | | 38 + | System is partially out of | 39 + | service | 40 + | | 41 + +----------------------------------+ 42 + ` 43 + var statusMajorOutage = ` 44 + +----------------------------------+ 45 + | | 46 + | System is out of service | 47 + | | 48 + +----------------------------------+ 49 + ` 50 + var statusUnderMaintenance = ` 51 + +----------------------------------+ 52 + | | 53 + | System is under | 54 + | maintenance | 55 + | | 56 + +----------------------------------+ 57 + ` 58 + var statusIncident = ` 59 + +----------------------------------+ 60 + | | 61 + | System is partially out of | 62 + | service | 63 + | | 64 + +----------------------------------+ 65 + ` 66 + 67 + type status struct { 68 + Status string `json:"status"` 69 + } 70 + 71 + func handler(s ssh.Session) { 72 + url := fmt.Sprintf("https://api.openstatus.dev/public/status/%s", s.User()) 73 + res, err := http.Get(url) 74 + if err != nil { 75 + fmt.Fprintf(s, "Error fetching status: %v\n", err) 76 + return 77 + } 78 + defer res.Body.Close() 79 + var status status 80 + json.NewDecoder(res.Body).Decode(&status) 81 + 82 + var currentStatus string 83 + switch status.Status { 84 + case "operational": 85 + currentStatus = statusOk 86 + case "degraded_performance": 87 + currentStatus = statusDegraded 88 + case "partial_outage": 89 + currentStatus = statusPartialOutage 90 + case "major_outage": 91 + currentStatus = statusMajorOutage 92 + case "under_maintenance": 93 + currentStatus = statusUnderMaintenance 94 + case "incident": 95 + currentStatus = statusIncident 96 + default: 97 + currentStatus = "" 98 + } 99 + 100 + if currentStatus == "" { 101 + io.WriteString(s, "Unknown status page") 102 + return 103 + } 104 + 105 + io.WriteString(s, fmt.Sprintf("\nCurrent Status for: %s\n\n%s\n\nVisit the status page at https://%s.openstatus.dev/\n\n", s.User(), currentStatus, s.User())) 106 + } 107 + 108 + func main() { 109 + 110 + server := &ssh.Server{ 111 + Addr: ":2222", 112 + BannerHandler: bannerfunc, 113 + Handler: handler, 114 + 115 + } 116 + ssh.HostKeyFile("/data/id_rsa") 117 + // server.AddHostKey(ssh.HostKeyFile(filepath string)) 118 + 119 + log.Println("starting ssh server on port 2222...") 120 + log.Fatal(server.ListenAndServe()) 121 + 122 + 123 + }
+1
packages/db/src/schema/pages/constants.ts
··· 10 10 "light", 11 11 "workflows", 12 12 "template", 13 + "ssh", 13 14 ];