Update gitea download and switch to xz files
XZ files are downloaded Change that any grep is replaced by jq command, and sed for " replace Add systemd service files as samples
This commit is contained in:
@@ -32,3 +32,13 @@ Run `install.sh <version>` to install the newest version
|
|||||||
Run `download-act_runner.sh` to download the latest file. Fill re-download as a different name if the same file is requested
|
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
|
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>`
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ BASE_FOLDER=$(dirname "$(readlink -f "$0")")"/";
|
|||||||
|
|
||||||
download_file=$(curl -s https://gitea.com/api/v1/repos/gitea/act_runner/releases/latest |\
|
download_file=$(curl -s https://gitea.com/api/v1/repos/gitea/act_runner/releases/latest |\
|
||||||
jq ".assets[].browser_download_url" |\
|
jq ".assets[].browser_download_url" |\
|
||||||
cut -d '"' -f 2 |\
|
sed -e 's/"//g' |\
|
||||||
grep "${arch}$");
|
grep "${arch}.xz$");
|
||||||
version=$(echo "${download_file}" | cut -d "/" -f 8);
|
version=$(echo "${download_file}" | cut -d "/" -f 8);
|
||||||
file=$(echo "${download_file}" | cut -d "/" -f 9);
|
file=$(echo "${download_file}" | cut -d "/" -f 9);
|
||||||
if [ -f "${download_folder}/${file}" ]; then
|
if [ -f "${download_folder}/${file}" ]; then
|
||||||
@@ -19,7 +19,7 @@ echo "act_runner version to download: ${version}";
|
|||||||
cd "${download_folder}" || exit;
|
cd "${download_folder}" || exit;
|
||||||
curl -s https://gitea.com/api/v1/repos/gitea/act_runner/releases/latest |\
|
curl -s https://gitea.com/api/v1/repos/gitea/act_runner/releases/latest |\
|
||||||
jq ".assets[].browser_download_url" |\
|
jq ".assets[].browser_download_url" |\
|
||||||
cut -d '"' -f 2 |\
|
sed -e 's/"//g' |\
|
||||||
grep "${arch}$" |\
|
grep "${arch}$" |\
|
||||||
xargs curl -LJO --output-dir "${download_folder}"
|
xargs curl -LJO --output-dir "${download_folder}"
|
||||||
cd - || exit;
|
cd - || exit;
|
||||||
|
|||||||
+2
-2
@@ -6,8 +6,8 @@ BASE_FOLDER=$(dirname "$(readlink -f "$0")")"/";
|
|||||||
|
|
||||||
download_file=$(curl -s https://api.github.com/repos/go-gitea/gitea/releases/latest |\
|
download_file=$(curl -s https://api.github.com/repos/go-gitea/gitea/releases/latest |\
|
||||||
jq ".assets[].browser_download_url" |\
|
jq ".assets[].browser_download_url" |\
|
||||||
cut -d '"' -f 4 |\
|
sed -e 's/"//g' |\
|
||||||
grep "${arch}$");
|
grep "${arch}.xz$");
|
||||||
|
|
||||||
version=$(echo "${download_file}" | cut -d "/" -f 8);
|
version=$(echo "${download_file}" | cut -d "/" -f 8);
|
||||||
file=$(echo "${download_file}" | cut -d "/" -f 9);
|
file=$(echo "${download_file}" | cut -d "/" -f 9);
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# check needed binaries
|
# check needed binaries
|
||||||
|
if [ -z "$(command -v xz)" ]; then
|
||||||
|
echo "Missing xz application, aborting";
|
||||||
|
exit;
|
||||||
|
fi;
|
||||||
if [ -z "$(command -v curl)" ]; then
|
if [ -z "$(command -v curl)" ]; then
|
||||||
echo "Missing curl application, aborting";
|
echo "Missing curl application, aborting";
|
||||||
exit;
|
exit;
|
||||||
|
|||||||
@@ -8,14 +8,15 @@ if [ -z "${1}" ]; then
|
|||||||
echo "Please give a Gitea Action Runner version to upgrade to";
|
echo "Please give a Gitea Action Runner version to upgrade to";
|
||||||
exit;
|
exit;
|
||||||
fi;
|
fi;
|
||||||
if [ ! -f "${download_folder}act_runner-${1}-${arch}" ]; then
|
file_name="${download_folder}act_runner-${1}-${arch}.xz";
|
||||||
echo "Cannot find file: ${download_folder}act_runner-${1}-${arch}";
|
if [ ! -f "${file_name}" ]; then
|
||||||
|
echo "Cannot find file: ${file_name}";
|
||||||
exit;
|
exit;
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
echo -e "Update gitea action runner to ${1} ... ";
|
echo -e "Update gitea action runner to ${1} ... ";
|
||||||
systemctl stop act_runner;
|
systemctl stop act_runner;
|
||||||
cp "${download_folder}act_runner-${1}-${arch}" "${target_file_act_runner}";
|
xz -dc "${file_name}" > "${target_file_act_runner}";
|
||||||
chmod +x "${target_file_act_runner}";
|
chmod +x "${target_file_act_runner}";
|
||||||
systemctl start act_runner;
|
systemctl start act_runner;
|
||||||
echo "[DONE]";
|
echo "[DONE]";
|
||||||
|
|||||||
+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 Actions runner
|
||||||
|
Documentation=https://gitea.com/gitea/act_runner
|
||||||
|
After=docker.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usr/local/bin/act_runner daemon --config /etc/act_runner/config.yaml
|
||||||
|
ExecReload=/bin/kill -s HUP $MAINPID
|
||||||
|
WorkingDirectory=/var/lib/act_runner
|
||||||
|
TimeoutSec=0
|
||||||
|
RestartSec=10
|
||||||
|
Restart=always
|
||||||
|
User=act_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