This commit is contained in:
leo 2024-08-09 02:45:42 +05:00
commit 9bcef17fcd
3 changed files with 141 additions and 0 deletions

47
create-all.sh Normal file
View File

@ -0,0 +1,47 @@
#!/bin/bash
LIST_FILE="./repos.list"
ENV_FILE="/data/secrets/dev.env"
# Checking for a CSV file
if [ ! -f "$LIST_FILE" ]; then
echo "File $LIST_FILE not found"
exit 1
fi
# Including a file with environment variables
if [ -f $ENV_FILE ]; then
source $ENV_FILE
else
echo "File dev.env not found"
exit 1
fi
# Checking the presence of a variable GITEA_W_USER_REPO
if [ -z "$GITEA_W_USER_REPO" ]; then
echo "The GITEA_W_USER_REPO variable is not set"
exit 1
fi
# Reading a CSV file and creating repositories
OLDIFS=$IFS
IFS=' | '
while read -r NAME_REPO DESCRIPTION_REPO; do
if [ "$NAME_REPO" != "NAME_REPO" ]; then # Skip title
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -X POST "https://git.rozenlab.com/api/v1/user/repos" \
-H "Content-Type: application/json" \
-H "Authorization: token $GITEA_W_USER_REPO" \
-d '{
"name": "'"$NAME_REPO"'",
"private": true,
"description": "'"$DESCRIPTION_REPO"'"
}')
if [ "$RESPONSE" -eq 201 ]; then
echo "The $NAME_REPO repository has been created successfully"
else
echo "Error creating repository $NAME_REPO. HTTP status: $RESPONSE"
fi
fi
done < "$LIST_FILE"
IFS=$OLDIFS

80
push-all.sh Normal file
View File

@ -0,0 +1,80 @@
# notes
# git@rozenlab.com:leo/notes.git
cd /data/notes
git push notes main
# ssl-gen
# git@rozenlab.com:leo/ssl-gen.git
cd /data/ssl-gen
git push ssl-gen main
# utils
# git@rozenlab.com:leo/utils.git
cd /data/utils
git push utils main
# server-origin
# git@rozenlab.com:leo/server-origin.git
cd /data/server-origin
git push server-origin main
# backup
# git@rozenlab.com:leo/backup.git
cd /data/backup
git push backup main
# gitea
# git@rozenlab.com:leo/gitea.git
cd /data/gitea
git push gitea main
# traefik
# git@rozenlab.com:leo/traefik.git
cd /data/traefik
git push traefik main
# socks5
# git@rozenlab.com:leo/socks5.git
cd /data/socks5
git push socks5 main
# install
# git@rozenlab.com:leo/install.git
cd /data/install
git push install main
# server-backup
# git@rozenlab.com:leo/server-backup.git
cd /data/server-backup
git push server-backup main
# tetris
# git@rozenlab.com:Leo/tetris.git
cd /data/tetris
git push tetris main
# brickgame
# git@rozenlab.com:leo/brickgame.git
cd /data/brickgame
git push brickgame main
# blog-frontend
# git@rozenlab.com:leo/blog-frontend.git
cd /data/blog-frontend
git push blog-frontend main
# nginx-main
# git@rozenlab.com:leo/nginx-main.git
#cd /data/nginx-main
#git push nginx-main main
# pgadmin
# git@rozenlab.com:leo/pgadmin.git
cd /data/pgadmin
git push pgadmin main
# postgres
# git@rozenlab.com:leo/postgres.git
cd /data/postgres
git push postgres main

14
repos.list Normal file
View File

@ -0,0 +1,14 @@
NAME_REPO | DESCRIPTION_REPO
utils | shell utils
server-backup | init server backup, proxy
install | first initialize server
socks5 | Create dante-server socks5
traefik | Traefik Docker configuration
gitea | Gitea Docker configuration
backup | Backup all databases & files
server-origin | Head site, repositories, etc
notes | Other notes
ssl-gen | Self signed SSL certs generator
brickgame | Tetris and other games
tetris | Classic Tetris
brickgame | Modular system with several games