Skip to content

Commit

Permalink
Fix: fix docker-compose.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
kai-yu-wm committed May 23, 2024
1 parent 1067c61 commit 3e13bd8
Show file tree
Hide file tree
Showing 16 changed files with 984 additions and 23 deletions.
6 changes: 4 additions & 2 deletions Dockerfile.wemix
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ RUN apt-get install -y --no-install-recommends \
# Create directories for wemix
RUN mkdir -p /usr/local/wemix /usr/local/wemix/keystore

# Set environment variables
ENV PATH=/usr/local/wemix/bin:$PATH

# Copy the built binaries and configuration files from the builder stage
COPY --from=builder /go-wemix/build /usr/local/wemix/

Expand All @@ -85,8 +88,7 @@ RUN apt-get remove -y \
apt-get clean

# Expose necessary ports
EXPOSE 10009
EXPOSE 10010
EXPOSE 8588 8589 8598

# Set the entrypoint
ENTRYPOINT ["/usr/local/wemix/bin/gwemix"]
6 changes: 4 additions & 2 deletions containers/docker/wemix/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ RUN apt-get install -y --no-install-recommends \
# Create directories for wemix
RUN mkdir -p /usr/local/wemix /usr/local/wemix/keystore

# Set environment variables
ENV PATH=/usr/local/wemix/bin:$PATH

# Copy the built binaries and configuration files from the builder stage
COPY --from=builder /go-wemix/build /usr/local/wemix/

Expand All @@ -85,8 +88,7 @@ RUN apt-get remove -y \
apt-get clean

# Expose necessary ports
EXPOSE 10009
EXPOSE 10010
EXPOSE 8588 8589 8598

# Set the entrypoint
ENTRYPOINT ["/usr/local/wemix/bin/gwemix"]
81 changes: 62 additions & 19 deletions containers/docker/wemix/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,77 @@
version: "3"
services:
wemix1:
container_name: wemix1
build:
context: .
dockerfile: Dockerfile
image: wemix/node-demo:latest
hostname: wemix1
stdin_open: true
networks:
wemix_bridge:
ipv4_address: 172.16.237.11
restart: unless-stopped
tty: true
build: .
image: wemix/multinode-demo:latest
volumes:
- ".:/opt"
entrypoint: ["/usr/local/wemix/bin/gwemix-demo.sh", "start-leader", "wemix1", "wemix2", "wemix3"]
- /etc/localtime:/etc/localtime:ro
- ./testdata/bootnode.sh:/usr/local/wemix/bin/bootnode.sh:ro
- ./testdata/gwemix.sh:/usr/local/wemix/bin/gwemix.sh:ro
- ./testdata/config.json:/usr/local/wemix/conf/config.json:ro
- ./testdata/deploy-governance.js:/usr/local/wemix/conf/deploy-governance.js:ro
- ./testdata/genesis.json:/usr/local/wemix/genesis.json:ro
- ./testdata/.rc:/usr/local/wemix/.rc:ro
- ./testdata/keystore:/usr/local/wemix/keystore
- ./testdata/nodekey/nodekey1:/usr/local/wemix/geth/nodekey:ro
ports:
- 8588:8588
- 8589:8589
- 8598:8598
container_name: wemix1
entrypoint: ["sh", "-c", "bootnode.sh && sleep 5 && tail -f /usr/local/wemix/logs/log"]
wemix2:
container_name: wemix2
image: wemix/node-demo:latest
hostname: wemix2
stdin_open: true
networks:
wemix_bridge:
ipv4_address: 172.16.237.12
restart: unless-stopped
tty: true
image: wemix/multinode-demo:latest
depends_on:
- wemix1
wemix1:
condition: service_started
volumes:
- ".:/opt"
entrypoint: ["/usr/local/wemix/bin/gwemix-demo.sh", "start"]
- /etc/localtime:/etc/localtime:ro
- ./testdata/gwemix.sh:/usr/local/wemix/bin/gwemix.sh:ro
- ./testdata/genesis.json:/usr/local/wemix/genesis.json:ro
- ./testdata/.rc:/usr/local/wemix/.rc:ro
- ./testdata/keystore/account2:/usr/local/wemix/keystore/account2
- ./testdata/nodekey/nodekey2:/usr/local/wemix/geth/nodekey:ro
container_name: wemix2
entrypoint: ["sh", "-c", "gwemix.sh start && sleep 5 && tail -f /usr/local/wemix/logs/log"]
wemix3:
container_name: wemix3
image: wemix/node-demo:latest
hostname: wemix3
stdin_open: true
networks:
wemix_bridge:
ipv4_address: 172.16.237.13
restart: unless-stopped
tty: true
image: wemix/multinode-demo:latest
depends_on:
- wemix1
wemix1:
condition: service_started
volumes:
- ".:/opt"
entrypoint: ["/usr/local/wemix/bin/gwemix-demo.sh", "start"]
- /etc/localtime:/etc/localtime:ro
- ./testdata/gwemix.sh:/usr/local/wemix/bin/gwemix.sh:ro
- ./testdata/genesis.json:/usr/local/wemix/genesis.json:ro
- ./testdata/.rc:/usr/local/wemix/.rc:ro
- ./testdata/keystore/account3:/usr/local/wemix/keystore/account3
- ./testdata/nodekey/nodekey3:/usr/local/wemix/geth/nodekey:ro
container_name: wemix3
entrypoint: ["sh", "-c", "gwemix.sh start && sleep 5 && tail -f /usr/local/wemix/logs/log"]

networks:
wemix_bridge:
name: wemix_bridge
driver: bridge
ipam:
driver: default
config:
- subnet: 172.16.237.0/24
2 changes: 2 additions & 0 deletions containers/docker/wemix/testdata/.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PORT=8588
DISCOVER=0
25 changes: 25 additions & 0 deletions containers/docker/wemix/testdata/bootnode.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

cd $(dirname ${BASH_SOURCE[0]})/..

gwemix.sh start
sleep 5

RESULT=$(gwemix --exec "admin.wemixInfo.etcd" attach gwemix.ipc)

if [[ "$RESULT" == "Fatal:"* ]]; then
echo "Failed to start gwemix!"
exit 1
elif [[ "$RESULT" == "{}" ]]; then
echo "Initailize governance"

gwemix.sh init-gov wemix conf/config.json
sleep 5

gwemix --exec "admin.wemixInfo" attach gwemix.ipc
gwemix --exec "admin.etcdInit()" attach gwemix.ipc # Initialize etcd
sleep 5
gwemix --exec "admin.wemixInfo.etcd" attach gwemix.ipc
fi

echo "Started gwemix!"
69 changes: 69 additions & 0 deletions containers/docker/wemix/testdata/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"extraData": "The beginning of Wemix3.0 localnet",
"staker": "0xf00d9928ed1dada205aec56ab85e0e2ab5670ad5",
"ecosystem": "0x92875d5ba8b104c375a471d58a6de4f75ccb431f",
"maintenance": "0x2c77f2c8997182e31a19ec48e321f4d09f36819e",
"feecollector": "0x2c77f2c8997182e31a19ec48e321f4d09f36819e",
"env": {
"ballotDurationMin": 86400,
"ballotDurationMax": 604800,
"stakingMin": 1500000000000000000000000,
"stakingMax": 1500000000000000000000000,
"MaxIdleBlockInterval": 100,
"blockCreationTime": 5000,
"blockRewardAmount": 1000000000000000000,
"maxPriorityFeePerGas": 100000000000,
"rewardDistributionMethod": [ 4000, 1000, 2500, 2500 ],
"maxBaseFee": 50000000000000,
"blockGasLimit": 105000000,
"baseFeeMaxChangeRate": 55,
"gasTargetPercentage": 30
},
"members": [
{
"addr": "0x92875d5ba8b104c375a471d58a6de4f75ccb431f",
"stake": 1500000000000000000000000,
"name": "node1",
"id": "0xe4dfe854223c1b85ea7962cd724d98eec1863a49847eb749bc5caa519104713c78a972ebf263b13329ceb8a7b5959125ab6e9a3c73c15f659cc1291d0a7aae1e",
"ip": "172.16.237.11",
"port": 8589,
"bootnode": true
},
{
"addr": "0xb61544371ef73161496009a77989da30f8f91867",
"stake": 1500000000000000000000000,
"name": "node2",
"id": "0x4b8b229f97bbe68fa7cfc43e357fe74503733d0cc236b8d176d896f33547d8fcfd59daa0b4f9e1a4e83157adf1a386ea314dfb9a3e6efe747948fa5e10d5fff5",
"ip": "172.16.237.12",
"port": 8589,
"bootnode": false
},
{
"addr": "0x708ebe75a5dbc5f56176db6e84ce5740897e8a17",
"stake": 1500000000000000000000000,
"name": "node3",
"id": "0xa6f08d187a8da5d76f072b0f0d114e1469e77a53713b710177bd6206b16331b8ead7d41bdeec1df3bb0bb56de8f102e86ecaf44bb6affb4383151c603ff5ac10",
"ip": "172.16.237.13",
"port": 8589,
"bootnode": false
}
],
"accounts": [
{
"addr": "0x92875d5ba8b104c375a471d58a6de4f75ccb431f",
"balance": 2000000000000000000000000
},
{
"addr": "0xb61544371ef73161496009a77989da30f8f91867",
"balance": 2000000000000000000000000
},
{
"addr": "0x708ebe75a5dbc5f56176db6e84ce5740897e8a17",
"balance": 2000000000000000000000000
},
{
"addr": "0x2c77f2c8997182e31a19ec48e321f4d09f36819e",
"balance": 2000000000000000000000000
}
]
}
Loading

0 comments on commit 3e13bd8

Please sign in to comment.