Skip to content

Some tech notes

Jsonnet Training Intro Available for Feedback

If you read this blog, you might have understood I’m a Jsonnet fan. To help people getting started with Jsonnet, I have prepared an online training. Here’s the first chapter, an introduction showing why you should be interested in Jsonnet. As this is my first online training production, your feedback is very welcome at yvesdennels@gmail.com. I hope this video raises you interest in Jsonnet. If you’re a self-learner, go to jsonnet.

Gitops for Swarm Using Private Registry

We will see how to store the compose files of a Docker Swarm in git, together with encrypted authentication data to retrieve images from private repositories. We will access a private registry hosted by Gitlab. Authentication to the registry is done with a deploy token, which gives you a username and password giving access only to the relevant registry. Docker authentication Authentication to a docker registry is done with the command docker login -u $login --password $password (or alternatively with --password-stdin to avoid putting the password on the command line).

Starting With Kapitan

Kapitan is a tool generating configuration files (and more), handling extension of configs and overriding of values. It is great when you need to generate complex configurations or config files that slightly differ by being used in slightly different scenarios. For example staging vs production, or client A vs client B. It is supporting multiple templating approaches, my favourite being jsonnet, which is the only we will cover here. It can be used to generated Kubernetes configurations, but not only.

Deploy authelia on swarm

Intro I started using Docker Swarm in 2022 and am still very satisfied with it. I am currenyl using it as a one node swarm. This post assumes you deployed Swarm with a Traefik reverse proxy as described on DockerSwarm.rocksi, that all services are deployed under the doomain stored in the DOMAIN environment variable, and that the variable DOCKER_HOST is set correctly. I wanted to test authelia for protecting a web app to be deployed on a Docker Swarm, and I decided to test it on an existing Docker Swarm.

Edit a file on a docker swarm volume

Editing a file stored on a container volume in production is a very bad idea. You should not do it and pass all configuration through your container orchestrator. Using a single node Docker Swarm for test purposes, it can be a huge time saver though. Here’s how to do it. Ensure that your DOCKER_HOST environment is set such that running docker volume ls will show the volume storing the file you want to edit (let’s call this volume myvol).

Ddefine a f# function using reflection

#Intro I looked at this thinking it would be useful with WebSharper.Forms definition. I was wrong, but I want to keep a trace of this, so here is a blog post about it. This post is not meant to be pedagogical, but it can be useful as an example. We’ll work on an example DU type hypothetically used to describe form fields: type DataType = |String of name:string |Int of name:string |Choice of name:string * string list You can use this type to define forms.

Websharper Proxy Project

WebSharper lets you bring your FSharp code to the client-side. For types in your WebSharper project to be used at both server and client sides, you annotate them with [<JavaScript>]. For types that were compiled without WebSharper, you need to define a proxy type, which will be compiled to javascript and be used in place of the compiled type. This is done easily, as this example from the official documentation shows:

Sending Mails In Aspnetcore

This post is part of series starting here. Here’s how I configure my mailers in a ASP.Net Core project developed in F#. I define an interface: type IMailer = // to * subject * body abstract Send: string * string * string -> unit of which I have 2 implementation. The first one is for development as it simply prints the mail on the server’s standard output: type ConsoleMailer() = interface IMailer with member _.

Passwordless Login Sending Login Mail Websharper

This post is part of series starting here. Sending the mail Sending the mail is not hard, but will show how code running at the client side can call RPC functions provided by the server. These calls are totally transparent. For the login page, we add an endpoint: | [<EndPoint "/l">] Login and map it to a function all as seen earlier: Application.MultiPage (fun ctx endpoint -> match endpoint with | EndPoint.

Passwordless Login With Websharper

Intro I had the need recently to provide some admin access to a web application, but adding password management in that application was not worth the trouble. It was much easier to allow users to request a authentication link by email, as this post will show. The web app is dveloped in WebSharper. If you’re a F# developed, you should really check it out! I like that I can develop client and server in one integrated code base, all in F#.