mirror of
https://git.cloudron.io/cloudron/gitea-app
synced 2025-09-26 06:57:26 +00:00
Compare commits
2 Commits
v1.36.2
...
act_runner
Author | SHA1 | Date | |
---|---|---|---|
|
22ddd5514d | ||
|
626326f65e |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"id": "io.gitea.cloudronapp",
|
"id": "io.gitea.actrunner.cloudronapp",
|
||||||
"title": "Gitea",
|
"title": "Gitea + Act Runner",
|
||||||
"author": "Gitea developers",
|
"author": "Gitea developers",
|
||||||
"description": "file://DESCRIPTION.md",
|
"description": "file://DESCRIPTION.md",
|
||||||
"tagline": "A painless self-hosted Git Service",
|
"tagline": "A painless self-hosted Git Service",
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
"httpPort": 3000,
|
"httpPort": 3000,
|
||||||
"memoryLimit": 536870912,
|
"memoryLimit": 536870912,
|
||||||
"addons": {
|
"addons": {
|
||||||
|
"docker": {},
|
||||||
"mysql": {},
|
"mysql": {},
|
||||||
"sendmail": {
|
"sendmail": {
|
||||||
"supportsDisplayName": true
|
"supportsDisplayName": true
|
||||||
|
@@ -27,6 +27,12 @@ RUN mkdir -p /home/git/gitea && \
|
|||||||
# setup config paths
|
# setup config paths
|
||||||
ADD app.ini.template /home/git/app.ini.template
|
ADD app.ini.template /home/git/app.ini.template
|
||||||
|
|
||||||
|
# renovate: datasource=github-releases depName=gitea/act_runner versioning=semver extractVersion=^v(?<version>.+)$ registryUrl=https://gitea.com
|
||||||
|
ARG ACT_RUNNER_VERSION=0.2.11
|
||||||
|
|
||||||
|
RUN curl -L https://gitea.com/gitea/act_runner/releases/download/v${ACT_RUNNER_VERSION}/act_runner-${ACT_RUNNER_VERSION}-linux-amd64.xz | unxz -dc > /usr/local/bin/act_runner && \
|
||||||
|
chmod +x /usr/local/bin/act_runner
|
||||||
|
|
||||||
# setup log paths
|
# setup log paths
|
||||||
RUN mkdir -p /run/gitea && chown -R git:git /run/gitea
|
RUN mkdir -p /run/gitea && chown -R git:git /run/gitea
|
||||||
RUN sed -e 's,^logfile=.*$,logfile=/run/gitea/supervisord.log,' -i /etc/supervisor/supervisord.conf
|
RUN sed -e 's,^logfile=.*$,logfile=/run/gitea/supervisord.log,' -i /etc/supervisor/supervisord.conf
|
||||||
|
@@ -6,3 +6,7 @@ This app is pre-setup with an admin account. The initial credentials are:
|
|||||||
<sso>
|
<sso>
|
||||||
Use the `Local` authentication source for logging in as admin.
|
Use the `Local` authentication source for logging in as admin.
|
||||||
</sso>
|
</sso>
|
||||||
|
|
||||||
|
Gitea is bundled along with `act_runner` runner. It's being registered in Gitea at the first run.
|
||||||
|
To configure `act_runner` you need to update `/app/data/act_runner/config.yaml`. Please read a config example for a reference.
|
||||||
|
https://gitea.com/gitea/act_runner/src/branch/main/internal/pkg/config/config.example.yaml
|
||||||
|
41
start.sh
41
start.sh
@@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
|
|
||||||
mkdir -p /run/gitea/tmp/uploads /run/sshd /run/gitea/sessions
|
mkdir -p /run/gitea/tmp/uploads /run/sshd /run/gitea/sessions /app/data/act_runner
|
||||||
|
|
||||||
|
export DOCKER_HOST=${CLOUDRON_DOCKER_HOST}
|
||||||
|
|
||||||
# CLOUDRON_OIDC_PROVIDER_NAME not supported as it will be used in rest route!
|
# CLOUDRON_OIDC_PROVIDER_NAME not supported as it will be used in rest route!
|
||||||
setup_oidc_source() {
|
setup_oidc_source() {
|
||||||
@@ -26,14 +28,38 @@ setup_root_user() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_auth() {
|
setup_act_runner() {
|
||||||
set -eu
|
wait_for_gitea
|
||||||
|
|
||||||
# Wait for gitea to finish db setup, before we do any db operations
|
echo "==> Setup act_runner"
|
||||||
while ! curl --fail http://localhost:3000/explore; do
|
if [[ ! -f /app/data/act_runner/config.yaml ]]; then
|
||||||
|
gosu git act_runner generate-config > /app/data/act_runner/config.yaml
|
||||||
|
fi
|
||||||
|
yq -e -i ".runner.file=\"/app/data/act_runner/.runner\"" /app/data/act_runner/config.yaml
|
||||||
|
|
||||||
|
if [[ ! -f /app/data/act_runner/.runner ]]; then
|
||||||
|
RUNNER_TOKEN=$(gosu git /home/git/gitea/gitea --config /run/gitea/app.ini actions generate-runner-token)
|
||||||
|
echo "===> act_runner token: ${RUNNER_TOKEN}"
|
||||||
|
|
||||||
|
echo "===> Register act_runner"
|
||||||
|
gosu git act_runner register --instance ${CLOUDRON_APP_ORIGIN} --token ${RUNNER_TOKEN} --name 'cloudron-runner' --config /app/data/act_runner/config.yaml --no-interactive
|
||||||
|
else
|
||||||
|
yq -e -i ".address=\"${CLOUDRON_APP_ORIGIN}\"" /app/data/act_runner/.runner
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
wait_for_gitea() {
|
||||||
|
while ! curl --fail -s http://localhost:3000/explore > /dev/null; do
|
||||||
echo "==> Waiting for gitea to come up"
|
echo "==> Waiting for gitea to come up"
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# Wait for gitea to finish db setup, before we do any db operations
|
||||||
|
wait_for_gitea
|
||||||
|
|
||||||
echo "==> Gitea is up, setting up auth"
|
echo "==> Gitea is up, setting up auth"
|
||||||
|
|
||||||
@@ -47,6 +73,9 @@ setup_auth() {
|
|||||||
echo "==> Setting up root user for first run"
|
echo "==> Setting up root user for first run"
|
||||||
setup_root_user
|
setup_root_user
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# setup act_runner
|
||||||
|
setup_act_runner
|
||||||
}
|
}
|
||||||
|
|
||||||
# SSH_PORT can be unset to disable SSH
|
# SSH_PORT can be unset to disable SSH
|
||||||
@@ -120,6 +149,6 @@ mkdir -p /app/data/repository /app/data/ssh /app/data/custom /app/data/gnupg
|
|||||||
chown -R git:git /app/data /run/gitea
|
chown -R git:git /app/data /run/gitea
|
||||||
|
|
||||||
# this expects app.ini to be available
|
# this expects app.ini to be available
|
||||||
( setup_auth ) &
|
( setup ) &
|
||||||
|
|
||||||
exec /usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon -i Gitea
|
exec /usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon -i Gitea
|
||||||
|
11
supervisor/act_runner.conf
Normal file
11
supervisor/act_runner.conf
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[program:act_runner]
|
||||||
|
directory=/app/data/act_runner/
|
||||||
|
command=bash -c "while true; do [[ -f /app/data/act_runner/.runner ]] && break; echo 'Wait for act_runner config'; sleep 1; done && act_runner daemon --config /app/data/act_runner/config.yaml"
|
||||||
|
user=git
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
stdout_logfile=/dev/stdout
|
||||||
|
stdout_logfile_maxbytes=0
|
||||||
|
stderr_logfile=/dev/stderr
|
||||||
|
stderr_logfile_maxbytes=0
|
||||||
|
environment=HOME="/home/git",USER="git"
|
Reference in New Issue
Block a user