feat(cmd): flags false by default

This commit is contained in:
Tine 2024-02-18 22:41:40 +01:00
parent 478232bcda
commit 1221f524d5
Signed by: mentos1386
SSH key fingerprint: SHA256:MNtTsLbihYaWF8j1fkOHfkKNlnN1JQfxEU/rBU8nCGw
4 changed files with 16 additions and 12 deletions

View file

@ -8,7 +8,7 @@ Mostly just a project to test [temporal.io](https://temporal.io/).
- [x] SSO Support for authentication. - [x] SSO Support for authentication.
- [x] SQLite for database. - [x] SQLite for database.
- This means for main app db as well as temporal db. - 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. - One binary to run worker, server and temporal all together.
- [ ] Abbility for multiple workers. - [ ] Abbility for multiple workers.
- Spread workers across regions to monitor latency from different locations. - Spread workers across regions to monitor latency from different locations.

View file

@ -25,9 +25,9 @@ func main() {
var startWorker bool var startWorker bool
var startTemporal bool var startTemporal bool
flag.BoolVar(&startServer, "server", true, "Start the server") flag.BoolVar(&startServer, "server", false, "Start the server")
flag.BoolVar(&startWorker, "worker", true, "Start the worker") flag.BoolVar(&startWorker, "worker", false, "Start the worker")
flag.BoolVar(&startTemporal, "temporal", true, "Start the temporal") flag.BoolVar(&startTemporal, "temporal", false, "Start the temporal")
flag.Parse() flag.Parse()
@ -36,6 +36,10 @@ func main() {
println("Worker: ", startWorker) println("Worker: ", startWorker)
println("Temporal: ", startTemporal) println("Temporal: ", startTemporal)
if !startServer && !startWorker && !startTemporal {
log.Fatal("At least one of the following must be set: --server, --worker, --temporal")
}
cfg := config.NewConfig() cfg := config.NewConfig()
var servers [3]StartableAndStoppable var servers [3]StartableAndStoppable

View file

@ -17,8 +17,8 @@ primary_region = 'waw'
TEMPORAL_SERVER_HOST = 'server.process.zdravko.internal:7233' TEMPORAL_SERVER_HOST = 'server.process.zdravko.internal:7233'
[processes] [processes]
server = '--temporal=true --server=true --worker=false' server = '--temporal --server'
worker = '--temporal=false --server=false --worker=true' worker = '--worker'
[[mounts]] [[mounts]]
source = 'data' source = 'data'

View file

@ -33,18 +33,18 @@ run:
run-worker: run-worker:
go build -o dist/zdravko cmd/zdravko/main.go 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 # Generates new jwt key pair
generate-jwt-key: generate-jwt-key:
openssl genrsa -out jwt.private.pem 2048 openssl genrsa -out jwt.private.pem 2048
openssl rsa -pubout -in jwt.private.pem -out jwt.public.pem 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 the application to fly.io
deploy: deploy:
fly deploy --ha=false -c deploy/fly.toml -i {{DOCKER_IMAGE}} fly deploy --ha=false -c deploy/fly.toml -i {{DOCKER_IMAGE}}