2024-08-08 06:01:49 +05:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
STARTDIR=server-origin
|
|
|
|
|
|
|
|
if [ "$(id -u)" != "0" ]; then
|
2024-08-14 10:49:54 +05:00
|
|
|
echo -e "\033[31mThis script requires superuser rights.\033[0m"
|
|
|
|
exit 0
|
2024-08-08 06:01:49 +05:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
echo "Please provide the DOMAIN_NAME as an argument"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-08-14 10:49:54 +05:00
|
|
|
trap 'echo -e "\033[31minstall.sh: Something went wrong\033[0m"; exit 1' ERR
|
2024-08-08 06:01:49 +05:00
|
|
|
set -e
|
|
|
|
|
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
2024-08-08 06:20:46 +05:00
|
|
|
DOMAIN=$1
|
2024-08-14 10:49:54 +05:00
|
|
|
SECRETS_PATH=/data/secrets/$DOMAIN/$DOMAIN.env
|
|
|
|
source $SECRETS_PATH
|
2024-08-08 06:01:49 +05:00
|
|
|
|
|
|
|
cd /data/utils
|
2024-08-08 06:32:17 +05:00
|
|
|
echo "Install docker..."
|
2024-08-08 06:01:49 +05:00
|
|
|
bash init-docker.sh
|
|
|
|
|
2024-08-08 06:32:17 +05:00
|
|
|
echo "Creating docker network proxynet..."
|
2024-08-08 06:01:49 +05:00
|
|
|
docker network create proxynet
|
|
|
|
|
2024-08-19 15:28:49 +05:00
|
|
|
#echo "create global environment vars..."
|
|
|
|
#bash global-env.sh SERVER_DOMAIN $DOMAIN
|
|
|
|
#bash global-env.sh ADMIN_EMAIL $ADMINEMAIL
|
|
|
|
#bash global-env.sh SRV_START_DIR $STARTDIR
|
2024-08-08 06:01:49 +05:00
|
|
|
|
2024-08-08 06:32:17 +05:00
|
|
|
echo "Init cron list..."
|
2024-08-14 10:49:54 +05:00
|
|
|
sudo bash cron-list.sh
|
2024-08-08 06:01:49 +05:00
|
|
|
|
2024-08-14 10:49:54 +05:00
|
|
|
echo "Clone backup.git..."
|
2024-08-08 06:01:49 +05:00
|
|
|
cd /data
|
|
|
|
git clone git@$GIT_SSH_DOMAIN:$GIT_USER/backup.git
|
|
|
|
|
2024-08-14 10:49:54 +05:00
|
|
|
echo "Install traefik..."
|
2024-08-08 06:01:49 +05:00
|
|
|
cd /data/utils
|
2024-08-14 10:49:54 +05:00
|
|
|
bash global-env.sh TRAEFIK_LOG_LEVEL $TRAEFIKLOGLEVEL
|
|
|
|
cd /data
|
2024-08-08 06:01:49 +05:00
|
|
|
git clone git@$GIT_SSH_DOMAIN:$GIT_USER/traefik.git
|
|
|
|
cd traefik
|
|
|
|
sudo docker compose up -d
|
|
|
|
|
2024-08-14 10:49:54 +05:00
|
|
|
echo "Install postgres..."
|
2024-08-08 06:01:49 +05:00
|
|
|
cd /data/utils
|
2024-08-14 10:49:54 +05:00
|
|
|
bash global-env.sh POSTGRES_USER admin
|
|
|
|
bash global-env.sh POSTGRES_DB postgres
|
2024-08-18 09:37:10 +05:00
|
|
|
sudo bash env-gen.sh POSTGRES_PASSWORD
|
2024-08-08 06:01:49 +05:00
|
|
|
cd /data
|
|
|
|
git clone git@$GIT_SSH_DOMAIN:$GIT_USER/postgres.git
|
|
|
|
cd postgres
|
|
|
|
sudo docker compose up -d
|
|
|
|
|
2024-08-14 10:49:54 +05:00
|
|
|
echo "Install pgadmin..."
|
2024-08-08 06:01:49 +05:00
|
|
|
mkdir -p /data/appdata/pgadmin
|
|
|
|
chown -R 5050:5050 /data/appdata/pgadmin
|
2024-08-14 10:49:54 +05:00
|
|
|
cd /data/utils
|
2024-08-18 09:37:10 +05:00
|
|
|
sudo bash env-gen.sh PGADMIN_DEFAULT_PASSWORD
|
2024-08-08 06:01:49 +05:00
|
|
|
cd /data
|
|
|
|
git clone git@$GIT_SSH_DOMAIN:$GIT_USER/pgadmin.git
|
|
|
|
cd pgadmin
|
|
|
|
sudo docker compose up -d
|
|
|
|
|
2024-08-14 10:49:54 +05:00
|
|
|
echo "Install gitea..."
|
|
|
|
cd /data/utils
|
2024-08-14 13:44:54 +05:00
|
|
|
GITEA__database__PASSWD=$(pwgen -s 20 1);
|
2024-08-18 09:37:10 +05:00
|
|
|
sudo bash env-gen.sh GITEA__database__PASSWD $GITEA__database__PASSWD
|
2024-08-18 08:03:19 +05:00
|
|
|
sudo bash init-db.sh gitea $GITEA__database__PASSWD
|
2024-08-08 06:01:49 +05:00
|
|
|
cd /data
|
|
|
|
git clone git@$GIT_SSH_DOMAIN:$GIT_USER/gitea.git
|
|
|
|
cd gitea
|
2024-08-14 10:49:54 +05:00
|
|
|
sudo docker compose up -d
|
|
|
|
|
|
|
|
echo "Install mariadb..."
|
2024-08-08 06:01:49 +05:00
|
|
|
cd /data/utils
|
2024-08-14 10:49:54 +05:00
|
|
|
bash global-env.sh MARIADB_USER admin
|
|
|
|
bash global-env.sh MARIADB_DB mariadb
|
2024-08-18 09:37:10 +05:00
|
|
|
sudo bash env-gen.sh MARIADB_ROOT_PASSWORD
|
2024-08-14 10:49:54 +05:00
|
|
|
MARIADBPASSWORD=$(pwgen -s 20 1);
|
2024-08-18 09:37:10 +05:00
|
|
|
sudo bash env-gen.sh MARIADB_PASSWORD $MARIADBPASSWORD
|
|
|
|
sudo bash env-gen.sh WORDPRESS_DB_PASSWORD $MARIADBPASSWORD
|
|
|
|
sudo bash env-gen.sh WP_ADMIN_PASSWORD
|
2024-08-14 10:49:54 +05:00
|
|
|
cd /data
|
|
|
|
git clone git@$GIT_SSH_DOMAIN:$GIT_USER/mariadb.git
|
2024-08-14 13:44:54 +05:00
|
|
|
mkdir -p /data/appdata/mariadb
|
|
|
|
sudo chown -R 1001:1001 /data/appdata/mariadb
|
2024-08-14 10:49:54 +05:00
|
|
|
cd mariadb
|
2024-08-08 06:01:49 +05:00
|
|
|
sudo docker compose up -d
|
|
|
|
|
2024-08-14 10:49:54 +05:00
|
|
|
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
|
2024-08-14 13:44:54 +05:00
|
|
|
sudo bash install.sh
|
2024-08-14 10:49:54 +05:00
|
|
|
|
|
|
|
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
|
2024-08-08 06:01:49 +05:00
|
|
|
|
2024-08-14 10:49:54 +05:00
|
|
|
trap - ERR
|
2024-08-08 06:01:49 +05:00
|
|
|
echo "Install server-origin complete"
|