From 5ecaaec269323675af0779ecb9739af132269887 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 8 Jan 2024 10:48:54 +0200 Subject: [PATCH] 1 --- Makefile | 56 +++++++++++++++++++++++++++++++++++++++++++++++ README.md | 1 + download-gitea.sh | 10 +++++++++ gitea.service | 20 +++++++++++++++++ 4 files changed, 87 insertions(+) create mode 100644 Makefile create mode 100644 README.md create mode 100755 download-gitea.sh create mode 100644 gitea.service diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0318e62 --- /dev/null +++ b/Makefile @@ -0,0 +1,56 @@ +all: + echo OK + +install-dependencies-debian: + apt -y install git vim bash-completion jq + apt -y install mariadb-server + git --version + +create-user: + adduser --system --shell /bin/bash --gecos 'Git Version Control' \ + --group --disabled-password --home /home/git git + +download-gitea: + bash download-gitea.sh + + +install-gitea-binary: + cp -vf gitea-linux-amd64 /usr/local/bin/gitea + gitea --version + +create-directories: + mkdir -p /etc/gitea /var/lib/gitea/{custom,data,indexers,public,log} + chown git:git /var/lib/gitea/{data,indexers,log} + chmod 750 /var/lib/gitea/{data,indexers,log} + chown root:git /etc/gitea + chmod 770 /etc/gitea + +install-systemd-service: + cp -vf gitea.service /etc/systemd/system/gitea.service + + +enable-service: + systemctl daemon-reload + systemctl enable gitea + +start: + systemctl start gitea + +restart: + systemctl restart gitea + +stop: + systemctl stop gitea + +disable-service: + systemctl daemon-reload + systemctl disable gitea + +status: + systemctl status gitea --no-pager + + +install-nginx: + apt -y install nginx + + diff --git a/README.md b/README.md new file mode 100644 index 0000000..3c106e4 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +* diff --git a/download-gitea.sh b/download-gitea.sh new file mode 100755 index 0000000..853a955 --- /dev/null +++ b/download-gitea.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +RELEASES_URL="https://api.github.com/repos/go-gitea/gitea/releases/latest" + +RELEASE_URLS=$(curl --silent "${RELEASES_URL}" | jq -r '.assets[] | select (.name|test("linux-amd64")) | .browser_download_url') + + +DOWNLOAD_URL=$(echo "${RELEASE_URLS}" | egrep "linux\-amd64$") + +wget "${DOWNLOAD_URL}" -O "gitea-linux-amd64" diff --git a/gitea.service b/gitea.service new file mode 100644 index 0000000..c8b5e66 --- /dev/null +++ b/gitea.service @@ -0,0 +1,20 @@ +[Unit] +Description=Gitea (Git with a cup of tea) +After=syslog.target +After=network.target +After=mysql.service + +[Service] +LimitMEMLOCK=infinity +LimitNOFILE=65535 +RestartSec=2s +Type=simple +User=git +Group=git +WorkingDirectory=/var/lib/gitea/ +ExecStart=/usr/local/bin/gitea web -c /etc/gitea/app.ini +Restart=always +Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea + +[Install] +WantedBy=multi-user.target