Update for multi-domain deployment alongside existing apps
This commit is contained in:
1 parent
b51b5e8d29
commit
5814f76b28
2 files changed
+30
-23
No files matched your search
@@ -116,39 +116,43 @@ Users can choose their preferred login method on the login page.
|
|||||||
|
|
||||||
## Production Deployment
|
## 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**:
|
1. **Run the automated installation script**:
|
||||||
```bash
|
```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
|
wget https://gitlab.com/trbc-dev/pdf-rename-sort/-/raw/main/ubuntu-install.sh
|
||||||
chmod +x ubuntu-install.sh
|
chmod +x ubuntu-install.sh
|
||||||
sudo ./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:
|
Edit `/etc/systemd/system/pdf-renamer.service` and update:
|
||||||
- `SECRET_KEY`: Generate a secure random key
|
- `SECRET_KEY`: Generate a secure random key
|
||||||
- `TENANT_ID`, `CLIENT_ID`, `CLIENT_SECRET`: From Azure AD app registration
|
- `TENANT_ID`, `CLIENT_ID`, `CLIENT_SECRET`: From Azure AD app registration
|
||||||
- `ADMIN_USERNAME` and `ADMIN_PASSWORD`: Set secure credentials
|
- `ADMIN_USERNAME` and `ADMIN_PASSWORD`: Set secure credentials
|
||||||
|
|
||||||
3. **Update domain configuration**:
|
4. **Update domain configuration**:
|
||||||
Edit `/etc/nginx/sites-available/pdf-renamer` and replace `your-domain.com` with your actual domain
|
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
|
```bash
|
||||||
sudo apt install certbot python3-certbot-nginx
|
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
|
```bash
|
||||||
sudo systemctl daemon-reload
|
sudo systemctl daemon-reload
|
||||||
sudo systemctl restart pdf-renamer
|
sudo systemctl restart pdf-renamer
|
||||||
sudo systemctl reload nginx
|
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
|
## Development
|
||||||
|
|
||||||
|
|||||||
+17
-14
@@ -67,12 +67,12 @@ sudo systemctl daemon-reload
|
|||||||
sudo systemctl enable pdf-renamer
|
sudo systemctl enable pdf-renamer
|
||||||
sudo systemctl start pdf-renamer
|
sudo systemctl start pdf-renamer
|
||||||
|
|
||||||
# Configure Nginx reverse proxy
|
# Configure Nginx reverse proxy for PDF Renamer (multi-domain setup)
|
||||||
echo "Configuring Nginx reverse proxy..."
|
echo "Configuring Nginx reverse proxy for PDF Renamer..."
|
||||||
sudo tee /etc/nginx/sites-available/pdf-renamer > /dev/null <<EOF
|
sudo tee /etc/nginx/sites-available/pdf-renamer > /dev/null <<EOF
|
||||||
server {
|
server {
|
||||||
listen 80;
|
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)
|
# Handle large file uploads (500MB)
|
||||||
client_max_body_size 500M;
|
client_max_body_size 500M;
|
||||||
@@ -91,7 +91,7 @@ server {
|
|||||||
add_header Cache-Control "public, immutable";
|
add_header Cache-Control "public, immutable";
|
||||||
}
|
}
|
||||||
|
|
||||||
# Proxy to Flask app
|
# Proxy to Flask app on port 3000
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://127.0.0.1:3000;
|
proxy_pass http://127.0.0.1:3000;
|
||||||
proxy_set_header Host \$host;
|
proxy_set_header Host \$host;
|
||||||
@@ -104,10 +104,10 @@ server {
|
|||||||
proxy_set_header Upgrade \$http_upgrade;
|
proxy_set_header Upgrade \$http_upgrade;
|
||||||
proxy_set_header Connection "upgrade";
|
proxy_set_header Connection "upgrade";
|
||||||
|
|
||||||
# Timeout settings
|
# Timeout settings for large files
|
||||||
proxy_connect_timeout 60s;
|
proxy_connect_timeout 60s;
|
||||||
proxy_send_timeout 60s;
|
proxy_send_timeout 300s; # Increased for large uploads
|
||||||
proxy_read_timeout 60s;
|
proxy_read_timeout 300s; # Increased for large uploads
|
||||||
}
|
}
|
||||||
|
|
||||||
# Gzip compression
|
# Gzip compression
|
||||||
@@ -119,11 +119,11 @@ server {
|
|||||||
}
|
}
|
||||||
EOF
|
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
|
sudo ln -s /etc/nginx/sites-available/pdf-renamer /etc/nginx/sites-enabled/ 2>/dev/null || true
|
||||||
|
|
||||||
# Remove default nginx site if it exists
|
# Don't remove default nginx site - let existing apps continue working
|
||||||
sudo rm -f /etc/nginx/sites-enabled/default
|
# sudo rm -f /etc/nginx/sites-enabled/default
|
||||||
|
|
||||||
# Test nginx configuration
|
# Test nginx configuration
|
||||||
echo "Testing 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 "2. Create a new registration or use existing one"
|
||||||
echo "3. Note the Application (client) ID and Directory (tenant) ID"
|
echo "3. Note the Application (client) ID and Directory (tenant) ID"
|
||||||
echo "4. Add a client secret under Certificates & secrets"
|
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 "6. Grant appropriate permissions if needed"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Next steps:"
|
echo "Next steps:"
|
||||||
@@ -158,11 +158,13 @@ echo " - CLIENT_ID: Your Microsoft Entra application ID"
|
|||||||
echo " - CLIENT_SECRET: Your Microsoft Entra client secret"
|
echo " - CLIENT_SECRET: Your Microsoft Entra client secret"
|
||||||
echo " - ADMIN_USERNAME and ADMIN_PASSWORD: Set secure admin credentials"
|
echo " - ADMIN_USERNAME and ADMIN_PASSWORD: Set secure admin credentials"
|
||||||
echo ""
|
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 ""
|
||||||
echo "3. For SSL/HTTPS, install certbot:"
|
echo "3. For SSL/HTTPS, install certbot:"
|
||||||
echo " sudo apt install certbot python3-certbot-nginx"
|
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 ""
|
||||||
echo "4. Reload systemd after updating environment variables:"
|
echo "4. Reload systemd after updating environment variables:"
|
||||||
echo " sudo systemctl daemon-reload"
|
echo " sudo systemctl daemon-reload"
|
||||||
@@ -172,4 +174,5 @@ echo "5. Check service status:"
|
|||||||
echo " sudo systemctl status pdf-renamer"
|
echo " sudo systemctl status pdf-renamer"
|
||||||
echo " sudo systemctl status nginx"
|
echo " sudo systemctl status nginx"
|
||||||
echo ""
|
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."
|
||||||
Reference in new issue
Block a user