Skip to content

aplbrain/BBQS-EMBER-web

Repository files navigation

EMBER Archive Portal

This repository contains the web application code for the NIH-funded Brain Behavior Quantification and Synchronization (BBQS) Ecosystem for Multi-modal Brain-behavior Experimentation and Research (EMBER) Data Archive. This web application allows users to view information about the program, search projects, and submit data.

Development

Native Development

For native development instructions, please refer to the individual frontend and backend readme files. This is the recommended approach for developers looking to make code contributions or perform debugging.

Docker Development

This is the simplest configuration for developers to get the web application up and running.

Prerequisites

  • Docker & Docker Compose

Environment Setup

  1. Create .env.docker file in BBQS-EMBER-web/backend/config. We will add six variables: DEBUG, DATABASE_URL, DJANGO_SECRET_KEY, POSTGRES_USER, POSTGRES_PASSWORD, and POSTGRES_DB.

  2. Set debug mode to true, by adding DEBUG=True to your .env.docker

  3. Define DATABASE_URL following the pattern: postgres://[user]:[password]@postgres:5432/[dbname]

    • For example, following the steps above, if we defined:

      • user as "ember"
      • password as "test123"
      • and dbname as "ember_db"
      DATABASE_URL=postgres://ember:test123@postgres:5432/ember_db
      
    • Please note that within docker the hostname is the Docker service name "postgres" rather than "localhost"

  4. Define POSTGRES_USER, POSTGRES_PASSWORD, and POSTGRES_DB using the same user, password, and dbname as above.

  5. Run the following to generate a secret key and write it to your .env.docker file:

    uv run python - <<'EOF' >> backend/config/.env.docker
    from django.core.management.utils import get_random_secret_key
    print(f"DJANGO_SECRET_KEY={get_random_secret_key()}")
    EOF
    
  6. A complete .env should look like

    DEBUG=True
    DATABASE_URL=postgres://myusername:mypassword@postgres:5432/mydatabase
    DJANGO_SECRET_KEY=key
    
    POSTGRES_USER=myusername
    POSTGRES_PASSWORD=mypassword
    POSTGRES_DB=mydatabase
    

Initial Setup

  1. Start the frontend, backend, and database containers:

    docker compose -f docker-compose.dev.yml up -d
  2. Apply database migrations

    docker compose -f docker-compose.dev.yml exec backend uv run manage.py migrate
  3. Create a superuser

    docker compose -f docker-compose.dev.yml exec backend uv run manage.py createsuperuser
  4. Load initial data

    docker compose -f docker-compose.dev.yml exec backend uv run manage.py load_initial_projects

Run Application

On subsequent runs, you will only need to run the first command from the initial setup, listed below for quick reference

  1. Start the frontend, backend, and database:

    docker compose -f docker-compose.dev.yml up -d
  2. The frontend should now be running at http://localhost:8080 and the backend at http://localhost:8000.

Contributing

Contibutions are welcome through pull requests. Please notify the BBQS EMBER team for review.

About

BBQS EMBER Archive web app

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors