Compare commits
3 Commits
v1
...
v202602271
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc28d93662 | ||
|
|
81ce1d277a | ||
|
|
2012894eeb |
@@ -15,7 +15,7 @@ set -euo pipefail
|
|||||||
|
|
||||||
SERVICE_USER="padelnomics_service"
|
SERVICE_USER="padelnomics_service"
|
||||||
REPO_DIR="/opt/padelnomics"
|
REPO_DIR="/opt/padelnomics"
|
||||||
GITLAB_PROJECT="deemanone/padelnomics"
|
GITEA_REPO="ssh://git@git.padelnomics.io:2222/deemanone/padelnomics.git"
|
||||||
UV="/home/${SERVICE_USER}/.local/bin/uv"
|
UV="/home/${SERVICE_USER}/.local/bin/uv"
|
||||||
|
|
||||||
[ "$(id -u)" = "0" ] || { echo "ERROR: Run as root"; exit 1; }
|
[ "$(id -u)" = "0" ] || { echo "ERROR: Run as root"; exit 1; }
|
||||||
@@ -35,7 +35,7 @@ if [ -d "${REPO_DIR}/.git" ]; then
|
|||||||
sudo -u "${SERVICE_USER}" git -C "${REPO_DIR}" fetch --tags --prune-tags origin
|
sudo -u "${SERVICE_USER}" git -C "${REPO_DIR}" fetch --tags --prune-tags origin
|
||||||
else
|
else
|
||||||
sudo -u "${SERVICE_USER}" git clone \
|
sudo -u "${SERVICE_USER}" git clone \
|
||||||
"git@gitlab.com:${GITLAB_PROJECT}.git" "${REPO_DIR}"
|
"${GITEA_REPO}" "${REPO_DIR}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LATEST_TAG=$(sudo -u "${SERVICE_USER}" \
|
LATEST_TAG=$(sudo -u "${SERVICE_USER}" \
|
||||||
|
|||||||
@@ -75,7 +75,8 @@ fi
|
|||||||
|
|
||||||
if [ ! -f "${SSH_DIR}/config" ]; then
|
if [ ! -f "${SSH_DIR}/config" ]; then
|
||||||
cat > "${SSH_DIR}/config" <<EOF
|
cat > "${SSH_DIR}/config" <<EOF
|
||||||
Host gitlab.com
|
Host git.padelnomics.io
|
||||||
|
Port 2222
|
||||||
IdentityFile ${DEPLOY_KEY}
|
IdentityFile ${DEPLOY_KEY}
|
||||||
IdentitiesOnly yes
|
IdentitiesOnly yes
|
||||||
EOF
|
EOF
|
||||||
@@ -83,7 +84,7 @@ EOF
|
|||||||
chmod 600 "${SSH_DIR}/config"
|
chmod 600 "${SSH_DIR}/config"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ssh-keyscan -H gitlab.com >> "${SSH_DIR}/known_hosts" 2>/dev/null
|
ssh-keyscan -H -p 2222 git.padelnomics.io >> "${SSH_DIR}/known_hosts" 2>/dev/null
|
||||||
sort -u "${SSH_DIR}/known_hosts" -o "${SSH_DIR}/known_hosts"
|
sort -u "${SSH_DIR}/known_hosts" -o "${SSH_DIR}/known_hosts"
|
||||||
chown "${SERVICE_USER}:${SERVICE_USER}" "${SSH_DIR}/known_hosts"
|
chown "${SERVICE_USER}:${SERVICE_USER}" "${SSH_DIR}/known_hosts"
|
||||||
chmod 644 "${SSH_DIR}/known_hosts"
|
chmod 644 "${SSH_DIR}/known_hosts"
|
||||||
|
|||||||
Reference in New Issue
Block a user