Skip to content
Patrick Upson edited this page Aug 21, 2025 · 4 revisions

Digital Twin Ocean (DTO) Viewer Setup Guide

Overview

This guide will help you set up the DTO Viewer for local development or production data access.

Prerequisites

Before you begin, ensure you have:

  • Docker Desktop installed and running
  • PyCharm Professional (for Docker Compose integration)
  • Git
  • Access to environment variables (contact team lead for production values)

Quick Start

  1. Clone the repository:

    git clone https://github.com/dfo-mar-odis/dto.git
    cd dto
  2. Choose your setup:

    • Local Development: Full local environment with database
    • Production Data Access: Connect to production database (for data loading only)

Docker Setup

Understanding the Docker Compose Files

The project includes three Docker Compose configurations:

File Purpose When to Use
docker-compose.yml Production webserver Loading data to production DB
docker-compose-local.yml Local development Testing and development
docker-compose-remote.yml Local development using remote database Used for Loading and testing the remote database

⚠️ Warning: Never modify docker-compose.yml - it's for production use only.

Environment Variables

Create a .env file in the project root with these variables:

# Django Settings
SECRET_KEY=your-secret-key-here
DJANGO_LOG_FILE=error.log
DJANGO_LOG_LEVEL=DEBUG
DJANGO_SETTINGS_MODULE=config.django.local  # or config.django.production

# Database Settings
PGUSER=postgres
PGPASSWORD=postgres
PGDATABASE=postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=postgres

# PostGIS Settings
POSTGIS_ADDR=dto-postgis  # for local, or production address
POSTGIS_PORT=5432

💡 Tip: For local development, you can use the default PostgreSQL values shown above.

PyCharm Setup

See Run Configuration Guide for instructions on:

  • Setting up species thermal data
  • Environment Variable Strings
  • Creating a Pycharm Run/Debug Configuration

Loading Initial Data

See Data Loading Guide for instructions on:

  • Importing MPA polygons
  • Loading GLORYS12V1 temperature data
  • Setting up species thermal data
  • Loading Observation data

Troubleshooting

Common Issues

Docker containers won't start:

  • Ensure Docker Desktop is running
  • Check environment variables are set correctly
  • Review logs: docker-compose logs

Database connection errors:

  • Verify POSTGIS_ADDR matches your setup
  • Check database credentials
  • Ensure database container is running (for local setup)

PyCharm can't find interpreter:

  • Rebuild containers: docker-compose down && docker-compose up --build
  • Invalidate PyCharm caches: File → Invalidate Caches

Next Steps

Getting Help