Enable Debug Mode in Specify 7

For debugging and development purposes, we have instructions on how to setup a dev version of Specify 7 with Docker– Docker Workflow for Development · specify/specify7 Wiki · GitHub

If you are using a traditional docker-compositions deployment of Specify 7, you can add - SP7_DEBUG=true in the environment section of both the specify7 and specify7-worker environment sections in the docker-compose.yml file to enable debugging. This is the easier method and provides the same result if you are not modifying any Specify files/code. Once you have made this change, you can compose up the docker containers again and see more verbose errors!

Example of a modified docker-compose.yml from the specify7 repository:

This assumes the following:

  • You are using a local MariaDB installation on the host of the Docker container.
  • Your Master User credentials are root for the username and password as the password.
    • You should not use root as the master user in production.
  • Your database name is specify in MariaDB.
  • You have cloned the entire specify7 in the current directory.
version: "3.7"
services:
  specify7:
    build:
      context: ./.
      target: run-development
    command: ve/bin/python manage.py runserver 0.0.0.0:8000
    init: true 
    restart: unless-stopped
    depends_on:
      - webpack
    volumes:
      - "specify6:/opt/Specify:ro"
      - "static-files:/volumes/static-files"
      - "./specifyweb:/opt/specify7/specifyweb"
      - "webpack-output:/opt/specify7/specifyweb/frontend/static/js:ro"
    environment:
      - DATABASE_HOST=host.docker.internal
      - DATABASE_PORT=3306
      - DATABASE_NAME=specify
      - MASTER_NAME=root
      - MASTER_PASSWORD=password
      - SECRET_KEY=91023j1023ui091jd90j
      - ASSET_SERVER_URL=http://host.docker.internal/web_asset_store.xml
      - ASSET_SERVER_KEY=assetserv
      - REPORT_RUNNER_HOST=report-runner
      - REPORT_RUNNER_PORT=8080
      - CELERY_BROKER_URL=redis://redis/0
      - CELERY_RESULT_BACKEND=redis://redis/1
      - LOG_LEVEL=WARNING
      - SP7_DEBUG=true

  webpack:
    build:
      context: ./.
      target: build-frontend
    command: npx webpack -w --mode development --color
    restart: unless-stopped
    volumes:
      - "webpack-output:/home/node/dist"
      - "./specifyweb/frontend/js_src/lib:/home/node/lib:ro"
      - "./specifyweb/frontend/js_src/css:/home/node/css:ro"

  specify7-worker:
    build:
      context: ./.
      target: run-development
    command: ve/bin/celery -A specifyweb worker -l INFO --concurrency=1 -Q specify
    init: true
    volumes:
      - "specify6:/opt/Specify:ro"
      - "static-files:/volumes/static-files"
      - "./specifyweb:/opt/specify7/specifyweb"
    environment:
      - DATABASE_HOST=host.docker.internal
      - DATABASE_PORT=3306
      - DATABASE_NAME=specify
      - MASTER_NAME=root
      - MASTER_PASSWORD=password
      - SECRET_KEY=91023j1023ui091jd90j
      - ASSET_SERVER_URL=http://host.docker.internal/web_asset_store.xml
      - ASSET_SERVER_KEY=assetserv
      - REPORT_RUNNER_HOST=report-runner
      - REPORT_RUNNER_PORT=8080
      - CELERY_BROKER_URL=redis://redis/0
      - CELERY_RESULT_BACKEND=redis://redis/1
      - LOG_LEVEL=WARNING
      - SP7_DEBUG=true

  redis:
    image: redis

  asset-server:
    image: specifyconsortium/specify-asset-service
    init: true
    volumes:
      - "attachments:/home/specify/attachments"
    environment:
      - SERVER_NAME=host.docker.internal
      - SERVER_PORT=80
      - ATTACHMENT_KEY=assetserv
      - DEBUG_MODE=false

  specify6:
    image: specifyconsortium/specify6-service:6.8.02
    volumes:
      - "specify6:/volumes/Specify"

  nginx:
    image: nginx
    ports:
      - "80:80"
    volumes:
      - "static-files:/volumes/static-files:ro"
      - "specify6:/volumes/specify6:ro"
      - "webpack-output:/volumes/webpack-output:ro"

      - "./nginx.conf:/etc/nginx/conf.d/default.conf:ro"

  report-runner:
    image: specifyconsortium/report-runner

volumes:
  attachments: # the asset-servers attachment files
  database: # the data directory for mariadb
  specify6: # provides Specify 6 files to Specify 7 and the web server
  static-files: # provides Specify 7 static files to the web server
  webpack-output:

If you use the all-in-one deployment, you can just place the SQL dump file in the /seed-database/ directory and build the docker containers after modifying the docker-compose.yml file. This will automatically place the database into a dockerized MariaDB installation! You can add the debug section in the environments just as described in the previous option and achieve the same effect.

If you need help getting this enabled, please let us know.