Skip to content

Commit 1d6175d

Browse files
areabassgeta
authored andcommitted
First pass at dev environment for proxy colonies
1 parent ef55a33 commit 1d6175d

File tree

8 files changed

+170
-4
lines changed

8 files changed

+170
-4
lines changed

docker/colony-cdapp-dev-env-network

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM colony-cdapp-dev-env/base:latest
22

3-
ENV NETWORK_HASH=291c8ad437f0a898e51c737ca0a3272d50be01af
3+
ENV NETWORK_HASH=d01b4401813f3bc9b9f04515708cf755db908c81
44

55
# Declare volumes to set up metadata
66
VOLUME [ "/colonyCDapp/amplify/mock-data" ]
@@ -33,6 +33,8 @@ RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | b
3333
# Install required network dependencies
3434
RUN pnpm i --frozen-lockfile
3535

36+
RUN npx hardhat compile
37+
3638
# Initialize the justification tree cache
3739
# To avoid the error spewed by the miner at startup
3840
RUN echo "{}" > ./packages/reputation-miner/justificationTreeCache.json
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM colony-cdapp-dev-env/network:latest
2+
# Add dependencies from the host
3+
# Note: these are listed individually so that if they change, they won't affect
4+
# the build of the other images
5+
ADD docker/files/network-remote/run.sh.base /colonyCDappBackend/run.sh
6+
7+
WORKDIR /colonyCDappBackend
8+
9+
# Open up ports to the docker image
10+
# Ganache
11+
EXPOSE 8545
12+
13+
# Make the run script executable
14+
RUN chmod +x ./run.sh
15+
16+
# Battlecruiser Operational!
17+
CMD [ "./run.sh" ]
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
FROM colony-cdapp-dev-env/network:latest
2+
# Add dependencies from the host
3+
# Note: these are listed individually so that if they change, they won't affect
4+
# the build of the other images
5+
ADD docker/files/network-wormhole-relayer/run.sh.base /colonyCDappBackend/run.sh
6+
7+
WORKDIR /colonyCDappBackend
8+
9+
# Open up ports to the docker image
10+
# Ganache
11+
# EXPOSE 8545
12+
13+
RUN apt-get update
14+
RUN apt-get install -y ca-certificates curl
15+
RUN install -m 0755 -d /etc/apt/keyrings
16+
RUN curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
17+
RUN chmod a+r /etc/apt/keyrings/docker.asc
18+
19+
# Add the repository to Apt sources:
20+
RUN echo \
21+
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
22+
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
23+
tee /etc/apt/sources.list.d/docker.list > /dev/null
24+
RUN apt-get update
25+
RUN apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
26+
27+
RUN cd ./colonyNetwork/lib/wormhole/sdk/js-proto-node && npm i
28+
29+
# Make the run script executable
30+
RUN chmod +x ./run.sh
31+
32+
# Battlecruiser Operational!
33+
CMD [ "./run.sh" ]

docker/colony-cdapp-dev-env-orchestration.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,40 @@ services:
2626
amplify-setup:
2727
condition: service_completed_successfully
2828

29+
network-contracts-remote:
30+
container_name: 'network-remote'
31+
image: colony-cdapp-dev-env/network-remote:latest
32+
volumes:
33+
- 'amplify-mock-data:/colonyCDapp/amplify/mock-data'
34+
ports:
35+
- '8546:8545'
36+
healthcheck:
37+
test: ['CMD', 'curl', '-f', 'http://localhost:8545']
38+
interval: 5s
39+
retries: 1000
40+
depends_on:
41+
amplify-setup:
42+
condition: service_completed_successfully
43+
environment:
44+
CHAIN_ID: 265669101
45+
46+
network-contracts-remote-2:
47+
container_name: 'network-remote-2'
48+
image: colony-cdapp-dev-env/network-remote:latest
49+
volumes:
50+
- 'amplify-mock-data:/colonyCDapp/amplify/mock-data'
51+
ports:
52+
- '8547:8545'
53+
healthcheck:
54+
test: ['CMD', 'curl', '-f', 'http://localhost:8545']
55+
interval: 5s
56+
retries: 1000
57+
depends_on:
58+
amplify-setup:
59+
condition: service_completed_successfully
60+
environment:
61+
CHAIN_ID: 265669102
62+
2963
reputation-monitor:
3064
container_name: 'monitor'
3165
image: colony-cdapp-dev-env/reputation-monitor:latest
@@ -95,6 +129,19 @@ services:
95129
network-contracts:
96130
condition: service_healthy
97131

132+
wormhole-relayer:
133+
container_name: 'wormhole-relayer'
134+
image: colony-cdapp-dev-env/network-wormhole-relayer:latest
135+
volumes:
136+
- '/var/run/docker.sock:/var/run/docker.sock'
137+
depends_on:
138+
network-contracts:
139+
condition: service_healthy
140+
network-contracts-remote:
141+
condition: service_healthy
142+
network-contracts-remote-2:
143+
condition: service_healthy
144+
98145
volumes:
99146
amplify-backend:
100147
amplify-mock-data:
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
cd colonyNetwork
4+
5+
# Ganache
6+
7+
# Uncomment the line below if you need ganache to run in verbose mode
8+
# sed -i 's/100000000000000000000" >\/dev\/null 2>&1/100000000000000000000" --verbose/g' scripts/start-blockchain-client.sh
9+
# sed -i 's/--db $DBPATH/--db $DBPATH --server.host "0.0.0.0"/g' scripts/start-blockchain-client.sh
10+
pnpm run start:blockchain:client
11+
12+
# Colony Network Contracts
13+
14+
npx hardhat compile
15+
npx hardhat deploy-proxy-network --network development
16+
17+
sleep infinity
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/bash
2+
cd ./colonyNetwork/lib/wormhole/ && DOCKER_BUILDKIT=1 docker build --target node-export -f Dockerfile.proto -o type=local,dest=. .
3+
cd ../.. && npx tsc --esModuleInterop --downlevelIteration ./scripts/mockGuardianSpy.ts
4+
5+
cd ./lib/safe-contracts
6+
7+
# This is the private key for the first account we create on ganache, so has ether to pay for gas fees
8+
rm -rf ./deployments/custom
9+
PK="0x0355596cdb5e5242ad082c4fe3f8bbe48c9dba843fe1f99dd8272f487e70efae" NODE_URL=http://network:8545 npx hardhat deploy --network custom
10+
11+
rm -rf ./deployments/custom
12+
PK="0x0355596cdb5e5242ad082c4fe3f8bbe48c9dba843fe1f99dd8272f487e70efae" NODE_URL=http://network-remote:8545 npx hardhat deploy --network custom
13+
14+
rm -rf ./deployments/custom
15+
PK="0x0355596cdb5e5242ad082c4fe3f8bbe48c9dba843fe1f99dd8272f487e70efae" NODE_URL=http://network-remote-2:8545 npx hardhat deploy --network custom
16+
17+
cd ../../
18+
19+
echo "const wormhole = require("@certusone/wormhole-sdk");
20+
21+
module.exports = {
22+
chains: {
23+
[wormhole.CHAIN_ID_ARBITRUM_SEPOLIA]: {
24+
endpoints: ["http://localhost:8545"],
25+
colonyBridgeAddress: "0x633899227A3BC1f79de097149E1E3C8097c07b1a",
26+
payForGas: true,
27+
evmChainId: 265669100,
28+
},
29+
[wormhole.CHAIN_ID_SEPOLIA]: {
30+
endpoints: ["http://localhost:8546"],
31+
colonyBridgeAddress: "0x161944B5601a7d3004E20d4Ca823F710838Ea1be",
32+
payForGas: true,
33+
evmChainId: 265669101,
34+
},
35+
[wormhole.CHAIN_ID_OPTIMISM_SEPOLIA]: {
36+
endpoints: ["http://localhost:8547"],
37+
colonyBridgeAddress: "0x161944B5601a7d3004E20d4Ca823F710838Ea1be",
38+
payForGas: false,
39+
evmChainId: 265669102,
40+
},
41+
}
42+
},
43+
};
44+
" > ./packages/wormhole-relayer/config.js
45+
46+
node -e 'require("./scripts/setup-bridging-contracts.js").setupBridging("http://network:8545", ["http://network-remote:8545", "http://network-remote-2:8545"])'
47+
48+
sleep infinity

docker/files/network/run.sh.base

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cd colonyNetwork
77
# Uncomment the line below if you need ganache to run in verbose mode
88
# sed -i 's/100000000000000000000" >\/dev\/null 2>&1/100000000000000000000" --verbose/g' scripts/start-blockchain-client.sh
99
# sed -i 's/--db $DBPATH/--db $DBPATH --server.host "0.0.0.0"/g' scripts/start-blockchain-client.sh
10-
pnpm run start:blockchain:client &
10+
pnpm run start:blockchain:client
1111

1212
# Colony Network Contracts
1313

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@
66
"scripts": {
77
"docker:build:base": "DOCKER_BUILDKIT=1 docker build --build-arg AMAZON_ARCH_FLAG=$(bash scripts/amazon-arch-flag.sh) --tag colony-cdapp-dev-env/base --file ./docker/colony-cdapp-dev-env-base .",
88
"docker:build:network": "DOCKER_BUILDKIT=1 docker build --tag colony-cdapp-dev-env/network --file ./docker/colony-cdapp-dev-env-network .",
9+
"docker:build:network-remote": "DOCKER_BUILDKIT=1 docker build --tag colony-cdapp-dev-env/network-remote --file ./docker/colony-cdapp-dev-env-network-remote .",
10+
"docker:build:network-wormhole-relayer": "DOCKER_BUILDKIT=1 docker build --tag colony-cdapp-dev-env/network-wormhole-relayer --file ./docker/colony-cdapp-dev-env-network-wormhole-relayer .",
911
"docker:build:monitor": "DOCKER_BUILDKIT=1 docker build --tag colony-cdapp-dev-env/reputation-monitor --file ./docker/colony-cdapp-dev-env-reputation-monitor .",
1012
"docker:build:mocking": "DOCKER_BUILDKIT=1 docker build --tag colony-cdapp-dev-env/mocking --file ./docker/colony-cdapp-dev-env-mocking .",
1113
"docker:build:ingestor": "DOCKER_BUILDKIT=1 docker build --ulimit nofile=5000:5000 --tag colony-cdapp-dev-env/block-ingestor --file ./docker/colony-cdapp-dev-env-block-ingestor .",
1214
"docker:build:amplify": "DOCKER_BUILDKIT=1 docker build --tag colony-cdapp-dev-env/amplify --file ./docker/colony-cdapp-dev-env-amplify .",
1315
"docker:build:safe": "DOCKER_BUILDKIT=1 docker build --tag colony-cdapp-dev-env/safe --file ./docker/colony-cdapp-dev-env-safe .",
1416
"docker:build:auth": "DOCKER_BUILDKIT=1 docker build --tag colony-cdapp-dev-env/auth-proxy --file ./docker/colony-cdapp-dev-env-auth-proxy .",
1517
"docker:build:bridge": "DOCKER_BUILDKIT=1 docker build --tag colony-cdapp-dev-env/mocking --file ./docker/colony-cdapp-dev-env-mocking .",
16-
"docker:build:core": "npm run docker:build:base && npm run docker:build:network && npm run docker:build:monitor && npm run docker:build:ingestor && npm run docker:build:amplify && npm run docker:build:auth",
17-
"docker:build:all": "npm run docker:build:base && npm run docker:build:network && npm run docker:build:monitor && npm run docker:build:ingestor && npm run docker:build:amplify && npm run docker:build:auth && npm run docker:build:mocking",
18+
"docker:build:core": "npm run docker:build:base && npm run docker:build:network && npm run docker:build:network-remote && npm run docker:build:network-wormhole-relayer && npm run docker:build:monitor && npm run docker:build:mocking && npm run docker:build:ingestor && npm run docker:build:amplify && npm run docker:build:auth",
19+
"docker:build:all": "npm run docker:build:base && npm run docker:build:network && npm run docker:build:network-remote && && npm run docker:build:network-wormhole-relayer && npm run docker:build:monitor && npm run docker:build:mocking && npm run docker:build:ingestor && npm run docker:build:amplify && npm run docker:build:safe && npm run docker:build:auth",
1820
"docker:compose:core": "docker compose --file docker/colony-cdapp-dev-env-orchestration.yaml",
1921
"docker:compose:all": "docker compose --file docker/colony-cdapp-dev-env-orchestration-all.yaml",
2022
"dev": "npm run watch-amplify & npm run generate-notifications-dev-key && npm run docker:build:core && npm run docker:compose:core up -- --force-recreate -V",

0 commit comments

Comments
 (0)