Last active
June 7, 2021 04:24
-
-
Save ImanMousavi/4cbdda976719aaaee9ab7d52ed7fb300 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.29.1" | |
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 | |
curl -sLf https://spacevim.org/install.sh | bash | |
wget -O ~/.SpaceVim.d/init.toml https://gist.githubusercontent.com/irmaster/362703e346b8023a0d15d0c087e36122/raw/64fdfc95ef73d36ef58e52ab54e389e9c68ce880/SpaceVim%2520settings%2520init.toml | |
echo "app ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers | |
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 | |
gpg --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.5 | |
gem install bundler | |
EOS | |
} | |
install_core | |
log_rotation | |
install_docker | |
sudo -u app /bin/bash --login | |
install_ruby | |
cd /home/app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment