gordio is now just stillbox

This commit is contained in:
Daniel 2024-11-03 07:19:03 -05:00
parent 160da5b246
commit 2dcbfd0f84
45 changed files with 61 additions and 58 deletions

1
.gitignore vendored
View file

@ -4,6 +4,7 @@ mydb.sql
client/calls/
!client/calls/.gitkeep
/gordio
/stillbox
/calls
Session.vim
*.log

View file

@ -4,15 +4,15 @@ BUILDDATE!=date '+%Y%m%d'
LDFLAGS=-ldflags="-X '${VPKG}.Version=${VER}' -X '${VPKG}.Built=${BUILDDATE}'"
all: checkcalls
go build -o gordio ${GOFLAGS} ${LDFLAGS} ./cmd/gordio/
go build -o stillbox ${GOFLAGS} ${LDFLAGS} ./cmd/stillbox/
go build -o calls ${GOFLAGS} ${LDFLAGS} ./cmd/calls/
buildpprof:
go build -o gordio-pprof ${GOFLAGS} ${LDFLAGS} -tags pprof ./cmd/gordio
go build -o stillbox-pprof ${GOFLAGS} ${LDFLAGS} -tags pprof ./cmd/stillbox
clean:
rm -rf client/calls/ && mkdir client/calls && touch client/calls/.gitkeep
rm -f gordio calls gordio-pprof
rm -f stillbox calls stillbox-pprof
checkcalls:
@test -e client/calls/index.html || make getcalls

View file

@ -1,10 +1,10 @@
# stillbox
A Golang scanner call server (`gordio`), with the Calls webapp.
A Golang scanner call server.
**NOTE**
If this message is still here, the database schema *initial migration* and protobuf definitions are **still subject to change**.
Once `gordio` is actually usable (but not necessarily feature-complete), I will remove this note, and start using DB migrations and
Once `stillbox` is actually usable (but not necessarily feature-complete), I will remove this note, and start using DB migrations and
protobuf best practices (i.e. not changing field numbers).

View file

@ -9,9 +9,9 @@ import (
"dynatron.me/x/stillbox/internal/common"
"dynatron.me/x/stillbox/internal/version"
"dynatron.me/x/stillbox/pkg/gordio"
"dynatron.me/x/stillbox/pkg/gordio/admin"
"dynatron.me/x/stillbox/pkg/gordio/config"
"dynatron.me/x/stillbox/pkg/cmd/serve"
"dynatron.me/x/stillbox/pkg/cmd/admin"
"dynatron.me/x/stillbox/pkg/config"
"github.com/spf13/cobra"
)
@ -20,7 +20,7 @@ func main() {
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr, TimeFormat: common.TimeFormat})
rootCmd := &cobra.Command{
Use: gordio.AppName,
Use: common.AppName,
}
rootCmd.PersistentFlags().BoolP("version", "V", false, "show version")
cfg := config.New(rootCmd)
@ -32,7 +32,7 @@ func main() {
}
}
cmds := append([]*cobra.Command{gordio.Command(cfg)}, admin.Command(cfg)...)
cmds := append([]*cobra.Command{serve.Command(cfg)}, admin.Command(cfg)...)
rootCmd.AddCommand(cmds...)
err := rootCmd.Execute()

View file

@ -7,6 +7,8 @@ import (
"github.com/spf13/cobra"
)
const AppName = "stillbox"
const (
TimeFormat = "Jan 2 15:04:05"
)

View file

@ -11,8 +11,8 @@ import (
"dynatron.me/x/stillbox/internal/forms"
"dynatron.me/x/stillbox/internal/jsontime"
"dynatron.me/x/stillbox/pkg/gordio/alerting"
"dynatron.me/x/stillbox/pkg/gordio/config"
"dynatron.me/x/stillbox/pkg/alerting"
"dynatron.me/x/stillbox/pkg/config"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

View file

@ -3,17 +3,19 @@ package version
import (
"fmt"
"runtime"
"dynatron.me/x/stillbox/internal/common"
)
var (
Name = "gordio"
Name = common.AppName
Version = "unset"
Built = "unset"
)
func String() string {
return fmt.Sprintf("gordio %s\nbuilt %s for %s-%s\n",
Version, Built, runtime.GOOS, runtime.GOARCH)
return fmt.Sprintf("%s %s\nbuilt %s for %s-%s\n",
Name, Version, Built, runtime.GOOS, runtime.GOARCH)
}
func HttpString(app string) string {

View file

@ -12,10 +12,10 @@ import (
"time"
cl "dynatron.me/x/stillbox/pkg/calls"
"dynatron.me/x/stillbox/pkg/gordio/config"
"dynatron.me/x/stillbox/pkg/gordio/database"
"dynatron.me/x/stillbox/pkg/gordio/notify"
"dynatron.me/x/stillbox/pkg/gordio/sinks"
"dynatron.me/x/stillbox/pkg/config"
"dynatron.me/x/stillbox/pkg/database"
"dynatron.me/x/stillbox/pkg/notify"
"dynatron.me/x/stillbox/pkg/sinks"
"dynatron.me/x/stillbox/internal/timeseries"
"dynatron.me/x/stillbox/internal/trending"

View file

@ -13,7 +13,7 @@ import (
"dynatron.me/x/stillbox/internal/jsontime"
"dynatron.me/x/stillbox/internal/trending"
cl "dynatron.me/x/stillbox/pkg/calls"
"dynatron.me/x/stillbox/pkg/gordio/config"
"dynatron.me/x/stillbox/pkg/config"
"github.com/rs/zerolog/log"
)

View file

@ -8,8 +8,8 @@ import (
"time"
"dynatron.me/x/stillbox/pkg/calls"
"dynatron.me/x/stillbox/pkg/gordio/config"
"dynatron.me/x/stillbox/pkg/gordio/database"
"dynatron.me/x/stillbox/pkg/config"
"dynatron.me/x/stillbox/pkg/database"
"dynatron.me/x/stillbox/internal/common"
"dynatron.me/x/stillbox/internal/jsontime"

View file

@ -6,7 +6,7 @@ import (
"encoding/base64"
"time"
"dynatron.me/x/stillbox/pkg/gordio/database"
"dynatron.me/x/stillbox/pkg/database"
"github.com/google/uuid"
"github.com/rs/zerolog/log"

View file

@ -4,7 +4,7 @@ import (
"errors"
"net/http"
"dynatron.me/x/stillbox/pkg/gordio/config"
"dynatron.me/x/stillbox/pkg/config"
"github.com/go-chi/jwtauth/v5"
)

View file

@ -10,7 +10,7 @@ import (
"golang.org/x/crypto/bcrypt"
"dynatron.me/x/stillbox/pkg/gordio/database"
"dynatron.me/x/stillbox/pkg/database"
"github.com/go-chi/chi/v5"
"github.com/go-chi/jwtauth/v5"

View file

@ -5,7 +5,7 @@ import (
"time"
"dynatron.me/x/stillbox/internal/audio"
"dynatron.me/x/stillbox/pkg/gordio/auth"
"dynatron.me/x/stillbox/pkg/auth"
"dynatron.me/x/stillbox/pkg/pb"
"google.golang.org/protobuf/types/known/timestamppb"

View file

@ -3,7 +3,7 @@ package calls
import (
"context"
"dynatron.me/x/stillbox/pkg/gordio/database"
"dynatron.me/x/stillbox/pkg/database"
"dynatron.me/x/stillbox/pkg/pb"
)

View file

@ -6,7 +6,7 @@ import (
"sync"
"time"
"dynatron.me/x/stillbox/pkg/gordio/database"
"dynatron.me/x/stillbox/pkg/database"
"dynatron.me/x/stillbox/internal/ruletime"
"dynatron.me/x/stillbox/internal/trending"

View file

@ -6,8 +6,8 @@ import (
"fmt"
"syscall"
"dynatron.me/x/stillbox/pkg/gordio/config"
"dynatron.me/x/stillbox/pkg/gordio/database"
"dynatron.me/x/stillbox/pkg/config"
"dynatron.me/x/stillbox/pkg/database"
"github.com/spf13/cobra"
"golang.org/x/crypto/bcrypt"
"golang.org/x/term"

View file

@ -1,4 +1,4 @@
package gordio
package serve
import (
"context"
@ -6,14 +6,12 @@ import (
"os/signal"
"dynatron.me/x/stillbox/internal/common"
"dynatron.me/x/stillbox/pkg/gordio/config"
"dynatron.me/x/stillbox/pkg/gordio/server"
"dynatron.me/x/stillbox/pkg/config"
"dynatron.me/x/stillbox/pkg/server"
"github.com/spf13/cobra"
)
const AppName = "gordio"
type ServeOptions struct {
cfg *config.Config
}
@ -22,7 +20,7 @@ func Command(cfg *config.Config) *cobra.Command {
opts := makeOptions(cfg)
serveCmd := &cobra.Command{
Use: "serve",
Short: "starts the" + AppName + " server",
Short: "starts the" + common.AppName + " server",
PersistentPreRunE: cfg.PreRunE(),
RunE: common.RunE(opts),
}

View file

@ -116,7 +116,7 @@ func (c *Config) ReadConfig() error {
return err
}
log.Info().Str("configPath", c.configPath).Msg("read gordio config")
log.Info().Str("configPath", c.configPath).Msg("read config")
return nil
}

View file

@ -5,7 +5,7 @@ import (
"errors"
"strings"
"dynatron.me/x/stillbox/pkg/gordio/config"
"dynatron.me/x/stillbox/pkg/config"
sqlembed "dynatron.me/x/stillbox/sql"
"github.com/golang-migrate/migrate/v4"
_ "github.com/golang-migrate/migrate/v4/database/pgx/v5"

View file

@ -9,7 +9,7 @@ import (
"dynatron.me/x/stillbox/internal/version"
"dynatron.me/x/stillbox/pkg/calls"
"dynatron.me/x/stillbox/pkg/gordio/database"
"dynatron.me/x/stillbox/pkg/database"
"dynatron.me/x/stillbox/pkg/pb"
"github.com/rs/zerolog/log"

View file

@ -5,7 +5,7 @@ import (
"encoding/json"
"dynatron.me/x/stillbox/pkg/calls"
"dynatron.me/x/stillbox/pkg/gordio/database"
"dynatron.me/x/stillbox/pkg/database"
"dynatron.me/x/stillbox/pkg/pb"
"github.com/jackc/pgx/v5"

View file

@ -5,7 +5,7 @@ import (
stdhttp "net/http"
"time"
"dynatron.me/x/stillbox/pkg/gordio/config"
"dynatron.me/x/stillbox/pkg/config"
"github.com/nikoksr/notify"
"github.com/nikoksr/notify/service/http"

View file

@ -10,7 +10,7 @@ import (
"time"
"dynatron.me/x/stillbox/internal/common"
"dynatron.me/x/stillbox/pkg/gordio/config"
"dynatron.me/x/stillbox/pkg/config"
"github.com/go-chi/chi/v5/middleware"
"github.com/rs/zerolog"

View file

@ -7,8 +7,8 @@ import (
"dynatron.me/x/stillbox/client"
"dynatron.me/x/stillbox/internal/version"
"dynatron.me/x/stillbox/pkg/gordio/config"
"dynatron.me/x/stillbox/pkg/gordio/database"
"dynatron.me/x/stillbox/pkg/config"
"dynatron.me/x/stillbox/pkg/database"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"github.com/go-chi/httprate"
@ -75,7 +75,7 @@ func (s *Server) clientRoute(r chi.Router, clientRoot fs.FS) {
}
func ServerHeaderAdd(next http.Handler) http.Handler {
serverString := version.HttpString("gordio")
serverString := version.HttpString(version.Name)
hfn := func(w http.ResponseWriter, r *http.Request) {
w.Header().Set(serverHeader, serverString)
next.ServeHTTP(w, r)

View file

@ -7,14 +7,14 @@ import (
"time"
"dynatron.me/x/stillbox/pkg/calls"
"dynatron.me/x/stillbox/pkg/gordio/alerting"
"dynatron.me/x/stillbox/pkg/gordio/auth"
"dynatron.me/x/stillbox/pkg/gordio/config"
"dynatron.me/x/stillbox/pkg/gordio/database"
"dynatron.me/x/stillbox/pkg/gordio/nexus"
"dynatron.me/x/stillbox/pkg/gordio/notify"
"dynatron.me/x/stillbox/pkg/gordio/sinks"
"dynatron.me/x/stillbox/pkg/gordio/sources"
"dynatron.me/x/stillbox/pkg/alerting"
"dynatron.me/x/stillbox/pkg/auth"
"dynatron.me/x/stillbox/pkg/config"
"dynatron.me/x/stillbox/pkg/database"
"dynatron.me/x/stillbox/pkg/nexus"
"dynatron.me/x/stillbox/pkg/notify"
"dynatron.me/x/stillbox/pkg/sinks"
"dynatron.me/x/stillbox/pkg/sources"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"github.com/go-chi/cors"

View file

@ -5,7 +5,7 @@ import (
"os/signal"
"syscall"
"dynatron.me/x/stillbox/pkg/gordio/config"
"dynatron.me/x/stillbox/pkg/config"
"github.com/rs/zerolog/log"
)

View file

@ -6,7 +6,7 @@ import (
"dynatron.me/x/stillbox/internal/common"
"dynatron.me/x/stillbox/pkg/calls"
"dynatron.me/x/stillbox/pkg/gordio/database"
"dynatron.me/x/stillbox/pkg/database"
"github.com/jackc/pgx/v5/pgtype"
"github.com/rs/zerolog/log"

View file

@ -4,7 +4,7 @@ import (
"context"
"dynatron.me/x/stillbox/pkg/calls"
"dynatron.me/x/stillbox/pkg/gordio/nexus"
"dynatron.me/x/stillbox/pkg/nexus"
)
type NexusSink struct {

View file

@ -8,7 +8,7 @@ import (
"dynatron.me/x/stillbox/internal/common"
"dynatron.me/x/stillbox/internal/forms"
"dynatron.me/x/stillbox/pkg/calls"
"dynatron.me/x/stillbox/pkg/gordio/auth"
"dynatron.me/x/stillbox/pkg/auth"
"github.com/go-chi/chi/v5"
"github.com/rs/zerolog/log"
)

View file

@ -6,7 +6,7 @@ sql:
gen:
go:
package: "database"
out: "../pkg/gordio/database"
out: "../pkg/database"
sql_package: "pgx/v5"
query_parameter_limit: 3
emit_json_tags: true