Skip to content

Commit

Permalink
feat(EFDE):
Browse files Browse the repository at this point in the history
- #16 Installation - Migrate docker-compose (v1) to docker compose (v2)
- #18 Installation - Validate requirements for docker and docker compose
  • Loading branch information
mmaximo33 committed Jan 29, 2023
1 parent aefc9a1 commit 8c52adf
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] AAAA-MM-DD
### Added
- EFDE: #14 Installation - Option by script due to lack of git and refactoring of the install.sh scripts
- EFDE: #16 Installation - Migrate docker-compose (v1) to docker compose (v2)
- EFDE: #18 Installation - Validate requirements for docker and docker compose
### Changed
- EFDE: #10 Disable automatic EFDE update - Available by parameter --update
### Fixed
Expand Down
48 changes: 45 additions & 3 deletions setup/install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usir/bin/env bash
#!/usr/bin/env bash
#
# EFDE : Easy and fast development environment
# Author : Marucci Maximo (https://mmaximo33.github.io/cv/)
Expand Down Expand Up @@ -99,11 +99,11 @@
efde_print_step requirements

if ! efde_has git; then
efde_echo "\nYou must install GIT to download ${PROJECT_NAME}"
efde_echo >&2 "\nYou must install GIT to download ${PROJECT_NAME}"
if efde_confirm_yes "Do you want to install GIT now?"; then
efde_git_install
elif ! efde_has curl && ! efde_has wget; then
efde_echo "\nYou must install CURL to download ${PROJECT_NAME}"
efde_echo >&2 "\nYou must install CURL to download ${PROJECT_NAME}"
efde_confirm_yes "Do you want to install CURL now?" && efde_curl_install || errors="$errors\n==> You need to have GIT or CURL or WGET installed"
fi
fi
Expand All @@ -116,6 +116,16 @@
efde_confirm_yes "Do you want to install python3-pip now?" && efde_python_dependecy_install || errors="$errors\n==> You need to have python3-pip (dependencies)"
fi

if ! efde_has docker; then
efde_echo >&2 "$PROJECT_NAME requires having docker to work"
efde_confirm_yes "Do you want to install docker now?" && efde_docker_install || errors="$errors\n==> You need to have docker"
else
if ! efde_has "docker compose"; then
efde_echo >&2 "$PROJECT_NAME requires having docker compose(v2) to work"
efde_confirm_yes "Do you want to install docker compose (v2) now?" && efde_docker_compose_install || errors="$errors\n==> You need to have docker compose (v2)"
fi
fi

if [ ! -z "$errors" ]; then
efde_echo "=> The following problems were detected:"
echo -e "$errors"
Expand Down Expand Up @@ -156,6 +166,38 @@
pip3 install python-dotenv
}

efde_docker_install() {
# https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
sudo apt install -y ca-certificates curl gnupg lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

# https://docs.docker.com/engine/install/ubuntu/#install-docker-engine
sudo apt update -y
sudo chmod a+r /etc/apt/keyrings/docker.gpg
sudo apt install -y docker-ce docker-ce-cli containerd.io

# https://docs.docker.com/engine/install/linux-postinstall/
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
sudo chown "$USER":"$USER" /home/"$USER"/.docker -R
sudo chmod g+rwx "$HOME/.docker" -R

#sudo systemctl restart docker

# docker compose (v2)
efde_docker_compose_install
}

efde_docker_compose_install() {
# https://docs.docker.com/compose/install/linux/
sudo apt-get install docker-compose-plugin
}

#######################################################################
# Installation section
#----------------------------------------------------------------------
Expand Down

0 comments on commit 8c52adf

Please sign in to comment.