update main.go: remove 'standalone' mode
This commit is contained in:
36
main.go
36
main.go
@@ -4,23 +4,17 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"flag"
|
"flag"
|
||||||
"log"
|
"log"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sync"
|
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/hohn/mrvacommander/config/mcc"
|
"github.com/hohn/mrvacommander/config/mcc"
|
||||||
|
|
||||||
"github.com/hohn/mrvacommander/pkg/agent"
|
|
||||||
"github.com/hohn/mrvacommander/pkg/artifactstore"
|
|
||||||
"github.com/hohn/mrvacommander/pkg/deploy"
|
"github.com/hohn/mrvacommander/pkg/deploy"
|
||||||
"github.com/hohn/mrvacommander/pkg/qldbstore"
|
|
||||||
"github.com/hohn/mrvacommander/pkg/queue"
|
|
||||||
"github.com/hohn/mrvacommander/pkg/server"
|
"github.com/hohn/mrvacommander/pkg/server"
|
||||||
"github.com/hohn/mrvacommander/pkg/state"
|
"github.com/hohn/mrvacommander/pkg/state"
|
||||||
)
|
)
|
||||||
@@ -28,8 +22,8 @@ import (
|
|||||||
func main() {
|
func main() {
|
||||||
// Define flags
|
// Define flags
|
||||||
helpFlag := flag.Bool("help", false, "Display help message")
|
helpFlag := flag.Bool("help", false, "Display help message")
|
||||||
logLevel := flag.String("loglevel", "info", "Set log level: debug, info, warn, error")
|
logLevel := flag.String("loglevel", "debug", "Set log level: debug, info, warn, error")
|
||||||
mode := flag.String("mode", "standalone", "Set mode: standalone, container, cluster")
|
mode := flag.String("mode", "container", "Set mode: standalone, container, cluster")
|
||||||
dbPathRoot := flag.String("dbpath", "", "Set the root path for the database store if using standalone mode.")
|
dbPathRoot := flag.String("dbpath", "", "Set the root path for the database store if using standalone mode.")
|
||||||
|
|
||||||
// Custom usage function for the help flag
|
// Custom usage function for the help flag
|
||||||
@@ -93,30 +87,8 @@ func main() {
|
|||||||
// Apply 'mode' flag
|
// Apply 'mode' flag
|
||||||
switch *mode {
|
switch *mode {
|
||||||
case "standalone":
|
case "standalone":
|
||||||
// Assemble single-process version
|
slog.Error("--mode standalone is deprecated. Allowed values are: container, cluster")
|
||||||
sq := queue.NewQueueSingle(2)
|
os.Exit(1)
|
||||||
ss := state.NewLocalState(config.Storage.StartingID)
|
|
||||||
as := artifactstore.NewInMemoryArtifactStore()
|
|
||||||
ql := qldbstore.NewLocalFilesystemCodeQLDatabaseStore(*dbPathRoot)
|
|
||||||
|
|
||||||
server.NewCommanderSingle(&server.Visibles{
|
|
||||||
Queue: sq,
|
|
||||||
State: ss,
|
|
||||||
Artifacts: as,
|
|
||||||
CodeQLDBStore: ql,
|
|
||||||
})
|
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
|
||||||
|
|
||||||
go agent.StartAndMonitorWorkers(ctx, as, ql, sq, 2, &wg)
|
|
||||||
|
|
||||||
slog.Info("Started server and standalone agent")
|
|
||||||
<-sigChan
|
|
||||||
slog.Info("Shutting down...")
|
|
||||||
cancel()
|
|
||||||
wg.Wait()
|
|
||||||
slog.Info("Agent shutdown complete")
|
|
||||||
|
|
||||||
case "container":
|
case "container":
|
||||||
isAgent := false
|
isAgent := false
|
||||||
|
|||||||
Reference in New Issue
Block a user