From d7ca9d0a987d47bb48a6e4b8477696bf73227d44 Mon Sep 17 00:00:00 2001 From: matias-gonz Date: Mon, 10 Jun 2024 12:59:29 +0200 Subject: [PATCH 1/2] Update to docker compose --- zk_toolbox/crates/common/src/docker.rs | 4 ++-- zk_toolbox/crates/common/src/prerequisites.rs | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/zk_toolbox/crates/common/src/docker.rs b/zk_toolbox/crates/common/src/docker.rs index f52e3214fa23..db8a63e9f5d0 100644 --- a/zk_toolbox/crates/common/src/docker.rs +++ b/zk_toolbox/crates/common/src/docker.rs @@ -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() } diff --git a/zk_toolbox/crates/common/src/prerequisites.rs b/zk_toolbox/crates/common/src/prerequisites.rs index 237af5b40483..ed9f189a02a1 100644 --- a/zk_toolbox/crates/common/src/prerequisites.rs +++ b/zk_toolbox/crates/common/src/prerequisites.rs @@ -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", @@ -11,10 +11,6 @@ const PREREQUISITES: [Prerequisite; 6] = [ name: "docker", download_link: "https://docs.docker.com/get-docker/", }, - Prerequisite { - name: "docker-compose", - download_link: "https://docs.docker.com/compose/install/", - }, Prerequisite { name: "forge", download_link: "https://book.getfoundry.sh/getting-started/installation", From 1a96a6dc0f0fb647bcd147e9d6a87bd7af023e82 Mon Sep 17 00:00:00 2001 From: matias-gonz Date: Mon, 17 Jun 2024 22:04:15 +0200 Subject: [PATCH 2/2] Add compose prerequisite --- zk_toolbox/crates/common/src/prerequisites.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/zk_toolbox/crates/common/src/prerequisites.rs b/zk_toolbox/crates/common/src/prerequisites.rs index ed9f189a02a1..ae21ba68b3c1 100644 --- a/zk_toolbox/crates/common/src/prerequisites.rs +++ b/zk_toolbox/crates/common/src/prerequisites.rs @@ -25,6 +25,11 @@ const PREREQUISITES: [Prerequisite; 5] = [ }, ]; +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, @@ -39,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( @@ -59,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() +}