Skip to content
This repository was archived by the owner on Sep 21, 2024. It is now read-only.

Commit 23ada3e

Browse files
authored
feat: Parameterize the orb-ns Docker image so that ENV can be used to customize more arguments. (#889)
1 parent bdf8614 commit 23ada3e

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

images/orb-ns/Dockerfile

+7-2
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,20 @@ COPY "./Cargo.toml" "./Cargo.lock" .
66
COPY ./rust ./rust
77

88
RUN apt-get update && apt-get install -y libssl-dev protobuf-compiler cmake jq binaryen
9-
RUN cargo build --release
9+
RUN cargo build --bin orb-ns --release
1010

1111
FROM docker.io/ubuntu:latest
1212

1313
RUN useradd -ms /bin/bash dhtuser
1414
USER dhtuser
1515
WORKDIR /home/dhtuser
1616

17-
ENV RUST_LOG="info,tower_http,noosphere,noosphere_ns,noosphere_ipfs,noosphere_storage,noosphere_core,noosphere_storage,orb_ns=debug"
17+
ENV RUST_LOG="info,orb_ns=debug"
18+
ENV NOOSPHERE_LOG="academic"
19+
ENV KEY_NAME="ephemeral"
20+
ENV P2P_ADDRESS="0.0.0.0:6666"
21+
ENV API_ADDRESS="0.0.0.0:6667"
22+
ENV IPFS_URL="http://127.0.0.1:5001"
1823

1924
COPY --from=builder /noosphere/target/release/orb-ns /usr/bin/orb-ns
2025
COPY --chown=dhtuser:dhtuser ./images/orb-ns/start.sh /home/dhtuser/start.sh

images/orb-ns/start.sh

+11-14
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,28 @@
22
set -x
33

44
MOUNT_DIR="/home/dhtuser/.noosphere"
5-
6-
KEY=$1
7-
CONFIG_FILE=$2
5+
ORB_NS="/usr/bin/orb-ns"
86

97
cd /home/dhtuser
108

11-
if [[ "$KEY" = "ephemeral" ]]; then
9+
if [[ "$KEY_NAME" = "ephemeral" ]]; then
1210
# This has a side effect of ensuring a ~/.noosphere/keys directory
1311
# exists to store the key, circumventing the need for mounting
14-
orb-ns key-gen --key ephemeral
12+
$ORB_NS key-gen --key ephemeral
1513
fi
1614
if [[ ! -d "$MOUNT_DIR" ]]; then
1715
echo "Missing mount on $MOUNT_DIR."
1816
exit 1
1917
fi
20-
if [[ -z "$1" ]]; then
21-
echo "ARGS: KEY CONFIG_FILE"
22-
exit 1
23-
fi
24-
if [[ -z "$2" ]]; then
25-
echo "Missing config file path."
26-
exit 1
27-
fi
2818

2919
echo "RUST_LOG=${RUST_LOG}"
3020
echo "NOOSPHERE_LOG=${NOOSPHERE_LOG}"
21+
echo "KEY_NAME=${KEY_NAME}"
22+
echo "P2P_ADDRESS=${P2P_ADDRESS}"
23+
echo "API_ADDRESS=${API_ADDRESS}"
24+
echo "IPFS_URL=${IPFS_URL}"
3125

32-
orb-ns run --config $CONFIG_FILE
26+
$ORB_NS run --key "${KEY_NAME}" \
27+
--listening-address "${P2P_ADDRESS}" \
28+
--api-address "${API_ADDRESS}" \
29+
--ipfs-api-url "${IPFS_URL}"

0 commit comments

Comments
 (0)