-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathipfs-start
executable file
·55 lines (44 loc) · 1.66 KB
/
ipfs-start
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
usage () {
echo -e "IPFS Server Start"
echo -e "Usage: `basename $0` [--expose-ports | -ep]"
}
if [[ "$1" =~ ^-h$ || "$1" =~ ^--help$ ]]; then
usage
exit 1
fi
source "${SCRIPT_DIR}/config/constants"
echo "Starting IPFS Server : '${IPFS_SERVER_NAME}'"
echo "STORAGE: '${IPFS_STORAGE_PATH}'"
echo "STAGING: '${IPFS_STAGING}'"
echo "DATA: '${IPFS_DATA}'"
mkdir -p "${IPFS_DATA}"
mkdir -p "${IPFS_STAGING}"
cd ${SCRIPT_DIR}
./ipfs-set-announce-address
if [[ "$1" =~ ^-ep$ || "$1" =~ ^--expose-ports$ ]]; then
echo "SWARM PORT: '${IPFS_SWARM_PORT}'"
echo "WS PORT: '${IPFS_WS_PORT}'"
echo "GATEWAY PORT: '${IPFS_GATEWAY_PORT}'"
echo "API PORT: '${IPFS_API_PORT}'"
docker run -d --name "${IPFS_SERVER_NAME}" \
--user $(id -u):$(id -g) \
-v $IPFS_STAGING:/staging:delegated -v $IPFS_DATA:/data/ipfs:delegated \
-p "${IPFS_SWARM_PORT}:4001" -p "${IPFS_WS_PORT}:4003" -p "${IPFS_GATEWAY_PORT}:8080" -p "${IPFS_API_PORT}:5001" \
"${IPFS_DOCKER_IMAGE}:${IPFS_DOCKER_TAG}" > /dev/null
elif [[ "$1" =~ ^-hn$ || "$1" =~ ^--host-network$ ]]; then
echo "Using host network"
docker run -d --name "${IPFS_SERVER_NAME}" \
--user $(id -u):$(id -g) \
-v $IPFS_STAGING:/staging:delegated -v $IPFS_DATA:/data/ipfs:delegated \
--network host \
"${IPFS_DOCKER_IMAGE}:${IPFS_DOCKER_TAG}" > /dev/null
else
echo "No ports exposed"
# docker run --init -d --name "${IPFS_SERVER_NAME}" \
docker run -d --name "${IPFS_SERVER_NAME}" \
--user $(id -u):$(id -g) \
-v $IPFS_STAGING:/staging:delegated -v $IPFS_DATA:/data/ipfs:delegated \
"${IPFS_DOCKER_IMAGE}:${IPFS_DOCKER_TAG}" > /dev/null
fi