:video_: Install Specify 7 with Docker (macOS & Ubuntu)


Note: The basic elements of this tutorial are shared on all systems!

If you are using Ubuntu, you can follow the same instructions but replace host.docker.internal in the docker-compose.yml file with 172.17.0.1 . This IP acts as the bridge between the docker instance and your host system.

You can use the SpBackupRestore application to make the backup used in this tutorial as an alternative to using the MariaDB/MySQL CLI or a MariaDB/MySQL GUI application.

Downloads

Required:

  • Docker and Docker Engine

  • YML file editor (BBEdit, VIM, nano, etc.)

  • Backup of a Specify database
    (Use CLI, DBeaver, SpBackupRestore, or MySQL Workbench)

    If you do not yet have a copy of a Specify database, you can create one using the Specify Setup Wizard bundled with Specify 6. Once this is created, you can back up the database and follow the tutorial above.

Reccomended:

MariaDB Homebrew Location:

/opt/homebrew/opt/mariadb/bin/mariadb


Example docker-compose.yml file from the video:

version: '3.7'
services:

  mariadb:
    restart: unless-stopped
    image: mariadb:10.11
    command: --max_allowed_packet=1073741824
    volumes:
      - "database:/var/lib/mysql"
      - "./seed-database:/docker-entrypoint-initdb.d"
    environment:
      - MYSQL_ROOT_PASSWORD=root
      - MYSQL_DATABASE=specify
      - MYSQL_USER=master
      - MYSQL_PASSWORD=master

  specify7:
    restart: unless-stopped
    image: specifyconsortium/specify7-service:v7
    init: true
    volumes:
      # - "specify6:/opt/Specify:ro"
      - "static-files:/volumes/static-files"
    environment:
      - DATABASE_HOST=mariadb
      - DATABASE_PORT=3306
      - DATABASE_NAME=specify
      # When running Specify 7 for the first time or during updates that
      # require migrations, ensure that the MASTER_NAME and MASTER_PASSWORD
      # are set to the root username and password. This will ensure proper
      # execution of Django migrations during the initial setup.
      # After launching Specify and verifying the update is complete, you can
      # safely replace these credentials with the master SQL user name and password.
      - MASTER_NAME=master
      - MASTER_PASSWORD=master
      - SECRET_KEY=change this to some unique random string
      - ASSET_SERVER_URL=http://host.docker.internal/web_asset_store.xml
      - ASSET_SERVER_KEY=your asset server access key
      - 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=false
      - SPECIFY_CONFIG_DIR=/opt/specify7/config
      - ALLOWED_HOSTS=*
      - CSRF_TRUSTED_ORIGINS=http://*,https://*

  specify7-worker:
    restart: unless-stopped
    image: specifyconsortium/specify7-service:v7
    command: ve/bin/celery -A specifyweb worker -l INFO --concurrency=1
    init: true
    volumes:
      # - "specify6:/opt/Specify:ro"
      - "static-files:/volumes/static-files"
    environment:
      - DATABASE_HOST=mariadb
      - DATABASE_PORT=3306
      - DATABASE_NAME=specify
      - MASTER_NAME=master
      - MASTER_PASSWORD=master
      - SECRET_KEY=change this to some unique random string
      - ASSET_SERVER_URL=http://host.docker.internal/web_asset_store.xml
      - ASSET_SERVER_KEY=your asset server access key
      - 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=false
      - SPECIFY_CONFIG_DIR=/opt/specify7/config
      - ALLOWED_HOSTS=*
      - CSRF_TRUSTED_ORIGINS=http://*,https://*

  asset-server:
    restart: unless-stopped
    image: specifyconsortium/specify-asset-service
    init: true
    volumes:
      - "attachments:/home/specify/attachments"
    environment:
      - SERVER_NAME=host.docker.internal
      - SERVER_PORT=80
      - ATTACHMENT_KEY=your asset server access key
      - DEBUG_MODE=false

  # specify6:
  #   image: specifyconsortium/specify6-service:6.8.03
  #   volumes:
  #     - "specify6:/volumes/Specify"

  nginx:
    restart: unless-stopped
    image: nginx
    ports:
      - "80:80"
    volumes:
      - "static-files:/volumes/static-files:ro"
      # - "specify6:/volumes/specify6:ro"

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

  report-runner:
    restart: unless-stopped
    image: specifyconsortium/report-runner

  redis:
    restart: unless-stopped
    image: redis:6.0

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

Great written instructions from the community: