Skip to content

UWA-CITS5206-DMR/deploy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DMR Deployment

This repository contains deployment configurations and scripts for the Digital Medical Records (DMR) system, a web-based simulation platform for medical education at UWA.

System Components

  • Backend: Django REST API (dmrserver)
  • Frontend: React SPA (react-ui)
  • Infrastructure: Docker + nginx

Documentation

We provide two comprehensive deployment guides:

Recommended for most users - Deploy with a single command using the deploy.sh script.

  • Automatic update checking for backend and frontend
  • One-command deployment and updates
  • Built-in database migrations
  • Detailed troubleshooting guide

Quick start:

cp dmrserver.env.example dmrserver.env
nano dmrserver.env  # Edit settings as needed
chmod +x deploy.sh
./deploy.sh

For developers and custom setups - Full control over the deployment process.

  • Step-by-step backend deployment instructions
  • Two frontend deployment options:
    • Download pre-built releases
    • Build from source with npm
  • Comprehensive configuration guide
  • Production deployment checklist

Prerequisites

  • Docker Desktop (version 20.10+)
  • Docker Compose (version 2.0+)
  • Git (version 2.20+)
  • wget (for frontend downloads)

See the documentation guides for detailed requirements.

Quick Start (Automated)

  1. Clone this repository:

    git clone https://github.com/UWA-CITS5206-DMR/deploy
    cd deploy
  2. Configure environment:

    cp dmrserver.env.example dmrserver.env
    nano dmrserver.env  # Edit settings as needed
  3. Run deployment:

    chmod +x deploy.sh
    ./deploy.sh

    The script will automatically:

    • Clone the backend repository (first time only)
    • Download the latest frontend release
    • Build and start Docker containers
    • Run database migrations
    • Verify everything is running
  4. Access the application: http://localhost:8000

Key Files

  • deploy.sh - Automated deployment script
  • compose.yaml - Docker service definitions
  • dmrserver.env.example - Django environment configuration template
  • dmrserver.env - Your environment configuration (created from .example)
  • nginx/ - Web server and reverse proxy configuration
  • react/dist/ - Frontend build output directory

Deploy Script Commands

The deploy.sh script supports multiple commands for different scenarios:

# Check for updates and deploy if available (default)
./deploy.sh
./deploy.sh update

# Force rebuild without checking for updates
./deploy.sh build

# Complete clean rebuild (removes containers and images)
./deploy.sh rebuild

# Check current deployment status
./deploy.sh status

# Show help
./deploy.sh help

Options

  • --force - Skip confirmation prompts
  • --skip-migrations - Skip running database migrations

Examples:

# Force complete rebuild
./deploy.sh rebuild --force

# Build without running migrations
./deploy.sh build --skip-migrations

Maintenance

Check for Updates

./deploy.sh update

The script automatically checks both repositories for updates.

View Logs

# All services
docker compose logs

# Backend only
docker logs dmrserver

# Nginx only
docker logs nginx

Restart Services

docker compose restart

Stop Services

docker compose down

Troubleshooting

For detailed troubleshooting, see the comprehensive TROUBLESHOOTING.md guide.

Common quick fixes:

# Use rebuild command for clean start
./deploy.sh rebuild --force

# Run migrations manually
docker exec dmrserver uv run python manage.py migrate

# Collect static files
docker exec dmrserver uv run python manage.py collectstatic --noinput

# Check status
./deploy.sh status

Production Deployment

For production environments:

  1. Copy and configure environment:

    cp dmrserver.env.example dmrserver.env
    nano dmrserver.env
  2. Update security settings in dmrserver.env:

    • Set DEBUG=False
    • Change SECRET_KEY to a secure random value
    • Restrict ALLOWED_HOSTS to your domain
    • Add CSRF_TRUSTED_ORIGINS with your domain
    • Configure CORS properly
  3. Use HTTPS - Configure SSL certificates and update nginx configuration

  4. Set up backups - Regularly backup dmrserver/data/ directory

  5. Monitor logs - Check log/nginx/ for access and error logs

Getting Help

Related Repositories


Quick Links: Automated Guide | Manual Guide | Backend Repo | Frontend Repo

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages