Table of Contents
Deployment Checklist - PR Review Utility
📋 Pre-Deployment Checklist
Development Environment
- [ ] All features tested locally
- [ ] No console errors in browser
- [ ] API endpoints returning correct data
- [ ] Export functionality works
- [ ] appsettings.json configured correctly
- [ ] .gitignore in place (credentials not committed)
Code Quality
- [ ] No hardcoded credentials
- [ ] Error handling implemented
- [ ] Logging configured
- [ ] Comments added where needed
- [ ] No debug code left in
🖥️ IIS Deployment
Prerequisites
- [ ] Windows Server with IIS installed
- [ ] .NET 5 Hosting Bundle installed
- Download: https://dotnet.microsoft.com/download/dotnet/5.0
- Run installer:
dotnet-hosting-5.0.x-win.exe - Restart IIS:
iisreset
Step 1: Publish Application
cd PRReviewUtility
dotnet publish -c Release -o ./publish
Verify publish folder contains:
- [ ] PRReviewUtility.dll
- [ ] appsettings.json
- [ ] wwwroot/ folder
- [ ] All dependencies
Step 2: Prepare Server
Create Application Folder
C:\inetpub\wwwroot\PRReviewUtility\Copy Files
- [ ] Copy entire publish folder contents
- [ ] Update appsettings.json with production credentials
- [ ] Set folder permissions (IIS_IUSRS: Read & Execute)
Create App Pool
- [ ] Open IIS Manager
- [ ] Application Pools → Add
- [ ] Name:
PRReviewUtilityPool - [ ] .NET CLR Version: No Managed Code
- [ ] Managed Pipeline Mode: Integrated
- [ ] Start immediately: Yes
Create Website/Application
- [ ] Sites → Add Website/Application
- [ ] Name:
PRReviewUtility - [ ] Application Pool:
PRReviewUtilityPool - [ ] Physical Path:
C:\inetpub\wwwroot\PRReviewUtility - [ ] Binding: HTTP, Port 80 (or your choice)
- [ ] Host name: (optional)
Step 3: Configure IIS
- [ ] Enable Anonymous Authentication
- [ ] Disable Windows Authentication (unless needed)
- [ ] Set Default Document: (none needed for API)
Step 4: Test
http://your-server-ip/
http://your-server-ip/api/pr/test-repo/1
Troubleshooting IIS
- 500.19 Error: Check web.config, verify .NET 5 Hosting Bundle
- 500.30 Error: Check app pool is "No Managed Code"
- 403 Error: Check folder permissions
- 404 Error: Verify physical path is correct
🐧 Linux (Nginx) Deployment
Prerequisites
- [ ] Ubuntu 20.04/22.04 (or similar)
- [ ] .NET 5 Runtime installed
- [ ] Nginx installed
Step 1: Install .NET 5 Runtime
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y aspnetcore-runtime-5.0
Verify:
dotnet --version # Should show 5.0.x
Step 2: Prepare Application
# On development machine
dotnet publish -c Release -o ./publish
# Transfer to server
scp -r ./publish user@server:/var/www/prreview/
Step 3: Configure Application
sudo mkdir -p /var/www/prreview
sudo chown -R www-data:www-data /var/www/prreview
Update appsettings.json:
sudo nano /var/www/prreview/appsettings.json
- [ ] Update BitBucket credentials
- [ ] Set production URLs
Step 4: Create Systemd Service
sudo nano /etc/systemd/system/prreview.service
Content:
[Unit]
Description=PR Review Utility
After=network.target
[Service]
WorkingDirectory=/var/www/prreview
ExecStart=/usr/bin/dotnet /var/www/prreview/PRReviewUtility.dll
Restart=always
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=prreview
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
[Install]
WantedBy=multi-user.target
Enable and Start:
sudo systemctl enable prreview
sudo systemctl start prreview
sudo systemctl status prreview # Check it's running
Step 5: Configure Nginx
sudo nano /etc/nginx/sites-available/prreview
Content:
server {
listen 80;
server_name prreview.yourdomain.com; # Or your IP
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Enable Site:
sudo ln -s /etc/nginx/sites-available/prreview /etc/nginx/sites-enabled/
sudo nginx -t # Test configuration
sudo systemctl reload nginx
Step 6: Configure Firewall
sudo ufw allow 'Nginx Full'
sudo ufw enable
Step 7: Test
http://your-server-ip/
http://your-server-ip/api/pr/test-repo/1
Troubleshooting Linux
- Service won't start: Check logs with
journalctl -u prreview -f - 502 Bad Gateway: Verify service is running on port 5000
- Permission errors: Check file ownership:
chown -R www-data:www-data /var/www/prreview
💻 Local Development Deployment
Windows
cd PRReviewUtility
dotnet run
Access: http://localhost:5000
macOS/Linux
cd PRReviewUtility
dotnet run
Access: http://localhost:5000
Docker (Optional)
Create Dockerfile:
FROM mcr.microsoft.com/dotnet/aspnet:5.0
WORKDIR /app
COPY ./publish .
EXPOSE 5000
ENV ASPNETCORE_URLS=http://+:5000
ENTRYPOINT ["dotnet", "PRReviewUtility.dll"]
Build and Run:
dotnet publish -c Release -o ./publish
docker build -t prreview .
docker run -p 5000:5000 prreview
🔐 Security Checklist
Before Going Live
- [ ] Credentials: Never commit appsettings.json with real credentials
- [ ] HTTPS: Enable SSL/TLS in production
- IIS: Configure SSL certificate
- Nginx: Use Let's Encrypt
- [ ] Authentication: Add auth if exposing publicly
- [ ] CORS: Restrict allowed origins if needed
- [ ] Rate Limiting: Consider adding if public-facing
- [ ] Logging: Configure logging for production
- [ ] Error Pages: Don't expose stack traces in production
appsettings.Production.json
Create separate production config:
{
"Logging": {
"LogLevel": {
"Default": "Warning",
"Microsoft": "Warning"
}
},
"BitBucket": {
"BaseUrl": "https://api.bitbucket.org/2.0",
"Workspace": "prod-workspace",
"Username": "prod-user",
"AppPassword": "prod-token"
}
}
📊 Post-Deployment Checklist
Verification Steps
- [ ] Open application URL in browser
- [ ] Test fetching a PR
- [ ] Verify diff displays correctly
- [ ] Test export functionality
- [ ] Check error handling
- [ ] Monitor logs for errors
- [ ] Test from different devices/networks
- [ ] Verify performance (response times)
Monitoring
- [ ] Set up application logging
- [ ] Monitor server resources (CPU, RAM)
- [ ] Track API response times
- [ ] Set up alerts for errors
Documentation
- [ ] Document production URLs
- [ ] Save deployment procedures
- [ ] Document troubleshooting steps
- [ ] Record any customizations
🔄 Update/Rollback Procedures
Deploying Updates
Test Locally
dotnet build dotnet testPublish New Version
dotnet publish -c Release -o ./publish-v2Backup Current Version
# IIS xcopy C:\inetpub\wwwroot\PRReviewUtility C:\backups\prreview-backup /E /I # Linux sudo cp -r /var/www/prreview /var/www/prreview-backupDeploy Update
- Stop service/app pool
- Replace files
- Start service/app pool
Rollback Procedure
# IIS
# Stop app pool, restore from backup, start app pool
# Linux
sudo systemctl stop prreview
sudo rm -rf /var/www/prreview
sudo mv /var/www/prreview-backup /var/www/prreview
sudo systemctl start prreview
🎯 Environment-Specific Settings
Development
{
"Logging": { "LogLevel": { "Default": "Debug" } },
"DetailedErrors": true
}
Staging
{
"Logging": { "LogLevel": { "Default": "Information" } },
"DetailedErrors": true
}
Production
{
"Logging": { "LogLevel": { "Default": "Warning" } },
"DetailedErrors": false
}
✅ Final Checklist
Before marking deployment as complete:
- [ ] Application accessible from expected URL
- [ ] All features working as expected
- [ ] No errors in logs
- [ ] Performance acceptable
- [ ] Security measures in place
- [ ] Backup created
- [ ] Documentation updated
- [ ] Team notified
- [ ] Rollback plan tested
📞 Support Contacts
Application Issues:
- Developer: _______________
- Repository: _______________
Infrastructure Issues:
- IT Support: _______________
- Server Admin: _______________
BitBucket Issues:
- BitBucket Admin: _______________
- Workspace Owner: _______________
📝 Deployment Log Template
Deployment Date: _______________
Deployed By: _______________
Version: 1.0.0 (Phase 1)
Environment: [ ] Dev [ ] Staging [ ] Production
Server: _______________
Pre-Deployment Checks:
[ ] Tests passed
[ ] Code reviewed
[ ] Backup created
Deployment Steps:
[ ] Published application
[ ] Copied files to server
[ ] Updated configuration
[ ] Restarted service
Post-Deployment Checks:
[ ] Application accessible
[ ] Features working
[ ] No errors in logs
Issues Encountered:
_________________________________
_________________________________
Resolution:
_________________________________
_________________________________
Sign-off: _______________
Good luck with your deployment! 🚀
Need help? Check README.md troubleshooting or create an issue.