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 Compose Enhancements #136

Merged
merged 20 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
1 change: 0 additions & 1 deletion .env

This file was deleted.

49 changes: 47 additions & 2 deletions .github/workflows/build-push-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ jobs:
run: |
./scripts/movement/build-push-image m1-da-light-node-celestia-bridge

celestia-node-manifest:
m1-da-light-node-celestia-bridge-manifest:
permissions:
contents: read
packages: write
Expand Down Expand Up @@ -469,4 +469,49 @@ jobs:
run: |
./scripts/movement/manifest suzuka-client-e2e-simple-interaction


container-checks:
runs-on: buildjet-8vcpu-ubuntu-2204
needs:
- m1-da-light-node-manifest
- m1-da-light-node-celestia-appd-manifest
- m1-da-light-node-celestia-bridge-manifest
- suzuka-full-node-setup-manifest
- wait-for-celestia-light-node-manifest
- suzuka-full-node-manifest
- suzuka-faucet-service-manifest
- suzuka-client-e2e-simple-interaction-manifest
steps:

- name: Checkout repository
uses: actions/checkout@v4

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main

- name: Read the commit SHA
id: vars
run: echo "CONTAINER_REV=${{ github.sha }}" >> .env

- name: Display .env file
run: cat .env

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y wget


- name: Install docker-ce-cli
run: |
sudo apt-get install -y docker-ce-cli

- name: Verify Docker Installation
run: |
docker compose version
docker --version
docker version

- name: Run docker-compose local.setup.test
run: |
# timeout here nneds to be 10m so that services have time to stop properly
nix develop --command bash -c "docker --version && docker compose up --help && timeout 10m just suzuka-full-node docker-compose local.setup.test --abort-on-container-failure"
35 changes: 0 additions & 35 deletions .github/workflows/container-checks.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/containers.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/target-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ jobs:
}
ref: ${{ fromJson(steps.get_pr.outputs.data).head.ref }}
repo: ${{ fromJson(steps.get_pr.outputs.data).head.repo.full_name }}
path: .github/workflows/handel-target-comment.yml



6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,5 @@ state_merkle_db/
.movement
.idea
.vscode
<<<<<<< HEAD
.env
.data
=======
.data
>>>>>>> l-monninger/timestamp-fix
.env
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ just monza-full-node native build.setup.test.local
When running with `docker compose` specif your revision in a file `.env` at the root of the project. The file should look like this:

```bash
REV=0fe2a4f28820c04ca0db07cdd44cafc98b792f3f
CONTAINER_REV=0fe2a4f28820c04ca0db07cdd44cafc98b792f3f
```

### `suzuka-full-node`
Expand All @@ -72,6 +72,17 @@ just suzuka-full-node docker-compose setup.local

**Note:** if you want to recreate the network, but not rely on the just target above, please read through the scripts to identify the correct `docker-compose` files to run.

## Services

### `suzuka-full-node`

Both `native` and `docker-compose` runners will serve the following services listening on the specified default addresses:

**Note:** Only APIs intended for the end-user are listed here. For a full list of services, please refer to respective `docker-compose` files.

- **[Aptos REST API](https://api.devnet.aptoslabs.com/v1/spec#/)**: `0.0.0.0:30731`
- **[Aptos Faucet API](https://aptos.dev/apis/#faucet-api-only-testnetdevnet)**: `0.0.0.0:30732`

## Troubleshooting

### `cp: cannot stat '': No such file or directory` when running `just suzuka-full-node native build.setup.test.local`
Expand Down
4 changes: 2 additions & 2 deletions docker/compose/suzuka-full-node/docker-compose.local.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:

m1-da-light-node-celestia-appd:
image: ghcr.io/movementlabsxyz/m1-da-light-node-celestia-appd:${REV}
image: ghcr.io/movementlabsxyz/m1-da-light-node-celestia-appd:${CONTAINER_REV}
container_name: m1-da-light-node-celestia-appd
environment:
DOT_MOVEMENT_PATH: /.movement
Expand All @@ -19,7 +19,7 @@ services:
retries: 3

m1-da-light-node-celestia-bridge:
image: ghcr.io/movementlabsxyz/m1-da-light-node-celestia-bridge:${REV}
image: ghcr.io/movementlabsxyz/m1-da-light-node-celestia-bridge:${CONTAINER_REV}
container_name: m1-da-light-node-celestia-bridge
environment:
DOT_MOVEMENT_PATH: /.movement
Expand Down
2 changes: 1 addition & 1 deletion docker/compose/suzuka-full-node/docker-compose.setup.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
setup:
image: ghcr.io/movementlabsxyz/suzuka-full-node-setup:${REV}
image: ghcr.io/movementlabsxyz/suzuka-full-node-setup:${CONTAINER_REV}
container_name: setup
environment:
DOT_MOVEMENT_PATH: /.movement
Expand Down
18 changes: 16 additions & 2 deletions docker/compose/suzuka-full-node/docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
services:

wait-for-suzuka-faucet-service:
image: busybox
container_name: wait-for-suzuka-faucet-service
depends_on:
- suzuka-faucet-service
entrypoint:
- /bin/sh
- -c
- |
echo "Waiting for suzuka-faucet-service to be ready..."
sleep 10
echo "suzuka-faucet-service is ready"

suzuka-client-e2e-simple-interaction:
image: ghcr.io/movementlabsxyz/suzuka-client-e2e-simple-interaction:${REV}
image: ghcr.io/movementlabsxyz/suzuka-client-e2e-simple-interaction:${CONTAINER_REV}
container_name: suzuka-client-e2e-simple-interaction
command: run-simple
environment:
- DOT_MOVEMENT_PATH=/.movement
volumes:
- ${DOT_MOVEMENT_PATH}:/.movement
depends_on:
- suzuka-faucet-service
wait-for-suzuka-faucet-service:
condition: service_completed_successfully
8 changes: 4 additions & 4 deletions docker/compose/suzuka-full-node/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ services:
start_period: 3s

celestia-light-node-synced:
image: ghcr.io/movementlabsxyz/wait-for-celestia-light-node:${REV}
image: ghcr.io/movementlabsxyz/wait-for-celestia-light-node:${CONTAINER_REV}
container_name: celestia-light-node-synced
environment:
- DOT_MOVEMENT_PATH=/.movement
Expand All @@ -38,7 +38,7 @@ services:
condition: service_healthy

m1-da-light-node:
image: ghcr.io/movementlabsxyz/m1-da-light-node:${REV}
image: ghcr.io/movementlabsxyz/m1-da-light-node:${CONTAINER_REV}
container_name: m1-da-light-node
environment:
- DOT_MOVEMENT_PATH=/.movement
Expand All @@ -51,7 +51,7 @@ services:
- "30730:30730"

suzuka-full-node:
image: ghcr.io/movementlabsxyz/suzuka-full-node:${REV}
image: ghcr.io/movementlabsxyz/suzuka-full-node:${CONTAINER_REV}
container_name: suzuka-full-node
environment:
- DOT_MOVEMENT_PATH=/.movement
Expand All @@ -76,7 +76,7 @@ services:
echo "suzuka-full-node is ready"

suzuka-faucet-service:
image: ghcr.io/movementlabsxyz/suzuka-faucet-service:${REV}
image: ghcr.io/movementlabsxyz/suzuka-faucet-service:${CONTAINER_REV}
container_name: suzuka-faucet-service
command: run-simple
environment:
Expand Down
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
celestia-app
monza-aptos
jq
docker
];

# Specific version of toolchain
Expand Down
1 change: 0 additions & 1 deletion protocol-units/settlement/mcr/contracts/lib/forge-std
Submodule forge-std deleted from bb4cee
1 change: 0 additions & 1 deletion protocol-units/settlement/mcr/contracts/lib/murky
Submodule murky deleted from 5feccd
18 changes: 14 additions & 4 deletions scripts/movement/docker-compose
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@
set -e
set -euo pipefail

IFS='.' read -r -a split <<< "$3"
if [ "$#" -lt 3 ]; then
echo "Usage: $0 <service> <runtime> <flags> [docker-compose flags...]"
echo "Example: $0 suzuka-full-node native setup.local.test"
exit 1
fi

SERVICE=$1
RUNTIME=$2
FLAGS=$3

IFS='.' read -r -a split <<< "$FLAGS"

override_files=()
for element in "${split[@]}"; do
override_files+=("-f")
override_files+=("docker/compose/$1/docker-compose.$element.yml")
override_files+=("docker/compose/$SERVICE/docker-compose.$element.yml")
done

echo "Running process-compose for $1 with override files: ${override_files[@]}..."
docker compose --env-file .env -f docker/compose/$1/docker-compose.yml "${override_files[@]}" "${@:4}" up --abort-on-container-failure
echo "Running docker-compose for $SERVICE with override files: ${override_files[@]}..."
docker compose --env-file .env -f docker/compose/$SERVICE/docker-compose.yml "${override_files[@]}" up "${@:4}"
57 changes: 57 additions & 0 deletions util/godfig/src/backend/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
pub(crate) trait BackendInternalOperations {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks out of place; an accidental commit from the Godfig work?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

From Godfig

/// Acquires a--usually time-limited--lock on a key.
async fn try_acquire<K>(&self, key: K) -> Result<(), anyhow::Error>
where
K: Into<String> + Send;

/// Sets a key-value pair.
async fn try_set_unsafe<K, T>(&self, key: K, value: T) -> Result<(), anyhow::Error>
where
K: Into<String> + Send,
T: serde::Serialize;

/// Gets a value from a key.
async fn try_get_unsafe<K, T>(&self, key: K) -> Result<T, anyhow::Error>
where
K: Into<String> + Send,
T: serde::de::DeserializeOwned;

/// Releases a lock on a key.
async fn try_release<K>(&self, key: K) -> Result<(), anyhow::Error>
where
K: Into<String> + Send;
}

pub trait BackendOperations: BackendInternalOperations {
/// Tries to get a value from a key.
async fn try_get<K, T>(&self, key: K) -> Result<T, anyhow::Error>
where
K: Into<String> + Send,
T: serde::de::DeserializeOwned,
{
let key_str = key.into();
self.try_acquire(key_str.clone()).await?;
let value = self.try_get_unsafe(key_str.clone()).await?;
self.try_release(key_str).await?;
Ok(value)
}

/// Tries to set a key-value pair.
async fn try_set<K, T>(&self, key: K, value: T) -> Result<(), anyhow::Error>
where
K: Into<String> + Send,
T: serde::Serialize,
{
let key_str = key.into();
self.try_acquire(key_str.clone()).await?;
self.try_set_unsafe(key_str.clone(), value).await?;
self.try_release(key_str).await?;
Ok(())
}

/// Tries to stream values from a key.
async fn try_stream<K, T>(&self, key: K) -> Result<impl futures::Stream<Item = T>, anyhow::Error>
where
K: Into<String> + Send,
T: serde::de::DeserializeOwned;
}
Loading