Skip to content

Commit

Permalink
feat : updated the docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
ocdbytes committed Apr 23, 2024
1 parent b3ac61b commit 99ead12
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ COPY ./src ./src
# Build for release
RUN rm -rf ./target/x86_64-unknown-linux-musl/release/deps/karnot_bridge_deploy*
RUN cargo build --target x86_64-unknown-linux-musl --release
RUN touch addresses.json
RUN mkdir data && touch data/addresses.json

ENV RUST_LOG=debug

Expand Down
8 changes: 6 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ cargo build --release
RUST_LOG=debug cargo run -- --help
```

**IMP 🚨** : It will store all the addresses in [data/addresses.json](data/addresses.json)

### Docker 🐳

1. You need to set up the .env file first. Fill all
Expand All @@ -72,7 +74,9 @@ RUST_LOG=debug cargo run -- --help
3. Run the image
```shell
# If both the networks are running locally
docker run -it --net=host karnot-bridge-deploy-app
docker compose -f docker-compose-local.yml up
# If you are hosting on already deployed networks
docker run -it karnot-bridge-deploy-app
docker compose up
```

**IMP 🚨** : It will store all the addresses in [data/addresses.json](data/addresses.json)
23 changes: 23 additions & 0 deletions docker-compose-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: "3.8"
services:
app:
build:
context: .
args:
APP_CHAIN_ID: ${APP_CHAIN_ID}
ETH_CHAIN_ID: ${ETH_CHAIN_ID}
ETH_PRIV_KEY: ${ETH_PRIV_KEY}
ETH_RPC: ${ETH_RPC}
FEE_TOKEN_ADDRESS: ${FEE_TOKEN_ADDRESS}
L1_DEPLOYER_ADDRESS: ${L1_DEPLOYER_ADDRESS}
L1_WAIT_TIME: ${L1_WAIT_TIME}
L2_DEPLOYER_ADDRESS: ${L2_DEPLOYER_ADDRESS}
ROLLUP_PRIV_KEY: ${ROLLUP_PRIV_KEY}
SN_OS_CONFIG_HASH_VERSION: ${SN_OS_CONFIG_HASH_VERSION}
SN_OS_PROGRAM_HASH: ${SN_OS_PROGRAM_HASH}
CROSS_CHAIN_WAIT_TIME: ${CROSS_CHAIN_WAIT_TIME}
volumes:
- type: bind
source: ./data
target: /karnot-bridge-deploy/data/
network_mode: host
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ services:
SN_OS_PROGRAM_HASH: ${SN_OS_PROGRAM_HASH}
CROSS_CHAIN_WAIT_TIME: ${CROSS_CHAIN_WAIT_TIME}
volumes:
- ./addresses.json:/karnot-bridge-deploy/addresses.json:rw
- type: bind
source: ./data
target: /karnot-bridge-deploy/data/
5 changes: 0 additions & 5 deletions eth_event.sh

This file was deleted.

3 changes: 1 addition & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ pub async fn deploy_bridges(config: &CliArgs) {
let clients = Config::init(config).await;
let core_contract_client = StarknetSovereignContract::deploy(&clients).await;
log::debug!("Core address [📦] : {:?}", core_contract_client.address());
save_to_json("l1_core_contract_address", &JsonValueType::EthAddress(core_contract_client.address().clone()))
.unwrap();
save_to_json("l1_core_contract_address", &JsonValueType::EthAddress(core_contract_client.address())).unwrap();
let (program_hash, config_hash) = get_bridge_init_configs(config);
core_contract_client.initialize_core_contract(0u64.into(), 0u64.into(), program_hash, config_hash).await;
log::debug!("Bridge init for goerli successful [✅]");
Expand Down
2 changes: 1 addition & 1 deletion src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub enum JsonValueType {
}

pub fn save_to_json(key: &str, value: &JsonValueType) -> Result<(), io::Error> {
let file_path: &str = "./addresses.json";
let file_path: &str = "./data/addresses.json";
let data = fs::read_to_string(file_path);
let mut json: Map<String, Value> = match data {
Ok(content) => serde_json::from_str(&content).unwrap_or_else(|_| Map::new()),
Expand Down

0 comments on commit 99ead12

Please sign in to comment.