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
|
||||
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:
|
||||
name: Final Verification
|
||||
runs-on: ubuntu-latest
|
||||
needs: [deploy-backend, deploy-web, deploy-admin]
|
||||
needs: [deploy-backend, deploy-web]
|
||||
if: always()
|
||||
steps:
|
||||
- name: Setup SSH
|
||||
|
|
|
|||
|
|
@ -44,8 +44,7 @@ export default function LoginPage() {
|
|||
},
|
||||
})
|
||||
|
||||
const handleRequestCode = (e: React.FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault()
|
||||
const handleRequestCode = () => {
|
||||
requestCodeMutation.mutate()
|
||||
}
|
||||
|
||||
|
|
@ -81,7 +80,7 @@ export default function LoginPage() {
|
|||
{step === 'request' ? (
|
||||
<div className="space-y-4">
|
||||
<Button
|
||||
onClick={() => handleRequestCode({} as React.FormEvent<HTMLFormElement>)}
|
||||
onClick={handleRequestCode}
|
||||
className="w-full"
|
||||
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/claim-code', // Bot endpoint for claiming web codes
|
||||
'/auth/refresh',
|
||||
'/admin/auth/request-code', // Admin login code request (public)
|
||||
'/tests',
|
||||
'/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_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)
|
||||
export SSL_SELF_CERT="/etc/ssl/certs/nginx-selfsigned.crt"
|
||||
export SSL_SELF_KEY="/etc/ssl/private/nginx-selfsigned.key"
|
||||
|
|
|
|||
|
|
@ -43,16 +43,22 @@ ssh "$SERVER_USER@$SERVER_IP" << EOF
|
|||
chown -R $WEB_USER:$WEB_GROUP $WEB_ROOT
|
||||
chmod -R $WEB_PERMISSIONS $WEB_ROOT
|
||||
|
||||
# Check SSL certificate status
|
||||
if [ -d "/etc/letsencrypt/live/admin.mnemo-cards.online" ]; then
|
||||
# Check SSL certificate status and obtain if needed
|
||||
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"
|
||||
else
|
||||
echo "⚠️ SSL certificate not found for admin.mnemo-cards.online"
|
||||
echo " This may cause HTTPS warnings. Certificate should be obtained separately:"
|
||||
echo " sudo certbot certonly --standalone -d admin.mnemo-cards.online --email $LETSENCRYPT_EMAIL --agree-tos"
|
||||
echo " Note: This requires stopping nginx temporarily"
|
||||
echo "🔐 Attempting to obtain Let's Encrypt certificate..."
|
||||
|
||||
# Generate self-signed certificate as fallback for immediate functionality
|
||||
# Try to obtain certificate automatically
|
||||
if [ -f "/root/mnemo_cards/tools/ssl/renew_admin_ssl.sh" ]; then
|
||||
if bash /root/mnemo_cards/tools/ssl/renew_admin_ssl.sh; then
|
||||
echo "✅ SSL certificate obtained successfully!"
|
||||
else
|
||||
echo "❌ Failed to obtain SSL certificate automatically"
|
||||
echo " Falling back to self-signed certificate..."
|
||||
|
||||
# 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 \
|
||||
|
|
@ -60,6 +66,13 @@ ssh "$SERVER_USER@$SERVER_IP" << EOF
|
|||
-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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue