diff --git a/README.md b/README.md index 00d2a18..50d0976 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/ubuntu-install.sh b/ubuntu-install.sh index fc83ef2..bff6654 100644 --- a/ubuntu-install.sh +++ b/ubuntu-install.sh @@ -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 </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." \ No newline at end of file +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." \ No newline at end of file