server-origin/install.sh
2024-08-31 02:26:11 +05:00

89 lines
1.7 KiB
Bash

#!/bin/bash
STARTDIR=server-origin
if [ "$(id -u)" != "0" ]; then
echo -e "\033[31mThis script requires superuser rights.\033[0m"
exit 0
fi
if [ -z "$1" ]; then
echo "Please provide the DOMAIN_NAME as an argument"
exit 1
fi
trap 'echo -e "\033[31minstall.sh: Something went wrong\033[0m"; exit 1' ERR
set -e
export DEBIAN_FRONTEND=noninteractive
DOMAIN=$1
SECRETS_PATH=/data/secrets/$DOMAIN/$DOMAIN.env
source $SECRETS_PATH
cd /data/utils
echo "Install docker..."
bash init-docker.sh
echo "Init cron list..."
sudo bash cron-list.sh
echo "Clone backup.git..."
cd /data
git clone git@$GIT_SSH_DOMAIN:$GIT_USER/backup.git
echo "Init traefik..."
cd /data
git clone git@$GIT_SSH_DOMAIN:$GIT_USER/traefik.git
cd traefik
sudo bash install.sh
echo "Init postgres..."
cd /data
git clone git@$GIT_SSH_DOMAIN:$GIT_USER/postgres.git
cd postgres
sudo bash install.sh
echo "Init pgadmin..."
cd /data
git clone git@$GIT_SSH_DOMAIN:$GIT_USER/pgadmin.git
cd pgadmin
sudo bash install.sh
echo "Init gitea..."
cd /data
git clone git@$GIT_SSH_DOMAIN:$GIT_USER/gitea.git
cd gitea
sudo bash install.sh
echo "Init mariadb..."
cd /data
git clone git@$GIT_SSH_DOMAIN:$GIT_USER/mariadb.git
cd mariadb
sudo bash install.sh
echo "Install blog-wp..."
cd /data
git clone git@$GIT_SSH_DOMAIN:$GIT_USER/blog-wp.git
cd blog-wp
sudo docker compose up -d
echo "Await 10s before blog-wp-install..."
sleep 10
echo "Install blog-wp-install..."
cd /data
git clone git@$GIT_SSH_DOMAIN:$GIT_USER/blog-wp-install.git
cd blog-wp-install
sudo bash install.sh
echo "Install tetris..."
cd /data
git clone git@$GIT_SSH_DOMAIN:$GIT_USER/tetris.git
cd tetris
sudo docker compose build
sudo docker compose up -d
trap - ERR
echo "Install server-origin complete"