It appears that the issue lies with the Specify-7 service being unable to find the database. The error message "Unknown MySQL server host 'mariadb' (-2)"
suggests that the hostname ‘mariadb’ specified in the environment variable DATABASE_HOST
cannot be resolved.
You should start by considering if you need this section:
mariadb:
restart: unless-stopped
image: mariadb
command: --max_allowed_packet=1073741824
ports:
- "${MYSQL_EXTERNAL_PORT}:3306"
volumes:
- "database:/var/lib/mysql"
- "./seed-database:/docker-entrypoint-initdb.d"
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
The image: mariadb
: specifies the Docker image to be used for the MariaDB container. If you are using a MariaDB installation outside of Docker, you can remove this section and the accompanying volume named database
.
Once this is removed, you can set it up a new variable named something like {MYSQL_EXTERNAL_IP}
which would need to be set to the IP of the MariaDB installation.
In the environment
section for both the specify7
and specify7-worker
, you can just set the database host and port to the IP and port of the MariaDB installation.
environment:
- DATABASE_HOST={MYSQL_EXTERNAL_IP}
- DATABASE_PORT={MYSQL_EXTERNAL_PORT}
I recommend referencing the just-specify7
configuration which expects a local installation of MariaDB instead of a Docker one: https://github.com/specify/docker-compositions/blob/production/just-specify7/docker-compose.yml
It also looks like you are using the v7.7
image for both the specify7
and specify7-worker
section. I recommend changing this to v7
so that you can receive the latest releases. Specify 7.7 over one year old and we just launched Specify 7.9.
If you are still encountering issues with the asset server, I recommend commenting out the ASSET_SERVER_URL
and ASSET_SERVER_KEY
just to confirm that Specify is up and running properly without. This will rule out other issues that may be causing a problem.
environment:
- DATABASE_HOST={MYSQL_EXTERNAL_IP}
- DATABASE_PORT={MYSQL_EXTERNAL_PORT}
- DATABASE_NAME=${MYSQL_DATABASE}
- MASTER_NAME=${MYSQL_USER}
- MASTER_PASSWORD=${MYSQL_PASSWORD}
- SECRET_KEY=${SPECIFY_SECRET_KEY}
# - ASSET_SERVER_URL=http://172.17.0.1/web_asset_store.xml
# - ASSET_SERVER_KEY=${ASSET_SERVER_KEY}
Here’s a modified version of your docker-compose.yml
file that may help you resolve the issues you are encountering!
version: '3.7'
services:
specify7:
restart: unless-stopped
image: specifyconsortium/specify7-service:v7
init: true
volumes:
- "specify6:/opt/Specify:ro"
- "static-files:/volumes/static-files"
environment:
- DATABASE_HOST={MYSQL_EXTERNAL_IP}
- DATABASE_PORT={MYSQL_EXTERNAL_PORT}
- DATABASE_NAME=${MYSQL_DATABASE}
- MASTER_NAME=${MYSQL_USER}
- MASTER_PASSWORD=${MYSQL_PASSWORD}
- SECRET_KEY=${SPECIFY_SECRET_KEY}
- ASSET_SERVER_URL=http://172.17.0.1/web_asset_store.xml
- ASSET_SERVER_KEY=${ASSET_SERVER_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
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={MYSQL_EXTERNAL_IP}
- DATABASE_PORT={MYSQL_EXTERNAL_PORT}
- DATABASE_NAME=${MYSQL_DATABASE}
- MASTER_NAME=${MYSQL_USER}
- MASTER_PASSWORD=${MYSQL_PASSWORD}
- SECRET_KEY=${SPECIFY_SECRET_KEY}
- ASSET_SERVER_URL=http://172.17.0.1/web_asset_store.xml
- ASSET_SERVER_KEY=${ASSET_SERVER_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
asset-server:
restart: unless-stopped
image: specifyconsortium/specify-asset-service
init: true
volumes:
- "attachments:/home/specify/attachments"
environment:
- SERVER_NAME=172.17.0.1
- SERVER_PORT=80
- ATTACHMENT_KEY=${ASSET_SERVER_KEY}
- DEBUG_MODE=false
specify6:
image: specifyconsortium/specify6-service:6.8.02
volumes:
- "specify6:/volumes/Specify"
nginx:
restart: unless-stopped
image: nginx
ports:
- "${SPECIFY_EXTERNAL_PORTAL_PORT}: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
specify6: # provides Specify 6 files to Specify 7 and the web server
static-files: # provides Specify 7 static files to the web server