Skip to content

Commit

Permalink
feat(api): add an API call
Browse files Browse the repository at this point in the history
  • Loading branch information
philtweir committed Mar 7, 2024
1 parent 16a52ec commit 25e8ff7
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
53 changes: 53 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
18 changes: 18 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 25e8ff7

Please sign in to comment.