Spyke

Posts

Using Kubernetes KEDA to scale workers to 0 when not needed

Using Kubernetes Event Driver Autoscaling to scale worker pods to 0 based on reading queues or checking APIs. Implemented for Pixelfed, Bookwyrm, and gitea action runners, with the runners scaling up to 4 pods, with examples.

Using Kubernetes KEDA to scale workers to 0 when not neededhttps://blog.keyboardvagabond.com/programming/using-kubernetes-keda-to-scale-workers-to-0-when-not-neededOpen linkView original on piefed.keyboardvagabond.com

recommendation for a good way to host short videos

I haven't really seen anything in the awesome lists for this, but they are also hard to parse out so I probably missed it.

I've been wanting a way for a while to share shirt videos and such that may be too long to send to people in chats. I have NextCloud, so I can use that, but sometimes I want to send maybe a 30s video, minutes or something. Maybe gifs and the like, or record a video message and share it as a link, kind of like imgur for videos (I host picsur, but it's only for images). I'm not really thinking of anything like a YouTube clone, more of a way to share a video. I do have immich, which would probably work fine.

Are there any recommendations for this sort of thing?

View original on piefed.keyboardvagabond.com
functional_programming·Functional ProgrammingbyragingHungryPanda

Blog - Shared Postgres Test Container with Expecto in FSharp

I'm learning FSharp by creating a web application. I've cycled through lots of different ways of doing things, libraries, etc. Today I finally got my integration tests to use a single docker test contaner with the Expecto test framework. I couldn't find a good example online of how to do it, so I'm sharing it here.

Blog - Shared Postgres Test Container with Expecto in FSharphttps://blog.keyboardvagabond.com/programming/shared-postgres-test-container-with-expecto-in-fsharpOpen linkView original on piefed.keyboardvagabond.com

Blog - Shared Postgres Test Container with Expecto in FSharp

I'm learning FSharp by creating a web application. I've cycled through lots of different ways of doing things, libraries, etc. Today I finally got my integration tests to use a single docker test contaner with the Expecto test framework. I couldn't find a good example online of how to do it, so I'm sharing it here.

Blog - Shared Postgres Test Container with Expecto in FSharphttps://blog.keyboardvagabond.com/programming/shared-postgres-test-container-with-expecto-in-fsharpOpen linkView original on piefed.keyboardvagabond.com

Blog - Shared Postgres Test Container with Expecto in FSharp

I'm learning FSharp by creating a web application. I've cycled through lots of different ways of doing things, libraries, etc. Today I finally got my integration tests to use a single docker test contaner with the Expecto test framework. I couldn't find a good example online of how to do it, so I'm sharing it here.

Blog - Shared Postgres Test Container with Expecto in FSharphttps://blog.keyboardvagabond.com/programming/shared-postgres-test-container-with-expecto-in-fsharpOpen linkView original on piefed.keyboardvagabond.com

I'm not sure I'm doing things well in my FSharp side project and could use some feedback

I might be going a bit all over the place, but I appreciate anyone reading and offering input.

I'm working on a side project that is an FSharp SAFE stack application. One of the issues that I've been running into is the multiple was of doing things, so I started out with some Saturn configuration, Fable.Remoting, and Giraffe endpoints and since I've upgraded to dotnet 10, I've eventually gotten rid of the Saturn components and almost exclusively am using Giraffe with dotnet EndpointRoutes so that I can better do things like e-tags and whatnot. Is this normal?

But my main example is on the data access layer. I found that there were a lot of cool looking libraries and after playing around a bit, I decided that I like Dapper, Dapper.FSharp, and DbFun.

DbFun does some cool stuff and looks like a more type safe Dapper with build or test run time evaluation of your queries, so a bad query or a typo will fail to build. It looks a bit like this (with explicit typing):

let findByUserId (userId: UserId) (queryBuilder: QueryBuilder) : (IConnector<unit> -> Async<UserOption>)->  
    queryBuilder.Sql<UserId, User option>(someSql, "id") userId  

This is pretty cool. The but though is that the new http handlers don't take an Async, they take a Task. It would be cool if it was possible to get the query object generated, but DbFun appears to be all partially applied functions, so I can't put it through a runner that returns a Task.

Now, I can convert the Async to a Task, but I'd prefer not to switch between the two. I ran some tests between DbFun with Async converted to Task and Dapper and there was a difference in memory and execution time. It's not a huge deal and this is a side project, but I'd prefer to stick with one type up through the stack.

This currently leaves me with using Dapper and the typical Repository pattern, though even this repo is getting bloated already.

What I'm doing at the moment until I decide a direction is I'm creating the DbFun queries for testing and type safety stuff, but also putting those queries into my dapper commands wrapped with instrumentation:

// I'm pretty sure I can make some handlers for dapper to work with my single case DUs, but I'm still looking at the best way to do strong typing of IDs.  
member this.FindTask(id:IdentityId, mediaId: MediaId, ct: CancellationToken) : Task<SomeFindResponseType option> =  
            let instrument = withDbActivity logger (nameof(findByUserIdAndMediaIdQuery)) (Some findByUserIdAndMediaIdSql)  
            instrument(fun () -> task {  
                let conn = connectionFactory()  
                let mediaGuid: Guid = mediaId  
                let guidValue = match id with | IdentityId guid -> guid  
                let! result = conn.QuerySingleOrDefaultAsync< SomeFindResponseType >(  
                    CommandDefinition(findByUserIdAndMediaIdSql, {| id = guidValue.ToString(); mediaId = mediaGuid |}, cancellationToken = ct))  
                return Option.ofObj result  
            })  

What is normally done with this sort of thing. Does anyone have any recommendations? Do most people go with the convenience of the FSharp libs and convert Async to Task and take the hit? Or do you just stick with dapper and maybe make a lightweight query/runner object to make things more functional?

View original on piefed.keyboardvagabond.com

[Photo Blog] The Art Islands of Naoshima and Teshima in Japan

I took a few days to visit the art islands of Naoshima and Teshima. As it was told to me, these islands knew that they were declining some decades ago and sought to revitalize themselves by bringing in artists to create exhibits and art houses. It seems to have worked.

Originally posted on ![email protected]

[Photo Blog] The Art Islands of Naoshima and Teshima in Japanhttps://blog.keyboardvagabond.com/michaeldileo/naoshima-art-islandOpen linkView original on piefed.keyboardvagabond.com
travelphotography·Travel Photography byragingHungryPanda

[Photo Blog] The Art Islands of Naoshima and Teshima in Japan

I took a few days to visit the art islands of Naoshima and Teshima. As it was told to me, these islands knew that they were declining some decades ago and sought to revitalize themselves by bringing in artists to create exhibits and art houses. It seems to have worked.

Originally posted on ![email protected]

[Photo Blog] The Art Islands of Naoshima and Teshima in Japanhttps://blog.keyboardvagabond.com/michaeldileo/naoshima-art-islandOpen linkView original on piefed.keyboardvagabond.com

[Photo Blog] The Art Islands of Naoshima and Teshima in Japan

I took a few days to visit the art islands of Naoshima and Teshima. As it was told to me, these islands knew that they were declining some decades ago and sought to revitalize themselves by bringing in artists to create exhibits and art houses. It seems to have worked.

[Photo Blog] The Art Islands of Naoshima and Teshima in Japanhttps://blog.keyboardvagabond.com/michaeldileo/naoshima-art-islandOpen linkView original on piefed.keyboardvagabond.com