Initial commit

This commit is contained in:
Tim | uVulpos 2020-03-24 20:46:14 +01:00 committed by Tim Riedl
commit 89a8218854
14 changed files with 404 additions and 0 deletions

25
.github/workflows/CI_Relese.yml vendored Normal file
View File

@ -0,0 +1,25 @@
on:
push:
branches:
- master
jobs:
tests:
name: Create new zip release
runs-on: ubuntu-20.04
steps:
- name: copy repo to runner
uses: actions/checkout@v2
- name: create new zip release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: Latest master version of gitea-installer
draft: false
prerelease: false

3
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,43 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredPackages">
<value>
<list size="14">
<item index="0" class="java.lang.String" itemvalue="async-timeout" />
<item index="1" class="java.lang.String" itemvalue="python-dotenv" />
<item index="2" class="java.lang.String" itemvalue="typing-extensions" />
<item index="3" class="java.lang.String" itemvalue="youtube-dl" />
<item index="4" class="java.lang.String" itemvalue="attrs" />
<item index="5" class="java.lang.String" itemvalue="chardet" />
<item index="6" class="java.lang.String" itemvalue="discord" />
<item index="7" class="java.lang.String" itemvalue="aiohttp" />
<item index="8" class="java.lang.String" itemvalue="multidict" />
<item index="9" class="java.lang.String" itemvalue="yarl" />
<item index="10" class="java.lang.String" itemvalue="discord.py" />
<item index="11" class="java.lang.String" itemvalue="idna" />
<item index="12" class="java.lang.String" itemvalue="regex" />
<item index="13" class="java.lang.String" itemvalue="dateparser" />
</list>
</value>
</option>
</inspection_tool>
<inspection_tool class="PyPep8Inspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="E722" />
</list>
</option>
</inspection_tool>
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredIdentifiers">
<list>
<option value="mysql.connector" />
<option value="bool.__await__" />
<option value="discord.user.User.joined_at" />
</list>
</option>
</inspection_tool>
</profile>
</component>

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

4
.idea/misc.xml Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/gitea-installer.iml" filepath="$PROJECT_DIR$/.idea/gitea-installer.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Tim | uVulpos
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

18
README.md Normal file
View File

@ -0,0 +1,18 @@
[gitea-tutorial-go2prepaid-video]: https://www.youtube.com/watch?v=Tj8a7TSG4sU
[gitea-tutorial-go2prepaid-thumbnail]: https://i.ytimg.com/vi/Tj8a7TSG4sU/hqdefault.jpg?sqp=-oaymwEZCNACELwBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLBrjPPYZu5KLIZ5Qx_Z0W60i44ojQ
# Gitea-installer
Simple bash-script installer to install Gitea on Ubuntu server. It's an alternative for server who can't run docker properly (e.x. LXC)
## Tutorials
[![Mainhoster (ehemals Go2Prepaid) Gitea Video (Installation)][gitea-tutorial-go2prepaid-thumbnail]][gitea-tutorial-go2prepaid-video]
## Supported Operating Systems:
| Name | Status |
|------|--------|
|Ubuntu| original supported |
|Debian| seems to work ([user confirmed it for debian 11](https://github.com/uvulpos/gitea-installer/issues/8)) |
## License:
-->> MIT License

2
after-install.sh Normal file
View File

@ -0,0 +1,2 @@
chmod 750 /etc/gitea
chmod 660 /etc/gitea/app.ini

15
config/gitea-service.txt Normal file
View File

@ -0,0 +1,15 @@
Requires=mysql.service
Requires=mariadb.service
[Service]
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/var/lib/gitea/
ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
Restart=always
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea
[Install]
WantedBy=multi-user.target

122
gitea-installer-de.sh Normal file
View File

@ -0,0 +1,122 @@
# variablen setzen
shell_arguments=$1
giteadownloader_default="https://dl.gitea.io/gitea/1.15/gitea-1.15-linux-amd64"
deineIP="$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)"
pwd="$(pwd)"
dbuser="giteauser"
dbpassword=$(date +%s | sha256sum | base64 | head -c 32)
dbtable="giteadb"
if [[ "$shell_arguments" == "--github-ci-test" ]]; then
run_ci_tests=1
else
run_ci_tests=0
fi
echo ""
echo ""
echo " Gitea installer"
echo "-------------------------------------------------------------------------"
echo "author: Tim Riedl - uVulpos"
echo "license: MIT"
echo "sourcecode: https://github.com/uvulpos/gitea-installer"
echo "-------------------------------------------------------------------------"
echo ""
sleep 3s
if [[ run_ci_tests == 1 ]]; then
giteadownloader="${giteadownloader_default}"
else
echo "Bitte gib den Downloadlink zur jeweiligen Version an. Alternativ nutze ich folgenden Link: ${giteadownloader_default}"
read -p "-> " giteadownloader
if [[ -z ${giteadownloader} ]]; then
giteadownloader="${giteadownloader_default}"
fi
echo "Du hast folgenden Link gewaehlt: ${giteadownloader}"
fi
echo ""
echo ""
echo "//-->> Update"
apt-get update -q >> /dev/null 2>&1
apt-get upgrade -q -y >> /dev/null 2>&1
echo "//-->> Installiere Pakete"
apt-get install git mariadb-server mariadb-client nano -q -y >> /dev/null 2>&1
echo "//-->> Erstelle nutzer: git"
adduser --system --shell /bin/bash --gecos 'Git Version Control' --group --disabled-password --home /home/git git >> /dev/null 2>&1
cd /home/git/
echo "//-->> Gitea Herunterladen"
wget -q $giteadownloader -O gitea >> /dev/null 2>&1
chmod +x gitea
echo "//-->> Erstelle alle wichtigen Ordner"
mkdir -p /var/lib/gitea/custom
mkdir -p /var/lib/gitea/data
mkdir -p /var/lib/gitea/data/lfs
mkdir -p /var/lib/gitea/log
chown -R git:git /var/lib/gitea
chmod -R 750 /var/lib/gitea/
mkdir /etc/gitea
chown root:git /etc/gitea
chmod 770 /etc/gitea
# insert gitea user
echo "//-->> Erstelle die Datenbank"
mysql -e "CREATE USER '$dbuser'@'localhost' IDENTIFIED BY '$dbpassword';"
mysql -e "CREATE DATABASE $dbtable;"
mysql -e "GRANT ALL PRIVILEGES ON $dbtable . * TO '$dbuser'@'localhost';"
mysql -e "FLUSH PRIVILEGES;"
# systemvariable setzen
echo "//-->> Systemvariablen setzen"
export GITEA_WORK_DIR=/var/lib/gitea/ >> /dev/null 2>&1
echo "//-->> Kopiere Gitea ins Verzeichnis: /usr/local/bin/gitea (Ersetze dort die Binary um Gitea zu aktualisieren.)"
mv gitea /usr/local/bin/gitea
# erstelle gitea als service
echo "//-->> Erstelle Gitea als Service"
cp "$pwd/config/gitea-service.txt" "/etc/systemd/system/gitea.service"
systemctl enable gitea >> /dev/null 2>&1
service gitea start >> /dev/null 2>&1
if [[ run_ci_tests == 0 ]]; then
while true; do
read -p "Möchtest du deine Datenbank absichern? [Y/n]" yn
case $yn in
[Yy]* ) mysql_secure_installation; break;;
[Jj]* ) mysql_secure_installation; break;;
[Nn]* ) break;;
* ) echo "FEHLER! Bitte antworte mit ja oder nein";;
esac
done
fi
echo ""
echo ""
# datenbankverbindung ausgeben
echo "##########################################################################"
echo "Gitea wurde erfolgreich installiert!"
echo "Bitte öffne nun deinen bowser und besuche die webseite: http://$deineIP:3000"
echo ""
echo "--- Datenbank ---"
echo "username: $dbuser"
echo "password: $dbpassword"
echo "database: $dbtable"
echo ""
echo "author: Tim Riedl - uVulpos"
echo "license: MIT"
echo "sourcecode: https://github.com/uvulpos/gitea-installer"
echo "##########################################################################"
echo "Viel Spaß!"

123
gitea-installer-en.sh Normal file
View File

@ -0,0 +1,123 @@
# variablen setzen
shell_arguments=$1
giteadownloader_default="https://dl.gitea.io/gitea/1.15/gitea-1.15-linux-amd64"
deineIP="$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)"
pwd="$(pwd)"
dbuser="giteauser"
dbpassword=$(date +%s | sha256sum | base64 | head -c 32)
dbtable="giteadb"
if [[ "$shell_arguments" == "--github-ci-test" ]]; then
run_ci_tests=1
else
run_ci_tests=0
fi
echo ""
echo ""
echo " Gitea installer"
echo "-------------------------------------------------------------------------"
echo "author: Tim Riedl - uVulpos"
echo "license: MIT"
echo "sourcecode: https://github.com/uvulpos/gitea-installer"
echo "-------------------------------------------------------------------------"
echo ""
sleep 3s
if [[ run_ci_tests == 1 ]]; then
giteadownloader="${giteadownloader_default}"
else
echo "Define your downloadpath. Otherwise I use: ${giteadownloader_default}"
read -p "-> " giteadownloader
if [[ -z ${giteadownloader} ]]; then
giteadownloader="${giteadownloader_default}"
fi
echo "You choose: ${giteadownloader}"
fi
echo ""
echo ""
echo "//-->> Update"
apt-get update -q >> /dev/null 2>&1
apt-get upgrade -q -y >> /dev/null 2>&1
echo "//-->> Install packages"
apt-get install git mariadb-server mariadb-client nano -q -y >> /dev/null 2>&1
echo "//-->> Create user: git"
adduser --system --shell /bin/bash --gecos 'Git Version Control' --group --disabled-password --home /home/git git >> /dev/null 2>&1
cd /home/git/
echo "//-->> Download Gitea"
wget -q $giteadownloader -O gitea >> /dev/null 2>&1
chmod +x gitea
echo "//-->> Create important folder"
mkdir -p /var/lib/gitea/custom
mkdir -p /var/lib/gitea/data
mkdir -p /var/lib/gitea/data/lfs
mkdir -p /var/lib/gitea/log
chown -R git:git /var/lib/gitea
chmod -R 750 /var/lib/gitea/
mkdir /etc/gitea
chown root:git /etc/gitea
chmod 770 /etc/gitea
# insert gitea user
echo "//-->> Prepare database"
mysql -e "CREATE USER '$dbuser'@'localhost' IDENTIFIED BY '$dbpassword';"
mysql -e "CREATE DATABASE $dbtable;"
mysql -e "GRANT ALL PRIVILEGES ON $dbtable . * TO '$dbuser'@'localhost';"
mysql -e "FLUSH PRIVILEGES;"
# systemvariable setzen
echo "//-->> Set system variables"
export GITEA_WORK_DIR=/var/lib/gitea/ >> /dev/null 2>&1
echo "//-->> Copy Gite to: /usr/local/bin/gitea (replace binary to upgrade.)"
mv gitea /usr/local/bin/gitea
# erstelle gitea als service
echo "//-->> Create gitea-servive"
cp "$pwd/config/gitea-service.txt" "/etc/systemd/system/gitea.service"
systemctl enable gitea >> /dev/null 2>&1
service gitea start >> /dev/null 2>&1
if [[ run_ci_tests == 0 ]]; then
while true; do
read -p "Do you want to secure your mysql-installation? [Y/n]" yn
case $yn in
[Yy]* ) mysql_secure_installation; break;;
[Jj]* ) mysql_secure_installation; break;;
[Nn]* ) break;;
* ) echo "ERROR! Please answer with [Y/n]";;
esac
done
fi
echo ""
echo ""
# datenbankverbindung ausgeben
echo "##########################################################################"
echo "Gitea was installed successfully!"
echo "Now, open your browser and visit: http://$deineIP:3000"
echo ""
echo "--- Database ---"
echo "username: $dbuser"
echo "password: $dbpassword"
echo "database: $dbtable"
echo ""
echo "author: Tim Riedl - uVulpos"
echo "license: MIT"
echo "sourcecode: https://github.com/uvulpos/gitea-installer"
echo "##########################################################################"
echo "Have fun :)"