Skip to content
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.

Commit

Permalink
fix: Do not start IPFS daemon when IPFS_DAEMON is false (#136)
Browse files Browse the repository at this point in the history
Do not start IPFS daemon when IPFS_DAEMON is false
  • Loading branch information
nahsi committed May 8, 2023
1 parent 6554394 commit 698d4e5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
9 changes: 6 additions & 3 deletions deploy/docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: rust-peer-network

services:
peer-1:
image: fluencelabs/rust-peer:minimal
image: fluencelabs/rust-peer:rich
container_name: "peer-1-12D3KooWBM3SdXWqGaawQDGQ6JprtwswEg3FWGvGhmgmMez1vRbR"
ports:
- 7771:7771
Expand All @@ -11,6 +11,7 @@ services:
- 18080
environment:
RUST_LOG: "info"
IPFS_DAEMON: false
FLUENCE_ENV_AQUA_IPFS_EXTERNAL_API_MULTIADDR: /dns4/ipfs/tcp/5001
FLUENCE_ENV_AQUA_IPFS_LOCAL_API_MULTIADDR: /dns4/ipfs/tcp/5001
labels:
Expand All @@ -30,7 +31,7 @@ services:
- -k=hK62afickoeP2uZbmSkAYXxxqP8ozq16VRN7qfTP719EHC5V5tjrtW57BSjUr8GvsEXmJRbtejUWyPZ2rZMyQdq

peer-2:
image: fluencelabs/rust-peer:minimal
image: fluencelabs/rust-peer:rich
container_name: "peer-2-12D3KooWQdpukY3p2DhDfUfDgphAqsGu5ZUrmQ4mcHSGrRag6gQK"
ports:
- 7772:7772
Expand All @@ -39,6 +40,7 @@ services:
- 18080
environment:
RUST_LOG: "info"
IPFS_DAEMON: false
FLUENCE_ENV_AQUA_IPFS_EXTERNAL_API_MULTIADDR: /dns4/ipfs/tcp/5001
FLUENCE_ENV_AQUA_IPFS_LOCAL_API_MULTIADDR: /dns4/ipfs/tcp/5001
labels:
Expand All @@ -58,7 +60,7 @@ services:
- -k=2WijTVdhVRzyZamWjqPx4V4iNMrajegNMwNa2PmvPSZV6RRpo5M2fsPWdQr22HVRubuJhhSw8BrWiGt6FPhFAuXy

peer-3:
image: fluencelabs/rust-peer:minimal
image: fluencelabs/rust-peer:rich
container_name: "peer-3-12D3KooWRT8V5awYdEZm6aAV9HWweCEbhWd7df4wehqHZXAB7yMZ"
ports:
- 7773:7773
Expand All @@ -67,6 +69,7 @@ services:
- 18080
environment:
RUST_LOG: "info"
IPFS_DAEMON: false
FLUENCE_ENV_AQUA_IPFS_EXTERNAL_API_MULTIADDR: /dns4/ipfs/tcp/5001
FLUENCE_ENV_AQUA_IPFS_LOCAL_API_MULTIADDR: /dns4/ipfs/tcp/5001
labels:
Expand Down
19 changes: 12 additions & 7 deletions s6/ipfs/etc/services.d/ipfs/run
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
# import ENV from container
with-contenv

# remove old HOME variable from the environment, so the daemon isn't confused by it
# see https://github.com/fluencelabs/node-distro/issues/14 for more details
unexport HOME
if [[ $IPFS_DAEMON == "false" ]]; then
echo "IPFS daemon will not start"
exit 0
else
# remove old HOME variable from the environment, so the daemon isn't confused by it
# see https://github.com/fluencelabs/node-distro/issues/14 for more details
unexport HOME

# seems like IPFS logs most logs to stderr, so
# map stderr to stdout so s6-log can catch it
fdmove -c 2 1
s6-setuidgid abc ipfs daemon
# seems like IPFS logs most logs to stderr, so
# map stderr to stdout so s6-log can catch it
fdmove -c 2 1
s6-setuidgid abc ipfs daemon
fi

0 comments on commit 698d4e5

Please sign in to comment.