Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker setup #48

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ mock-data/broadcast/
gate-keeper/packages/contracts/.env
item-seller/packages/contracts/.env
item-seller/packages/client/.env
vending-machine/packages/contracts/.env
vending-machine/packages/contracts/.env
.pnpm-store/
19 changes: 18 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ services:
ports:
- "8545:8545"
healthcheck:
test: [ "CMD-SHELL", "anvil --help || exit 1" ]
test: ["CMD-SHELL", "anvil --help || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 20s
networks:
- devNet

world-deployer:
container_name: world-deployer
Expand All @@ -24,3 +26,18 @@ services:
condition: service_healthy
command: "--rpc-url http://foundry:8545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
tty: true
networks:
- devNet

dev-environment:
container_name: dev-environment
image: ghcr.io/projectawakening/builder-dev-environment:0.0.1
networks:
- devNet
tty: true
volumes:
- ./:/builder-examples

networks:
devNet:
driver: bridge
16 changes: 16 additions & 0 deletions docker-file.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:18.12.1

RUN mkdir -p /usr/src/builder-examples
WORKDIR /usr/src/builder-examples
RUN apt-get install -y git curl

RUN npm install -g pnpm@8

RUN curl -L https://foundry.paradigm.xyz | bash && \
export PATH="$HOME/.foundry/bin:$PATH" && \
foundryup && \
echo 'export PATH="$HOME/.foundry/bin:$PATH"' >> /root/.bash_profile

ENV PATH="/root/.foundry/bin:${PATH}"

ENTRYPOINT ["tail", "-f", "/dev/null"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this since this is being built elsewhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this docker file anymore ?

12 changes: 8 additions & 4 deletions gate-keeper/packages/contracts/.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
WORLD_ADDRESS=0x8a791620dd6260079bf849dc5567adc3f2fdc318
PLAYER_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80

#Docker RPC
RPC_URL="http://foundry:8545"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break the deploy:local script for those that are not on the docker network, right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to remove this from the env and pass in with a special deploy:builder_env command. I know its not the nicest approach.

CHAIN_ID=31337

#Local RPC
RPC_URL="http://127.0.0.1:8545"
# RPC_URL="http://127.0.0.1:8545"
CHAIN_ID=31337

#Devnet RPC
# RPC_URL=https://testnet-game-sync.nursery.reitnorf.com
# CHAIN_ID=3541000
# Garnet RPC
# RPC_URL=https://rpc.garnetchain.com
# CHAIN_ID=17069

#GATE KEEPER CONFIG
# Copy this info from in game smart storage unit
Expand Down
2 changes: 1 addition & 1 deletion gate-keeper/packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"prettier": "prettier --write 'src/**/*.sol'",
"solhint": "solhint --config ./.solhint.json 'src/**/*.sol' --fix",
"test": "tsc --noEmit && mud test",
"mock-data": ". ./.env && pnpm forge script ./script/MockSsuData.s.sol:MockSsuData --broadcast --rpc-url $RPC_URL --chain-id $CHAIN_ID --sig \"run(address)\" $WORLD_ADDRESS -vvv",
"mock-data": ". ./.env && pnpm mud build && pnpm forge script ./script/MockSsuData.s.sol:MockSsuData --broadcast --rpc-url $RPC_URL --chain-id $CHAIN_ID --sig \"run(address)\" $WORLD_ADDRESS -vvv",
"configure-gate-keeper": ". ./.env && pnpm forge script ./script/ConfigureGateKeeper.s.sol:ConfigureGateKeeper --broadcast --rpc-url $RPC_URL --chain-id $CHAIN_ID --sig \"run(address)\" $WORLD_ADDRESS -vvv",
"deposit-to-ssu": ". ./.env && pnpm forge script ./script/DepositToSSU.s.sol:DepositToSSU --broadcast --rpc-url $RPC_URL --chain-id $CHAIN_ID --sig \"run(address)\" $WORLD_ADDRESS -vvv"
},
Expand Down
13 changes: 9 additions & 4 deletions item-seller/packages/contracts/.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
WORLD_ADDRESS=0x8a791620dd6260079bf849dc5567adc3f2fdc318
PLAYER_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80

#Local RPC
RPC_URL="http://127.0.0.1:8545"
#Docker RPC
RPC_URL="http://foundry:8545"
CHAIN_ID=31337

# Devnet RPC
# RPC_URL=https://devnet-game-sync.nursery.reitnorf.com
#Local RPC
# RPC_URL="http://127.0.0.1:8545"
# CHAIN_ID=31337

# Garnet RPC
# RPC_URL=https://rpc.garnetchain.com
# CHAIN_ID=17069

#SMART STORAGE UNIT ID
#Copy this info from in game smart storage unit
Expand Down
6 changes: 5 additions & 1 deletion item-seller/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ Production which connects to Nebula

https://blockchain-gateway-nebula.nursery.reitnorf.com/config

eg: `pnpm deploy:local --worldAddress 0xafc8e4fd5eee66590c93feebf526e1aa2e93c6c3`
```bash
pnpm run deploy:prod --worldAddress <worldAddress>
```

eg: `pnpm run deploy:local --worldAddress 0xafc8e4fd5eee66590c93feebf526e1aa2e93c6c3`

Once the deployment is successful, you'll see a screen similar to the one below. This process deploys the Item Seller contract and a test ERC20 token required for the Item Seller. Be sure to copy the ERC20 token address and save it for future use.
![alt text](./readme-imgs/deployment.png)
Expand Down
12 changes: 10 additions & 2 deletions item-trade/packages/contracts/.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,18 @@ PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
WORLD_ADDRESS=0x8a791620dd6260079bf849dc5567adc3f2fdc318
PLAYER_PRIVATE_KEY=0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d

#Local RPC
RPC_URL="http://127.0.0.1:8545"
#Docker RPC
RPC_URL="http://foundry:8545"
CHAIN_ID=31337

#Local RPC
# RPC_URL="http://127.0.0.1:8545"
# CHAIN_ID=31337

# Garnet RPC
# RPC_URL=https://rpc.garnetchain.com
# CHAIN_ID=17069

#SMART STORAGE UNIT ID
#Copy this info from in game smart storage unit
SSU_ID=11196282436511424955311689125460433858625928370621647559384988961918634545666
Expand Down
6 changes: 5 additions & 1 deletion item-trade/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ Production which connects to Nebula

https://blockchain-gateway-nebula.nursery.reitnorf.com/config

eg: `pnpm deploy:local --worldAddress 0xafc8e4fd5eee66590c93feebf526e1aa2e93c6c3`
```bash
pnpm run deploy:prod --worldAddress <worldAddress>
```

eg: `pnpm run deploy:local --worldAddress 0xafc8e4fd5eee66590c93feebf526e1aa2e93c6c3`

Once the deployment is successful, you'll see a screen similar to the one below. This process deploys the Item Trade contract and a test ERC20 token required for the Item Trade. Be sure to copy the ERC20 token address and save it for future use.
![alt text](./readme-imgs/deployment.png)
Expand Down
11 changes: 9 additions & 2 deletions smart-gate/packages/contracts/.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,17 @@ PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
WORLD_ADDRESS=0x8a791620dd6260079bf849dc5567adc3f2fdc318
PLAYER_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80

#Local RPC
RPC_URL="http://127.0.0.1:8545"
#Docker RPC
RPC_URL="http://foundry:8545"
CHAIN_ID=31337

#Local RPC
# RPC_URL="http://127.0.0.1:8545"
# CHAIN_ID=31337

# Garnet RPC
# RPC_URL=https://rpc.garnetchain.com
# CHAIN_ID=17069

# SMART GATE CONFIG
# Copy this info from in game smart gate
Expand Down
11 changes: 9 additions & 2 deletions smart-turret/packages/contracts/.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,17 @@ PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
WORLD_ADDRESS=0x8a791620dd6260079bf849dc5567adc3f2fdc318
PLAYER_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80

#Local RPC
RPC_URL="http://127.0.0.1:8545"
#Docker RPC
RPC_URL="http://foundry:8545"
CHAIN_ID=31337

#Local RPC
# RPC_URL="http://127.0.0.1:8545"
# CHAIN_ID=31337

# Garnet RPC
# RPC_URL=https://rpc.garnetchain.com
# CHAIN_ID=17069

# SMART TURRET CONFIG
# Copy this info from in game smart turret
Expand Down
2 changes: 2 additions & 0 deletions smart-turret/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ This will deploy the contracts to your local world.
```bash
pnpm deploy:local --worldAddress <worldAddress>
```
**Devnet/Production Deployment**
To deploy in devenet or production you can retrieve the world address through the below links and then replace <worldAddress> with the world address.

**Devnet/Production Deployment**
To deploy in devenet or production you can retrieve the world address through the below links and then replace <worldAddress> with the world address.
Expand Down
14 changes: 9 additions & 5 deletions vending-machine/packages/contracts/.env
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ WORLD_ADDRESS=0x8a791620dd6260079bf849dc5567adc3f2fdc318
#Player interacting with the SSU
PLAYER_PRIVATE_KEY=0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d

#Local RPC
RPC_URL="http://127.0.0.1:8545"
#Docker RPC
RPC_URL="http://foundry:8545"
CHAIN_ID=31337

#Devnet RPC
# RPC_URL=https://testnet-game-sync.nursery.reitnorf.com
# CHAIN_ID=3541000
#Local RPC
# RPC_URL="http://127.0.0.1:8545"
# CHAIN_ID=31337

# Garnet RPC
# RPC_URL=https://rpc.garnetchain.com
# CHAIN_ID=17069

#SMART STORAGE UNIT ID
#Copy this info from in game smart storage unit
Expand Down
8 changes: 0 additions & 8 deletions vending-machine/packages/contracts/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ extra_output_files = [
]
fs_permissions = [{ access = "read", path = "./"}]

[profile.devnet]
# CCP Internal Devnet?
eth_rpc_url = "https://devnet-game-sync.nursery.reitnorf.com"

[profile.testnet]
# CCP Internal Testnet?
eth_rpc_url = "https://testnet-game-sync.nursery.reitnorf.com"

[profile.garnet]
# Public Testnet
eth_rpc_url = "https://rpc.garnetchain.com"
Expand Down