git-trace

romele / git-trace public

62 commits · 1 branch · 1 tag · 1 contributor (top: Romele) · first commit 3d ago · last push 11m ago

deploy/docker-entrypoint.sh

#!/bin/sh
# git-trace container entrypoint.
# Starts the forge sshd on :2222 (unless GIT_TRACE_SSHD=0) and the
# HTTP daemon on :8081 as the unprivileged 'git' user.
set -e
D=${GIT_TRACE_HOME:-/srv/git-trace}
export GIT_TRACE_REPOS=$D/repos
export GIT_TRACE_DB=$D/var/git-trace.db
export GIT_TRACE_SSH_URL=${GIT_TRACE_SSH_URL:-ssh://git@localhost:2222}

mkdir -p "$GIT_TRACE_REPOS" "$D/var"
chown -R git:git "$D"

if [ "${GIT_TRACE_SSHD:-1}" = "1" ]; then
    mkdir -p /var/empty          # sshd privilege separation
    [ -f "$D/var/ssh_host_ed25519_key" ] || \
        ssh-keygen -q -t ed25519 -N '' -f "$D/var/ssh_host_ed25519_key"
    [ -f "$D/var/ssh_host_rsa_key" ] || \
        ssh-keygen -q -t rsa -b 3072 -N '' -f "$D/var/ssh_host_rsa_key"
    chown git:git "$D"/var/ssh_host_*
    touch "$D/var/authorized_keys"
    chown git:git "$D/var/authorized_keys"
    /usr/sbin/sshd -f /etc/git-trace/sshd-forge.conf
    echo "git-trace: forge sshd on :2222"
fi

echo "git-trace: serving on :8081"
exec su-exec git git-trace serve -p "${GIT_TRACE_PORT:-8081}"