Running Atuin server on windows as a service

I couldn’t find anything on the internet when I went to sort this out. I know atuin on windows is not officially supported. Regardless, it works fine, you just need to know what to do.

First, I got the atuin server mode running fine from windows. Assume you have the atuin binary available. from cli, atuin server start. It won’t otuput anything to the screen. It will try to load the server.toml config from your user folder root, eg ~.config\atuin\server.toml … use that file to get the settings right .. for me, it’s

host = “0.0.0.0”
port = 8123
open_registration = true
db_uri = “postgres://pguser:pgpassword@localhost:5432/atuin”

I first created the atuin database in postgres.

Having put that into the server config file, and run the atuin server start, you may get the windows firewall uac prompt, and need to allow it, letting atuin connections to/from the process & port.

Now clients should be able to connect remotely and sync. you can check, remotely, by running atuin sync. Those clients will need to follow the standard process of atuin register, atuin login. atuin status should show you connected now, to your server, and atuin sync will do the actual sync.

So now, it’s the important bit. install the service using nssm. Set the normal service stuff - service name (atuin), working dir (put the exe in this, or point to where your exe is), and in the path, put the fully qualified path to autin.exe, including the exe itself. And in arguments, put in server start (no quotes needed).

That will let the app run, let it be managed using service stuff (gui, service start/stop from pwsh etc). In the dependencies tab, I include postgresql service, since atuin needs that for my choice of data store.

finally the important step, in the last tab, environment, you need to put the contents of the server config file , as single line per, blah=blah … so you can just copy and paste the lot in. We know they work since your cli instance of atuin server works.

You can, optionally,set the IO tab, output (eg c:\bin\atuin\log.txt) and error (eg c:\bin\atuin\log-errors.txt) … atuin server mode won’t often output much apart from “graceful shutdown” or if the config environment stuff is not avail, possibly some error that won’t really help too much to us windows users.

Finally, you must allow the whole thing thru the firewall on a slightly wider basis. If you don’t do this, even tho you did allow it for your cli instance, you won’t get it to work as clients will again not be able to connect.

so.

New-NetFirewallRule -DisplayName “Atuin Server 8123” -Direction Inbound -Action Allow -Protocol TCP -LocalPort 8123

and then service-start atuin (or net start atuin if you prefer).

it should run, not show a service start error, and you can check by get-service atuin.

On the prior working-to-the-cli-server client, do an “atuin sync” and it should all be good, should sync fine, and we are done.

Hope this helps. I suppose it could be added to the official docs with a bit of tidying up. The main points here are - service needs the env vars set, nothing else seemed to work for providing the vars needed, and windows firewall needs to be set to allow also.