Skip to content

Commit

Permalink
Some performance in nflux running inside a container
Browse files Browse the repository at this point in the history
  • Loading branch information
containerscrew committed Dec 19, 2024
1 parent 9bbe922 commit f52dab7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ compose-build: ## Run docker-compose build
compose-up: ## Run docker-compose up
docker-compose -f docker/compose.yml up -d --force-recreate

compose-up-build: ## Run docker-compose and build
docker compose -f docker/compose.yml up --build -d

compose-down: ## Run docker-compose down
docker-compose -f docker/compose.yml down

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ ip link show # get the name of your PHYSICAL interface
make compose-up
```

> [!WARNING]
> In Fedora, where selinux is enforced by default, I'm having some problems.
> Quick fix (not secure): `sudo setenforce 0`
> By default, nflux will allow SSH (22) connections from any IP. Avoid blocking your SSH connection if testing in remote servers (VPS).
# Local development
Expand Down
11 changes: 7 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@ FROM docker.io/rust:1 as build-env

WORKDIR /app

COPY . /app

RUN set -eux ;\
cargo install bpf-linker ;\
rustup install stable && rustup toolchain install nightly --component rust-src

COPY . /app

# cargo xtask build --release
RUN cargo xtask build --release

# Strip debugging symbols to reduce binary size
RUN strip target/release/nflux

FROM gcr.io/distroless/cc-debian12

COPY --from=build-env /app/target/release/nflux /
COPY --from=build-env /app/target/release/nflux /app/nflux

CMD ["./nflux"]
CMD ["/app/nflux"]
7 changes: 1 addition & 6 deletions docker/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@ services:
restart: unless-stopped
network_mode: host
cap_add:
# Required caps:
# - CAP_NET_ADMIN
# - CAP_BPF
# - CAP_PERFMON
# Insecure, by the moment give all capabilities
- ALL
- ALL
container_name: nflux
environment:
- NFLUX_CONFIG_FILE_PATH=/nflux.toml
Expand Down

0 comments on commit f52dab7

Please sign in to comment.