2020-12-05 15:46:40 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
# Update the package repositories
|
|
|
|
|
pacman -Syu --noconfirm
|
|
|
|
|
|
|
|
|
|
# Force the locale
|
|
|
|
|
echo "LC_ALL=en_GB.UTF-8" >> /etc/default/locale
|
|
|
|
|
locale-gen en_US.UTF-8
|
|
|
|
|
|
|
|
|
|
# Install necessary packages
|
|
|
|
|
pacman -S --needed --noconfirm sudo wget tmux htop vim docker docker-compose
|
|
|
|
|
|
|
|
|
|
# Set the hostname
|
|
|
|
|
echo "scarif.space" >> /etc/hostname
|
|
|
|
|
|
|
|
|
|
# Add me as a user and git for SSH passthrough to gitea (change passwords after finishing)
|
|
|
|
|
useradd -m -psecret chris
|
|
|
|
|
useradd -m -psecret -u1200 git
|
|
|
|
|
|
|
|
|
|
# Make files necessary for SSH passthrough (https://docs.gitea.io/en-us/install-with-docker/#ssh-container-passthrough)
|
|
|
|
|
#mkdir -p /var/lib/gitea
|
|
|
|
|
mkdir -p /app/gitea
|
|
|
|
|
tee /app/gitea/gitea <<END
|
|
|
|
|
#!/bin/sh
|
|
|
|
|
ssh -p 2222 -o StrictHostKeyChecking=no git@127.0.0.1 "SSH_ORIGINAL_COMMAND=\\"\$SSH_ORIGINAL_COMMAND\\" \$0 \$@"
|
|
|
|
|
END
|
|
|
|
|
|
|
|
|
|
chmod +x /app/gitea/gitea
|
|
|
|
|
|
|
|
|
|
chown -R git /app/gitea/gitea
|
|
|
|
|
chown -R git /var/lib/gitea
|
|
|
|
|
rm -f /home/git/.ssh/*
|
|
|
|
|
|
|
|
|
|
sudo -u git ssh-keygen -t rsa -b 4096 -C "Gitea Host Key" -f/home/git/.ssh/id_rsa -q -N ""
|
|
|
|
|
|
|
|
|
|
sudo -u git touch /home/git/.ssh/authorized_keys
|
|
|
|
|
echo "no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty $(cat /home/git/.ssh/id_rsa.pub)" >> /home/git/.ssh/authorized_keys
|
|
|
|
|
|
|
|
|
|
# Start the docker service and build docker compose
|
|
|
|
|
systemctl enable docker --now
|
|
|
|
|
|
|
|
|
|
docker-compose -f "/opt/scarif/docker-compose.yml" --env-file "/opt/scarif/.env" up -d
|
2020-12-13 16:37:09 +00:00
|
|
|
|
|
|
|
|
docker exec -it scarif_pinry_1 python manage.py createsuperuser --settings=pinry.settings.docker
|