diff --git a/docker-compose.yml b/docker-compose.yml index 6379dd0..79b01d9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -86,6 +86,58 @@ services: - PYTHONUNBUFFERED=0 - TZ=PST + arches_api: + image: arches_${ARCHES_PROJECT}:latest + restart: unless-stopped + entrypoint: ["../entrypoint.sh"] + build: + context: ${ARCHES_PROJECT_ROOT}. + dockerfile: ${ARCHES_PROJECT_ROOT}./docker/Dockerfile + args: + - ARCHES_PROJECT=$ARCHES_PROJECT + - ARCHES_BASE=$ARCHES_BASE + command: run_api + ports: + - '8001:8000' + volumes: + - arches-log:/arches/arches/logs + - arches-static:/static_root + # $ARCHES_ROOT:/web_root/arches + # $ARCHES_ROOT/docker/gunicorn_config.py:/web_root/arches/gunicorn_config.py + # ./$ARCHES_PROJECT/media/node_modules/arches/docker/gunicorn_config.py:/web_root/arches/arches/gunicorn_config.py + - ${ARCHES_PROJECT_ROOT}.:/web_root/$ARCHES_PROJECT + - ${ARCHES_PROJECT_ROOT}./docker/entrypoint.sh:/web_root/entrypoint.sh + - ${ARCHES_PROJECT_ROOT}./docker/settings_docker.py:/web_root/$ARCHES_PROJECT/$ARCHES_PROJECT/settings_local.py + # ${ARCHES_PROJECT_ROOT}./../arches-orm/arches_orm:/web_root/ENV/lib/python3.10/site-packages/arches_orm + environment: + - ARCHES_PROJECT=$ARCHES_PROJECT + - INSTALL_DEFAULT_GRAPHS=False + - INSTALL_DEFAULT_CONCEPTS=False + - PGUSERNAME=postgres + - PGPASSWORD=postgres + - PGDBNAME=arches + - PGHOST=db + - PGPORT=5432 + - ESHOST=elasticsearch + - ESPORT=9200 + - DJANGO_MODE=DEV + - DJANGO_DEBUG=True + # - DJANGO_REMOTE_DEBUG=False + - DOMAIN_NAMES=localhost + - PYTHONUNBUFFERED=0 + - CELERY_BROKER_URL=amqp://rabbitmq:rabbitmq@rabbitmq + - RABBITMQ_USER=rabbitmq + - RABBITMQ_PASS=rabbitmq + - CANTALOUPE_HOST=cantaloupe + - CANTALOUPE_PORT=8182 + - TZ=PST + depends_on: + - db + - elasticsearch + - rabbitmq + - arches + - cantaloupe + arches_worker: image: arches_${ARCHES_PROJECT}:latest restart: unless-stopped @@ -107,6 +159,7 @@ services: - ${ARCHES_PROJECT_ROOT}.:/web_root/$ARCHES_PROJECT - ${ARCHES_PROJECT_ROOT}./docker/entrypoint.sh:/web_root/entrypoint.sh - ${ARCHES_PROJECT_ROOT}./docker/settings_docker.py:/web_root/$ARCHES_PROJECT/$ARCHES_PROJECT/settings_local.py + # ${ARCHES_PROJECT_ROOT}./../arches-orm/arches_orm:/web_root/ENV/lib/python3.10/site-packages/arches_orm environment: - ARCHES_PROJECT=$ARCHES_PROJECT - INSTALL_DEFAULT_GRAPHS=False diff --git a/entrypoint.sh b/entrypoint.sh index 54d78df..36948ad 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -426,6 +426,20 @@ run_celery_worker() { exec python manage.py celery start } +run_api_server() { + echo "" + echo "" + echo "----- *** RUNNING API SERVER *** -----" + echo "" + cd_app_folder + + if [[ ! -z ${ARCHES_PROJECT} ]]; then + gunicorn ${ARCHES_PROJECT}.asgi:create_app \ + --config ${ARCHES_ROOT}/docker/gunicorn_config.py \ + -k uvicorn.workers.UvicornWorker + fi +} + run_gunicorn_server() { echo "" @@ -515,6 +529,10 @@ do wait_for_db run_arches ;; + run_api) + wait_for_db + run_api_server + ;; run_celery) wait_for_db run_celery_worker