Update for multi-domain deployment alongside existing apps

This commit is contained in:
nmemmert committed 2025-11-06 10:06:30 -05:00
1 parent b51b5e8d29
commit 5814f76b28
2 files changed
+30 -23

No files matched your search

+13 -9
View File
@@ -116,39 +116,43 @@ Users can choose their preferred login method on the login page.
## Production Deployment
For production deployment on Ubuntu with reverse proxy:
For production deployment on Ubuntu with reverse proxy (multi-domain setup):
1. **Run the automated installation script**:
```bash
# On your Ubuntu server
# On your Ubuntu server (can coexist with other apps)
wget https://gitlab.com/trbc-dev/pdf-rename-sort/-/raw/main/ubuntu-install.sh
chmod +x ubuntu-install.sh
sudo ./ubuntu-install.sh
```
2. **Configure environment variables**:
2. **Configure DNS**:
- Point a subdomain (e.g., `pdf-renamer.yourdomain.com`) to your server's IP
- This allows the app to run alongside your existing app on port 5000
3. **Configure environment variables**:
Edit `/etc/systemd/system/pdf-renamer.service` and update:
- `SECRET_KEY`: Generate a secure random key
- `TENANT_ID`, `CLIENT_ID`, `CLIENT_SECRET`: From Azure AD app registration
- `ADMIN_USERNAME` and `ADMIN_PASSWORD`: Set secure credentials
3. **Update domain configuration**:
Edit `/etc/nginx/sites-available/pdf-renamer` and replace `your-domain.com` with your actual domain
4. **Update domain configuration**:
Edit `/etc/nginx/sites-available/pdf-renamer` and replace `pdf-renamer.your-domain.com` with your actual subdomain
4. **Enable SSL (recommended)**:
5. **Enable SSL (recommended)**:
```bash
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d your-domain.com
sudo certbot --nginx -d your-subdomain.yourdomain.com
```
5. **Reload services**:
6. **Reload services**:
```bash
sudo systemctl daemon-reload
sudo systemctl restart pdf-renamer
sudo systemctl reload nginx
```
The application will be accessible at your domain on ports 80 (HTTP) and 443 (HTTPS after SSL setup).
The application will be accessible at your subdomain on ports 80 (HTTP) and 443 (HTTPS after SSL setup), running alongside your existing application.
## Development
+17 -14
View File
@@ -67,12 +67,12 @@ sudo systemctl daemon-reload
sudo systemctl enable pdf-renamer
sudo systemctl start pdf-renamer
# Configure Nginx reverse proxy
echo "Configuring Nginx reverse proxy..."
# Configure Nginx reverse proxy for PDF Renamer (multi-domain setup)
echo "Configuring Nginx reverse proxy for PDF Renamer..."
sudo tee /etc/nginx/sites-available/pdf-renamer > /dev/null <<EOF
server {
listen 80;
server_name your-domain.com www.your-domain.com;
server_name pdf-renamer.your-domain.com; # Change this to your actual subdomain
# Handle large file uploads (500MB)
client_max_body_size 500M;
@@ -91,7 +91,7 @@ server {
add_header Cache-Control "public, immutable";
}
# Proxy to Flask app
# Proxy to Flask app on port 3000
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host \$host;
@@ -104,10 +104,10 @@ server {
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "upgrade";
# Timeout settings
# Timeout settings for large files
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
proxy_send_timeout 300s; # Increased for large uploads
proxy_read_timeout 300s; # Increased for large uploads
}
# Gzip compression
@@ -119,11 +119,11 @@ server {
}
EOF
# Enable the site
# Enable the PDF Renamer site (doesn't remove existing sites)
sudo ln -s /etc/nginx/sites-available/pdf-renamer /etc/nginx/sites-enabled/ 2>/dev/null || true
# Remove default nginx site if it exists
sudo rm -f /etc/nginx/sites-enabled/default
# Don't remove default nginx site - let existing apps continue working
# sudo rm -f /etc/nginx/sites-enabled/default
# Test nginx configuration
echo "Testing Nginx configuration..."
@@ -147,7 +147,7 @@ echo "1. Go to Azure Portal > Microsoft Entra ID > App registrations"
echo "2. Create a new registration or use existing one"
echo "3. Note the Application (client) ID and Directory (tenant) ID"
echo "4. Add a client secret under Certificates & secrets"
echo "5. Add redirect URI: https://your-domain.com/auth/microsoft/callback"
echo "5. Add redirect URI: https://pdf-renamer.your-domain.com/auth/microsoft/callback"
echo "6. Grant appropriate permissions if needed"
echo ""
echo "Next steps:"
@@ -158,11 +158,13 @@ echo " - CLIENT_ID: Your Microsoft Entra application ID"
echo " - CLIENT_SECRET: Your Microsoft Entra client secret"
echo " - ADMIN_USERNAME and ADMIN_PASSWORD: Set secure admin credentials"
echo ""
echo "2. Update the server_name in /etc/nginx/sites-available/pdf-renamer to your actual domain"
echo "2. Update the server_name in /etc/nginx/sites-available/pdf-renamer:"
echo " - Change 'pdf-renamer.your-domain.com' to your actual subdomain"
echo " - Point your DNS for this subdomain to this server's IP"
echo ""
echo "3. For SSL/HTTPS, install certbot:"
echo " sudo apt install certbot python3-certbot-nginx"
echo " sudo certbot --nginx -d your-domain.com"
echo " sudo certbot --nginx -d pdf-renamer.your-domain.com"
echo ""
echo "4. Reload systemd after updating environment variables:"
echo " sudo systemctl daemon-reload"
@@ -172,4 +174,5 @@ echo "5. Check service status:"
echo " sudo systemctl status pdf-renamer"
echo " sudo systemctl status nginx"
echo ""
echo "The application supports ZIP files up to 500MB and will be accessible at your domain name."
echo "NOTE: This setup runs alongside your existing app on port 5000."
echo "The PDF Renamer will be accessible at your subdomain on port 80/443."