diff --git a/README.md b/README.md index a03c715..9e2c378 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Mostly just a project to test [temporal.io](https://temporal.io/). - [x] SSO Support for authentication. - [x] SQLite for database. - This means for main app db as well as temporal db. - - [ ] Single binary. + - [x] Single binary. - One binary to run worker, server and temporal all together. - [ ] Abbility for multiple workers. - Spread workers across regions to monitor latency from different locations. diff --git a/cmd/zdravko/main.go b/cmd/zdravko/main.go index 9678e82..8f257e8 100644 --- a/cmd/zdravko/main.go +++ b/cmd/zdravko/main.go @@ -25,9 +25,9 @@ func main() { var startWorker bool var startTemporal bool - flag.BoolVar(&startServer, "server", true, "Start the server") - flag.BoolVar(&startWorker, "worker", true, "Start the worker") - flag.BoolVar(&startTemporal, "temporal", true, "Start the temporal") + flag.BoolVar(&startServer, "server", false, "Start the server") + flag.BoolVar(&startWorker, "worker", false, "Start the worker") + flag.BoolVar(&startTemporal, "temporal", false, "Start the temporal") flag.Parse() @@ -36,6 +36,10 @@ func main() { println("Worker: ", startWorker) println("Temporal: ", startTemporal) + if !startServer && !startWorker && !startTemporal { + log.Fatal("At least one of the following must be set: --server, --worker, --temporal") + } + cfg := config.NewConfig() var servers [3]StartableAndStoppable diff --git a/deploy/fly.toml b/deploy/fly.toml index 6436119..834d0d3 100644 --- a/deploy/fly.toml +++ b/deploy/fly.toml @@ -17,8 +17,8 @@ primary_region = 'waw' TEMPORAL_SERVER_HOST = 'server.process.zdravko.internal:7233' [processes] - server = '--temporal=true --server=true --worker=false' - worker = '--temporal=false --server=false --worker=true' + server = '--temporal --server' + worker = '--worker' [[mounts]] source = 'data' diff --git a/justfile b/justfile index 9bc6220..6e66fee 100644 --- a/justfile +++ b/justfile @@ -33,18 +33,18 @@ run: run-worker: go build -o dist/zdravko cmd/zdravko/main.go - ./dist/zdravko --worker=true --server=false --temporal=false + ./dist/zdravko --worker + +# Start zdravko +run-zdravko: + go build -o dist/zdravko cmd/zdravko/main.go + ./dist/zdravko --server --temporal # Generates new jwt key pair generate-jwt-key: openssl genrsa -out jwt.private.pem 2048 openssl rsa -pubout -in jwt.private.pem -out jwt.public.pem -# Start zdravko -run-zdravko: - go build -o dist/zdravko cmd/zdravko/main.go - ./dist/zdravko --worker=false - # Deploy the application to fly.io deploy: fly deploy --ha=false -c deploy/fly.toml -i {{DOCKER_IMAGE}}