Stormkit can run long-running server processes (for example Go HTTP servers) by using the Start command setting. This option is available only on self-hosted Stormkit instances.
To run a Go program, you typically compile a binary during the build step and start it with the Start command.
go.mod file in your build root..go-version or mise.toml.PORT environment variable.Example .go-version:
1.22.5
Example mise.toml:
[tools]
go = "1.22.5"
In Your App > Environments > Config:
go build -o .stormkit/server/app ./cmd/server.stormkit./appThis configuration will:
.stormkit/server.package main
import (
"log"
"net/http"
"os"
)
func main() {
port := os.Getenv("PORT")
if port == "" {
port = "3000"
}
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello from Go"))
})
log.Fatal(http.ListenAndServe(":"+port, nil))
}
go run ./cmd/server as the Start command, but compiling a binary is faster and more reliable..stormkit/server as part of the build step.