disabled skel functionality for now
ci/woodpecker/push/woodpecker Pipeline failed Details

main
Johannes Bülow 2024-02-01 17:32:46 +01:00
parent 39c969ec51
commit 0e21438cc8
Signed by untrusted user who does not match committer: jmb
GPG Key ID: B56971CF7B8F83A6
6 changed files with 43 additions and 7 deletions

View File

@ -8,3 +8,5 @@
5533801d-70e3-4c21-9942-82d20930c789
5533801d-70e3-4c21-9942-82d20930c789
5533801d-70e3-4c21-9942-82d20930c789
5533801d-70e3-4c21-9942-82d20930c789
5533801d-70e3-4c21-9942-82d20930c789

View File

@ -12,6 +12,9 @@ On Debian 12, you will need the following dependencies:
apt install -y git wget podman make gcc libgpgme-dev build-essential pkgconf pkgconf-bin libdevmapper-dev libbtrfs-dev
```
## Installing
Executing `make install` will install and start podterminal as a systemd service, including an example config file.
## Running
To run the built binary, just execute it as root. You will have to have Podman installed and its socket enabled.
Currently you have to set the Image, port etc. directly in the Source Code, however that should be eventually moved into

View File

@ -9,7 +9,7 @@ envvars:
# HTTP_PROXY: 192.168.0.10
# Container Image you want to use
image: lscr.io/linuxserver/webtop
image: git.jmbit.de/jmb/webtop-plus:latest
# Maximum age of Session
maxage: 10800
# Port Podterminal should listen to
@ -17,9 +17,8 @@ port: 80
# Files that will be copied into container on startup
skel: /etc/podterminal/skel.tar.gz
skel_target: /config
skel_chown: true
# Currently useless
skel_owner: "abc"
# Overrides UID/GID from tar archive to container user
skel_chown: false
ssl: false
ssl_cert: /etc/ssl/certs/ssl-cert-snakeoil.pem
ssl_cert_key: /etc/ssl/private/ssl-cert-snakeoil.key

View File

@ -1,10 +1,13 @@
package pods
import (
"bytes"
"fmt"
"io"
"log"
"net/http"
"os"
"strings"
"github.com/containers/podman/v4/pkg/bindings"
"github.com/containers/podman/v4/pkg/bindings/containers"
@ -65,7 +68,36 @@ func CopySkelToContainer(id string) error {
return err
}
log.Println(response.StatusCode, response.Body)
if viper.GetString("skel_user") != "" {
chownSkel(id)
}
// Manually chown the Directory, because podmans chown is sometimes unreliable
return response.Process(nil)
}
func chownSkel(id string) {
command := fmt.Sprintf(
"chown -R %s %s \n\n",
viper.GetString("skel_user"),
viper.GetString("skel_target"),
)
done := make(chan bool)
detachKeys := "\n\n"
commandReader := strings.NewReader(command)
var output bytes.Buffer
outputWriter := io.Writer(&output)
options := &containers.AttachOptions{
DetachKeys: &detachKeys,
}
err := containers.Attach(Socket, id, commandReader, outputWriter, outputWriter, done, options)
if err != nil {
log.Printf("Error: %v \n %s\n", err, output.String())
} else {
log.Println(output.String())
}
}

View File

@ -12,14 +12,14 @@ func readConfigFile() {
viper.SetConfigFile("/etc/podterminal/config.yaml")
viper.SetDefault("port", 80)
viper.SetDefault("ip_addr", "0.0.0.0")
viper.SetDefault("image", "lscr.io/linuxserver/webtop")
viper.SetDefault("image", "git.jmbit.de/jmb/webtop-plus:latest")
viper.SetDefault("maxAge", 10800)
viper.SetDefault("dri", false)
viper.SetDefault("dir_node", "/dev/dri/renderD128")
viper.SetDefault("skel", "/etc/podterminal/skel.tar.gz")
viper.SetDefault("skel_chown", false)
viper.SetDefault("skel_target", "/")
viper.SetDefault("skel_owner", "abc")
viper.SetDefault("skel_user", "")
viper.SetDefault("block_filebrowser", false)
viper.SetDefault("envvars",
map[string]string{

View File

@ -58,7 +58,7 @@ func containerProxy(c *gin.Context) {
}
// Soft fail Skel
_ = pods.CopySkelToContainer(ct)
// _ = pods.CopySkelToContainer(ct)
proxies[ct], err = createReverseProxy(fmt.Sprintf("http://%s:3000", ctip))