Last active
March 24, 2023 09:39
-
-
Save alinetskyi/cfc95dbce01d9452d93726e9157e89a1 to your computer and use it in GitHub Desktop.
Setup Debian machine for docker-compose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
COMPOSE_VERSION="1.23.2" | |
COMPOSE_URL="https://github.com/docker/compose/releases/download/$COMPOSE_VERSION/docker-compose-$(uname -s)-$(uname -m)" | |
# Opendax bootstrap script | |
install_core() { | |
sudo bash <<EOS | |
apt-get update | |
apt-get remove -y --purge unscd | |
userdel -r debian | |
apt-get install -y -q git tmux gnupg2 dirmngr dbus htop curl libmariadbclient-dev-compat build-essential | |
useradd -m -G root -p '*' -s /bin/bash app | |
EOS | |
} | |
log_rotation() { | |
sudo bash <<EOS | |
mkdir -p /etc/docker | |
echo ' | |
{ | |
"log-driver": "json-file", | |
"log-opts": { | |
"max-size": "10m", | |
"max-file": "10" | |
} | |
}' > /etc/docker/daemon.json | |
EOS | |
} | |
# Docker installation | |
install_docker() { | |
curl -fsSL https://get.docker.com/ | bash | |
sudo bash <<EOS | |
usermod -a -G docker app | |
curl -L "$COMPOSE_URL" -o /usr/local/bin/docker-compose | |
chmod +x /usr/local/bin/docker-compose | |
EOS | |
} | |
install_ruby() { | |
sudo -u app bash <a<EOS | |
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB | |
curl -sSL https://get.rvm.io | bash -s stable | |
source /home/app/.rvm/scripts/rvm | |
rvm install 2.6.3 | |
EOS | |
} | |
install_core | |
log_rotation | |
install_docker | |
install_ruby | |
sudo -u app /bin/bash --login | |
cd /home/app |
@kbsc332: Thanks for your input
@alinetskyi: Thanks for the script. Is it possible to change the script, according improvements of kbsc332, so we can use it for installation? We are not able to run anything after Docker has been installed. Many thanks for your input and effort. Looking forward to your reaction. Kind regards Mr. Maister
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@alinetskyi
You would change install_ruby function.
On the first line, sudo -u app bash <a<EOS should change into sudo -u app bash <<EOS
sudo -u app bash <<EOS
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL https://get.rvm.io | bash -s stable
source /home/app/.rvm/scripts/rvm
rvm autolibs disable
rvm install 2.6.5
EOS
and who got error when installing bundler,
do under line in command
rvm pkg install openssl
rvm reinstall ruby-2.6.5 --with-openssl-dir=$rvm_path/usr