Compare commits
25 Commits
0594026785
...
feature/te
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
70bde90792 | ||
|
|
f7e691a24c | ||
|
|
1b4adde2bb | ||
|
|
9217a71d5a | ||
|
|
de11388a77 | ||
|
|
9ab5fb67a6 | ||
|
|
699caf348b | ||
|
|
9abdf38a8a | ||
|
|
0183f4d027 | ||
|
|
9d2cb407ff | ||
|
|
63ee007a48 | ||
|
|
adf6e3a5b2 | ||
|
|
936ff29f56 | ||
|
|
5589ebc7b7 | ||
| 929b9b3090 | |||
| 899bc2be76 | |||
| 6a3608fe1f | |||
|
|
c08f8a4cfe | ||
|
|
542b62eaf2 | ||
|
|
60131da7a0 | ||
|
|
d08fdbbf64 | ||
|
|
81f852669c | ||
|
|
acbda1e8e1 | ||
|
|
18882365a0 | ||
| 5c4de4eeb1 |
@@ -6,22 +6,31 @@ on:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: [ mainhost, docker ]
|
||||
concurrency:
|
||||
group: deploy-stellaamor
|
||||
cancel-in-progress: false
|
||||
|
||||
runs-on: [ mainhost ] # must match your runner label (e.g. mainhost:host)
|
||||
env:
|
||||
SSH_HOST: ${{ secrets.SSH_HOST }}
|
||||
SSH_USER: ${{ secrets.SSH_USER }}
|
||||
SSH_KEY: ${{ secrets.SSH_KEY }}
|
||||
SSH_KNOWN_HOSTS: ${{ secrets.SSH_KNOWN_HOSTS }}
|
||||
SSH_OPTS: >-
|
||||
-F /dev/null
|
||||
-o IdentitiesOnly=yes
|
||||
-o IdentityAgent=none
|
||||
-o PreferredAuthentications=publickey
|
||||
-o PubkeyAuthentication=yes
|
||||
-o PasswordAuthentication=no
|
||||
-o NumberOfPasswordPrompts=0
|
||||
-o BatchMode=yes
|
||||
-o ServerAliveInterval=15
|
||||
-o ServerAliveCountMax=3
|
||||
-o ConnectTimeout=20
|
||||
-o StrictHostKeyChecking=no
|
||||
|
||||
APP_ROOT: /var/www/stellaamor
|
||||
UPLOADS_DIR: uploads
|
||||
KEEP_N: "5"
|
||||
HEALTH_URL: https://stellaamor.com/
|
||||
SERVICE_RELOAD: "systemctl reload apache2 || true"
|
||||
SSH_KEY_PATH: /home/gitea-runner/.ssh/id_ed25519
|
||||
|
||||
|
||||
steps:
|
||||
- name: Checkout (pure git)
|
||||
@@ -31,81 +40,41 @@ jobs:
|
||||
git fetch --depth=1 origin "$GITHUB_SHA"
|
||||
git checkout -q "$GITHUB_SHA"
|
||||
|
||||
# Build only if package.json exists — run Node inside a throwaway container
|
||||
- name: Build frontend (if present)
|
||||
if: hashFiles('package.json') != ''
|
||||
run: |
|
||||
docker run --rm -v "$PWD:/app" -w /app node:20 bash -lc "
|
||||
npm ci
|
||||
npm run build
|
||||
"
|
||||
|
||||
- name: Prepare release tarball
|
||||
run: |
|
||||
set -euo pipefail
|
||||
REL="$(date -u +%Y%m%d-%H%M%SZ)-${{ github.sha }}"
|
||||
echo "REL=$REL" >> $GITHUB_ENV
|
||||
mkdir -p release
|
||||
UPLOADS="${{ env.UPLOADS_DIR }}"
|
||||
tar --exclude-vcs --exclude='./node_modules' --exclude="./${UPLOADS}" \
|
||||
-czf "release/${REL}.tar.gz" .
|
||||
|
||||
- name: Write SSH key
|
||||
run: |
|
||||
set -eu
|
||||
install -d -m 700 ~/.ssh
|
||||
printf '%s\n' "${SSH_KEY}" > ~/.ssh/id_ed25519
|
||||
sed -i 's/\r$//' ~/.ssh/id_ed25519
|
||||
chmod 600 ~/.ssh/id_ed25519
|
||||
if [ -n "${SSH_KNOWN_HOSTS}" ]; then
|
||||
printf '%s\n' "${SSH_KNOWN_HOSTS}" > ~/.ssh/known_hosts
|
||||
chmod 644 ~/.ssh/known_hosts
|
||||
else
|
||||
printf 'StrictHostKeyChecking no\n' >> ~/.ssh/config
|
||||
fi
|
||||
- name: SSH smoke test
|
||||
run: ssh $SSH_OPTS -i "$SSH_KEY_PATH" ${SSH_USER}@${SSH_HOST} true
|
||||
|
||||
- name: Upload & activate atomically
|
||||
run: |
|
||||
set -euo pipefail
|
||||
REL="${{ env.REL }}"
|
||||
TAR="release/${REL}.tar.gz"
|
||||
REL="$(date -u +%Y%m%d-%H%M%SZ)-${{ github.sha }}"
|
||||
echo "REL=$REL" >> $GITHUB_ENV
|
||||
TAR="/tmp/${REL}.tar.gz"
|
||||
APP="${{ env.APP_ROOT }}"
|
||||
SHARED="${APP}/shared"
|
||||
RELEASES="${APP}/releases"
|
||||
CUR="${APP}/current"
|
||||
UPLOADS="${{ env.UPLOADS_DIR }}"
|
||||
|
||||
# ensure layout exists
|
||||
ssh -i ~/.ssh/id_ed25519 ${SSH_USER}@${SSH_HOST} "
|
||||
set -e
|
||||
sudo install -d -o ${SSH_USER} -g ${SSH_USER} -m 755 ${RELEASES} ${SHARED} ${SHARED}/${UPLOADS}
|
||||
"
|
||||
tar -czf "$TAR" --exclude-vcs --exclude='./node_modules' --exclude="./${UPLOADS}" --exclude='./release' .
|
||||
mkdir -p release && mv "$TAR" "release/${REL}.tar.gz"
|
||||
|
||||
# upload tar
|
||||
scp -i ~/.ssh/id_ed25519 ${TAR} ${SSH_USER}@${SSH_HOST}:/tmp/${REL}.tar.gz
|
||||
ssh $SSH_OPTS -i "$SSH_KEY_PATH" ${SSH_USER}@${SSH_HOST} \
|
||||
"set -e; install -d -m 755 ${RELEASES} ${SHARED} ${SHARED}/${UPLOADS}"
|
||||
|
||||
# unpack, link shared, flip symlink, reload, health check, prune
|
||||
ssh -i ~/.ssh/id_ed25519 ${SSH_USER}@${SSH_HOST} '
|
||||
scp -O $SSH_OPTS -vvv -i "$SSH_KEY_PATH" "release/${REL}.tar.gz" ${SSH_USER}@${SSH_HOST}:/tmp/${REL}.tar.gz
|
||||
|
||||
ssh $SSH_OPTS -i "$SSH_KEY_PATH" ${SSH_USER}@${SSH_HOST} '
|
||||
set -euo pipefail
|
||||
REL="'${REL}'"; APP="'${APP}'"; SHARED="'${SHARED}'"; RELEASES="'${RELEASES}'"; CUR="'${CUR}'"; UPLOADS="'${UPLOADS}'";
|
||||
|
||||
NEW="${RELEASES}/${REL}"
|
||||
mkdir -p "${NEW}"
|
||||
tar -xzf "/tmp/${REL}.tar.gz" -C "${NEW}"
|
||||
rm -f "/tmp/${REL}.tar.gz"
|
||||
|
||||
rm -rf "${NEW}/${UPLOADS}"
|
||||
ln -s "${SHARED}/${UPLOADS}" "${NEW}/${UPLOADS}"
|
||||
|
||||
if [ -f "${SHARED}/.env" ]; then ln -sf "${SHARED}/.env" "${NEW}/.env"; fi
|
||||
|
||||
tar -xzf "/tmp/${REL}.tar.gz" -C "${NEW}" && rm -f "/tmp/${REL}.tar.gz"
|
||||
rm -rf "${NEW}/${UPLOADS}" && ln -s "${SHARED}/${UPLOADS}" "${NEW}/${UPLOADS}"
|
||||
[ -f "${SHARED}/.env" ] && ln -sf "${SHARED}/.env" "${NEW}/.env" || true
|
||||
printf "sha=%s\nbuilt_at=%s\n" "'${{ github.sha }}'" "$(date -u +%FT%TZ)" > "${NEW}/RELEASE"
|
||||
|
||||
PREV="$(readlink -f "${CUR}" || true)"
|
||||
ln -sfn "${NEW}" "${CUR}"
|
||||
|
||||
'"${{ env.SERVICE_RELOAD }}"' >/dev/null 2>&1 || true
|
||||
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsS --max-time 5 "'"${{ env.HEALTH_URL }}"'" >/dev/null || {
|
||||
echo "Health check failed, rolling back..."
|
||||
@@ -113,7 +82,5 @@ jobs:
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
|
||||
cd "${RELEASES}"
|
||||
ls -1tr | head -n -'${{ env.KEEP_N }}' | xargs -r -I{} rm -rf "{}"
|
||||
cd "${RELEASES}" && ls -1tr | head -n -'${{ env.KEEP_N }}' | xargs -r -I{} rm -rf "{}"
|
||||
'
|
||||
|
||||
47
.gitea/workflows/rollback.yml
Normal file
47
.gitea/workflows/rollback.yml
Normal file
@@ -0,0 +1,47 @@
|
||||
# manual rollback
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
steps:
|
||||
description: "How many releases to roll back (1 = previous)"
|
||||
default: "1"
|
||||
|
||||
jobs:
|
||||
rollback:
|
||||
runs-on: [ mainhost ]
|
||||
env:
|
||||
SSH_HOST: ${{ secrets.SSH_HOST }}
|
||||
SSH_USER: ${{ secrets.SSH_USER }}
|
||||
SSH_KEY_PATH: /home/gitea-runner/.ssh/id_ed25519
|
||||
SSH_OPTS: >-
|
||||
-F /dev/null -o IdentitiesOnly=yes -o IdentityAgent=none
|
||||
-o PreferredAuthentications=publickey -o PubkeyAuthentication=yes
|
||||
-o PasswordAuthentication=no -o NumberOfPasswordPrompts=0 -o BatchMode=yes
|
||||
-o ServerAliveInterval=15 -o ServerAliveCountMax=3 -o ConnectTimeout=20
|
||||
-o StrictHostKeyChecking=no
|
||||
APP_ROOT: /var/www/stellaamor
|
||||
SERVICE_RELOAD: "systemctl reload apache2 || true"
|
||||
|
||||
steps:
|
||||
- name: Roll back symlink to an older release
|
||||
run: |
|
||||
set -euo pipefail
|
||||
APP="${{ env.APP_ROOT }}"
|
||||
RELEASES="${APP}/releases"
|
||||
CUR="${APP}/current"
|
||||
N="${{ github.event.inputs.steps || '1' }}"
|
||||
|
||||
# pick target release (1=previous)
|
||||
TARGET="$(ls -1tr "${RELEASES}" | tail -n +"$((N+1))" | tail -n 1)"
|
||||
if [ -z "${TARGET}" ]; then
|
||||
echo "No release found to roll back to."; exit 1
|
||||
fi
|
||||
echo "Rolling back to: ${TARGET}"
|
||||
|
||||
ssh $SSH_OPTS -i "$SSH_KEY_PATH" ${SSH_USER}@${SSH_HOST} "
|
||||
set -euo pipefail
|
||||
APP='${APP}'; RELEASES='${RELEASES}'; CUR='${CUR}'; TARGET='${TARGET}';
|
||||
[ -d \"\${RELEASES}/\${TARGET}\" ] || { echo 'Target release missing'; exit 1; }
|
||||
ln -sfn \"\${RELEASES}/\${TARGET}\" \"\${CUR}\"
|
||||
${SERVICE_RELOAD} >/dev/null 2>&1 || true
|
||||
"
|
||||
@@ -2,8 +2,6 @@
|
||||
RewriteEngine On
|
||||
RewriteBase /
|
||||
|
||||
RewriteCond %{HTTPS} off
|
||||
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
||||
|
||||
# Add trailing slash to URLs (except files and directories)
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" type="image/x-icon" href="favicon.ico"><title>Stella Amor | Discover Your Dream Date Today</title><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" crossorigin="anonymous"/><link rel="canonical" href="https://stellaamor.com"><link rel="icon" type="image/x-icon" href="favicon.ico"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="description" content="Discover endless possibilities for meaningful connections at Stella Amor, the innovative dating platform designed to cater to every preference. With our comprehensive filtering system, finding your perfect match has never been easier. Explore a diverse community and unlock your path to love and companionship today"><meta property="og:title" content="Stella Amor | Discover Your Dream Date Today"><meta property="og:description" content="Discover endless possibilities for meaningful connections at Stella Amor, the innovative dating platform designed to cater to every preference. With our comprehensive filtering system, finding your perfect match has never been easier. Explore a diverse community and unlock your path to love and companionship today"><meta property="og:image" content="https://api.stellaamor.com/static/logo2.png"><meta property="og:url" content="https://stellaamor.com"><meta property="og:type" content="website"><meta name="twitter:title" content="Stella Amor | Discover Your Dream Date Today"><meta name="twitter:description" content="Discover endless possibilities for meaningful connections at Stella Amor, the innovative dating platform designed to cater to every preference. With our comprehensive filtering system, finding your perfect match has never been easier. Explore a diverse community and unlock your path to love and companionship today"><meta name="twitter:image" content="https://api.stellaamor.com/static/logo2.png"><meta name="twitter:card" content="summary_large_image"><meta name="author" content="Stella Amor"><meta name="keywords" content="Dating"><meta name="robots" content="index,follow"><meta httpequiv="expires" content="0"><meta httpequiv="pragma" content="no-cache"><script defer="defer" src="/js/chunk-vendors.644485be.js"></script><script defer="defer" src="/js/app.eb118890.js"></script><link href="/css/chunk-vendors.0ee1ee54.css" rel="stylesheet"><link href="/css/app.5360f6f2.css" rel="stylesheet"></head><script async src="https://www.googletagmanager.com/gtag/js?id=G-486MZV8H9M"></script><script>window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
//
|
||||
gtag('config', 'G-486MZV8H9M');</script><body><noscript><strong>We're sorry but app doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
|
||||
@@ -5,7 +5,7 @@
|
||||
<div class="inner-row">
|
||||
<div class="text-col">
|
||||
<h1 class="title mb-3">Discover <span class="text-primary">Your Love Story</span> with Stella Amor</h1>
|
||||
<p class="lead mb-1">Join free today with unique date filters for finance, kinks, lifestyle, and beyond. Start exploring now!</p>
|
||||
<p class="lead mb-1">Join free today with unique dating filters for finance, kinks, lifestyle, and much more. Start exploring now!</p>
|
||||
<a href="/register/" class="mb-3 btn btn-dark cta-btn">Sign up today</a>
|
||||
<p class="login-text">Already have an account? <a href="/login/" class="login-link">Login now</a></p>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user