Compare commits

...

12 commits
v11 ... main

Author SHA1 Message Date
c7ed0f148f
Disable oom killer completely
All checks were successful
Unittests / deploy-dev (push) Successful in 57s
Unittests / unittests (push) Successful in 1m1s
Release / deploy-production (release) Successful in 1m6s
2025-06-14 12:38:08 +02:00
ec1f0d3f3a
No node-26
All checks were successful
Unittests / unittests (push) Successful in 15s
Unittests / deploy-dev (push) Successful in 42s
Release / deploy-production (release) Successful in 1m5s
2025-06-14 03:05:58 +02:00
3d559fc94d
Add wait time when container was in starting phase
Some checks failed
Unittests / unittests (push) Successful in 1m6s
Unittests / deploy-dev (push) Successful in 54s
Release / deploy-production (release) Failing after 1m6s
2025-06-14 02:52:31 +02:00
cx
0bc10b7154 Update .gitea/workflows/release.yml
All checks were successful
Unittests / unittests (push) Successful in 1m0s
Unittests / deploy-dev (push) Successful in 47s
Release / deploy-production (release) Successful in 1m29s
2025-05-28 21:43:46 +00:00
cx
0d81ffaa86 node-28.rosti.cz
All checks were successful
Unittests / deploy-dev (push) Successful in 1m5s
Unittests / unittests (push) Successful in 1m29s
Release / deploy-production (release) Successful in 1m6s
2025-04-01 18:03:29 +00:00
cx
a94ccbc554 Update .gitea/workflows/unittests.yml
All checks were successful
Unittests / deploy-dev (push) Successful in 45s
Unittests / unittests (push) Successful in 1m8s
2025-01-30 23:13:16 +00:00
cx
08f213e0de Update .gitea/workflows/unittests.yml
Some checks failed
Unittests / deploy-dev (push) Has been cancelled
Unittests / unittests (push) Has been cancelled
2025-01-30 23:12:49 +00:00
cx
231441f980 Update .gitea/workflows/unittests.yml
Some checks are pending
Unittests / unittests (push) Waiting to run
Unittests / deploy-dev (push) Waiting to run
2025-01-30 23:12:30 +00:00
622dd91ba6
node-26
All checks were successful
Unittests / unittests (push) Successful in 1m7s
Unittests / deploy-dev (push) Successful in 1m2s
Release / deploy-production (release) Successful in 2m17s
2024-11-19 14:50:14 +01:00
bc875b83a4
Add Bun
All checks were successful
Unittests / unittests (push) Successful in 14s
Unittests / deploy-dev (push) Successful in 47s
2024-07-13 12:05:40 +02:00
27152bad72
Debug line
All checks were successful
Unittests / unittests (push) Successful in 9s
Unittests / deploy-dev (push) Successful in 46s
2024-05-28 00:38:33 +02:00
27948ee5b6
HTTP API for snapshots
All checks were successful
Unittests / unittests (push) Successful in 9s
Unittests / deploy-dev (push) Successful in 41s
2024-05-27 18:51:56 +02:00
7 changed files with 146 additions and 10 deletions

View file

@ -11,7 +11,7 @@ jobs:
deploy-production: deploy-production:
runs-on: [amd64, prod] runs-on: [amd64, prod]
env: env:
NODES: node-22.rosti.cz node-23.rosti.cz node-24.rosti.cz node-25.rosti.cz NODES: node-22.rosti.cz node-23.rosti.cz node-24.rosti.cz node-25.rosti.cz node-28.rosti.cz node-29.rosti.cz
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: deploy - name: deploy

View file

@ -7,7 +7,7 @@ on:
jobs: jobs:
unittests: unittests:
runs-on: [amd64, moon] runs-on: [amd64, dev]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-go@v3 - uses: actions/setup-go@v3
@ -36,11 +36,14 @@ jobs:
# - 9001:9001 # - 9001:9001
# options: server /data --console-address :9001 # options: server /data --console-address :9001
deploy-dev: deploy-dev:
runs-on: [amd64, moon] runs-on: [amd64, dev]
env: env:
NODES: "192.168.1.33" NODES: "192.168.1.199"
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_MASTER_KEY }}
- name: deploy - name: deploy
run: | run: |
# echo LS1 # echo LS1

View file

@ -338,10 +338,13 @@ func (d *Driver) Create(name string, image string, volumePath string, HTTPPort i
} }
} }
OOMKillDisable := false // OOMKillDisable := false
if memory < 1500 { // if memory < 1500 {
OOMKillDisable = true // OOMKillDisable = true
} // }
// We disable OOM killer because it keeps containers in resource heavy loop
// This is from some discussion: If OOM-killer is disabled, tasks under cgroup will hang/sleep in memory cgroup's OOM-waitqueue when they request accountable memory
OOMKillDisable := true
envList := []string{} envList := []string{}
for key, value := range env { for key, value := range env {

View file

@ -100,6 +100,9 @@ func (p *Processor) waitForApp() error {
return err return err
} }
if status.Status == "running" { if status.Status == "running" {
if i > 0 {
time.Sleep(sleepFor) // We wait a little bit more to make sure the container is fully started
}
return nil return nil
} }

View file

@ -3,7 +3,6 @@ package main
import ( import (
"fmt" "fmt"
"io" "io"
"io/ioutil"
"log" "log"
"net/http" "net/http"
"os" "os"
@ -236,7 +235,7 @@ func clearPasswordHandler(c echo.Context) error {
func setKeysHandler(c echo.Context) error { func setKeysHandler(c echo.Context) error {
name := c.Param("name") name := c.Param("name")
body, err := ioutil.ReadAll(c.Request().Body) body, err := io.ReadAll(c.Request().Body)
if err != nil { if err != nil {
return c.JSONPretty(http.StatusInternalServerError, Message{Message: err.Error()}, JSONIndent) return c.JSONPretty(http.StatusInternalServerError, Message{Message: err.Error()}, JSONIndent)
} }
@ -495,3 +494,119 @@ func metricsHandler(c echo.Context) error {
return c.String(http.StatusOK, metrics) return c.String(http.StatusOK, metrics)
} }
func CreateSnapshotHandler(c echo.Context) error {
name := c.Param("name")
body := createSnapshotBody{}
err := c.Bind(body)
if err != nil {
return c.JSONPretty(http.StatusBadRequest, Message{Message: err.Error()}, JSONIndent)
}
processor := glue.Processor{
AppName: name,
DB: common.GetDBConnection(),
SnapshotProcessor: &snapshotProcessor,
DockerSock: config.DockerSocket,
BindIPHTTP: config.AppsBindIPHTTP,
BindIPSSH: config.AppsBindIPSSH,
AppsPath: config.AppsPath,
}
err = processor.CreateSnapshot(body.Labels)
if err != nil {
return c.JSONPretty(http.StatusInternalServerError, Message{Message: err.Error()}, JSONIndent)
}
return c.JSONPretty(http.StatusOK, Message{Message: "ok"}, JSONIndent)
}
func RestoreFromSnapshotHandler(c echo.Context) error {
name := c.Param("name")
snapshot := c.Param("snapshot")
processor := glue.Processor{
AppName: name,
DB: common.GetDBConnection(),
SnapshotProcessor: &snapshotProcessor,
DockerSock: config.DockerSocket,
BindIPHTTP: config.AppsBindIPHTTP,
BindIPSSH: config.AppsBindIPSSH,
AppsPath: config.AppsPath,
}
err := processor.RestoreFromSnapshot(snapshot)
if err != nil {
return c.JSONPretty(http.StatusInternalServerError, Message{Message: err.Error()}, JSONIndent)
}
return c.JSONPretty(http.StatusOK, Message{Message: "ok"}, JSONIndent)
}
func ListSnapshotsHandler(c echo.Context) error {
name := c.Param("name")
processor := glue.Processor{
AppName: name,
DB: common.GetDBConnection(),
SnapshotProcessor: &snapshotProcessor,
DockerSock: config.DockerSocket,
BindIPHTTP: config.AppsBindIPHTTP,
BindIPSSH: config.AppsBindIPSSH,
AppsPath: config.AppsPath,
}
snapshots, err := processor.ListSnapshots()
if err != nil {
return c.JSONPretty(http.StatusInternalServerError, Message{Message: err.Error()}, JSONIndent)
}
return c.JSON(http.StatusOK, snapshots)
}
func ListAppsSnapshotsHandler(c echo.Context) error {
name := c.Param("name")
apps := []string{}
err := c.Bind(&apps)
if err != nil {
return c.JSONPretty(http.StatusBadRequest, Message{Message: err.Error()}, JSONIndent)
}
processor := glue.Processor{
AppName: name,
DB: common.GetDBConnection(),
SnapshotProcessor: &snapshotProcessor,
DockerSock: config.DockerSocket,
BindIPHTTP: config.AppsBindIPHTTP,
BindIPSSH: config.AppsBindIPSSH,
AppsPath: config.AppsPath,
}
snapshots, err := processor.ListAppsSnapshots(apps)
if err != nil {
return c.JSONPretty(http.StatusInternalServerError, Message{Message: err.Error()}, JSONIndent)
}
return c.JSON(http.StatusOK, snapshots)
}
func ListSnapshotsByLabelHandler(c echo.Context) error {
label := c.Param("label")
processor := glue.Processor{
AppName: "",
DB: common.GetDBConnection(),
SnapshotProcessor: &snapshotProcessor,
DockerSock: config.DockerSocket,
BindIPHTTP: config.AppsBindIPHTTP,
BindIPSSH: config.AppsBindIPSSH,
AppsPath: config.AppsPath,
}
snapshots, err := processor.ListSnapshotsByLabel(label)
if err != nil {
return c.JSONPretty(http.StatusInternalServerError, Message{Message: err.Error()}, JSONIndent)
}
return c.JSON(http.StatusOK, snapshots)
}

View file

@ -198,6 +198,13 @@ func main() {
// Delete one app // Delete one app
e.DELETE("/v1/apps/:name", deleteAppHandler) e.DELETE("/v1/apps/:name", deleteAppHandler)
// Snapshots
e.POST("/v1/apps/:name/snapshots", CreateSnapshotHandler)
e.POST("/v1/apps/:name/snapshots/restore/:snapshot", RestoreFromSnapshotHandler)
e.GET("/v1/apps/:name/snapshots", ListSnapshotsHandler)
e.GET("/v1/snapshots", ListAppsSnapshotsHandler)
e.GET("/v1/snapshots/by-label", ListSnapshotsByLabelHandler)
// Orphans returns directories in /srv that doesn't match any hosted application // Orphans returns directories in /srv that doesn't match any hosted application
e.GET("/v1/orphans", getOrphansHander) e.GET("/v1/orphans", getOrphansHander)

View file

@ -56,6 +56,7 @@ type QuickServices struct {
PHP bool `json:"php"` PHP bool `json:"php"`
Ruby bool `json:"ruby"` Ruby bool `json:"ruby"`
Deno bool `json:"deno"` Deno bool `json:"deno"`
Bun bool `json:"bun"`
Memcached bool `json:"memcached"` Memcached bool `json:"memcached"`
Redis bool `json:"redis"` Redis bool `json:"redis"`
} }
@ -65,3 +66,7 @@ type Technology struct {
Name string Name string
Version string Version string
} }
type createSnapshotBody struct {
Labels []string `json:"labels"`
}