From 32c5ed4d29bf4892c926dac05b90619b8828f84f Mon Sep 17 00:00:00 2001 From: BenediktMKuehne Date: Wed, 13 Dec 2023 10:45:50 +0000 Subject: [PATCH] change docker install source to download.docker.com --- dev-tools/check_project.sh | 2 +- helper/helper_embark_general.sh | 4 +-- installer.sh | 50 +++++++++++++-------------------- 3 files changed, 23 insertions(+), 33 deletions(-) diff --git a/dev-tools/check_project.sh b/dev-tools/check_project.sh index a55381e8..24111b88 100755 --- a/dev-tools/check_project.sh +++ b/dev-tools/check_project.sh @@ -242,7 +242,7 @@ dockerchecker(){ mapfile -t DOCKER_COMPS < <(find . -maxdepth 1 -type d -name migrations -prune -false -o -iname "docker-compose*.yml") for DOCKER_COMP in "${DOCKER_COMPS[@]}"; do echo -e "\\n""${GREEN}""Run docker check on ${DOCKER_COMP}:""${NC}""\\n" - if docker-compose -f "${DOCKER_COMP}" config 1>/dev/null || [[ $? -ne 1 ]]; then + if docker compose -f "${DOCKER_COMP}" config 1>/dev/null || [[ $? -ne 1 ]]; then # TODO check echo -e "${GREEN}""${BOLD}""==> SUCCESS""${NC}""\\n" else echo -e "\\n""${ORANGE}${BOLD}==> FIX ERRORS""${NC}""\\n" diff --git a/helper/helper_embark_general.sh b/helper/helper_embark_general.sh index aa40c218..e3f574d4 100644 --- a/helper/helper_embark_general.sh +++ b/helper/helper_embark_general.sh @@ -113,9 +113,9 @@ check_db() { HOST_ENV=$(grep DATABASE_HOST ./.env | sed 's/DATABASE\_HOST\=//') echo -e "\\n${ORANGE}""${BOLD}""checking database""${NC}\\n""${BOLD}=================================================================${NC}" echo -e "${BLUE}""${BOLD}""1. checking startup""${NC}\\n" - if docker-compose -f ./docker-compose.yml up -d ; then + if docker compose -f ./docker-compose.yml up -d ; then echo -e "${GREEN}""${BOLD}""Finished setup mysql and redis docker images""${NC}" - add_to_env_history "${PW_ENV}" "$(docker-compose ps -q embark_db)" + add_to_env_history "${PW_ENV}" "$(docker compose ps -q embark_db)" else echo -e "${ORANGE}""${BOLD}""Failed setup mysql and redis docker images""${NC}" exit 1 diff --git a/installer.sh b/installer.sh index 73fa2c1d..fd4f9a32 100755 --- a/installer.sh +++ b/installer.sh @@ -226,37 +226,27 @@ install_debs(){ fi # Gcc if ! command -v gcc > /dev/null ; then - apt-get install build-essential + apt-get install -y build-essential fi # Docker if [[ "${WSL}" -eq 1 ]]; then echo -e "\n${ORANGE}WARNING: If you are using WSL2, disable docker integration from the docker-desktop daemon!${NC}" read -p "Fix docker stuff, then continue. Press any key to continue ..." -n1 -s -r fi - if ! command -v docker > /dev/null ; then - apt-get install -y docker.io - fi - DOCKER_VER=$(pip3 show docker | grep Version: | awk '{print $2}') - if [[ $(version "${DOCKER_VER}") -ge $(version "7.0.0") ]]; then - echo -e "\n${ORANGE}WARNING: compatibility of the used docker version is unknown!${NC}" - echo -e "\n${ORANGE}Please consider downgrading your pip3 docker version. \$pip3 install \"docker<7.0.0\"${NC}" - read -p "If you know what you are doing you can press any key to continue ..." -n1 -s -r - fi - # docker-compose - if ! command -v docker-compose > /dev/null ; then - pip3 install docker-compose --upgrade || true - if ! [[ -d /usr/bin/docker-compose ]]; then - ln -sf /usr/local/bin/docker-compose /usr/bin/docker-compose - fi - else - DOCKER_COMP_VER=$(docker-compose -v | grep version | awk '{print $3}' | tr -d ',') - if [[ $(version "${DOCKER_COMP_VER}") -lt $(version "1.28.5") ]]; then - echo -e "\n${ORANGE}WARNING: compatibility of the used docker-compose version is unknown!${NC}" - echo -e "\n${ORANGE}Please consider updating your docker-compose installation to version 1.28.5 or later.${NC}" - read -p "If you know what you are doing you can press any key to continue ..." -n1 -s -r - fi + if ! command -v docker > /dev/null && ! command -v docker-compose > /dev/null ; then + # Add Docker's official GPG key: + apt-get install -y ca-certificates curl gnupg + install -m 0755 -d /etc/apt/keyrings + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg + chmod a+r /etc/apt/keyrings/docker.gpg + # Add the repository to Apt sources: + echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ + $(. /etc/os-release && echo "${VERSION_CODENAME}") stable" | \ + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + apt-get update -y + apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin fi - # python3-dev if ! dpkg -l python3.10-dev &>/dev/null; then apt-get install -y python3.10-dev || apt-get install -y -q python3-dev @@ -373,13 +363,13 @@ install_embark_default(){ fi # download images for container - docker-compose pull - docker-compose up -d + docker compose pull + docker compose up -d # activate daemon systemctl start embark.service check_db - docker-compose stop + docker compose stop echo -e "${GREEN}""${BOLD}""Ready to use \$sudo ./run-server.sh ""${NC}" echo -e "${GREEN}""${BOLD}""Which starts the server on (0.0.0.0) port 80 ""${NC}" } @@ -449,11 +439,11 @@ install_embark_dev(){ chmod 644 .env # download images for container - docker-compose pull - docker-compose up -d + docker compose pull + docker compose up -d check_db - docker-compose stop + docker compose stop echo -e "${GREEN}""${BOLD}""Ready to use \$sudo ./dev-tools/debug-server-start.sh""${NC}" echo -e "${GREEN}""${BOLD}""Or use otherwise""${NC}" }