Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 008f53fd90 | |||
| dfad774412 | |||
| 169e50a4e5 | |||
| 1905a8affb | |||
| a58e0d8de5 | |||
| 26cbfbe39f | |||
| 147f3e07d1 | |||
| d32ddb1734 | |||
| 324b577134 | |||
| 11c1daf4a1 |
@@ -1,14 +1,44 @@
|
|||||||
# Download and install gitea
|
# Scripts to download and install gitea and act_runner binary files
|
||||||
|
|
||||||
In `init.sh` set the `target_file` as to where the gitea binary is located (full path including binary name)
|
Helps to install and setup the gitea and act_runner binary
|
||||||
|
|
||||||
|
## Things needed
|
||||||
|
|
||||||
|
The application "xc", "curl" and "jq" must be installed.
|
||||||
|
|
||||||
|
Both gitea and act_runner must be run a systemd control file named "gitea" and "act_runner"
|
||||||
|
|
||||||
|
## Basic setup
|
||||||
|
|
||||||
|
In `init.sh` set to the full path including the binary name:
|
||||||
|
|
||||||
|
- `target_file` as to where the gitea binary is located
|
||||||
|
- `target_file_act_runner` as to where the gitea act_runner binary is located
|
||||||
|
|
||||||
If the download folder should be not in the subfolder "download" change the `download_folder` variable to the path as to where the files hould be downloaded. Note that this folder must exist
|
If the download folder should be not in the subfolder "download" change the `download_folder` variable to the path as to where the files hould be downloaded. Note that this folder must exist
|
||||||
|
|
||||||
|
## Architectures detected
|
||||||
|
|
||||||
Only arm64 and x86 64bit are auto detected
|
Only arm64 and x86 64bit are auto detected
|
||||||
|
|
||||||
|
## Download and install: gitea
|
||||||
|
|
||||||
Run `download.sh` to download the latest file. Fill re-download as a different name if the same file is requested
|
Run `download.sh` to download the latest file. Fill re-download as a different name if the same file is requested
|
||||||
|
|
||||||
Run `install.sh <version>` to install the newest version
|
Run `install.sh <version>` to install the newest version
|
||||||
|
|
||||||
There is a simple "download-act_runner" script, that has the URL as to where the action runner can be
|
## Download and install: act_runner
|
||||||
downloaded
|
|
||||||
|
Run `download-act_runner.sh` to download the latest file. Fill re-download as a different name if the same file is requested
|
||||||
|
|
||||||
|
Run `install-act_runner.sh <version>` to install the newest version
|
||||||
|
|
||||||
|
## Systemd
|
||||||
|
|
||||||
|
in the `systemd` folder are systemd service files that can be used with gitea and the act_runner
|
||||||
|
|
||||||
|
Note that in the gitea.service the "[Unit]" After= block needs to be adjusted depending on what services are used
|
||||||
|
|
||||||
|
[See more here](https://docs.gitea.com/installation/linux-service)
|
||||||
|
|
||||||
|
Copy them into `/etc/systemd/system/` and run `systemctl daemon-reload`, after that they can be launched with `systemctl start <name>` and enabled with `systemctl enable <name>`
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
BASE_FOLDER=$(dirname "$(readlink -f "$0")")"/";
|
|
||||||
# shellcheck source=init.sh
|
|
||||||
. "${BASE_FOLDER}init.sh";
|
|
||||||
|
|
||||||
cd "${download_folder}" || exit;
|
|
||||||
curl -s https://gitea.com/api/v1/repos/gitea/act_runner/releases/latest |\
|
|
||||||
jq ".assets[].browser_download_url" |\
|
|
||||||
cut -d '"' -f 2 |\
|
|
||||||
grep "${arch}$" |\
|
|
||||||
wget -P "${download_folder}" -i -
|
|
||||||
cd - || exit;
|
|
||||||
|
|
||||||
# __END__
|
|
||||||
Executable
+24
@@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
BASE_FOLDER=$(dirname "$(readlink -f "$0")")"/";
|
||||||
|
# shellcheck source=init.sh
|
||||||
|
. "${BASE_FOLDER}init.sh";
|
||||||
|
|
||||||
|
download_file=$(curl -s https://gitea.com/api/v1/repos/gitea/runner/releases/latest |\
|
||||||
|
jq ".assets[].browser_download_url" |\
|
||||||
|
sed -e 's/"//g' |\
|
||||||
|
grep "${arch}.xz$");
|
||||||
|
version=$(echo "${download_file}" | cut -d "/" -f 8);
|
||||||
|
file=$(echo "${download_file}" | cut -d "/" -f 9);
|
||||||
|
if [ -f "${download_folder}/${file}" ]; then
|
||||||
|
echo "[!] File ${file} has already been downloaded";
|
||||||
|
exit;
|
||||||
|
fi;
|
||||||
|
echo "act_runner version to download: ${version}";
|
||||||
|
|
||||||
|
cd "${download_folder}" || exit;
|
||||||
|
echo "${download_file}" |\
|
||||||
|
xargs curl -LJO --output-dir "${download_folder}"
|
||||||
|
cd - || exit;
|
||||||
|
|
||||||
|
# __END__
|
||||||
+15
-5
@@ -4,12 +4,22 @@ BASE_FOLDER=$(dirname "$(readlink -f "$0")")"/";
|
|||||||
# shellcheck source=init.sh
|
# shellcheck source=init.sh
|
||||||
. "${BASE_FOLDER}init.sh";
|
. "${BASE_FOLDER}init.sh";
|
||||||
|
|
||||||
|
download_file=$(curl -s https://api.github.com/repos/go-gitea/gitea/releases/latest |\
|
||||||
|
jq ".assets[].browser_download_url" |\
|
||||||
|
sed -e 's/"//g' |\
|
||||||
|
grep "${arch}.xz$");
|
||||||
|
|
||||||
|
version=$(echo "${download_file}" | cut -d "/" -f 8);
|
||||||
|
file=$(echo "${download_file}" | cut -d "/" -f 9);
|
||||||
|
if [ -f "${download_folder}/${file}" ]; then
|
||||||
|
echo "[!] File ${file} has already been downloaded";
|
||||||
|
exit;
|
||||||
|
fi;
|
||||||
|
echo "gitea version to download: ${version}";
|
||||||
|
|
||||||
cd "${download_folder}" || exit;
|
cd "${download_folder}" || exit;
|
||||||
curl -s https://api.github.com/repos/go-gitea/gitea/releases/latest |\
|
echo "${download_file}" |\
|
||||||
grep browser_download_url |\
|
xargs curl -LJO --output-dir "${download_folder}"
|
||||||
cut -d '"' -f 4 |\
|
|
||||||
grep "${arch}$" |\
|
|
||||||
wget -P "${download_folder}" -i -
|
|
||||||
cd - || exit;
|
cd - || exit;
|
||||||
|
|
||||||
# __END__
|
# __END__
|
||||||
|
|||||||
@@ -1,11 +1,24 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# check needed binaries
|
||||||
|
if [ -z "$(command -v xz)" ]; then
|
||||||
|
echo "Missing xz application, aborting";
|
||||||
|
exit;
|
||||||
|
fi;
|
||||||
|
if [ -z "$(command -v curl)" ]; then
|
||||||
|
echo "Missing curl application, aborting";
|
||||||
|
exit;
|
||||||
|
fi;
|
||||||
|
if [ -z "$(command -v jq)" ]; then
|
||||||
|
echo "Missing jq application, aborting";
|
||||||
|
exit;
|
||||||
|
fi;
|
||||||
|
|
||||||
CPU_ARCH=""
|
CPU_ARCH=""
|
||||||
# get the architecture
|
# get the architecture
|
||||||
_cpu_arch=$(uname -m);
|
_cpu_arch=$(uname -m);
|
||||||
# weg get like x86_64 or x86_32 (NO), aarch64, etc
|
# weg get like x86_64 or x86_32 (NO), aarch64, etc
|
||||||
# we ONLY allow x86_64 or aarch64
|
# we ONLY allow x86_64 or aarch64/arm64
|
||||||
# possible add: arm64
|
|
||||||
if [ "${_cpu_arch}" = "x86_64" ]; then
|
if [ "${_cpu_arch}" = "x86_64" ]; then
|
||||||
CPU_ARCH="amd64";
|
CPU_ARCH="amd64";
|
||||||
elif [ "${_cpu_arch}" = "aarch64" ] || [ "${_cpu_arch}" = "arm64" ]; then
|
elif [ "${_cpu_arch}" = "aarch64" ] || [ "${_cpu_arch}" = "arm64" ]; then
|
||||||
@@ -21,16 +34,18 @@ if [ ! -d "${download_folder}" ]; then
|
|||||||
exit;
|
exit;
|
||||||
fi;
|
fi;
|
||||||
target_file="/usr/local/bin/gitea";
|
target_file="/usr/local/bin/gitea";
|
||||||
|
gitea_exists=1;
|
||||||
if [ ! -f "${target_file}" ]; then
|
if [ ! -f "${target_file}" ]; then
|
||||||
echo "There is no gitea target file at ${target_file}. Is gitea installed?";
|
echo "[!] There is no gitea target file at ${target_file}. Is gitea installed?";
|
||||||
exit;
|
gitea_exists=0;
|
||||||
fi;
|
fi;
|
||||||
target_file_act_runner="/usr/local/bin/act_runner";
|
target_file_gitea_runner="/usr/local/bin/gitea-runner";
|
||||||
if [ ! -f "${target_file_act_runner}" ]; then
|
gitea_runner_exists=1
|
||||||
echo "There is no gitea action runner target file at ${target_file}. Is gitea action runner installed?";
|
if [ ! -f "${target_file_gitea_runner}" ]; then
|
||||||
exit;
|
echo "[!] There is no gitea runner target file at ${target_file_gitea_runner}. Is gitea runner installed?";
|
||||||
|
gitea_runner_exists=0
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
export arch target_file;
|
export arch target_file gitea_exists gitea_runner_exists;
|
||||||
|
|
||||||
# __END__
|
# __END__
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
BASE_FOLDER=$(dirname "$(readlink -f "$0")")"/";
|
|
||||||
# shellcheck source=init.sh
|
|
||||||
. "${BASE_FOLDER}init.sh";
|
|
||||||
|
|
||||||
if [ -z "${1}" ]; then
|
|
||||||
echo "Please give a Gitea Action Runner version to upgrade to";
|
|
||||||
exit;
|
|
||||||
fi;
|
|
||||||
if [ ! -f "${download_folder}act_runner-${1}-${arch}" ]; then
|
|
||||||
echo "Cannot find file: ${download_folder}act_runner-${1}-${arch}";
|
|
||||||
exit;
|
|
||||||
fi;
|
|
||||||
|
|
||||||
echo -e "Update gitea action runner to ${1} ... ";
|
|
||||||
systemctl stop act_runner;
|
|
||||||
cp "${download_folder}act_runner-${1}-${arch}" "${target_file_act_runner}";
|
|
||||||
chmod +x "${target_file_act_runner}";
|
|
||||||
systemctl start gitea;
|
|
||||||
echo "[DONE]";
|
|
||||||
|
|
||||||
# __END__
|
|
||||||
Executable
+24
@@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
BASE_FOLDER=$(dirname "$(readlink -f "$0")")"/";
|
||||||
|
# shellcheck source=init.sh
|
||||||
|
. "${BASE_FOLDER}init.sh";
|
||||||
|
|
||||||
|
if [ -z "${1}" ]; then
|
||||||
|
echo "Please give a Gitea Runner version to upgrade to";
|
||||||
|
exit;
|
||||||
|
fi;
|
||||||
|
file_name="${download_folder}gitea-runner-${1}-${arch}.xz";
|
||||||
|
if [ ! -f "${file_name}" ]; then
|
||||||
|
echo "Cannot find file: ${file_name}";
|
||||||
|
exit;
|
||||||
|
fi;
|
||||||
|
|
||||||
|
echo -e "Update gitea runner to ${1} ... ";
|
||||||
|
systemctl stop gitea-runner;
|
||||||
|
xz -dc "${file_name}" > "${target_file_gitea_runner}";
|
||||||
|
chmod +x "${target_file_gitea_runner}";
|
||||||
|
systemctl start gitea-runner;
|
||||||
|
echo "[DONE]";
|
||||||
|
|
||||||
|
# __END__
|
||||||
+4
-3
@@ -8,14 +8,15 @@ if [ -z "${1}" ]; then
|
|||||||
echo "Please give a Gitea version to upgrade to";
|
echo "Please give a Gitea version to upgrade to";
|
||||||
exit;
|
exit;
|
||||||
fi;
|
fi;
|
||||||
if [ ! -f "${download_folder}gitea-${1}-${arch}" ]; then
|
file_name="${download_folder}gitea-${1}-${arch}.xz";
|
||||||
echo "Cannot find file: ${download_folder}gitea-${1}-${arch}";
|
if [ ! -f "${file_name}" ]; then
|
||||||
|
echo "Cannot find file: ${file_name}";
|
||||||
exit;
|
exit;
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
echo -e "Update gitea to ${1} ... ";
|
echo -e "Update gitea to ${1} ... ";
|
||||||
systemctl stop gitea;
|
systemctl stop gitea;
|
||||||
cp "${download_folder}gitea-${1}-${arch}" "${target_file}";
|
xz -dc "${file_name}" > "${target_file}";
|
||||||
chmod +x "${target_file}";
|
chmod +x "${target_file}";
|
||||||
systemctl start gitea;
|
systemctl start gitea;
|
||||||
echo "[DONE]";
|
echo "[DONE]";
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Gitea Runner
|
||||||
|
Documentation=https://gitea.com/gitea/runner
|
||||||
|
After=docker.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usr/local/bin/gitea-runner daemon --config /etc/gitea-runner/config.yaml
|
||||||
|
ExecReload=/bin/kill -s HUP $MAINPID
|
||||||
|
WorkingDirectory=/var/lib/gitea-runner
|
||||||
|
TimeoutSec=0
|
||||||
|
RestartSec=10
|
||||||
|
Restart=always
|
||||||
|
User=gitea-runner
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Gitea (Git with a cup of tea)
|
||||||
|
After=syslog.target
|
||||||
|
After=network.target
|
||||||
|
#After=mysqld.service
|
||||||
|
After=postgresql.service
|
||||||
|
#After=memcached.service
|
||||||
|
#After=redis.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
# Modify these two values and uncomment them if you have
|
||||||
|
# repos with lots of files and get an HTTP error 500 because
|
||||||
|
# of that
|
||||||
|
###
|
||||||
|
#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
|
||||||
|
# If you want to bind Gitea to a port below 1024 uncomment
|
||||||
|
# the two values below
|
||||||
|
###
|
||||||
|
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
|
||||||
|
#AmbientCapabilities=CAP_NET_BIND_SERVICE
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
Reference in New Issue
Block a user