mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-25 04:49:05 +01:00
Change import path
This commit is contained in:
parent
1c1b043246
commit
436eaf0a9d
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,5 +1,5 @@
|
||||
# executable:
|
||||
cc-jobarchive
|
||||
cc-backend
|
||||
|
||||
/var/job-archive
|
||||
/var/*.db
|
||||
|
13
README.md
13
README.md
@ -1,6 +1,6 @@
|
||||
# ClusterCockpit with a Golang backend
|
||||
|
||||
[![Build](https://github.com/ClusterCockpit/cc-jobarchive/actions/workflows/test.yml/badge.svg)](https://github.com/ClusterCockpit/cc-jobarchive/actions/workflows/test.yml)
|
||||
[![Build](https://github.com/ClusterCockpit/cc-backend/actions/workflows/test.yml/badge.svg)](https://github.com/ClusterCockpit/cc-backend/actions/workflows/test.yml)
|
||||
|
||||
Create your job-archive accoring to [this specification](https://github.com/ClusterCockpit/cc-specifications). At least one cluster with a valid `cluster.json` file is required. Having no jobs in the job-archive at all is fine. You may use the sample job-archive available for download [in cc-docker/develop](https://github.com/ClusterCockpit/cc-docker/tree/develop).
|
||||
|
||||
@ -8,10 +8,10 @@ Create your job-archive accoring to [this specification](https://github.com/Clus
|
||||
|
||||
```sh
|
||||
# The frontend is a submodule, so use `--recursive`
|
||||
git clone --recursive git@github.com:ClusterCockpit/cc-jobarchive.git
|
||||
git clone --recursive git@github.com:ClusterCockpit/cc-backend.git
|
||||
|
||||
# Prepare frontend
|
||||
cd ./cc-jobarchive/frontend
|
||||
cd ./cc-backend/frontend
|
||||
yarn install
|
||||
yarn build
|
||||
|
||||
@ -33,13 +33,13 @@ vim ./.env
|
||||
# This will first initialize the job.db database by traversing all
|
||||
# `meta.json` files in the job-archive and add a new user. `--no-server` will cause the
|
||||
# executable to stop once it has done that instead of starting a server.
|
||||
./cc-jobarchive --init-db --add-user <your-username>:admin:<your-password> --no-server
|
||||
./cc-backend --init-db --add-user <your-username>:admin:<your-password> --no-server
|
||||
|
||||
# Start a HTTP server (HTTPS can be enabled, the default port is 8080):
|
||||
./cc-jobarchive
|
||||
./cc-backend
|
||||
|
||||
# Show other options:
|
||||
./cc-jobarchive --help
|
||||
./cc-backend --help
|
||||
```
|
||||
|
||||
In order to run this program as a deamon, look at [utils/systemd/README.md](./utils/systemd/README.md) where a systemd unit file and more explanation is provided.
|
||||
@ -89,4 +89,3 @@ This project uses [gqlgen](https://github.com/99designs/gqlgen) for the GraphQL
|
||||
- [ ] documentation, comments in the code base
|
||||
- [ ] write more TODOs
|
||||
- [ ] use more prepared statements and [sqrl](https://github.com/elgris/sqrl) instead of *squirrel*
|
||||
- [ ] replace `github.com/ClusterCockpit/cc-jobarchive` with `github.com/ClusterCockpit/cc-backend` in all import paths
|
||||
|
12
api/rest.go
12
api/rest.go
@ -12,12 +12,12 @@ import (
|
||||
"path/filepath"
|
||||
"sync"
|
||||
|
||||
"github.com/ClusterCockpit/cc-jobarchive/auth"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/config"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/graph"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/graph/model"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/metricdata"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/schema"
|
||||
"github.com/ClusterCockpit/cc-backend/auth"
|
||||
"github.com/ClusterCockpit/cc-backend/config"
|
||||
"github.com/ClusterCockpit/cc-backend/graph"
|
||||
"github.com/ClusterCockpit/cc-backend/graph/model"
|
||||
"github.com/ClusterCockpit/cc-backend/metricdata"
|
||||
"github.com/ClusterCockpit/cc-backend/schema"
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/jmoiron/sqlx"
|
||||
|
10
api_test.go
10
api_test.go
@ -14,11 +14,11 @@ import (
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/ClusterCockpit/cc-jobarchive/api"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/config"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/graph"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/metricdata"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/schema"
|
||||
"github.com/ClusterCockpit/cc-backend/api"
|
||||
"github.com/ClusterCockpit/cc-backend/config"
|
||||
"github.com/ClusterCockpit/cc-backend/graph"
|
||||
"github.com/ClusterCockpit/cc-backend/metricdata"
|
||||
"github.com/ClusterCockpit/cc-backend/schema"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/jmoiron/sqlx"
|
||||
)
|
||||
|
@ -14,7 +14,7 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/ClusterCockpit/cc-jobarchive/templates"
|
||||
"github.com/ClusterCockpit/cc-backend/templates"
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/golang-jwt/jwt/v4"
|
||||
"github.com/gorilla/sessions"
|
||||
|
@ -10,8 +10,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/ClusterCockpit/cc-jobarchive/auth"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/graph/model"
|
||||
"github.com/ClusterCockpit/cc-backend/auth"
|
||||
"github.com/ClusterCockpit/cc-backend/graph/model"
|
||||
"github.com/iamlouk/lrucache"
|
||||
"github.com/jmoiron/sqlx"
|
||||
)
|
||||
|
3
go.mod
3
go.mod
@ -1,4 +1,4 @@
|
||||
module github.com/ClusterCockpit/cc-jobarchive
|
||||
module github.com/ClusterCockpit/cc-backend
|
||||
|
||||
go 1.15
|
||||
|
||||
@ -20,4 +20,3 @@ require (
|
||||
gopkg.in/yaml.v2 v2.3.0 // indirect
|
||||
)
|
||||
|
||||
// replace github.com/iamlouk/lrucache => /home/lou/zeugs/go/lru-cache
|
||||
|
24
gqlgen.yml
24
gqlgen.yml
@ -35,7 +35,7 @@ resolver:
|
||||
# gqlgen will search for any type names in the schema in these go packages
|
||||
# if they match it will use them, otherwise it will generate them.
|
||||
autobind:
|
||||
- "github.com/ClusterCockpit/cc-jobarchive/graph/model"
|
||||
- "github.com/ClusterCockpit/cc-backend/graph/model"
|
||||
|
||||
# This section declares type mapping between the GraphQL and go type systems
|
||||
#
|
||||
@ -55,19 +55,19 @@ models:
|
||||
- github.com/99designs/gqlgen/graphql.Int64
|
||||
- github.com/99designs/gqlgen/graphql.Int32
|
||||
Job:
|
||||
model: "github.com/ClusterCockpit/cc-jobarchive/schema.Job"
|
||||
model: "github.com/ClusterCockpit/cc-backend/schema.Job"
|
||||
fields:
|
||||
tags:
|
||||
resolver: true
|
||||
NullableFloat: { model: "github.com/ClusterCockpit/cc-jobarchive/schema.Float" }
|
||||
MetricScope: { model: "github.com/ClusterCockpit/cc-jobarchive/schema.MetricScope" }
|
||||
JobStatistics: { model: "github.com/ClusterCockpit/cc-jobarchive/schema.JobStatistics" }
|
||||
Tag: { model: "github.com/ClusterCockpit/cc-jobarchive/schema.Tag" }
|
||||
Resource: { model: "github.com/ClusterCockpit/cc-jobarchive/schema.Resource" }
|
||||
JobState: { model: "github.com/ClusterCockpit/cc-jobarchive/schema.JobState" }
|
||||
JobMetric: { model: "github.com/ClusterCockpit/cc-jobarchive/schema.JobMetric" }
|
||||
Series: { model: "github.com/ClusterCockpit/cc-jobarchive/schema.Series" }
|
||||
MetricStatistics: { model: "github.com/ClusterCockpit/cc-jobarchive/schema.MetricStatistics" }
|
||||
StatsSeries: { model: "github.com/ClusterCockpit/cc-jobarchive/schema.StatsSeries" }
|
||||
NullableFloat: { model: "github.com/ClusterCockpit/cc-backend/schema.Float" }
|
||||
MetricScope: { model: "github.com/ClusterCockpit/cc-backend/schema.MetricScope" }
|
||||
JobStatistics: { model: "github.com/ClusterCockpit/cc-backend/schema.JobStatistics" }
|
||||
Tag: { model: "github.com/ClusterCockpit/cc-backend/schema.Tag" }
|
||||
Resource: { model: "github.com/ClusterCockpit/cc-backend/schema.Resource" }
|
||||
JobState: { model: "github.com/ClusterCockpit/cc-backend/schema.JobState" }
|
||||
JobMetric: { model: "github.com/ClusterCockpit/cc-backend/schema.JobMetric" }
|
||||
Series: { model: "github.com/ClusterCockpit/cc-backend/schema.Series" }
|
||||
MetricStatistics: { model: "github.com/ClusterCockpit/cc-backend/schema.MetricStatistics" }
|
||||
StatsSeries: { model: "github.com/ClusterCockpit/cc-backend/schema.StatsSeries" }
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,7 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/ClusterCockpit/cc-jobarchive/schema"
|
||||
"github.com/ClusterCockpit/cc-backend/schema"
|
||||
)
|
||||
|
||||
type Accelerator struct {
|
||||
|
@ -8,9 +8,9 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/ClusterCockpit/cc-jobarchive/auth"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/graph/model"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/schema"
|
||||
"github.com/ClusterCockpit/cc-backend/auth"
|
||||
"github.com/ClusterCockpit/cc-backend/graph/model"
|
||||
"github.com/ClusterCockpit/cc-backend/schema"
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/jmoiron/sqlx"
|
||||
)
|
||||
|
@ -10,12 +10,12 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/ClusterCockpit/cc-jobarchive/auth"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/config"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/graph/generated"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/graph/model"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/metricdata"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/schema"
|
||||
"github.com/ClusterCockpit/cc-backend/auth"
|
||||
"github.com/ClusterCockpit/cc-backend/config"
|
||||
"github.com/ClusterCockpit/cc-backend/graph/generated"
|
||||
"github.com/ClusterCockpit/cc-backend/graph/model"
|
||||
"github.com/ClusterCockpit/cc-backend/metricdata"
|
||||
"github.com/ClusterCockpit/cc-backend/schema"
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
)
|
||||
|
||||
|
@ -8,10 +8,10 @@ import (
|
||||
"math"
|
||||
|
||||
"github.com/99designs/gqlgen/graphql"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/config"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/graph/model"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/metricdata"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/schema"
|
||||
"github.com/ClusterCockpit/cc-backend/config"
|
||||
"github.com/ClusterCockpit/cc-backend/graph/model"
|
||||
"github.com/ClusterCockpit/cc-backend/metricdata"
|
||||
"github.com/ClusterCockpit/cc-backend/schema"
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
)
|
||||
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/ClusterCockpit/cc-jobarchive/schema"
|
||||
"github.com/ClusterCockpit/cc-backend/schema"
|
||||
"github.com/jmoiron/sqlx"
|
||||
)
|
||||
|
||||
|
@ -13,8 +13,8 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/ClusterCockpit/cc-jobarchive/config"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/schema"
|
||||
"github.com/ClusterCockpit/cc-backend/config"
|
||||
"github.com/ClusterCockpit/cc-backend/schema"
|
||||
)
|
||||
|
||||
// For a given job, return the path of the `data.json`/`meta.json` file.
|
||||
|
@ -9,8 +9,8 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/ClusterCockpit/cc-jobarchive/config"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/schema"
|
||||
"github.com/ClusterCockpit/cc-backend/config"
|
||||
"github.com/ClusterCockpit/cc-backend/schema"
|
||||
)
|
||||
|
||||
type CCMetricStore struct {
|
||||
|
@ -10,9 +10,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/ClusterCockpit/cc-jobarchive/config"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/graph/model"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/schema"
|
||||
"github.com/ClusterCockpit/cc-backend/config"
|
||||
"github.com/ClusterCockpit/cc-backend/graph/model"
|
||||
"github.com/ClusterCockpit/cc-backend/schema"
|
||||
influxdb2 "github.com/influxdata/influxdb-client-go/v2"
|
||||
influxdb2Api "github.com/influxdata/influxdb-client-go/v2/api"
|
||||
)
|
||||
|
@ -5,8 +5,8 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/ClusterCockpit/cc-jobarchive/config"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/schema"
|
||||
"github.com/ClusterCockpit/cc-backend/config"
|
||||
"github.com/ClusterCockpit/cc-backend/schema"
|
||||
"github.com/iamlouk/lrucache"
|
||||
)
|
||||
|
||||
|
@ -3,7 +3,7 @@ package metricdata
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/ClusterCockpit/cc-jobarchive/schema"
|
||||
"github.com/ClusterCockpit/cc-backend/schema"
|
||||
)
|
||||
|
||||
var TestLoadDataCallback func(job *schema.Job, metrics []string, scopes []schema.MetricScope, ctx context.Context) (schema.JobData, error) = func(job *schema.Job, metrics []string, scopes []schema.MetricScope, ctx context.Context) (schema.JobData, error) {
|
||||
|
16
server.go
16
server.go
@ -24,14 +24,14 @@ import (
|
||||
|
||||
"github.com/99designs/gqlgen/graphql/handler"
|
||||
"github.com/99designs/gqlgen/graphql/playground"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/api"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/auth"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/config"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/graph"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/graph/generated"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/metricdata"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/schema"
|
||||
"github.com/ClusterCockpit/cc-jobarchive/templates"
|
||||
"github.com/ClusterCockpit/cc-backend/api"
|
||||
"github.com/ClusterCockpit/cc-backend/auth"
|
||||
"github.com/ClusterCockpit/cc-backend/config"
|
||||
"github.com/ClusterCockpit/cc-backend/graph"
|
||||
"github.com/ClusterCockpit/cc-backend/graph/generated"
|
||||
"github.com/ClusterCockpit/cc-backend/metricdata"
|
||||
"github.com/ClusterCockpit/cc-backend/schema"
|
||||
"github.com/ClusterCockpit/cc-backend/templates"
|
||||
"github.com/gorilla/handlers"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/jmoiron/sqlx"
|
||||
|
@ -8,7 +8,7 @@ The `config.json` can have the optional fields *user* and *group*. If provided,
|
||||
|
||||
```sh
|
||||
# 1.: Clone this repository to /var/clustercockpit
|
||||
git clone git@github.com:ClusterCockpit/cc-specifications.git /var/clustercockpit
|
||||
git clone git@github.com:ClusterCockpit/cc-backend.git /var/clustercockpit
|
||||
|
||||
# 2.: Install all dependencies and build everything
|
||||
cd /var/clustercockpit
|
||||
|
@ -3,6 +3,7 @@ Description=ClusterCockpit Web Server (Go edition)
|
||||
Documentation=https://github.com/ClusterCockpit/cc-backend
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
After=mariadb.service mysql.service
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/var/clustercockpit
|
||||
@ -10,7 +11,7 @@ Type=notify
|
||||
NotifyAccess=all
|
||||
Restart=on-failure
|
||||
TimeoutStopSec=100
|
||||
ExecStart=/var/clustercockpit/cc-jobarchive --config ./config.json
|
||||
ExecStart=/var/clustercockpit/cc-backend --config ./config.json
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
@ -2,6 +2,8 @@
|
||||
"addr": "0.0.0.0:443",
|
||||
"https-cert-file": "/etc/letsencrypt/live/<...>/fullchain.pem",
|
||||
"https-key-file": "/etc/letsencrypt/live/<...>/privkey.pem",
|
||||
"db-driver": "mysql",
|
||||
"db": "clustercockpit:password@/cc_backend",
|
||||
"user": "clustercockpit",
|
||||
"group": "clustercockpit"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user