atuinsh/atuin

Self-hosted server questions

zohar opened this issue · 9 comments

I'm 100% new to Rust but I like atuin and would like to self-host it for fun, exercise and if all goes well - for work.
Hopefully some newbie questions here will find their way to an FAQ or to the docs themselves.
This will be a live issue with follow up questions until the goal is reached.

  1. I'm getting an error: failed to read /app/atuin-client/Cargo.toml . Do I have to install the atuin client on the server?
  2. I configured an environment variable ATUIN_CONFIG_DIR as /app/config . Which files should reside there at the build and run times?

This sounds much more like a compile time error than anything to do with runtime - see Cargo.toml reference

Could you please share what you are running?

"atuin server start" will create the configuration it requires

Thanks. I am getting the following errors upon running cargo build:

error: failed to load manifest for workspace member /app/atuin-client 
Caused by:
    failed to read `/app/atuin-client/Cargo.toml`

My current /app dir structure is:

atuin/      config/

./atuin:
Cargo.lock Cargo.toml

./config:
server.toml   # Has the variables from https://docs.atuin.sh/self-hosting/server-setup/

OK - first discovery... I assumed cargo build will actually fetch all of the code, but it doesn't.
Running cargo install atuin@v18.1.0 instead seem to fetch everything.
I'll report back when I have further progress or problems.

Moving forward! After using the whole repository structure the deployment is almost flawless :-)
My next challenge is to inject environment variables into the config file.
I'm getting the values for URL, DB_URI, PORT etc from my cloud provider. I imagine these need to be injected into .config/atuin/server.toml ?
Using Bash variables replacement didn't work. Should this be done using Rust? I saw this format somewhere env::var but not sure how I should use it.

(edit: https://siciarz.net/24-days-rust-environment-variables/#:~:text=The%20simplest%20way%20to%20access,to%20read%20current%20language%20setting. )

OK, I see this file https://github.com/atuinsh/atuin/blob/main/atuin-server/src/settings.rs is using the above method.
In my case the environment variables are not available at build time, and after that the files are no longer writeable.
So I guess the solution would be to make the server check for ENV variables and use them if they're available, before applying the defaults.

I'm not sure why you're trying to build and run a server in this way

Here is how to install a binary: https://docs.atuin.sh/guide/installation/

They're also available on the release page

You may find this part of the docs helpful: https://docs.atuin.sh/self-hosting/server-setup/

I'm going to close this because we can only support documented use cases, and there doesn't seem to be a particular problem

Success! https://main-bvxea6i-gwpe7afqcpu6k.eu.platformsh.site/ (this domain will probably won't survive long time, but enough for you @ellie to see) 😃

That was a great first exercise in Rust!

I will publish the configuration I used to deploy to https://upsun.com so anyone who wants to have a self-hosted Atuin server or simply to have a Rust reference on Upsun, will be able to use it.

Please don't - we are only able to support deployment methods listed in our documentation