Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Sjors
Copy link
Collaborator

@Sjors Sjors commented Feb 20, 2023

Create a user stratum, install rust and clone the repo. And then use this systemd service to have it run automatically.

[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
Copy link
Collaborator Author

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?

Copy link
Contributor

@xraid xraid Feb 20, 2023

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

Copy link
Collaborator Author

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.

Copy link
Contributor

@xraid xraid Feb 20, 2023

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

?

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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
Copy link

codecov bot commented Feb 20, 2023

Codecov Report

Merging #446 (4a26164) into main (03e19d8) will decrease coverage by 0.05%.
The diff coverage is n/a.

@@            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     
Impacted Files Coverage Δ
protocols/v2/framing-sv2/src/framing2.rs 30.08% <0.00%> (-0.89%) ⬇️
utils/buffer/src/buffer_pool/mod.rs 55.90% <0.00%> (-0.63%) ⬇️
protocols/v2/noise-sv2/src/lib.rs 71.42% <0.00%> (-0.37%) ⬇️
...les-logic-sv2/src/channel_logic/channel_factory.rs 28.14% <0.00%> (+0.02%) ⬆️
...logic-sv2/src/channel_logic/proxy_group_channel.rs 21.17% <0.00%> (+0.24%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@Sjors Sjors marked this pull request as ready for review February 20, 2023 16:36
@xraid
Copy link
Contributor

xraid commented Feb 20, 2023

maybe add a installTranslarorProxy.sh to do the dance ?

@Sjors
Copy link
Collaborator Author

Sjors commented Feb 20, 2023

Isn't there a more Rust'y way to do that?

@xraid
Copy link
Contributor

xraid commented Feb 20, 2023

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

@Sjors
Copy link
Collaborator Author

Sjors commented Feb 21, 2023

I usually manually install systemd services. Using a script is not that convenient, since it would need sudo rights.

I made a separate issue for cargo install: #450

@Sjors
Copy link
Collaborator Author

Sjors commented Feb 21, 2023

I wrote:

It would be nice if the working directory could just be some random temp directory, but it won't start when I do that.

See #451.

@pavlenex pavlenex added the translation proxy SV1>SV2 translation proxy issues label Feb 21, 2023
@Sjors
Copy link
Collaborator Author

Sjors commented Mar 6, 2023

Note to self: update instructions to put proxy-config.toml somewhere else and point to it with -c ~/.stratum/proxy-config.toml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
translation proxy SV1>SV2 translation proxy issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants