New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add systemd example for Translator #446
base: main
Are you sure you want to change the base?
Conversation
[Service] | ||
# Assumes a user stratum with Rust installed and the repository cloned into ~/src | ||
WorkingDirectory=/home/stratum/src/stratum/roles/translator | ||
ExecStart=/home/stratum/.cargo/bin/cargo run -p translator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume there's a way to install the binary and avoid cargo run
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after cargo build the executable would be in target folder need adjust ExecStart
in config
or have cp /usr/local/bin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to us cargo build -p translator --release
and point to the target dir.
It would be nice if the working directory could just be some random temp directory, but it won't start when I do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$USER/src/stratum/target/release/translator
?
# cargo build -p translator --release && cp target/release/translator /usr/local/bin
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/usr/local/bin
is not accesible for my stratum
user (no sudo rights).
~/.cargo/bin
would be a better location, but I couldn't get the something like cargo install
to work. Manually copying the binary feels like a hack, but it's an option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if $USER works inside a systemd service file?
Codecov Report
@@ Coverage Diff @@
## main #446 +/- ##
==========================================
- Coverage 30.46% 30.41% -0.05%
==========================================
Files 102 102
Lines 7809 7802 -7
==========================================
- Hits 2379 2373 -6
+ Misses 5430 5429 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
5079941
to
4a26164
Compare
maybe add a installTranslarorProxy.sh to do the dance ? |
Isn't there a more Rust'y way to do that? |
the systemd needs install to so maybe a .sh is right https://doc.rust-lang.org/cargo/commands/cargo-install.html brings us to maybe have a README.md in each roles folder with alternatives and general documentation |
I usually manually install I made a separate issue for |
I wrote:
See #451. |
Note to self: update instructions to put |
Create a user
stratum
, install rust and clone the repo. And then use this systemd service to have it run automatically.