Skip to content

tshafer/databio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Databiologics Docker Setup

This setup provides a complete Docker environment for the Databiologics project with multiple services:

  • Database: PostgreSQL 15
  • Authentication: Keratin AuthN server
  • Backend: Rails API server
  • UI Modules: Individual React applications for different user interfaces

Prerequisites

  • Docker Desktop installed and running
  • Docker Compose (included with Docker Desktop)
  • Your databiologics-UI and databiologics-api project directories

Quick Start

Initial Setup (First Time Only)

chmod +x setup.sh
./setup.sh /path/to/databiologics-UI /path/to/databiologics-api

Daily Usage

# Start the application (auto-opens browser)
./start.sh

# Stop the application  
./stop.sh

Note: After the initial setup, you can use ./start.sh and ./stop.sh for daily development. Your project paths are automatically saved and reused.

See QUICK_START.md for detailed usage instructions.

For Windows (Command Prompt):

setup.bat C:\path\to\databiologics-UI C:\path\to\databiologics-api

For Windows (PowerShell):

.\setup.ps1 -FrontendPath "C:\path\to\databiologics-UI" -BackendPath "C:\path\to\databiologics-api"

What the Setup Does

  1. Validates Prerequisites: Checks if Docker is installed and running
  2. Validates Paths: Ensures your project directories exist
  3. Creates Project Structure: Sets up symbolic links or copies to your projects
  4. Creates Environment File: Copies env.example to .env for configuration
  5. Builds Containers: Creates Docker images for frontend and backend
  6. Starts Services: Launches all three containers with proper networking

Application URLs & Access

UI Modules (Frontend Applications)

Module URL Purpose Supported User Roles
Impact Dashboard http://localhost:3000 Impact tracking and analytics ✅ Staff, SuperAdmin, InsightsUser
❌ Patient, AccessUser
Super Admin http://localhost:3001 Administrative interface ✅ SuperAdmin, Staff
❌ Patient, AccessUser, InsightsUser
Patient Portal http://localhost:3002 Patient portal ✅ Patient
❌ Staff, SuperAdmin, AccessUser, InsightsUser
Access Management http://localhost:3003 Access management ✅ AccessUser, Staff, SuperAdmin
❌ Patient, InsightsUser

Backend Services

Service URL Purpose
Rails API http://localhost:21003 Main application API
Keratin AuthN (Public) http://localhost:21001 Authentication endpoints
Keratin AuthN (Admin) http://localhost:21002 Admin API for user management

Database & Infrastructure

Service Connection Purpose
PostgreSQL localhost:5432 Main application database
Redis localhost:6379 Caching and session storage

User Credentials

Application Users (Login to UI modules)

User Type Email Password Role Access
Provider [email protected] Secret Staff All modules except Patient
Provider [email protected] Secret Staff All modules except Patient
Provider [email protected] Secret Staff All modules except Patient
Provider [email protected] Secret Staff All modules except Patient
Medical Assistant [email protected] Secret Staff All modules except Patient
Patient [email protected] Secret Patient Patient portal only
Patient [email protected] Secret Patient Patient portal only
Patient [email protected] Secret Patient Patient portal only
Patient [email protected] Secret Patient Patient portal only

Auth-Only Users (API access)

Email Password Purpose
[email protected] DataSecret Development/Testing
[email protected] DataSecret Development/Testing
[email protected] DataSecret Development/Testing
[email protected] DataSecret Development/Testing

System Credentials

Service Username Password Purpose
Keratin AuthN Admin admin admin123 User management
PostgreSQL data_biologics_dev dev Database access
Development Bypass - dataBiologicsDEVteam API bypass token

Container Details

Database Container (databiologics-db)

  • Image: PostgreSQL 15 Alpine
  • Port: 5432
  • Database: data_bio_auth_dev
  • User: data_biologics_dev
  • Password: dev
  • Volume: Persistent data storage

Authentication Container (databiologics-keratin)

  • Image: keratin/authn-server:latest
  • Ports: 21001 (public), 21002 (admin)
  • Purpose: User authentication and session management
  • Database: Uses same PostgreSQL instance

Backend Container (databiologics-backend)

  • Base: Rails application
  • Port: 21003
  • Environment: Development mode
  • Volume: Your API project directory mounted for live updates

UI Module Containers

Container Port Purpose
databiologics-dbio-impact 3000 Impact tracking interface
databiologics-dbio-super-admin 3001 Administrative interface
databiologics-dbio-patient 3002 Patient portal
databiologics-dbio-access 3003 Access management interface

Useful Commands

View Logs

# All services
docker-compose logs -f

# Specific services
docker-compose logs -f dbio-impact
docker-compose logs -f dbio-super-admin
docker-compose logs -f dbio-patient
docker-compose logs -f dbio-access
docker-compose logs -f backend
docker-compose logs -f keratin_auth
docker-compose logs -f db

Container Management

# Stop all services
docker-compose down

# Start specific UI module
docker-compose up -d dbio-super-admin

# Restart a specific service
docker-compose restart dbio-impact

# Rebuild and restart all
docker-compose up --build

# Access container shell
docker-compose exec dbio-super-admin sh
docker-compose exec backend sh
docker-compose exec keratin_auth sh
docker-compose exec db psql -U data_biologics_dev -d data_bio_auth_dev

Database Management

# Connect to main application database
docker-compose exec db psql -U data_biologics_dev -d dbio_primary_dev

# Connect to authentication database
docker-compose exec db psql -U data_biologics_dev -d data_bio_auth_dev

# Backup main database
docker-compose exec db pg_dump -U data_biologics_dev dbio_primary_dev > backup.sql

# Backup auth database
docker-compose exec db pg_dump -U data_biologics_dev data_bio_auth_dev > auth_backup.sql

# Restore database
docker-compose exec -T db psql -U data_biologics_dev -d dbio_primary_dev < backup.sql

Environment Configuration

The setup creates a .env file with default configuration. You can modify this file to change:

  • Database credentials
  • API URLs
  • Port numbers
  • Environment variables

Troubleshooting

Common Issues

  1. Port Already in Use

    • Stop other services using ports 3000, 3001, or 5432
    • Or modify the ports in docker-compose.yml
  2. Permission Denied (Linux/macOS)

    • Make sure the script is executable: chmod +x setup.sh
  3. Docker Not Running

    • Start Docker Desktop
    • Wait for it to fully initialize
  4. Build Failures

    • Check that your project directories contain valid package.json files
    • Ensure all dependencies are properly defined
  5. Container Won't Start

    • Check logs: docker-compose logs [service_name]
    • Verify your project structure and dependencies

Reset Everything

# Stop and remove all containers, networks, and volumes
docker-compose down -v --remove-orphans

# Remove all images
docker-compose down --rmi all

# Start fresh
./setup.sh /path/to/databiologics-UI /path/to/databiologics-api

Development Workflow

  1. Code Changes: Your local files are mounted into containers, so changes are reflected immediately
  2. Dependencies: If you add new dependencies, rebuild the containers:
    docker-compose up --build
  3. Database Changes: The database persists between restarts, but you can reset it by removing the volume

File Structure

databiologics-docker-setup/
├── docker-compose.yml          # Main Docker Compose configuration
├── databiologics-UI/           # Symlink to your UI project
├── databiologics-api/          # Symlink to your API project
├── init-db/                    # Database initialization scripts
│   └── 01-init.sql
├── setup.sh                    # macOS/Linux setup script
├── setup.bat                   # Windows batch setup script
├── setup.ps1                   # Windows PowerShell setup script
├── env.example                 # Environment configuration template
└── README.md                   # This file

Support

If you encounter issues:

  1. Check the troubleshooting section above
  2. Review Docker and Docker Compose logs
  3. Ensure your project directories have the correct structure
  4. Verify all prerequisites are met

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published