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

Update docker-compose min requirement #72

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ In the other hand, creating your own self-managed platform will take time and ef
* Domain for HTTPS (Recommended for Production Server)
* Port 80, 443, 6320
* Python 3.x
* Docker and Docker-compose v1
* Docker
* Docker Compose v1.29.2 or later

__(You don't need to install anything manually, we'll do it for you!)__

Expand Down Expand Up @@ -131,6 +132,6 @@ Yeah we have it too

## Feedback
If you have any feedback, please reach out to us at __gerobug.id@gmail.com__



31 changes: 30 additions & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,37 @@ echo -e "\n================================"
echo "CHECK AND INSTALL PREREQUISITES"
echo "================================"
apt-get install -y python3 docker docker.io docker-compose libmagic-dev
systemctl restart docker

extract_version() {
echo "$1" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+'
}
CURRENT_COMPOSE_VERSION=$(extract_version "$(docker-compose --version)")
MIN_COMPOSE_VERSION="1.29.2"

if [ -z "$CURRENT_COMPOSE_VERSION" ]; then
echo "Unable to determine docker-compose version."
exit 1
fi

version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; }
if version_gt $MIN_COMPOSE_VERSION $CURRENT_COMPOSE_VERSION; then
echo "=============================="
echo "Your docker-compose version ($CURRENT_COMPOSE_VERSION) is less than the minimum required version ($MIN_COMPOSE_VERSION)."
echo -e "Updating Docker Compose...\n"

DESTINATION=$(which docker-compose)
sudo wget "https://github.com/docker/compose/releases/download/v2.24.2/docker-compose-$(uname -s)-$(uname -m)" -O $DESTINATION
sudo chmod +x $DESTINATION

UPDATED_COMPOSE_VERSION=$(extract_version "$(docker-compose --version)")
echo "=============================="
echo "Docker Compose has been updated to version $UPDATED_COMPOSE_VERSION."
else
echo "=============================="
echo -e "Your docker-compose version ($CURRENT_COMPOSE_VERSION) meets the minimum required version ($MIN_COMPOSE_VERSION)."
fi

systemctl restart docker

echo -e "\n=============================="
echo "CREATE SECRET FILES"
Expand Down
Loading