fix
This commit is contained in:
parent
74164d2749
commit
eda8cfdeaa
7 changed files with 33 additions and 55 deletions
|
|
@ -468,48 +468,10 @@ jobs:
|
||||||
fi
|
fi
|
||||||
ENDSSH
|
ENDSSH
|
||||||
|
|
||||||
deploy-admin:
|
|
||||||
name: Deploy Admin Panel
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: deploy-backend
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Setup Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: '20'
|
|
||||||
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: |
|
|
||||||
apt-get update && apt-get install -y rsync openssh-client
|
|
||||||
|
|
||||||
- name: Setup SSH
|
|
||||||
run: |
|
|
||||||
mkdir -p ~/.ssh
|
|
||||||
echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_rsa
|
|
||||||
chmod 600 ~/.ssh/id_rsa
|
|
||||||
ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
|
|
||||||
|
|
||||||
- name: Build Admin Panel
|
|
||||||
run: |
|
|
||||||
echo "🔨 Building admin panel..."
|
|
||||||
cd mnemo_cards_admin/web
|
|
||||||
npm install
|
|
||||||
npm run build
|
|
||||||
echo "✅ Admin panel built successfully"
|
|
||||||
|
|
||||||
- name: Deploy Admin Panel
|
|
||||||
run: |
|
|
||||||
echo "🚀 Deploying admin panel..."
|
|
||||||
cd tools/deploy/admin
|
|
||||||
./deploy.sh
|
|
||||||
|
|
||||||
final-verification:
|
final-verification:
|
||||||
name: Final Verification
|
name: Final Verification
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [deploy-backend, deploy-web, deploy-admin]
|
needs: [deploy-backend, deploy-web]
|
||||||
if: always()
|
if: always()
|
||||||
steps:
|
steps:
|
||||||
- name: Setup SSH
|
- name: Setup SSH
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,7 @@ export default function LoginPage() {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const handleRequestCode = (e: React.FormEvent<HTMLFormElement>) => {
|
const handleRequestCode = () => {
|
||||||
e.preventDefault()
|
|
||||||
requestCodeMutation.mutate()
|
requestCodeMutation.mutate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -81,7 +80,7 @@ export default function LoginPage() {
|
||||||
{step === 'request' ? (
|
{step === 'request' ? (
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<Button
|
<Button
|
||||||
onClick={() => handleRequestCode({} as React.FormEvent<HTMLFormElement>)}
|
onClick={handleRequestCode}
|
||||||
className="w-full"
|
className="w-full"
|
||||||
disabled={requestCodeMutation.isPending}
|
disabled={requestCodeMutation.isPending}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -9,6 +9,7 @@ const _publicAuthPaths = {
|
||||||
'/auth/telegram/web-code', // Web app endpoint for creating auth codes
|
'/auth/telegram/web-code', // Web app endpoint for creating auth codes
|
||||||
'/auth/telegram/claim-code', // Bot endpoint for claiming web codes
|
'/auth/telegram/claim-code', // Bot endpoint for claiming web codes
|
||||||
'/auth/refresh',
|
'/auth/refresh',
|
||||||
|
'/admin/auth/request-code', // Admin login code request (public)
|
||||||
'/tests',
|
'/tests',
|
||||||
'/test',
|
'/test',
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,9 @@ export API_BASE_URL_DEV="https://api.mnemo-cards.online"
|
||||||
export SSL_CERT_PATH="/etc/letsencrypt/live/$DOMAIN/fullchain.pem"
|
export SSL_CERT_PATH="/etc/letsencrypt/live/$DOMAIN/fullchain.pem"
|
||||||
export SSL_KEY_PATH="/etc/letsencrypt/live/$DOMAIN/privkey.pem"
|
export SSL_KEY_PATH="/etc/letsencrypt/live/$DOMAIN/privkey.pem"
|
||||||
|
|
||||||
|
# SSL certificate renewal script path
|
||||||
|
export SSL_RENEWAL_SCRIPT="/root/mnemo_cards/tools/ssl/renew_admin_ssl.sh"
|
||||||
|
|
||||||
# Self-signed certificate paths (fallback)
|
# Self-signed certificate paths (fallback)
|
||||||
export SSL_SELF_CERT="/etc/ssl/certs/nginx-selfsigned.crt"
|
export SSL_SELF_CERT="/etc/ssl/certs/nginx-selfsigned.crt"
|
||||||
export SSL_SELF_KEY="/etc/ssl/private/nginx-selfsigned.key"
|
export SSL_SELF_KEY="/etc/ssl/private/nginx-selfsigned.key"
|
||||||
|
|
|
||||||
|
|
@ -43,23 +43,36 @@ ssh "$SERVER_USER@$SERVER_IP" << EOF
|
||||||
chown -R $WEB_USER:$WEB_GROUP $WEB_ROOT
|
chown -R $WEB_USER:$WEB_GROUP $WEB_ROOT
|
||||||
chmod -R $WEB_PERMISSIONS $WEB_ROOT
|
chmod -R $WEB_PERMISSIONS $WEB_ROOT
|
||||||
|
|
||||||
# Check SSL certificate status
|
# Check SSL certificate status and obtain if needed
|
||||||
if [ -d "/etc/letsencrypt/live/admin.mnemo-cards.online" ]; then
|
if [ -d "/etc/letsencrypt/live/admin.mnemo-cards.online" ] && [ -f "/etc/letsencrypt/live/admin.mnemo-cards.online/fullchain.pem" ]; then
|
||||||
echo "✅ Let's Encrypt certificate exists for admin.mnemo-cards.online"
|
echo "✅ Let's Encrypt certificate exists for admin.mnemo-cards.online"
|
||||||
else
|
else
|
||||||
echo "⚠️ SSL certificate not found for admin.mnemo-cards.online"
|
echo "⚠️ SSL certificate not found for admin.mnemo-cards.online"
|
||||||
echo " This may cause HTTPS warnings. Certificate should be obtained separately:"
|
echo "🔐 Attempting to obtain Let's Encrypt certificate..."
|
||||||
echo " sudo certbot certonly --standalone -d admin.mnemo-cards.online --email $LETSENCRYPT_EMAIL --agree-tos"
|
|
||||||
echo " Note: This requires stopping nginx temporarily"
|
|
||||||
|
|
||||||
# Generate self-signed certificate as fallback for immediate functionality
|
# Try to obtain certificate automatically
|
||||||
if [ ! -f "$SSL_SELF_CERT" ]; then
|
if [ -f "/root/mnemo_cards/tools/ssl/renew_admin_ssl.sh" ]; then
|
||||||
echo " Generating self-signed certificate as fallback..."
|
if bash /root/mnemo_cards/tools/ssl/renew_admin_ssl.sh; then
|
||||||
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
|
echo "✅ SSL certificate obtained successfully!"
|
||||||
-keyout $SSL_SELF_KEY \
|
else
|
||||||
-out $SSL_SELF_CERT \
|
echo "❌ Failed to obtain SSL certificate automatically"
|
||||||
-subj "/C=RU/ST=Moscow/L=Moscow/O=MnemoCards/OU=Admin/CN=admin.mnemo-cards.online"
|
echo " Falling back to self-signed certificate..."
|
||||||
echo " ✅ Self-signed certificate generated"
|
|
||||||
|
# Generate self-signed certificate as fallback
|
||||||
|
if [ ! -f "$SSL_SELF_CERT" ]; then
|
||||||
|
echo " Generating self-signed certificate as fallback..."
|
||||||
|
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
|
||||||
|
-keyout $SSL_SELF_KEY \
|
||||||
|
-out $SSL_SELF_CERT \
|
||||||
|
-subj "/C=RU/ST=Moscow/L=Moscow/O=MnemoCards/OU=Admin/CN=admin.mnemo-cards.online"
|
||||||
|
echo " ✅ Self-signed certificate generated"
|
||||||
|
echo " ⚠️ WARNING: Using self-signed certificate. HTTPS warnings will appear in browsers."
|
||||||
|
echo " To fix: Run 'bash /root/mnemo_cards/tools/ssl/renew_admin_ssl.sh' manually after deployment"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "❌ SSL renewal script not found!"
|
||||||
|
echo " Falling back to self-signed certificate..."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue