feature/remove-fleet #2

Merged
elderbraum merged 16 commits from feature/remove-fleet into main 2025-11-29 23:29:17 +01:00
Showing only changes of commit 21238c5d41 - Show all commits

View File

@@ -1,29 +1 @@
deploy_staging:
stage: deploy
script:
- eval $(ssh-agent -s)
- echo "$SSH_REPO_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh && touch ~/.ssh/known_hosts
- echo "$SSH_STAGING_KNOWN_HOST" >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
# Make a temp folder
- ssh -p22 root@${STAGING_IP} "mkdir -p /var/www/html/${SITE_DIR}_tmp"
# Copy the files from the repo to the temp folder
- rsync -rav -e ssh --exclude='.git/' --exclude='.gitlab-ci.yml' --exclude='gulpfile.js' --delete-excluded ./ root@${STAGING_IP}:/var/www/html/${SITE_DIR}_tmp
# Rename current site into backup
- ssh -p22 root@${STAGING_IP} "mv /var/www/html/${SITE_DIR} /var/www/html/${SITE_DIR}_bak"
# Copy uploads folder to temp
- ssh -p22 root@${STAGING_IP} "cp -rf /var/www/html/${SITE_DIR}_bak/wp-content/uploads /var/www/html/${SITE_DIR}_tmp/wp-content/uploads"
# Make the temp folder the actual site
- ssh -p22 root@${STAGING_IP} "cp -rf /var/www/html/${SITE_DIR}_tmp /var/www/html/${SITE_DIR}"
# Set the ownership and permissions
- ssh -p22 root@${STAGING_IP} "find /var/www/html/${SITE_DIR} -type f -exec chmod 644 {} \;"
- ssh -p22 root@${STAGING_IP} "find /var/www/html/${SITE_DIR} -type d -exec chmod 755 {} \;"
- ssh -p22 root@${STAGING_IP} "chown -R www-data:www-data /var/www/html/${SITE_DIR}"
# Remove the old site
- ssh -p22 root@${STAGING_IP} "rm -rf /var/www/html/${SITE_DIR}_bak"
# Remove the temp site
- ssh -p22 root@${STAGING_IP} "rm -rf /var/www/html/${SITE_DIR}_tmp"
only:
- staging