Skip to content

Commit 107ad98

Browse files
committed
chore: show docker approach.
1 parent 8bed653 commit 107ad98

19 files changed

Lines changed: 119 additions & 75 deletions

File tree

Cargo.lock

Lines changed: 7 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ mtma-migrator-test-types = { path = "checks/migrator/util/types" }
181181
movement-syncing = { path = "util/movement/movement-syncing" }
182182
movement-core = { path = "util/movement/movement-core" }
183183
movement-util = { path = "util/movement/movement-util" }
184-
movement-aptos-core-inner = { path = "util/movement-aptos/movement-aptos-core-inner" }
185184
movement-aptos = { path = "util/movement-aptos/movement-aptos" }
186185
movement-aptos-core = { path = "util/movement-aptos/movement-aptos-core" }
186+
movement-aptos-util = { path = "util/movement-aptos/movement-aptos-util" }
187187

188188
[workspace.lints.clippy]
189189
debug_assert_with_mut_call = "deny"

util/movement-aptos/movement-aptos-core-inner/Cargo.toml

Lines changed: 0 additions & 36 deletions
This file was deleted.

util/movement-aptos/movement-aptos-core-inner/src/lib.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

util/movement-aptos/movement-aptos-core/Cargo.toml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,35 @@ publish = { workspace = true }
99
rust-version = { workspace = true }
1010

1111
[dependencies]
12-
movement-aptos-core-inner = { workspace = true }
13-
movement-aptos = { workspace = true }
12+
thiserror = { workspace = true }
13+
serde = { workspace = true }
14+
anyhow = { workspace = true }
15+
hex = { workspace = true }
16+
syncador = { workspace = true }
17+
tokio = { workspace = true }
18+
aptos-node = { workspace = true }
19+
aptos-config = { workspace = true }
20+
serde_json = { workspace = true }
21+
clap = { workspace = true }
22+
jsonlvar = { workspace = true }
23+
orfile = { workspace = true }
24+
kestrel = { workspace = true }
25+
reqwest = { workspace = true }
26+
aptos-cached-packages = { workspace = true }
27+
rand = { workspace = true }
28+
chrono = { workspace = true }
29+
uuid = { workspace = true }
30+
movement-aptos-util = { workspace = true }
31+
32+
[dev-dependencies]
33+
uuid = { workspace = true }
34+
chrono = { workspace = true }
1435

1536
[build-dependencies]
16-
cargo_metadata = { workspace = true }
37+
tokio = { workspace = true }
38+
ready-docker = { workspace = true }
39+
movement-aptos-util = { workspace = true }
40+
anyhow = { workspace = true }
1741

1842
[lints]
1943
workspace = true
File renamed without changes.
Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
// make sure that `movement-aptos` is built from the workspace
2-
use std::process::Command;
1+
use movement_aptos_util::CONTAINERS;
32

4-
fn main() {
5-
// check that `movement-aptos` exists
6-
let binary_name =
7-
if cfg!(target_os = "windows") { "movement-aptos.exe" } else { "movement-aptos" };
8-
9-
let output = Command::new(binary_name).output().expect("Failed to run 'movement-aptos");
10-
if !output.status.success() {
11-
panic!("'movement-aptos' failed to run with status: {}", output.status);
3+
#[tokio::main]
4+
async fn main() -> Result<(), anyhow::Error> {
5+
let mut readier: ready_docker::Buildtime<ready_docker::Noop, ready_docker::Noop> =
6+
ready_docker::Buildtime::new();
7+
for container in CONTAINERS {
8+
readier.add_image(container.to_string());
9+
}
10+
if !readier.build().await.is_err() {
11+
panic!("Expected error for arm64 pull: this means that the image is now available and you should update this implementation");
1212
}
13+
14+
Ok(())
1315
}

util/movement-aptos/movement-aptos-core-inner/src/config.rs renamed to util/movement-aptos/movement-aptos-core/src/config.rs

File renamed without changes.
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
pub use ::movement_aptos::*;
2-
pub use movement_aptos_core_inner::*;
1+
pub mod config;
2+
pub mod movement_aptos;
3+
4+
pub use config::*;
5+
pub use movement_aptos::*;

util/movement-aptos/movement-aptos-core-inner/src/movement_aptos.rs renamed to util/movement-aptos/movement-aptos-core/src/movement_aptos.rs

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,35 @@ where
154154

155155
// spawn the node in a new process
156156
let command = Command::line(
157-
"movement-aptos",
157+
"docker",
158158
vec![
159+
// mount the workspace to /app
159160
"run",
160-
"using",
161+
"-v",
162+
&format!(
163+
"{}:/app",
164+
self.workspace
165+
.to_str()
166+
.context("Failed to convert workspace to str")
167+
.map_err(|e| MovementAptosError::Internal(e.into()))?
168+
),
169+
&movement_aptos_util::VALIDATOR.to_string(),
170+
// use the config path
161171
"--config-path",
162-
config_path
163-
.to_str()
164-
.context("Failed to convert config path to str")
165-
.map_err(|e| MovementAptosError::Internal(e.into()))?,
172+
&format!(
173+
"/app/{}",
174+
config_path
175+
.to_str()
176+
.context("Failed to convert config path to str")
177+
.map_err(|e| MovementAptosError::Internal(e.into()))?
178+
),
179+
// expose the port
180+
"-p",
181+
&format!(
182+
"{}:{}",
183+
self.node_config.api.address.port(),
184+
self.node_config.api.address.port()
185+
),
166186
],
167187
None,
168188
false,

0 commit comments

Comments
 (0)