-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3678c2c
commit 85964f7
Showing
7 changed files
with
108 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM rust:1.50-alpine as builder | ||
|
||
ENV WORKDIR /code | ||
WORKDIR ${WORKDIR} | ||
|
||
RUN rustup target add x86_64-unknown-linux-musl && \ | ||
apk add --no-cache musl-dev perl make gcc | ||
|
||
ADD . . | ||
|
||
RUN cargo build --release --target x86_64-unknown-linux-musl | ||
|
||
FROM scratch as runner | ||
|
||
COPY --from=builder /code/target/x86_64-unknown-linux-musl/release/rust-strom /usr/bin/rust-strom | ||
|
||
CMD ["rust-strom"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# config.toml | ||
http_address = "[::]:80" | ||
https_address = "[::]:443" | ||
|
||
[[backend_pools]] | ||
matcher = "Host('whoami.localhost')" | ||
addresses = ["127.0.0.1:8080", "127.0.0.1:8081", "127.0.0.1:8082"] | ||
schemes = ["HTTP", "HTTPS"] | ||
strategy = { RoundRobin = {} } | ||
[backend_pools.middlewares.HttpsRedirector] | ||
|
||
[[backend_pools]] | ||
matcher = "Host('youtube.de') && Path('/admin')" | ||
addresses = ["192.168.0.168:15060"] | ||
schemes = ["HTTPS"] | ||
strategy = { RoundRobin = {} } | ||
[backend_pools.middlewares.RateLimiter] | ||
limit = 10 | ||
window_sec = 1 | ||
[backend_pools.middlewares.Compression] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
# Clone the git repo | ||
git clone https://github.com/ismoilovdevml/RustStrom.git | ||
|
||
# Move to the directory | ||
cd rust-strom | ||
|
||
# Build the program (assuming you have Rust and Cargo installed) | ||
cargo build --release | ||
|
||
# Move the executable and configuration | ||
sudo mv target/release/rust-strom /usr/local/bin/ | ||
sudo mkdir -p /etc/rust-strom | ||
sudo mv path/to/config.toml /etc/rust-strom/config.toml | ||
|
||
# Set up user, group, and permissions | ||
sudo addgroup rust-strom | ||
sudo adduser --system --no-create-home --ingroup rust-strom rust-strom | ||
sudo chown rust-strom:rust-strom /usr/local/bin/rust-strom | ||
sudo chown -R rust-strom:rust-strom /etc/rust-strom/ | ||
sudo chmod 755 /usr/local/bin/rust-strom | ||
|
||
# Create and start the systemd service | ||
echo "[Unit] | ||
Description=Rust Strom Service | ||
After=network.target | ||
[Service] | ||
Type=simple | ||
User=rust-strom | ||
Group=rust-strom | ||
ExecStart=/usr/local/bin/rust-strom --config /etc/rust-strom/config.toml | ||
Restart=on-failure | ||
[Install] | ||
WantedBy=multi-user.target" | sudo tee /etc/systemd/system/rust-strom.service | ||
|
||
sudo systemctl enable rust-strom | ||
sudo systemctl start rust-strom |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
[Unit] | ||
Description=Load Balancer RS | ||
Description=Rust Strom Service | ||
After=network.target | ||
|
||
[Service] | ||
ExecStart=/etc/rust-strom | ||
WorkingDirectory=/opt/rust-strom | ||
Restart=always | ||
User=loadbalancer | ||
Group=loadbalancer | ||
Environment="PATH=/usr/bin:/bin" "LOAD_BALANCER_CONFIG=/etc/rust-strom/loadbalancer.toml" | ||
AmbientCapabilities=CAP_NET_BIND_SERVICE | ||
Type=simple | ||
User=rust-strom | ||
Group=rust-strom | ||
ExecStart=/usr/local/bin/rust-strom --config /etc/rust-strom/config.toml | ||
Restart=on-failure | ||
|
||
[Install] | ||
WantedBy=multi-user.target |