From 31a23c1e4f83d9415c71e74bfd2394bf1ccbd2ae Mon Sep 17 00:00:00 2001 From: "bparodi@lezzo.org" Date: Fri, 13 Dec 2024 13:08:39 +0100 Subject: [PATCH] trying first deploy --- Makefile | 8 ++++++++ entrypoint/entrypoint.csproj | 25 +++++++++++-------------- src/Database.fs | 2 +- src/Grains.fs | 1 + src/Library.fs | 3 ++- 5 files changed, 23 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index ebaf115..20bd6ec 100644 --- a/Makefile +++ b/Makefile @@ -2,14 +2,22 @@ USER := $(shell cat user.secret) PASSWORD := $(shell cat password.secret) HOST := $(shell cat host.secret) + build: cd src && dotnet build --no-restore + run: cd entrypoint && dotnet run -- --user ${USER} --password ${PASSWORD} -H ${HOST} + test: cd tests && dotnet test + restore: dotnet restore && cd src && dotnet build clean: rm src/bin src/obj tests/bin tests/obj entrypoint/bin entrypoint/obj -fr + +release: + cd entrypoint && dotnet publish -r linux-x64 -p:PublishSingleFile=true --self-contained true -c Release + cp entrypoint/bin/Release/net8.0/linux-x64/publish/entrypoint bidello diff --git a/entrypoint/entrypoint.csproj b/entrypoint/entrypoint.csproj index 2318cb6..9f3797c 100644 --- a/entrypoint/entrypoint.csproj +++ b/entrypoint/entrypoint.csproj @@ -1,20 +1,17 @@ - - + - - + - - - - Exe - net8.0 - enable - enable - - - + + + Exe + net8.0 + enable + enable + true + + diff --git a/src/Database.fs b/src/Database.fs index d2c20eb..d9689c4 100644 --- a/src/Database.fs +++ b/src/Database.fs @@ -91,7 +91,7 @@ let make_from_grain (ct: CancellationToken) = task { let wait_notification (ms: int) (ct: CancellationToken) (db: t) = - db.connection.WaitAsync (ms, ct) + db.connection.WaitAsync (ms, ct) let gather_requirements (hostname: string) (ct: CancellationToken) (db: t) = diff --git a/src/Grains.fs b/src/Grains.fs index c4bbfb9..218aea8 100644 --- a/src/Grains.fs +++ b/src/Grains.fs @@ -16,6 +16,7 @@ let try_ (lambda: (unit -> ValueTask)) (prefix: string) (level: LogEventLevel) = with exn -> let logger = Logging.logger let msg = sprintf "%s - %s" prefix exn.Message + printfn "%A" exn.StackTrace match level with | LogEventLevel.Verbose -> logger.Debug msg diff --git a/src/Library.fs b/src/Library.fs index ed1f9c8..5ac265c 100644 --- a/src/Library.fs +++ b/src/Library.fs @@ -60,7 +60,8 @@ type Bidello(client: IClusterClient) = |> Seq.iter schedule_jobs let timeout = next_job_at - now |> _.TotalMilliseconds |> floor |> int32 - // printfn $"Waking up in: {timeout}|{next_job_at}" + let timeout_print = next_job_at - now |> _.TotalMinutes |> floor |> int32 + printfn $"Waking up in: {timeout_print}|{next_job_at}" // TODO: remove let! _wake_up = db |> Database.wait_notification timeout ct () }