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(zk_toolbox): Use docker compose instead of docker-compose #2195

Merged
merged 12 commits into from
Jun 18, 2024
4 changes: 2 additions & 2 deletions zk_toolbox/crates/common/src/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use xshell::{cmd, Shell};
use crate::cmd::Cmd;

pub fn up(shell: &Shell, docker_compose_file: &str) -> anyhow::Result<()> {
Cmd::new(cmd!(shell, "docker-compose -f {docker_compose_file} up -d")).run()
Cmd::new(cmd!(shell, "docker compose -f {docker_compose_file} up -d")).run()
}
pub fn down(shell: &Shell, docker_compose_file: &str) -> anyhow::Result<()> {
Cmd::new(cmd!(shell, "docker-compose -f {docker_compose_file} down")).run()
Cmd::new(cmd!(shell, "docker compose -f {docker_compose_file} down")).run()
}
21 changes: 16 additions & 5 deletions zk_toolbox/crates/common/src/prerequisites.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use xshell::{cmd, Shell};

use crate::{cmd::Cmd, logger};

const PREREQUISITES: [Prerequisite; 6] = [
const PREREQUISITES: [Prerequisite; 5] = [
Prerequisite {
name: "git",
download_link: "https://git-scm.com/book/en/v2/Getting-Started-Installing-Git",
Expand All @@ -11,10 +11,6 @@ const PREREQUISITES: [Prerequisite; 6] = [
name: "docker",
download_link: "https://docs.docker.com/get-docker/",
Deniallugo marked this conversation as resolved.
Show resolved Hide resolved
},
Prerequisite {
name: "docker-compose",
download_link: "https://docs.docker.com/compose/install/",
},
Prerequisite {
name: "forge",
download_link: "https://book.getfoundry.sh/getting-started/installation",
Expand All @@ -29,6 +25,11 @@ const PREREQUISITES: [Prerequisite; 6] = [
},
];

const DOCKER_COMPOSE_PREREQUISITE: Prerequisite = Prerequisite {
name: "docker compose",
download_link: "https://docs.docker.com/compose/install/",
};

struct Prerequisite {
name: &'static str,
download_link: &'static str,
Expand All @@ -43,6 +44,10 @@ pub fn check_prerequisites(shell: &Shell) {
}
}

if !check_docker_compose_prerequisite(shell) {
missing_prerequisites.push(&DOCKER_COMPOSE_PREREQUISITE);
}

if !missing_prerequisites.is_empty() {
logger::error("Prerequisite check has failed");
logger::error_note(
Expand All @@ -63,3 +68,9 @@ pub fn check_prerequisites(shell: &Shell) {
fn check_prerequisite(shell: &Shell, name: &str) -> bool {
Cmd::new(cmd!(shell, "which {name}")).run().is_ok()
}

fn check_docker_compose_prerequisite(shell: &Shell) -> bool {
Cmd::new(cmd!(shell, "docker compose version"))
.run()
.is_ok()
}
Loading