Added gitea CT
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
String[] ImgVariantList = ['minmal', 'default']
|
String[] ImgVariantList = ['minmal', 'default' , 'gitea' ]
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent { label 'LXCBuilder' }
|
agent { label 'LXCBuilder' }
|
||||||
|
|||||||
@@ -256,6 +256,21 @@ files:
|
|||||||
# Stuff to do before rebooting
|
# Stuff to do before rebooting
|
||||||
::shutdown:/sbin/openrc shutdown
|
::shutdown:/sbin/openrc shutdown
|
||||||
|
|
||||||
|
#Readme for FirstRunScript
|
||||||
|
- path: /root/ReadMe
|
||||||
|
generator: dump
|
||||||
|
content: |-
|
||||||
|
To setup this container edit and run the FirstRun script `/opt/Setup/Scripts/FirstRun.sh`
|
||||||
|
variants:
|
||||||
|
- gitea
|
||||||
|
|
||||||
|
#FileForGitea
|
||||||
|
- path: /opt/Setup
|
||||||
|
generator: copy
|
||||||
|
source: CT-Files/gitea
|
||||||
|
variants:
|
||||||
|
- gitea
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
manager: apk
|
manager: apk
|
||||||
update: true
|
update: true
|
||||||
@@ -271,6 +286,13 @@ packages:
|
|||||||
action: install
|
action: install
|
||||||
variants:
|
variants:
|
||||||
- default
|
- default
|
||||||
|
- packages:
|
||||||
|
- py3-pip
|
||||||
|
- xz
|
||||||
|
- git
|
||||||
|
action: install
|
||||||
|
variants:
|
||||||
|
- gitea
|
||||||
|
|
||||||
repositories:
|
repositories:
|
||||||
- name: /etc/apk/repositories
|
- name: /etc/apk/repositories
|
||||||
@@ -307,5 +329,14 @@ actions:
|
|||||||
echo "Europe/Amsterdam" > /etc/timezone
|
echo "Europe/Amsterdam" > /etc/timezone
|
||||||
ln -s /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime
|
ln -s /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime
|
||||||
|
|
||||||
|
#Run provided init script
|
||||||
|
- trigger: post-files
|
||||||
|
action: |-
|
||||||
|
#!/bin/sh
|
||||||
|
ash /opt/Setup/Scripts/Init.sh
|
||||||
|
rm /opt/Setup/Scripts/Init.sh
|
||||||
|
variants:
|
||||||
|
- gitea
|
||||||
|
|
||||||
mappings:
|
mappings:
|
||||||
architecture_map: alpinelinux
|
architecture_map: alpinelinux
|
||||||
|
|||||||
@@ -862,14 +862,14 @@ files:
|
|||||||
variants:
|
variants:
|
||||||
- imgbuilder
|
- imgbuilder
|
||||||
|
|
||||||
#Readme for imgbuilder
|
#Readme for FirstRunScript
|
||||||
- path: /root/ReadMe
|
- path: /root/ReadMe
|
||||||
generator: dump
|
generator: dump
|
||||||
content: |-
|
content: |-
|
||||||
To setup Jenkins on this system edit and run the FirstRun script `/opt/Setup/Scripts/FirstRun.sh`
|
To setup this container run the FirstRun script `/opt/Setup/Scripts/FirstRun.sh`
|
||||||
Make sure a container with imgbuilder is all ready up and running
|
|
||||||
variants:
|
variants:
|
||||||
- imgbuilder
|
- imgbuilder
|
||||||
|
- mysql
|
||||||
|
|
||||||
#FilesForJenkinsVariant
|
#FilesForJenkinsVariant
|
||||||
- path: /root/ReadMe
|
- path: /root/ReadMe
|
||||||
|
|||||||
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
|
||||||
34
Readme.md
34
Readme.md
@@ -21,6 +21,33 @@ This can be done on a Minimal debian CT (make sure to enable nesting) on the new
|
|||||||
| jenkins | Debian | Jenkins server |
|
| jenkins | Debian | Jenkins server |
|
||||||
| jenkinsBuilder | Debian | Basic node for Jenkins |
|
| jenkinsBuilder | Debian | Basic node for Jenkins |
|
||||||
| imgbuilder | Debian | LXC template builder node for Jenkins |
|
| imgbuilder | Debian | LXC template builder node for Jenkins |
|
||||||
|
| mysql | Debian | Mysql server with PhpMyadmin |
|
||||||
|
| gitea | Alpine | Gitea server |
|
||||||
|
|
||||||
|
|
||||||
|
## TODO
|
||||||
|
Domoticz
|
||||||
|
Hass+Mqtt
|
||||||
|
Z2mqtt+zw2mqtt
|
||||||
|
SMB
|
||||||
|
iSCSI
|
||||||
|
|
||||||
|
Nginx
|
||||||
|
Nextcloud
|
||||||
|
|
||||||
|
JellyFin
|
||||||
|
AptCacherNG
|
||||||
|
NodeRed
|
||||||
|
Omada
|
||||||
|
Unifi
|
||||||
|
Docker
|
||||||
|
PiHole
|
||||||
|
dDNS
|
||||||
|
Colabora
|
||||||
|
MailBackup*
|
||||||
|
FileShelter/transfer.sh
|
||||||
|
WS(x2go-xfce)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Container Setup
|
# Container Setup
|
||||||
@@ -33,7 +60,7 @@ This can be done on a Minimal debian CT (make sure to enable nesting) on the new
|
|||||||
5. Create folders on mountpoint using `mkdir /LXCBuild/template/cache`
|
5. Create folders on mountpoint using `mkdir /LXCBuild/template/cache`
|
||||||
6. Set permissions on the folder `chmod o+w -R /LXCBuild`
|
6. Set permissions on the folder `chmod o+w -R /LXCBuild`
|
||||||
7. Write down the ip of this server (for use in the jenkins container)
|
7. Write down the ip of this server (for use in the jenkins container)
|
||||||
## Jenkins
|
## jenkins
|
||||||
1. In the container configure the setup script `nano /opt/Setup/Scripts/FirstRun.sh`
|
1. In the container configure the setup script `nano /opt/Setup/Scripts/FirstRun.sh`
|
||||||
2. In the container run the setup script `bash /opt/Setup/Scripts/FirstRun.sh`
|
2. In the container run the setup script `bash /opt/Setup/Scripts/FirstRun.sh`
|
||||||
3. Acces Jenkins using `http://<ip>:8080`
|
3. Acces Jenkins using `http://<ip>:8080`
|
||||||
@@ -44,3 +71,8 @@ Under Credentials click 'Add', enter 'jenkins' as username, and set the password
|
|||||||
Then select the created credential and click save
|
Then select the created credential and click save
|
||||||
7. Click 'Relaunch agent'
|
7. Click 'Relaunch agent'
|
||||||
8. Now you can build container images
|
8. Now you can build container images
|
||||||
|
## mysql
|
||||||
|
1. To configure the MySQL root password in the container run the setup script `bash /opt/Setup/Scripts/FirstRun.sh`
|
||||||
|
## gitea
|
||||||
|
1. Edit the parameters in the FistRun script in the container `vi /opt/Setup/Scripts/FirstRun.sh`
|
||||||
|
2. Run the FistRun scipt in the container `ash /opt/Setup/Scripts/FirstRun.sh`
|
||||||
Reference in New Issue
Block a user