This commit is contained in:
radhitya 2026-04-01 12:07:25 +07:00
parent 631859263d
commit 589decd571
4 changed files with 261 additions and 0 deletions

View File

@ -0,0 +1,152 @@
services:
node-1:
image: ${BESU_IMAGE}
container_name: besu-node-1
hostname: node-1
networks:
besu-network:
ipv4_address: 172.16.239.11
ports:
- '8545:8545'
- '8546:8546'
volumes:
- ./nodes:/nodes
command:
- --data-path=/nodes/node-1/data
- --genesis-file=/nodes/networkFiles/genesis.json
- --network-id=${NETWORK_ID}
- --rpc-http-enabled=true
- --rpc-http-host=0.0.0.0
- --rpc-http-api=ETH,NET,IBFT,WEB3,ADMIN,DEBUG,TRACE, TXPOOL
- --rpc-http-max-active-connections=80
- --rpc-http-cors-origins=*
- --host-allowlist=*
- --p2p-enabled=true
- --p2p-host=172.16.239.11
- --p2p-port=30303
- --rpc-ws-enabled=true
- --rpc-ws-host=0.0.0.0
- --rpc-ws-port=8546
- --rpc-ws-api=ETH,NET,IBFT,WEB3,ADMIN,DEBUG,TRACE,TXPOOL
- --rpc-ws-max-active-connections=80
- --data-storage-format=BONSAI
- --min-gas-price=${MIN_GAS_PRICE}
restart: unless-stopped
node-2:
image: ${BESU_IMAGE}
container_name: besu-node-2
hostname: node-2
networks:
besu-network:
ipv4_address: 172.16.239.12
ports:
- '8547:8545'
volumes:
- ./nodes:/nodes
depends_on:
- node-1
command:
- --data-path=/nodes/node-2/data
- --genesis-file=/nodes/networkFiles/genesis.json
- --network-id=${NETWORK_ID}
- --rpc-http-enabled=true
- --rpc-http-host=0.0.0.0
- --rpc-http-port=8545
- --rpc-http-api=ETH,NET,IBFT,WEB3,ADMIN
- --rpc-http-cors-origins=*
- --rpc-http-max-active-connections=80
- --host-allowlist=*
- --p2p-enabled=true
- --p2p-host=172.16.239.12
- --p2p-port=30303
- --rpc-ws-enabled=true
- --rpc-ws-host=0.0.0.0
- --rpc-ws-port=8546
- --rpc-ws-api=ETH,NET,IBFT,WEB3,ADMIN,DEBUG,TRACE,TXPOOL
- --rpc-ws-max-active-connections=80
- --data-storage-format=BONSAI
- --bootnodes=enode://ee7202c18150e21bf68a2e4f87590a273cda755dc68a66267dea175aaaf2dfe48b70a90356c00d05eb163b14f807f538199570e99a9d76451b953d0354506639@172.16.239.11:30303
- --min-gas-price=${MIN_GAS_PRICE}
restart: unless-stopped
node-3:
image: ${BESU_IMAGE}
container_name: besu-node-3
hostname: node-3
networks:
besu-network:
ipv4_address: 172.16.239.13
ports:
- '8548:8545'
volumes:
- ./nodes:/nodes
depends_on:
- node-1
command:
- --data-path=/nodes/node-3/data
- --genesis-file=/nodes/networkFiles/genesis.json
- --network-id=${NETWORK_ID}
- --rpc-http-enabled=true
- --rpc-http-host=0.0.0.0
- --rpc-http-port=8545
- --rpc-http-api=ETH,NET,IBFT,WEB3,ADMIN
- --rpc-http-max-active-connections=80
- --rpc-http-cors-origins=*
- --host-allowlist=*
- --p2p-enabled=true
- --p2p-host=172.16.239.13
- --p2p-port=30303
- --rpc-ws-enabled=true
- --rpc-ws-host=0.0.0.0
- --rpc-ws-port=8546
- --rpc-ws-api=ETH,NET,IBFT,WEB3,ADMIN,DEBUG,TRACE,TXPOOL
- --rpc-ws-max-active-connections=80
- --data-storage-format=BONSAI
- --bootnodes=enode://ee7202c18150e21bf68a2e4f87590a273cda755dc68a66267dea175aaaf2dfe48b70a90356c00d05eb163b14f807f538199570e99a9d76451b953d0354506639@172.16.239.11:30303
- --min-gas-price=${MIN_GAS_PRICE}
restart: unless-stopped
node-4:
image: ${BESU_IMAGE}
container_name: besu-node-4
hostname: node-4
networks:
besu-network:
ipv4_address: 172.16.239.14
ports:
- '8549:8545'
volumes:
- ./nodes:/nodes
depends_on:
- node-1
command:
- --data-path=/nodes/node-4/data
- --genesis-file=/nodes/networkFiles/genesis.json
- --network-id=${NETWORK_ID}
- --rpc-http-enabled=true
- --rpc-http-host=0.0.0.0
- --rpc-http-port=8545
- --rpc-http-api=ETH,NET,WEB3,DEBUG,TRACE,TXPOOL
- --rpc-http-max-active-connections=80
- --rpc-http-cors-origins=*
- --host-allowlist=*
- --p2p-enabled=true
- --p2p-host=172.16.239.14
- --p2p-port=30303
- --rpc-ws-enabled=true
- --rpc-ws-host=0.0.0.0
- --rpc-ws-port=8546
- --rpc-ws-api=ETH,NET,WEB3,DEBUG,TRACE,TXPOOL
- --rpc-ws-max-active-connections=80
- --data-storage-format=BONSAI
- --bootnodes=enode://ee7202c18150e21bf68a2e4f87590a273cda755dc68a66267dea175aaaf2dfe48b70a90356c00d05eb163b14f807f538199570e99a9d76451b953d0354506639@172.16.239.11:30303
- --min-gas-price=${MIN_GAS_PRICE}
restart: unless-stopped
networks:
besu-network:
driver: bridge
ipam:
config:
- subnet: 172.16.239.0/24

View File

@ -0,0 +1,21 @@
services:
quorum-explorer:
container_name: blockchain-explorer
image: consensys/quorum-explorer
ports:
- "25000:25000/tcp"
networks:
besu-network:
ipv4_address: 172.16.239.24
environment:
- QE_CONFIG_PATH=/app/config.json
- NODE_ENV=production
- DISABLE_AUTH=true
volumes:
- ./explorer-config.json:/app/config.json
restart: unless-stopped
networks:
besu-network:
external: true
name: besu-docker-network_besu-network

26
ipfs/docker-compose.yml Normal file
View File

@ -0,0 +1,26 @@
services:
ipfs_node1:
image: ipfs/kubo:latest
container_name: ipfs_node1
volumes:
- ./ipfs_node1_staging:/export
- ./ipfs_node1_data:/data/ipfs
- ./swarm.key:/data/ipfs/swarm.key
ports:
- "4001:4001"
- "0.0.0.0:5001:5001"
- "0.0.0.0:8080:8080"
restart: always
ipfs_node2:
image: ipfs/kubo:latest
container_name: ipfs_node2
volumes:
- ./ipfs_node2_staging:/export
- ./ipfs_node2_data:/data/ipfs
- ./swarm.key:/data/ipfs/swarm.key
ports:
- "4002:4001"
- "0.0.0.0:5002:5001"
- "0.0.0.0:8081:8080"
restart: always

62
ipfs/setup.sh Normal file
View File

@ -0,0 +1,62 @@
#!/bin/bash
IP_HOST="192.168.1.132"
WEBUI_CAR="ipfs-webui-v4.12.0.car"
WEBUI_URL="https://github.com/ipfs/ipfs-webui/releases/download/v4.12.0/ipfs-webui@v4.12.0.car"
WEBUI_CID="bafybeihxglpcfyarpm7apn7xpezbuoqgk3l5chyk7w4gvrjwk45rqohlmm"
if [ ! -f "$WEBUI_CAR" ]; then
echo "[+] WebUI CAR x_x"
wget -O "$WEBUI_CAR" "$WEBUI_URL" || { echo "[!] Gagal download WebUI! Cek koneksi internet."; exit 1; }
fi
docker compose down 2>/dev/null
sudo rm -f ipfs_node1_data/repo.lock ipfs_node2_data/repo.lock
mkdir -p ipfs_node1_staging ipfs_node1_data ipfs_node2_staging ipfs_node2_data
if [ ! -f "swarm.key" ]; then
echo "[+] Generating swarm.key..."
echo -e "/key/swarm/psk/1.0.0/\n/base16/\n$(openssl rand -hex 32)" > swarm.key
fi
sudo chown -R 1000:1000 ipfs_node1_data ipfs_node1_staging ipfs_node2_data ipfs_node2_staging swarm.key
chmod 600 swarm.key
REPOS=("ipfs_node1_data" "ipfs_node2_data")
for REPO in "${REPOS[@]}"; do
echo "[*] Patching config di $REPO..."
if [ ! -f "$REPO/config" ]; then
sudo docker run --rm -v "$(pwd)/$REPO":/data/ipfs ipfs/kubo:latest init --profile=server
fi
sudo docker run --rm -v "$(pwd)/$REPO":/data/ipfs ipfs/kubo:latest config --json AutoConf.Enabled false
sudo docker run --rm -v "$(pwd)/$REPO":/data/ipfs ipfs/kubo:latest config --json Bootstrap '[]'
sudo docker run --rm -v "$(pwd)/$REPO":/data/ipfs ipfs/kubo:latest config --json Routing.Type '"dhtserver"'
sudo docker run --rm -v "$(pwd)/$REPO":/data/ipfs ipfs/kubo:latest config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"http://$IP_HOST:8080\", \"http://$IP_HOST:8081\", \"http://localhost:8080\", \"http://127.0.0.1:8080\"]"
sudo docker run --rm -v "$(pwd)/$REPO":/data/ipfs ipfs/kubo:latest config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "POST", "GET"]'
sudo docker run --rm -v "$(pwd)/$REPO":/data/ipfs ipfs/kubo:latest config Addresses.API /ip4/0.0.0.0/tcp/5001
done
echo "[*] Docker Compose Up..."
docker compose up -d
sleep 10
echo "[*] Peering nodes..."
ADDR_NODE1=$(docker exec ipfs_node1 ipfs id | grep -o '/ip4/172[^"]*' | head -n 1)
if [ ! -z "$ADDR_NODE1" ]; then
docker exec ipfs_node2 ipfs swarm connect "$ADDR_NODE1"
docker exec ipfs_node2 ipfs bootstrap add "$ADDR_NODE1"
echo "[+] Peering success!"
fi
echo "[+] Injecting WebUI ke Node 1..."
cp "$WEBUI_CAR" ipfs_node1_staging/
docker exec ipfs_node1 ipfs dag import "/export/$WEBUI_CAR"
docker exec ipfs_node1 ipfs pin add "$WEBUI_CID"
echo "--------------------------------------------------------"
echo "DONE! Private Net is ready."
echo "Dashboard: http://$IP_HOST:8080/ipfs/$WEBUI_CID/"
echo "API Port: 5001 (Node 1) | 5002 (Node 2)"
echo "Gateway: 8080 (Node 1) | 8081 (Node 2)"
echo "--------------------------------------------------------"