Added gitea CT
This commit is contained in:
86
CT-Files/gitea/Configs/app.ini
Normal file
86
CT-Files/gitea/Configs/app.ini
Normal file
@@ -0,0 +1,86 @@
|
||||
APP_NAME = InstName
|
||||
RUN_USER = git
|
||||
RUN_MODE = prod
|
||||
|
||||
[security]
|
||||
INTERNAL_TOKEN = IntToken
|
||||
INSTALL_LOCK = true
|
||||
SECRET_KEY = SecKey
|
||||
|
||||
[database]
|
||||
DB_TYPE = mysql
|
||||
HOST = DBServer
|
||||
NAME = DBName
|
||||
USER = DBUser
|
||||
PASSWD = DBPass
|
||||
SSL_MODE = disable
|
||||
PATH = data/gitea.db
|
||||
|
||||
[repository]
|
||||
ROOT = /gitea-data/gitea-repositories
|
||||
|
||||
[server]
|
||||
SSH_DOMAIN = DOMAINname
|
||||
DOMAIN = localhost
|
||||
HTTP_PORT = 3000
|
||||
ROOT_URL = DomainProto
|
||||
DISABLE_SSH = FALSE
|
||||
SSH_PORT = 22
|
||||
LFS_START_SERVER = true
|
||||
APP_DATA_PATH = /gitea-data
|
||||
LFS_JWT_SECRET = LFSSecret
|
||||
OFFLINE_MODE = false
|
||||
|
||||
[mailer]
|
||||
ENABLED = false
|
||||
|
||||
[service]
|
||||
REGISTER_EMAIL_CONFIRM = false
|
||||
ENABLE_NOTIFY_MAIL = false
|
||||
DISABLE_REGISTRATION = true
|
||||
ALLOW_ONLY_EXTERNAL_REGISTRATION = false
|
||||
ENABLE_CAPTCHA = false
|
||||
REQUIRE_SIGNIN_VIEW = false
|
||||
DEFAULT_KEEP_EMAIL_PRIVATE = false
|
||||
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
|
||||
DEFAULT_ENABLE_TIMETRACKING = true
|
||||
NO_REPLY_ADDRESS = noreply.localhost
|
||||
|
||||
[picture]
|
||||
DISABLE_GRAVATAR = false
|
||||
ENABLE_FEDERATED_AVATAR = true
|
||||
|
||||
[openid]
|
||||
ENABLE_OPENID_SIGNIN = false
|
||||
ENABLE_OPENID_SIGNUP = false
|
||||
|
||||
[session]
|
||||
PROVIDER = file
|
||||
|
||||
[log]
|
||||
MODE = console
|
||||
LEVEL = Info
|
||||
|
||||
|
||||
[i18n]
|
||||
LANGS = en-US
|
||||
NAMES = English
|
||||
|
||||
[repository.upload]
|
||||
; Whether repository file uploads are enabled. Defaults to `true`
|
||||
ENABLED = true
|
||||
; Path for uploads. Defaults to `data/tmp/uploads` (tmp gets deleted on gitea restart)
|
||||
TEMP_PATH = data/tmp/uploads
|
||||
; One or more allowed types, e.g. image/jpeg|image/png. Nothing means any file type
|
||||
; ALLOWED_TYPES =
|
||||
; Max size of each file in megabytes. Defaults to 3MB
|
||||
FILE_MAX_SIZE = 40
|
||||
; Max number of files per upload. Defaults to 5
|
||||
MAX_FILES = 5
|
||||
|
||||
[oauth2]
|
||||
JWT_SECRET = JWTSectet
|
||||
|
||||
[ui]
|
||||
THEMES = gitea,arc-green,arc-blue
|
||||
DEFAULT_THEME = arc-blue
|
||||
10
CT-Files/gitea/Configs/auto-update.ini
Normal file
10
CT-Files/gitea/Configs/auto-update.ini
Normal file
@@ -0,0 +1,10 @@
|
||||
[Gitea]
|
||||
site=http://localhost:3000/api/v1/version
|
||||
apiUrl=https://api.github.com/repos/go-gitea/gitea/releases/latest
|
||||
system=linux-amd64
|
||||
file=/usr/local/bin/gitea
|
||||
tmpDir=/tmp/
|
||||
buildFromSource=
|
||||
sourceDir=
|
||||
logFile=/var/log/gitupdate.log
|
||||
|
||||
14
CT-Files/gitea/Configs/gitea.service
Normal file
14
CT-Files/gitea/Configs/gitea.service
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
supervisor=supervise-daemon
|
||||
name=gitea
|
||||
command="/usr/local/bin/gitea"
|
||||
command_user="git"
|
||||
command_args="web --config '${GITEA_CONF:-/etc/gitea/app.ini}'"
|
||||
supervise_daemon_args="--env GITEA_WORK_DIR='${GITEA_WORK_DIR:-/var/lib/gitea}' --chdir '${GITEA_WORK_DIR:-/var/lib/gitea}' --stdout '${GITEA_LOG_FILE:-/var/log/gitea/gitea.log}' --stderr '${GITEA_LOG_FILE:-/var/log/gitea/gitea.log}'"
|
||||
pidfile="/run/gitea.pid"
|
||||
|
||||
depend() {
|
||||
use logger dns
|
||||
need net
|
||||
}
|
||||
37
CT-Files/gitea/Scripts/FirstRun.sh
Normal file
37
CT-Files/gitea/Scripts/FirstRun.sh
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/bin/ash
|
||||
#UserSettings
|
||||
ThisScriptConfigured=no
|
||||
## Gitea Admin user
|
||||
GiteaUsername=<Username>
|
||||
GiteaUserEmail=<Email>
|
||||
GiteaPassword=<Password>
|
||||
##Gitea
|
||||
GiteaName=<Name>
|
||||
GiteaDomain=<Domain>
|
||||
GiteaWebProto=http
|
||||
##DB
|
||||
MysqlIP=127.0.0.1
|
||||
MysqlPort=3306
|
||||
MysqlUsername=gitea
|
||||
MysqlDatabase=gitea
|
||||
MysqlPassword=<Password>
|
||||
|
||||
#Check if script is configured
|
||||
if [ $ThisScriptConfigured = no ]; then
|
||||
echo "Script is not configured"
|
||||
exit
|
||||
fi
|
||||
|
||||
#Updateing gitea config
|
||||
sed -i -e 's/DBServer/'$MysqlIP':'$MysqlPort'/' -e 's/DBName/'$MysqlDatabase'/' -e 's/DBUser/'$MysqlUsername'/' -e 's/DBPass/'$MysqlPassword'/' -e 's/DOMAINname/'$GiteaDomain'/' -e 's#DomainProto#'$GiteaWebProto'://'$GiteaDomain'#' -e 's/InstName/'$GiteaName'/' -e 's/IntToken/'$(/usr/local/bin/gitea generate secret INTERNAL_TOKEN)'/' -e 's/SecKey/'$(/usr/local/bin/gitea generate secret SECRET_KEY)'/' -e 's/JWTSectet/'$(/usr/local/bin/gitea generate secret JWT_SECRET)'/' -e 's/LFSSecret/'$(/usr/local/bin/gitea generate secret LFS_JWT_SECRET)'/' /etc/gitea/app.ini
|
||||
|
||||
#generate all db tables
|
||||
su git -c 'gitea --config /etc/gitea/app.ini migrate'
|
||||
|
||||
#Create admin user
|
||||
su git -c "gitea --config /etc/gitea/app.ini admin user create --admin --email $GiteaUserEmail --username $GiteaUsername --password $GiteaPassword"
|
||||
|
||||
#Enable on boot
|
||||
rc-update add gitea
|
||||
#Start gitea
|
||||
service gitea start
|
||||
54
CT-Files/gitea/Scripts/Init.sh
Normal file
54
CT-Files/gitea/Scripts/Init.sh
Normal file
@@ -0,0 +1,54 @@
|
||||
#!/bin/ash
|
||||
#Vars
|
||||
apiUrl=https://api.github.com/repos/go-gitea/gitea/releases/latest
|
||||
|
||||
#install Update tool
|
||||
pip install install gitea-auto-update
|
||||
|
||||
#Get latest gitea version info
|
||||
#giteaver=$(python3 -c "import requests; print (requests.get('$apiUrl').json()['tag_name'])")
|
||||
#giteaver=${giteaver//v}
|
||||
giteaver=1.15.0
|
||||
|
||||
#Add gitea `git` service user
|
||||
addgroup git
|
||||
adduser -S -s /bin/ash -g 'Git Version Control' -h /home/git -D -G git git
|
||||
|
||||
#Making Gitea Folders
|
||||
mkdir -p /gitea-data
|
||||
mkdir -p /var/lib/gitea/custom/public
|
||||
mkdir -p /var/lib/gitea/data
|
||||
mkdir -p /var/log/gitea
|
||||
mkdir -p /etc/gitea
|
||||
|
||||
#Download Gitea binary
|
||||
echo "Downloading gitea binary..."
|
||||
python3 -c "import requests; url = 'https://dl.gitea.io/gitea/"$giteaver"/gitea-"$giteaver"-linux-amd64'; r = requests.get(url, allow_redirects=True); open('/usr/local/bin/gitea', 'wb').write(r.content)"
|
||||
|
||||
#Install custom theme
|
||||
git clone https://git.bprieshof.nl/DarkTheme/Gitea-Arc_blue-Theme.git /opt/gitea_blue-theme/
|
||||
ln -sfn /opt/gitea_blue-theme/custom_public_bin/css /var/lib/gitea/custom/public/css
|
||||
ln -sfn /opt/gitea_blue-theme/custom_public_bin/js /var/lib/gitea/custom/public/js
|
||||
|
||||
|
||||
#Moving configs in place
|
||||
mv /opt/Setup/Configs/app.ini /etc/gitea/app.ini
|
||||
mv /opt/Setup/Configs/auto-update.ini /etc/gitea/auto-update.ini
|
||||
mv /opt/Setup/Configs/gitea.service /etc/init.d/gitea
|
||||
|
||||
#Set folder permissions
|
||||
chown -R git:git /gitea-data
|
||||
chown -R git:git /var/log/gitea
|
||||
chown -R git:git /var/lib/gitea/
|
||||
chown -R root:git /etc/gitea
|
||||
chmod -R 750 /var/lib/gitea/
|
||||
chmod +x /usr/local/bin/gitea
|
||||
chmod +x /etc/init.d/gitea
|
||||
chmod 750 /etc/gitea
|
||||
chmod 640 /etc/gitea/app.ini
|
||||
|
||||
#Fix Gitea-auto-updater to support OpenRC
|
||||
sed -i -e 's/systemctl start gitea.service/service gitea start/' -e 's/systemctl stop gitea.service/service gitea stop/' /usr/lib/python3.*/site-packages/gitea_auto_update/update.py
|
||||
|
||||
#Gitea update Sript
|
||||
echo "gitea-auto-update --settings=/etc/gitea/auto-update.ini" > /opt/UpdateGitea.sh
|
||||
Reference in New Issue
Block a user