diff options
Diffstat (limited to '')
| -rwxr-xr-x | setup.sh | 37 |
1 files changed, 28 insertions, 9 deletions
@@ -5,7 +5,7 @@ set -eu ROOT_DIR=${ROOT_DIR:-"/opt/project"} configure() { - configure_user && configure_fs && configure_packages && configure_git && configure_firewall + configure_user && configure_fs && configure_packages && configure_git && configure_ssh && configure_firewall } services() { cd "$ROOT_DIR"; docker compose --profile services "$@"; } @@ -14,43 +14,62 @@ core() { cd "$ROOT_DIR"; docker compose --profile core "$@"; } # TODO: use --wait and add health checks start() { - stop || true; services up -d "$@" + services build --pull + stop || true + services up -d "$@" core down nginx core up nginx -d } -startfg() { stop || true; services up "$@"; } +startfg() { + services build --pull + stop || true + services up "$@" +} stop() { services down; } configure_packages() { + echo "== Packages ==" apt install \ docker.io docker-buildx docker-compose-v2 \ git ufw } configure_git() { + echo "== Git ==" sudo -u git git config --global init.defaultBranch main - # kept explicit shell setup - chsh -s "$(which git-shell)" git - ln -sf "$ROOT_DIR/cgit/ssh/git-shell-commands" /home/git/ + sudo -u git git config --global receive.fsckObjects true + sudo -u git git config --global core.sharedRepository group + chsh -s "$(which git-shell)" git # kept explicit shell setup + ln -sf "$ROOT_DIR/cgit/ssh/git-shell-commands" /git/ +} + +configure_ssh() { + echo "== Git ==" + ln -sf "$ROOT_DIR/ssh/sshd-config/host.conf" /etc/ssh/sshd_config.d/100-host.conf + ln -sf "$ROOT_DIR/ssh/sshd-config/git.conf" /etc/ssh/sshd_config.d/110-git.conf + # Set up authorized keys for git? } configure_firewall() { + echo "== Firewall ==" ufw allow 443/tcp ufw allow 80/tcp - ufw allow 22 - ufw enable + ufw limit 22/tcp } configure_user() { + echo "== User ==" + mkdir -p /home/git groupadd -f -g 1001 git - useradd --shell /usr/sbin/nologin git --uid 1001 --gid 1001 || true + useradd --shell /usr/sbin/nologin --home-dir /home/git git --uid 1001 --gid 1001 || true groupadd -f -g 1002 send useradd --shell /usr/sbin/nologin --no-create-home send --uid 1002 --gid 1002 || true } configure_fs() { + echo "== File system ==" mkdir -p /git chown -R git:git /git mkdir -p /uploads |
