#!/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 "Creating docker network proxynet..." docker network create proxynet #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 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 "Install traefik..." cd /data/utils bash global-env.sh TRAEFIK_LOG_LEVEL $TRAEFIKLOGLEVEL cd /data git clone git@$GIT_SSH_DOMAIN:$GIT_USER/traefik.git cd traefik sudo docker compose up -d echo "Install postgres..." cd /data/utils bash global-env.sh POSTGRES_USER admin bash global-env.sh POSTGRES_DB postgres sudo bash env-gen.sh POSTGRES_PASSWORD cd /data git clone git@$GIT_SSH_DOMAIN:$GIT_USER/postgres.git cd postgres sudo docker compose up -d echo "Install pgadmin..." mkdir -p /data/appdata/pgadmin chown -R 5050:5050 /data/appdata/pgadmin cd /data/utils sudo bash env-gen.sh PGADMIN_DEFAULT_PASSWORD cd /data git clone git@$GIT_SSH_DOMAIN:$GIT_USER/pgadmin.git cd pgadmin sudo docker compose up -d echo "Install gitea..." cd /data/utils GITEA__database__PASSWD=$(pwgen -s 20 1); sudo bash env-gen.sh GITEA__database__PASSWD $GITEA__database__PASSWD sudo bash init-db.sh gitea $GITEA__database__PASSWD cd /data git clone git@$GIT_SSH_DOMAIN:$GIT_USER/gitea.git cd gitea sudo docker compose up -d echo "Install mariadb..." cd /data/utils bash global-env.sh MARIADB_USER admin bash global-env.sh MARIADB_DB mariadb sudo bash env-gen.sh MARIADB_ROOT_PASSWORD MARIADBPASSWORD=$(pwgen -s 20 1); 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 cd /data git clone git@$GIT_SSH_DOMAIN:$GIT_USER/mariadb.git mkdir -p /data/appdata/mariadb sudo chown -R 1001:1001 /data/appdata/mariadb cd mariadb sudo docker compose up -d 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"