zhaofengli / attic

Multi-tenant Nix Binary Cache

Home Page:https://docs.attic.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

attic-server Docker image run fails

evenbrenden opened this issue · comments

The attic-server:main build fails when I try to run it:

> docker load -i $(nix build --print-out-paths github:zhaofengli/attic#attic-server-image)
0b31fe12b1c0: Loading layer [==================================================>]  101.2MB/101.2MB
Loaded image: attic-server:main

> docker run -t attic-server:main
Attic Server 0.1.0 (release)
Error: No such file or directory (os error 2)

From what I can tell, the image is fine per the GitHub Actions workflow, so am I missing something?

Tested at e9918bc.

You likely need to set the the ATTIC_SERVER_BASE64_CONFIG environment variable to the base64-encoded server.toml. It's probably trying to read a $XDG_CONFIG_DIR/attic/server.toml file that doesn't exist.

The docker image doesn't run in monolithic mode by default, which is probably why this is happening. If you create a custom image that doesn't specify --mode (or specifies --mode monolithic), it'll create a config for you:

config::load_config(opts.config.as_deref(), opts.mode == ServerMode::Monolithic).await?;

(where that second argument determines if the server will setup the "OOBE" (Out-Of-Box Experience) by creating a config and root token for you)

So your course of action should probably be to copy the template.toml, modify it, and then load it base64'd into the environment like so: export ATTIC_SERVER_BASE64_CONFIG="$(cat config.toml | base64 -w0)" (or however you'd do that with docker).

Changing the image to run in monolithic mode does the trick. Thanks!