From f15a8cf7e36d1a83854b5e3cbc00618e904a4eb8 Mon Sep 17 00:00:00 2001 From: Jan Eitzinger Date: Tue, 10 May 2022 11:20:03 +0200 Subject: [PATCH] Remove obsolete util dir --- utils/README.md | 1 - utils/add-job.mjs | 40 ---------------------------------------- utils/gen-keypair.go | 22 ---------------------- utils/systemd/README.md | 30 ------------------------------ 4 files changed, 93 deletions(-) delete mode 100644 utils/README.md delete mode 100644 utils/add-job.mjs delete mode 100644 utils/gen-keypair.go delete mode 100644 utils/systemd/README.md diff --git a/utils/README.md b/utils/README.md deleted file mode 100644 index fabc774..0000000 --- a/utils/README.md +++ /dev/null @@ -1 +0,0 @@ -# Helper scripts diff --git a/utils/add-job.mjs b/utils/add-job.mjs deleted file mode 100644 index dc14039..0000000 --- a/utils/add-job.mjs +++ /dev/null @@ -1,40 +0,0 @@ -import fetch from 'node-fetch' - -// Just for testing - -const job = { - jobId: 123, - user: 'lou', - project: 'testproj', - cluster: 'heidi', - partition: 'default', - arrayJobId: 0, - numNodes: 1, - numHwthreads: 8, - numAcc: 0, - exclusive: 1, - monitoringStatus: 1, - smt: 1, - jobState: 'running', - duration: 2*60*60, - tags: [], - resources: [ - { - hostname: 'heidi', - hwthreads: [0, 1, 2, 3, 4, 5, 6, 7] - } - ], - metaData: null, - startTime: 1641427200 -} - -fetch('http://localhost:8080/api/jobs/start_job/', { - method: 'POST', - body: JSON.stringify(job), - headers: { - 'Content-Type': 'application/json', - 'Authorization': 'Bearer eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJpc19hZG1pbiI6dHJ1ZSwiaXNfYXBpIjpmYWxzZSwic3ViIjoibG91In0.nY6dCgLSdm7zXz1xPkrb_3JnnUCgExXeXcrTlAAySs4p72VKJhmzzC1RxgkJE26l8tDYUilM-o-urzlaqK5aDA' - } - }) - .then(res => res.status == 200 ? res.json() : res.text()) - .then(res => console.log(res)) diff --git a/utils/gen-keypair.go b/utils/gen-keypair.go deleted file mode 100644 index 905817d..0000000 --- a/utils/gen-keypair.go +++ /dev/null @@ -1,22 +0,0 @@ -package main - -import ( - "crypto/ed25519" - "crypto/rand" - "encoding/base64" - "fmt" - "os" -) - -func main() { - // rand.Reader uses /dev/urandom on Linux - pub, priv, err := ed25519.GenerateKey(rand.Reader) - if err != nil { - fmt.Fprintf(os.Stderr, "error: %s\n", err.Error()) - os.Exit(1) - } - - fmt.Fprintf(os.Stdout, "JWT_PUBLIC_KEY=%#v\nJWT_PRIVATE_KEY=%#v\n", - base64.StdEncoding.EncodeToString(pub), - base64.StdEncoding.EncodeToString(priv)) -} diff --git a/utils/systemd/README.md b/utils/systemd/README.md deleted file mode 100644 index ed715ab..0000000 --- a/utils/systemd/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# How to run this as a systemd deamon - -The files in this directory assume that you install the Golang version of ClusterCockpit to `/var/clustercockpit`. If you do not like that, you can choose any other location, but make sure to replace all paths that begin with `/var/clustercockpit` in the `clustercockpit.service` file! - -If you have not installed [yarn](https://yarnpkg.com/getting-started/install) and [go](https://go.dev/doc/install) already, do that (Golang is available in most package managers). - -The `config.json` can have the optional fields *user* and *group*. If provided, the application will call [setuid](https://man7.org/linux/man-pages/man2/setuid.2.html) and [setgid](https://man7.org/linux/man-pages/man2/setgid.2.html) after having read the config file and having bound to a TCP port (so that it can take a privileged port), but before it starts accepting any connections. This is good for security, but means that the directories `frontend/public`, `var/` and `templates/` must be readable by that user and `var/` writable as well (All paths relative to the repos root). The `.env` and `config.json` files might contain secrets and should not be readable by that user. If those files are changed, the server has to be restarted. - -```sh -# 1.: Clone this repository to /var/clustercockpit -git clone git@github.com:ClusterCockpit/cc-backend.git /var/clustercockpit - -# 2.: Install all dependencies and build everything -cd /var/clustercockpit -go get && go build && (cd ./frontend && yarn install && yarn build) - -# 3.: Modify the `./config.json` file from the directory which contains this README.md to your liking and put it in the repo root -cp ./utils/systemd/config.json ./config.json -vim ./config.json # do your thing... - -# 4.: Add the systemd service unit file -sudo ln -s /var/clustercockpit/utils/systemd/clustercockpit.service /etc/systemd/system/clustercockpit.service - -# 5.: Enable and start the server -sudo systemctl enable clustercockpit.service # optional (if done, (re-)starts automatically) -sudo systemctl start clustercockpit.service - -# Check whats going on: -sudo journalctl -u clustercockpit.service -```