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

feat: dedockerize nodes #319

Merged
merged 24 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
bcda877
Working local testing
ChaoticTempest Oct 11, 2023
97eceaf
Moved running local related testing functions over to local.rs
ChaoticTempest Oct 11, 2023
fa5f204
Reduced LeaderNode::api to not require arguments
ChaoticTempest Oct 11, 2023
3fff52a
Moved all containers init into env/
ChaoticTempest Oct 12, 2023
869c39a
Moved containers.rs and local.rs into env/
ChaoticTempest Oct 12, 2023
9d967f3
Change feature flag to docker-test
ChaoticTempest Oct 12, 2023
4895ad5
Fix docker test
ChaoticTempest Oct 12, 2023
2d496cf
Consistent way to create CLI args
ChaoticTempest Oct 12, 2023
920b895
Removed need for integration-tests/main.rs
ChaoticTempest Oct 12, 2023
b4de4f0
Merge branch 'develop' of github.com:near/mpc-recovery into phuong/fe…
ChaoticTempest Oct 12, 2023
46b615a
Update docs and cleanup
ChaoticTempest Oct 12, 2023
fdcbeaf
Merge branch 'develop' of github.com:near/mpc-recovery into phuong/fe…
ChaoticTempest Oct 13, 2023
d68e11f
Cleanup
ChaoticTempest Oct 13, 2023
3f2fc62
setup-env cmd
ChaoticTempest Oct 13, 2023
8c7288e
Update GA pipeline
ChaoticTempest Oct 13, 2023
2b04955
More cleanup
ChaoticTempest Oct 13, 2023
9fbf7f5
Use env::run for setup-env
ChaoticTempest Oct 13, 2023
3921623
More cleanup
ChaoticTempest Oct 13, 2023
8ca535a
Better setup-env logging
ChaoticTempest Oct 13, 2023
3325261
prefer 127.0.0.1 over localhost to enforce IPv4
itegulov Oct 16, 2023
c7d3837
Separate out docker image dep
ChaoticTempest Oct 16, 2023
cb00f2c
Merge branch 'phuong/feat/dedockerize-node' of github.com:near/mpc-re…
ChaoticTempest Oct 16, 2023
6c56325
Rename local_url to pk_local_url
ChaoticTempest Oct 16, 2023
0b925a8
Move mpc-recovery build step
ChaoticTempest Oct 16, 2023
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
5 changes: 2 additions & 3 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,9 @@ jobs:
env:
GOOGLE_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS_DEV }}

- name: Pull MPC Recovery Docker Image
- name: Build MPC Recovery Binary Locally
run: |
docker pull us-east1-docker.pkg.dev/pagoda-discovery-platform-dev/mpc-recovery/mpc-recovery-dev:${{ github.sha }}
docker tag us-east1-docker.pkg.dev/pagoda-discovery-platform-dev/mpc-recovery/mpc-recovery-dev:${{ github.sha }} near/mpc-recovery:latest
cargo build --release
ChaoticTempest marked this conversation as resolved.
Show resolved Hide resolved

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ publish = false
[dependencies]
aes-gcm = "0.10"
anyhow = { version = "1.0", features = ["backtrace"] }
async-process = "1"
bollard = "0.11"
clap = { version = "4.2", features = ["derive", "env"] }
ed25519-dalek = {version = "1.0.1", features = ["serde"]}
curv = { package = "curv-kzen", version = "0.9", default-features = false }
ed25519-dalek = { version = "1.0.1", features = ["serde"] }
futures = "0.3"
hex = "0.4.3"
hyper = { version = "0.14", features = ["full"] }
Expand All @@ -36,9 +38,9 @@ test-log = { version = "0.2.12", features = ["log", "trace"] }
env_logger = "0.10.0"
tracing-log = "0.1.3"
tokio-util = { version = "0.7", features = ["full"] }
curv = { package = "curv-kzen", version = "0.9", default-features = false }
reqwest = "0.11.16"

[features]
drop-containers = []
default = ["drop-containers"]
drop-containers = []
ChaoticTempest marked this conversation as resolved.
Show resolved Hide resolved
docker-test = []
39 changes: 28 additions & 11 deletions integration-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,43 @@
Running integration tests requires you to have relayer and sandbox docker images present on your machine:

```BASH
docker pull ghcr.io/near/pagoda-relayer-rs-fastauth
docker pull ghcr.io/near/os-relayer
docker pull ghcr.io/near/sandbox
```

In case of authorization issues make sure you have logged into docker using your [access token](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-with-a-personal-access-token-classic).

Build OIDC Provider test image
```bash
docker build -t near/test-oidc-provider ./test-oidc-provider
```

Now, build mpc-recovery from the project's root:

```BASH
docker build . -t near/mpc-recovery
cargo build --release
```

**Note**. You will need to re-build the Docker image each time you make a code change and want to run the integration tests.
Then run the integration tests:

Build OIDC Provider test image
```bash
docker build -t near/test-oidc-provider ./test-oidc-provider
```BASH
cargo test -p mpc-recovery-integration-tests
```

Finally, run the integration tests:
### Alternative: Docker Builds/Tests

If instead, we need to run docker build/tests:

```BASH
cargo test -p mpc-recovery-integration-tests
docker build . -t near/mpc-recovery
```

**Note**. You will need to re-build the Docker image each time you make a code change and want to run the integration tests.

Finally, run the integration tests with the built docker image:

```BASH
cargo test -p mpc-recovery-integration-tests --features docker-test
```

## FAQ
Expand Down Expand Up @@ -55,7 +70,7 @@ b2724d0c9530 near/mpc-recovery:latest "mpc-recovery st
67308ab06c5d near/mpc-recovery:latest "mpc-recovery start-…" 5 minutes ago Up 5 minutes 0.0.0.0:32791->3000/tcp, :::32791->3000/tcp upbeat_volhard
65ec65384af4 near/mpc-recovery:latest "mpc-recovery start-…" 5 minutes ago Up 5 minutes 0.0.0.0:32790->3000/tcp, :::32790->3000/tcp friendly_easley
b4f90b1546ec near/mpc-recovery:latest "mpc-recovery start-…" 5 minutes ago Up 5 minutes 0.0.0.0:32789->3000/tcp, :::32789->3000/tcp vibrant_allen
934ec13d9146 ghcr.io/near/pagoda-relayer-rs-fastauth:latest "/usr/local/bin/entr…" 5 minutes ago Up 5 minutes 0.0.0.0:32788->16581/tcp, :::32788->16581/tcp sleepy_grothendieck
934ec13d9146 ghcr.io/near/os-relayer:latest "/usr/local/bin/entr…" 5 minutes ago Up 5 minutes 0.0.0.0:32788->16581/tcp, :::32788->16581/tcp sleepy_grothendieck
c505ead6eb18 redis:latest "docker-entrypoint.s…" 5 minutes ago Up 5 minutes 0.0.0.0:32787->6379/tcp, :::32787->6379/tcp trusting_lederberg
2843226b16a9 google/cloud-sdk:latest "gcloud beta emulato…" 5 minutes ago Up 5 minutes 0.0.0.0:32786->15805/tcp, :::32786->15805/tcp hungry_pasteur
3f4c70020a4c ghcr.io/near/sandbox:latest "near-sandbox --home…" 5 minutes ago Up 5 minutes practical_elbakyan
Expand All @@ -68,12 +83,14 @@ Now, you can inspect each container's logs according to your needs using `docker
We have a CLI tool that can instantiate a short-lived development environment that has everything except for the leader node set up. You can then seamlessly plug in your own leader node instance that you have set up manually (the tool gives you a CLI command to use as a starting point, but you can attach debugger, enable extra logs etc). Try it out now (sets up 3 signer nodes):

```bash
$ cargo run -p mpc-recovery-integration-tests -- test-leader 3
$ export RUST_LOG=info
$ cargo run -p mpc-recovery-integration-tests -- setup-env 3
```

### I'm getting "Error: error trying to connect: No such file or directory (os error 2)"

It's a known issue on MacOS. Try executiong the following command:

```bash
sudo ln -s $HOME/.docker/run/docker.sock /var/run/docker.sock
```
```
3 changes: 3 additions & 0 deletions integration-tests/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// HACK: need this build script so that env var OUT_DIR gets set:
// https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-crates
fn main() {}
Loading
Loading