mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-24 12:29:05 +01:00
Merge branch 'master' of https://github.com/ClusterCockpit/cc-backend
This commit is contained in:
commit
483443afe6
2
Makefile
2
Makefile
@ -2,7 +2,7 @@ TARGET = ./cc-backend
|
|||||||
VAR = ./var
|
VAR = ./var
|
||||||
DB = ./var/job.db
|
DB = ./var/job.db
|
||||||
FRONTEND = ./web/frontend
|
FRONTEND = ./web/frontend
|
||||||
VERSION = 0.1
|
VERSION = 1
|
||||||
GIT_HASH := $(shell git rev-parse --short HEAD || echo 'development')
|
GIT_HASH := $(shell git rev-parse --short HEAD || echo 'development')
|
||||||
CURRENT_TIME = $(shell date +"%Y-%m-%d:T%H:%M:%S")
|
CURRENT_TIME = $(shell date +"%Y-%m-%d:T%H:%M:%S")
|
||||||
LD_FLAGS = '-s -X main.buildTime=${CURRENT_TIME} -X main.version=${VERSION} -X main.hash=${GIT_HASH}'
|
LD_FLAGS = '-s -X main.buildTime=${CURRENT_TIME} -X main.version=${VERSION} -X main.hash=${GIT_HASH}'
|
||||||
|
@ -84,6 +84,8 @@ func main() {
|
|||||||
fmt.Printf("Version:\t%s\n", version)
|
fmt.Printf("Version:\t%s\n", version)
|
||||||
fmt.Printf("Git hash:\t%s\n", hash)
|
fmt.Printf("Git hash:\t%s\n", hash)
|
||||||
fmt.Printf("Build time:\t%s\n", buildTime)
|
fmt.Printf("Build time:\t%s\n", buildTime)
|
||||||
|
fmt.Printf("SQL db version:\t%d\n", repository.Version)
|
||||||
|
fmt.Printf("Job archive version:\t%d\n", archive.Version)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,50 +1,50 @@
|
|||||||
{
|
{
|
||||||
"addr": "127.0.0.1:8080",
|
"addr": "127.0.0.1:8080",
|
||||||
"archive": {
|
"archive": {
|
||||||
"kind": "file",
|
"kind": "file",
|
||||||
"path": "./var/job-archive"
|
"path": "./var/job-archive"
|
||||||
},
|
},
|
||||||
"clusters": [
|
"clusters": [
|
||||||
{
|
{
|
||||||
"name": "emmy",
|
"name": "fritz",
|
||||||
"metricDataRepository": {
|
"metricDataRepository": {
|
||||||
"kind": "cc-metric-store",
|
"kind": "cc-metric-store",
|
||||||
"url": "http://localhost:8081",
|
"url": "http://localhost:8082",
|
||||||
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSJ9.eyJ1c2VyIjoiYWRtaW4iLCJyb2xlcyI6WyJST0xFX0FETUlOIiwiUk9MRV9BTkFMWVNUIiwiUk9MRV9VU0VSIl19.d-3_3FZTsadPjDEdsWrrQ7nS0edMAR4zjl-eK7rJU3HziNBfI9PDHDIpJVHTNN5E5SlLGLFXctWyKAkwhXL-Dw"
|
"token": ""
|
||||||
},
|
},
|
||||||
"filterRanges": {
|
"filterRanges": {
|
||||||
"numNodes": {
|
"numNodes": {
|
||||||
"from": 1,
|
"from": 1,
|
||||||
"to": 32
|
"to": 64
|
||||||
},
|
},
|
||||||
"duration": {
|
"duration": {
|
||||||
"from": 0,
|
"from": 0,
|
||||||
"to": 172800
|
"to": 86400
|
||||||
},
|
},
|
||||||
"startTime": {
|
"startTime": {
|
||||||
"from": "2010-01-01T00:00:00Z",
|
"from": "2022-01-01T00:00:00Z",
|
||||||
"to": null
|
"to": null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "woody",
|
"name": "alex",
|
||||||
"metricDataRepository": {
|
"metricDataRepository": {
|
||||||
"kind": "cc-metric-store",
|
"kind": "cc-metric-store",
|
||||||
"url": "http://localhost:8081",
|
"url": "http://localhost:8082",
|
||||||
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSJ9.eyJ1c2VyIjoiYWRtaW4iLCJyb2xlcyI6WyJST0xFX0FETUlOIiwiUk9MRV9BTkFMWVNUIiwiUk9MRV9VU0VSIl19.d-3_3FZTsadPjDEdsWrrQ7nS0edMAR4zjl-eK7rJU3HziNBfI9PDHDIpJVHTNN5E5SlLGLFXctWyKAkwhXL-Dw"
|
"token": ""
|
||||||
},
|
},
|
||||||
"filterRanges": {
|
"filterRanges": {
|
||||||
"numNodes": {
|
"numNodes": {
|
||||||
"from": 1,
|
"from": 1,
|
||||||
"to": 1
|
"to": 64
|
||||||
},
|
},
|
||||||
"duration": {
|
"duration": {
|
||||||
"from": 0,
|
"from": 0,
|
||||||
"to": 172800
|
"to": 86400
|
||||||
},
|
},
|
||||||
"startTime": {
|
"startTime": {
|
||||||
"from": "2015-01-01T00:00:00Z",
|
"from": "2022-01-01T00:00:00Z",
|
||||||
"to": null
|
"to": null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// @title ClusterCockpit REST API
|
// @title ClusterCockpit REST API
|
||||||
// @version 0.2.0
|
// @version 1
|
||||||
// @description API for batch job control.
|
// @description API for batch job control.
|
||||||
|
|
||||||
// @tag.name Job API
|
// @tag.name Job API
|
||||||
|
@ -17,7 +17,7 @@ import (
|
|||||||
"github.com/golang-migrate/migrate/v4/source/iofs"
|
"github.com/golang-migrate/migrate/v4/source/iofs"
|
||||||
)
|
)
|
||||||
|
|
||||||
const supportedVersion uint = 3
|
const Version uint = 3
|
||||||
|
|
||||||
//go:embed migrations/*
|
//go:embed migrations/*
|
||||||
var migrationFiles embed.FS
|
var migrationFiles embed.FS
|
||||||
@ -65,13 +65,13 @@ func checkDBVersion(backend string, db *sql.DB) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if v < supportedVersion {
|
if v < Version {
|
||||||
log.Warnf("Unsupported database version %d, need %d.\nPlease backup your database file and run cc-backend --migrate-db", v, supportedVersion)
|
log.Warnf("Unsupported database version %d, need %d.\nPlease backup your database file and run cc-backend --migrate-db", v, Version)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
if v > supportedVersion {
|
if v > Version {
|
||||||
log.Warnf("Unsupported database version %d, need %d.\nPlease refer to documentation how to downgrade db with external migrate tool!", v, supportedVersion)
|
log.Warnf("Unsupported database version %d, need %d.\nPlease refer to documentation how to downgrade db with external migrate tool!", v, Version)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,10 @@ import (
|
|||||||
"github.com/ClusterCockpit/cc-backend/pkg/schema"
|
"github.com/ClusterCockpit/cc-backend/pkg/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
const Version = 1
|
const Version uint64 = 1
|
||||||
|
|
||||||
type ArchiveBackend interface {
|
type ArchiveBackend interface {
|
||||||
Init(rawConfig json.RawMessage) (int, error)
|
Init(rawConfig json.RawMessage) (uint64, error)
|
||||||
|
|
||||||
LoadJobMeta(job *schema.Job) (*schema.JobMeta, error)
|
LoadJobMeta(job *schema.Job) (*schema.JobMeta, error)
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ func loadJobData(filename string, isCompressed bool) (schema.JobData, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fsa *FsArchive) Init(rawConfig json.RawMessage) (int, error) {
|
func (fsa *FsArchive) Init(rawConfig json.RawMessage) (uint64, error) {
|
||||||
|
|
||||||
var config FsArchiveConfig
|
var config FsArchiveConfig
|
||||||
if err := json.Unmarshal(rawConfig, &config); err != nil {
|
if err := json.Unmarshal(rawConfig, &config); err != nil {
|
||||||
@ -121,7 +121,7 @@ func (fsa *FsArchive) Init(rawConfig json.RawMessage) (int, error) {
|
|||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
version, err := strconv.Atoi(strings.TrimSuffix(string(b), "\n"))
|
version, err := strconv.ParseUint(strings.TrimSuffix(string(b), "\n"), 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("fsBackend Init()- %v", err)
|
log.Errorf("fsBackend Init()- %v", err)
|
||||||
return 0, err
|
return 0, err
|
||||||
|
11
startDemo.sh
11
startDemo.sh
@ -5,16 +5,13 @@ if [ -d './var' ]; then
|
|||||||
./cc-backend --server --dev
|
./cc-backend --server --dev
|
||||||
else
|
else
|
||||||
make
|
make
|
||||||
|
wget https://hpc-mover.rrze.uni-erlangen.de/HPC-Data/0x7b58aefb/eig7ahyo6fo2bais0ephuf2aitohv1ai/job-archive-demo.tar
|
||||||
cd var
|
tar xf job-archive-demo.tar
|
||||||
wget https://hpc-mover.rrze.uni-erlangen.de/HPC-Data/0x7b58aefb/eig7ahyo6fo2bais0ephuf2aitohv1ai/job-archive-dev.tar.xz
|
rm ./job-archive-demo.tar
|
||||||
tar xJf job-archive-dev.tar.xz
|
|
||||||
rm ./job-archive-dev.tar.xz
|
|
||||||
cd ../
|
|
||||||
|
|
||||||
cp ./configs/env-template.txt .env
|
cp ./configs/env-template.txt .env
|
||||||
cp ./docs/config.json config.json
|
cp ./docs/config.json config.json
|
||||||
|
|
||||||
./cc-backend --migrate-db
|
./cc-backend --migrate-db
|
||||||
./cc-backend --server --dev --init-db --add-user demo:admin:AdminDev
|
./cc-backend --server --dev --init-db --add-user demo:admin:demo
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user