2023-04-27 18:40:25 +00:00
|
|
|
#!/bin/bash
|
|
|
|
cd "$(dirname "$0")" || exit
|
|
|
|
|
2023-04-27 19:02:11 +00:00
|
|
|
# Create the required directories on the host machine if they don't exist
|
|
|
|
[ ! -d "./application/indexes" ] && mkdir -p ./application/indexes
|
|
|
|
[ ! -d "./application/inputs" ] && mkdir -p ./application/inputs
|
|
|
|
[ ! -d "./application/vectors" ] && mkdir -p ./application/vectors
|
|
|
|
|
2023-04-27 18:40:25 +00:00
|
|
|
# Build frontend and backend images
|
|
|
|
docker build -t frontend_image ./frontend
|
|
|
|
docker build -t backend_image ./application
|
|
|
|
|
|
|
|
# Run redis and mongo services
|
|
|
|
docker run -d --name redis -p 6379:6379 redis:6-alpine
|
|
|
|
docker run -d --name mongo -p 27017:27017 -v mongodb_data_container:/data/db mongo:6
|
|
|
|
|
|
|
|
# Run backend and worker services
|
|
|
|
docker run -d --name backend -p 5001:5001 \
|
2023-04-27 19:39:03 +00:00
|
|
|
--link redis:redis --link mongo:mongo \
|
2023-04-27 18:40:25 +00:00
|
|
|
-v $(pwd)/application/indexes:/app/indexes \
|
|
|
|
-v $(pwd)/application/inputs:/app/inputs \
|
|
|
|
-v $(pwd)/application/vectors:/app/vectors \
|
|
|
|
-e API_KEY=$OPENAI_API_KEY \
|
|
|
|
-e EMBEDDINGS_KEY=$OPENAI_API_KEY \
|
2023-04-27 19:39:03 +00:00
|
|
|
-e CELERY_BROKER_URL=redis://redis:6379/0 \
|
|
|
|
-e CELERY_RESULT_BACKEND=redis://redis:6379/1 \
|
|
|
|
-e MONGO_URI=mongodb://mongo:27017/docsgpt \
|
2023-04-27 18:40:25 +00:00
|
|
|
backend_image
|
|
|
|
|
|
|
|
docker run -d --name worker \
|
2023-04-27 19:39:03 +00:00
|
|
|
--link redis:redis --link mongo:mongo \
|
2023-04-27 18:40:25 +00:00
|
|
|
-e API_KEY=$OPENAI_API_KEY \
|
|
|
|
-e EMBEDDINGS_KEY=$OPENAI_API_KEY \
|
2023-04-27 19:39:03 +00:00
|
|
|
-e CELERY_BROKER_URL=redis://redis:6379/0 \
|
|
|
|
-e CELERY_RESULT_BACKEND=redis://redis:6379/1 \
|
|
|
|
-e MONGO_URI=mongodb://mongo:27017/docsgpt \
|
|
|
|
-e API_URL=http://backend:5001 \
|
|
|
|
backend_image \
|
|
|
|
celery -A app.celery worker -l INFO
|
2023-04-27 18:40:25 +00:00
|
|
|
|
|
|
|
# Run frontend service
|
|
|
|
docker run -d --name frontend -p 5173:5173 \
|
|
|
|
-e VITE_API_HOST=http://localhost:5001 \
|
|
|
|
frontend_image
|
|
|
|
|