autocommit
This commit is contained in:
parent
1841cc4cb0
commit
503e9d1ee3
@ -1,3 +1,3 @@
|
|||||||
# /sample/folder/
|
# /sample/folder/
|
||||||
/data/appdata/gitea/
|
/data/appdata/gitea/
|
||||||
/data/projects/
|
/data/appdata/wordpress/wp-content/
|
||||||
|
@ -1,2 +1 @@
|
|||||||
0 8 * * * ./data/backup/all.sh
|
0 8 * * * /data/server-origin/cron.sh
|
||||||
# 0 9 * * * ./data/backup/remote-backup.sh
|
|
||||||
|
19
cron.sh
Normal file
19
cron.sh
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ "$(id -u)" != "0" ]; then
|
||||||
|
echo -e "\033[31mThis script requires superuser rights\033[0m"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
trap 'echo -e "\033[31mcron.sh: Something went wrong\033[0m"; exit 1' ERR
|
||||||
|
set -e
|
||||||
|
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
cd /data/backup
|
||||||
|
bash files-all.sh
|
||||||
|
bash postgres-all.sh
|
||||||
|
bash mariadb-all.sh
|
||||||
|
|
||||||
|
trap - ERR
|
||||||
|
echo "All cron tasks completed successfully"
|
112
install.sh
112
install.sh
@ -1,19 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#SECRETS_STORE=/data/secrets/secrets.env
|
|
||||||
GIT_SSH_DOMAIN=rozenlab.com
|
|
||||||
GIT_USER=leo
|
|
||||||
PGUSER=admin
|
|
||||||
PGDATABASE=postgres
|
|
||||||
LETSENCRYPT_EMAIL=426742@gmail.com
|
|
||||||
TRAEFIKLOGLEVEL=DEBUG # / INFO / ERROR
|
|
||||||
ADMINEMAIL=426742@gmail.com
|
|
||||||
STARTDIR=server-origin
|
STARTDIR=server-origin
|
||||||
SSHPORT=2525
|
|
||||||
|
|
||||||
if [ "$(id -u)" != "0" ]; then
|
if [ "$(id -u)" != "0" ]; then
|
||||||
echo "This script requires superuser rights. Running with sudo..."
|
echo -e "\033[31mThis script requires superuser rights.\033[0m"
|
||||||
exec sudo "$0" "$@"
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
@ -21,95 +12,106 @@ if [ -z "$1" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#if [ -f $SECRETS_STORE ]; then
|
trap 'echo -e "\033[31minstall.sh: Something went wrong\033[0m"; exit 1' ERR
|
||||||
# source $SECRETS_STORE
|
|
||||||
#fi
|
|
||||||
|
|
||||||
trap 'echo -e "\033[31minstall.sh: Something went wrong\033[0m"; exit 1' EXIT
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
DOMAIN=$1
|
DOMAIN=$1
|
||||||
#$SERVER_TYPE=dev
|
SECRETS_PATH=/data/secrets/$DOMAIN/$DOMAIN.env
|
||||||
|
source $SECRETS_PATH
|
||||||
|
|
||||||
#mkdir -p /data
|
|
||||||
#chown usradmin:usradmin /data
|
|
||||||
#chmod 770 /data
|
|
||||||
|
|
||||||
#cd /data
|
|
||||||
#git clone git@$GIT_SSH_DOMAIN:$GIT_USER/utils.git
|
|
||||||
cd /data/utils
|
cd /data/utils
|
||||||
#bash init-server.sh
|
|
||||||
|
|
||||||
echo "Install docker..."
|
echo "Install docker..."
|
||||||
bash init-docker.sh
|
bash init-docker.sh
|
||||||
|
|
||||||
echo "Creating docker network proxynet..."
|
echo "Creating docker network proxynet..."
|
||||||
docker network create proxynet
|
docker network create proxynet
|
||||||
|
|
||||||
# SSH config:
|
echo "create global environment vars..."
|
||||||
#bash ssh-port.sh $SSHPORT
|
|
||||||
#ssh-keygen -t ed25519 -C "$ADMINEMAIL"
|
|
||||||
|
|
||||||
#echo "Init cron list..."
|
|
||||||
#bash cron-list.sh
|
|
||||||
|
|
||||||
# create global environment vars:
|
|
||||||
bash global-env.sh SERVER_DOMAIN $DOMAIN
|
bash global-env.sh SERVER_DOMAIN $DOMAIN
|
||||||
bash global-env.sh POSTGRES_USER $PGUSER
|
|
||||||
bash global-env.sh POSTGRES_DB $PGDATABASE
|
|
||||||
bash global-env.sh TRAEFIK_LOG_LEVEL $TRAEFIKLOGLEVEL
|
|
||||||
bash global-env.sh ADMIN_EMAIL $ADMINEMAIL
|
bash global-env.sh ADMIN_EMAIL $ADMINEMAIL
|
||||||
bash global-env.sh SRV_START_DIR $STARTDIR
|
bash global-env.sh SRV_START_DIR $STARTDIR
|
||||||
|
|
||||||
echo "Init cron list..."
|
echo "Init cron list..."
|
||||||
bash cron-list.sh
|
sudo bash cron-list.sh
|
||||||
|
|
||||||
#bash global-env.sh SERVER_TYPE $SERVER_TYPE
|
|
||||||
|
|
||||||
|
echo "Clone backup.git..."
|
||||||
cd /data
|
cd /data
|
||||||
git clone git@$GIT_SSH_DOMAIN:$GIT_USER/backup.git
|
git clone git@$GIT_SSH_DOMAIN:$GIT_USER/backup.git
|
||||||
|
|
||||||
|
echo "Install traefik..."
|
||||||
cd /data/utils
|
cd /data/utils
|
||||||
#bash env-gen.sh LE_EMAIL "$LETSENCRYPT_EMAIL"
|
bash global-env.sh TRAEFIK_LOG_LEVEL $TRAEFIKLOGLEVEL
|
||||||
|
cd /data
|
||||||
git clone git@$GIT_SSH_DOMAIN:$GIT_USER/traefik.git
|
git clone git@$GIT_SSH_DOMAIN:$GIT_USER/traefik.git
|
||||||
cd traefik
|
cd traefik
|
||||||
sudo docker compose up -d
|
sudo docker compose up -d
|
||||||
|
|
||||||
|
echo "Install postgres..."
|
||||||
cd /data/utils
|
cd /data/utils
|
||||||
|
bash global-env.sh POSTGRES_USER admin
|
||||||
|
bash global-env.sh POSTGRES_DB postgres
|
||||||
bash env-gen.sh POSTGRES_PASSWORD
|
bash env-gen.sh POSTGRES_PASSWORD
|
||||||
|
|
||||||
cd /data
|
cd /data
|
||||||
git clone git@$GIT_SSH_DOMAIN:$GIT_USER/postgres.git
|
git clone git@$GIT_SSH_DOMAIN:$GIT_USER/postgres.git
|
||||||
cd postgres
|
cd postgres
|
||||||
sudo docker compose up -d
|
sudo docker compose up -d
|
||||||
|
|
||||||
# pgadmin install:
|
echo "Install pgadmin..."
|
||||||
mkdir -p /data/appdata/pgadmin
|
mkdir -p /data/appdata/pgadmin
|
||||||
chown -R 5050:5050 /data/appdata/pgadmin
|
chown -R 5050:5050 /data/appdata/pgadmin
|
||||||
|
cd /data/utils
|
||||||
|
bash env-gen.sh PGADMIN_DEFAULT_PASSWORD
|
||||||
cd /data
|
cd /data
|
||||||
git clone git@$GIT_SSH_DOMAIN:$GIT_USER/pgadmin.git
|
git clone git@$GIT_SSH_DOMAIN:$GIT_USER/pgadmin.git
|
||||||
cd pgadmin
|
cd pgadmin
|
||||||
sudo docker compose up -d
|
sudo docker compose up -d
|
||||||
|
|
||||||
ln -s /data/blog-frontend/main /data/www
|
echo "Install gitea..."
|
||||||
cd /data
|
|
||||||
git clone git@$GIT_SSH_DOMAIN:$GIT_USER/nginx-main.git
|
|
||||||
cd nginx-main
|
|
||||||
sudo docker compose up -d
|
|
||||||
|
|
||||||
cd /data
|
|
||||||
git clone git@$GIT_SSH_DOMAIN:$GIT_USER/gitea.git
|
|
||||||
cd gitea
|
|
||||||
cd /data/utils
|
cd /data/utils
|
||||||
bash env-gen.sh GITEA__database__PASSWD
|
bash env-gen.sh GITEA__database__PASSWD
|
||||||
bash init-db.sh gitea $GITEA__database__PASSWD
|
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
|
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
|
||||||
|
bash env-gen.sh MARIADB_ROOT_PASSWORD
|
||||||
|
MARIADBPASSWORD=$(pwgen -s 20 1);
|
||||||
|
bash env-gen.sh MARIADB_PASSWORD $MARIADBPASSWORD
|
||||||
|
bash env-gen.sh WORDPRESS_DB_PASSWORD $MARIADBPASSWORD
|
||||||
|
bash env-gen.sh WP_ADMIN_PASSWORD
|
||||||
|
cd /data
|
||||||
|
git clone git@$GIT_SSH_DOMAIN:$GIT_USER/mariadb.git
|
||||||
|
cd mariadb
|
||||||
|
sudo docker compose up -d
|
||||||
|
|
||||||
trap - EXIT
|
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 docker 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"
|
echo "Install server-origin complete"
|
84
push-all.sh
Normal file
84
push-all.sh
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Auto push all dependences..."
|
||||||
|
|
||||||
|
echo "push install..."
|
||||||
|
cd /data/install
|
||||||
|
git add -A
|
||||||
|
git commit -m autocommit
|
||||||
|
git push install main
|
||||||
|
|
||||||
|
echo "push server-origin..."
|
||||||
|
cd /data/server-origin
|
||||||
|
git add -A
|
||||||
|
git commit -m autocommit
|
||||||
|
git push server-origin main
|
||||||
|
|
||||||
|
echo "push utils..."
|
||||||
|
cd /data/utils
|
||||||
|
git add -A
|
||||||
|
git commit -m autocommit
|
||||||
|
git push utils main
|
||||||
|
|
||||||
|
echo "push backup..."
|
||||||
|
cd /data/backup
|
||||||
|
git add -A
|
||||||
|
git commit -m autocommit
|
||||||
|
git push backup main
|
||||||
|
|
||||||
|
echo "push traefik..."
|
||||||
|
cd /data/traefik
|
||||||
|
git add -A
|
||||||
|
git commit -m autocommit
|
||||||
|
git push traefik main
|
||||||
|
|
||||||
|
|
||||||
|
echo "push postgres..."
|
||||||
|
cd /data/postgres
|
||||||
|
git add -A
|
||||||
|
git commit -m autocommit
|
||||||
|
git push postgres main
|
||||||
|
|
||||||
|
echo "push pgadmin..."
|
||||||
|
cd /data/pgadmin
|
||||||
|
git add -A
|
||||||
|
git commit -m autocommit
|
||||||
|
git push pgadmin main
|
||||||
|
|
||||||
|
echo "push gitea..."
|
||||||
|
cd /data/gitea
|
||||||
|
git add -A
|
||||||
|
git commit -m autocommit
|
||||||
|
git push gitea main
|
||||||
|
|
||||||
|
echo "push gitea-init..."
|
||||||
|
cd /data/gitea-init
|
||||||
|
git add -A
|
||||||
|
git commit -m autocommit
|
||||||
|
git push gitea-init main
|
||||||
|
|
||||||
|
|
||||||
|
echo "push mariadb..."
|
||||||
|
cd /data/mariadb
|
||||||
|
git add -A
|
||||||
|
git commit -m autocommit
|
||||||
|
git push mariadb main
|
||||||
|
|
||||||
|
echo "push blog-wp..."
|
||||||
|
cd /data/blog-wp
|
||||||
|
git add -A
|
||||||
|
git commit -m autocommit
|
||||||
|
git push blog-wp main
|
||||||
|
|
||||||
|
echo "push blog-wp-install..."
|
||||||
|
cd /data/blog-wp-install
|
||||||
|
git add -A
|
||||||
|
git commit -m autocommit
|
||||||
|
git push blog-wp-install main
|
||||||
|
|
||||||
|
|
||||||
|
echo "push tetris..."
|
||||||
|
cd /data/tetris
|
||||||
|
git add -A
|
||||||
|
git commit -m autocommit
|
||||||
|
git push tetris main
|
Loading…
Reference in New Issue
Block a user