2025-03-05 21:43:20 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
echo "== Fetch Source Code (from git)"
|
2025-03-06 19:35:20 +00:00
|
|
|
cd "/root/service"
|
2025-03-05 21:43:20 +00:00
|
|
|
# Clone if not yet cloned
|
|
|
|
if [ ! -d .git ]; then
|
|
|
|
git clone \
|
|
|
|
--depth 1 \
|
|
|
|
--no-checkout \
|
|
|
|
--filter=tree:0 \
|
2025-03-06 19:04:18 +00:00
|
|
|
https://github.com/tjo-space/tjo-space-infrastructure.git .
|
2025-03-05 21:43:20 +00:00
|
|
|
git sparse-checkout set --no-cone /id.tjo.space
|
|
|
|
git checkout
|
|
|
|
else
|
|
|
|
git fetch --depth=1
|
|
|
|
git reset --hard origin/main
|
|
|
|
fi
|
|
|
|
|
2025-03-06 19:10:20 +00:00
|
|
|
echo "=== Installing Dependencies"
|
|
|
|
apt update -y
|
|
|
|
apt install -y \
|
|
|
|
git \
|
|
|
|
podman
|
2025-03-05 21:43:20 +00:00
|
|
|
|
2025-03-06 19:10:20 +00:00
|
|
|
echo "=== Configure Firewall"
|
|
|
|
ufw allow 22/tcp # SSH
|
|
|
|
ufw allow 443/tcp # HTTPS
|
|
|
|
ufw allow 636/tcp # LDAPS
|
|
|
|
ufw enable
|
2025-03-06 19:31:24 +00:00
|
|
|
|
|
|
|
echo "=== Setup Containers"
|
|
|
|
cp -r /id.tjo.space/containers /etc/containers/systemd/
|