This commit is contained in:
Dmitry 2025-11-20 01:40:56 +03:00
parent 8d471e8e84
commit cdf6f9aa95
6 changed files with 21 additions and 21 deletions

View file

@ -1,6 +1,6 @@
server { server {
listen 80; listen 80;
server_name memo-cards.online; server_name mnemo-cards.online;
# Redirect HTTP to HTTPS # Redirect HTTP to HTTPS
return 301 https://$server_name$request_uri; return 301 https://$server_name$request_uri;
@ -8,11 +8,11 @@ server {
server { server {
listen 443 ssl http2; listen 443 ssl http2;
server_name memo-cards.online; server_name mnemo-cards.online;
# SSL configuration - Let's Encrypt (preferred) # SSL configuration - Let's Encrypt (preferred)
ssl_certificate /etc/letsencrypt/live/memo-cards.online/fullchain.pem; ssl_certificate /etc/letsencrypt/live/mnemo-cards.online/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/memo-cards.online/privkey.pem; ssl_certificate_key /etc/letsencrypt/live/mnemo-cards.online/privkey.pem;
# Fallback to self-signed certificates if Let's Encrypt fails # Fallback to self-signed certificates if Let's Encrypt fails
# ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt; # ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;

View file

@ -73,7 +73,7 @@ cd web-app
Основные настройки в `web-app/config.sh`: Основные настройки в `web-app/config.sh`:
- `SERVER_IP` - IP сервера (147.45.152.129) - `SERVER_IP` - IP сервера (147.45.152.129)
- `DOMAIN` - домен веб приложения (memo-cards.online) - `DOMAIN` - домен веб приложения (mnemo-cards.online)
- `API_BASE_URL` - URL API (https://api.mnemo-cards.online) [nginx:443 → backend:8081] - `API_BASE_URL` - URL API (https://api.mnemo-cards.online) [nginx:443 → backend:8081]
### SSH доступ ### SSH доступ
@ -102,7 +102,7 @@ cd web-app
## SSL сертификаты ## SSL сертификаты
Автоматически получаются сертификаты Let's Encrypt для: Автоматически получаются сертификаты Let's Encrypt для:
- `memo-cards.online` (web app) - `mnemo-cards.online` (web app)
- `api.mnemo-cards.online` (backend API) - `api.mnemo-cards.online` (backend API)
- `vscode.mnemo-cards.online` (VSCode Server) - `vscode.mnemo-cards.online` (VSCode Server)
- `code.mnemo-cards.online` (Forgejo Git Server) - `code.mnemo-cards.online` (Forgejo Git Server)

View file

@ -20,7 +20,7 @@ deploy/
# Сервер # Сервер
SERVER_IP="147.45.152.129" SERVER_IP="147.45.152.129"
SERVER_USER="root" SERVER_USER="root"
DOMAIN="5492281-cf88967.twc1.net" DOMAIN="mnemo-cards.online"
# Приложение # Приложение
APP_NAME="mnemo_cards" APP_NAME="mnemo_cards"

View file

@ -15,7 +15,7 @@ export SERVER_IP="147.45.152.129"
export SERVER_USER="root" export SERVER_USER="root"
# Domain configuration # Domain configuration
export DOMAIN="memo-cards.online" export DOMAIN="mnemo-cards.online"
# ============================================================================= # =============================================================================
# APPLICATION CONFIGURATION # APPLICATION CONFIGURATION
@ -99,7 +99,7 @@ export WEB_PERMISSIONS="755"
# EMAIL CONFIGURATION (for Let's Encrypt) # EMAIL CONFIGURATION (for Let's Encrypt)
# ============================================================================= # =============================================================================
export LETSENCRYPT_EMAIL="admin@memo-cards.online" export LETSENCRYPT_EMAIL="admin@mnemo-cards.online"
# ============================================================================= # =============================================================================
# FIREWALL CONFIGURATION # FIREWALL CONFIGURATION
@ -113,7 +113,7 @@ export FIREWALL_ALLOW_SSH="ssh"
# ============================================================================= # =============================================================================
export CRON_RENEWAL_TIMES="0 12 * * * 0 0 * * *" export CRON_RENEWAL_TIMES="0 12 * * * 0 0 * * *"
export CRON_RENEWAL_COMMAND="certbot renew --quiet --post-hook \"systemctl reload nginx\" --cert-name memo-cards.online" export CRON_RENEWAL_COMMAND="certbot renew --quiet --post-hook \"systemctl reload nginx\" --cert-name mnemo-cards.online"
export CRON_API_RENEWAL_COMMAND="certbot renew --quiet --cert-name api.mnemo-cards.online" export CRON_API_RENEWAL_COMMAND="certbot renew --quiet --cert-name api.mnemo-cards.online"
export CRON_FORGEJO_RENEWAL_COMMAND="certbot renew --quiet --cert-name code.mnemo-cards.online" export CRON_FORGEJO_RENEWAL_COMMAND="certbot renew --quiet --cert-name code.mnemo-cards.online"

View file

@ -44,13 +44,13 @@ ssh "$SERVER_USER@$SERVER_IP" << EOF
chmod -R $WEB_PERMISSIONS $WEB_ROOT chmod -R $WEB_PERMISSIONS $WEB_ROOT
# Install SSL certificate - try Let's Encrypt first # Install SSL certificate - try Let's Encrypt first
if [ ! -d "/etc/letsencrypt/live/memo-cards.online" ]; then if [ ! -d "/etc/letsencrypt/live/mnemo-cards.online" ]; then
echo "🔐 Attempting to get Let's Encrypt SSL certificate for memo-cards.online..." echo "🔐 Attempting to get Let's Encrypt SSL certificate for mnemo-cards.online..."
# Stop nginx temporarily for certificate issuance # Stop nginx temporarily for certificate issuance
systemctl stop nginx 2>/dev/null || true systemctl stop nginx 2>/dev/null || true
if certbot certonly --standalone -d memo-cards.online --non-interactive --agree-tos --email $LETSENCRYPT_EMAIL; then if certbot certonly --standalone -d mnemo-cards.online --non-interactive --agree-tos --email $LETSENCRYPT_EMAIL; then
echo "✅ Let's Encrypt certificate obtained successfully!" echo "✅ Let's Encrypt certificate obtained successfully!"
else else
echo "❌ Failed to get Let's Encrypt certificate. Generating self-signed certificate..." echo "❌ Failed to get Let's Encrypt certificate. Generating self-signed certificate..."
@ -58,14 +58,14 @@ ssh "$SERVER_USER@$SERVER_IP" << EOF
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \ openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout $SSL_SELF_KEY \ -keyout $SSL_SELF_KEY \
-out $SSL_SELF_CERT \ -out $SSL_SELF_CERT \
-subj "/C=RU/ST=Moscow/L=Moscow/O=MnemoCards/OU=IT/CN=memo-cards.online" -subj "/C=RU/ST=Moscow/L=Moscow/O=MnemoCards/OU=IT/CN=mnemo-cards.online"
fi fi
fi fi
# Start nginx again # Start nginx again
systemctl start nginx 2>/dev/null || true systemctl start nginx 2>/dev/null || true
else else
echo "✅ Let's Encrypt certificate already exists for memo-cards.online" echo "✅ Let's Encrypt certificate already exists for mnemo-cards.online"
fi fi
# Configure nginx # Configure nginx
@ -99,9 +99,9 @@ ssh "$SERVER_USER@$SERVER_IP" << EOF
ufw --force enable ufw --force enable
echo "Deployment completed successfully!" echo "Deployment completed successfully!"
echo "Application is available at: https://memo-cards.online" echo "Application is available at: https://mnemo-cards.online"
EOF EOF
print_success "Deployment completed successfully! 🎉" print_success "Deployment completed successfully! 🎉"
print_success "Your app is now available at: https://memo-cards.online" print_success "Your app is now available at: https://mnemo-cards.online"
print_info "SSL certificate: Let's Encrypt (preferred) or self-signed (fallback)" print_info "SSL certificate: Let's Encrypt (preferred) or self-signed (fallback)"

View file

@ -1,6 +1,6 @@
server { server {
listen 80; listen 80;
server_name memo-cards.online; server_name mnemo-cards.online;
# Redirect HTTP to HTTPS # Redirect HTTP to HTTPS
return 301 https://$server_name$request_uri; return 301 https://$server_name$request_uri;
@ -8,11 +8,11 @@ server {
server { server {
listen 443 ssl http2; listen 443 ssl http2;
server_name memo-cards.online; server_name mnemo-cards.online;
# SSL configuration - Let's Encrypt (preferred) # SSL configuration - Let's Encrypt (preferred)
ssl_certificate /etc/letsencrypt/live/memo-cards.online/fullchain.pem; ssl_certificate /etc/letsencrypt/live/mnemo-cards.online/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/memo-cards.online/privkey.pem; ssl_certificate_key /etc/letsencrypt/live/mnemo-cards.online/privkey.pem;
# Fallback to self-signed certificates if Let's Encrypt fails # Fallback to self-signed certificates if Let's Encrypt fails
# ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt; # ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;