Skip to content

Commit

Permalink
feat(docker): add qdrant (#200)
Browse files Browse the repository at this point in the history
* feat(docker): add qdrant

* fix restore on docker monolithic
  • Loading branch information
bytestream authored Aug 27, 2024
1 parent 622b2f7 commit 614184d
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 1 deletion.
2 changes: 2 additions & 0 deletions templates/docker-compose/.env
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ CACHE_VOLUME=supportpal_cache
MAILER_VOLUME=supportpal_mailer
ADDONS_VOLUME=supportpal_addons
MEILISEARCH_VOLUME=supportpal_meilisearch
QDRANT_VOLUME=supportpal_qdrant

# Services
WEB_SERVICE_NAME=supportpal
Expand All @@ -31,6 +32,7 @@ CRON_SERVICE_NAME=supportpal_cron
WS_SERVICE_NAME=supportpal_ws
MQ_SERVICE_NAME=supportpal_mq
MEILISEARCH_SERVICE_NAME=meilisearch
QDRANT_SERVICE_NAME=qdrant

# Misc
APP_VERSION=5.3.1
Expand Down
3 changes: 3 additions & 0 deletions templates/docker-compose/Makefile.dist
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ uninstall: ## Irreversibly uninstall the help desk and all associated data.
$(DOCKER_BIN) volume remove $(CACHE_VOLUME)
$(DOCKER_BIN) volume remove $(MAILER_VOLUME)
$(DOCKER_BIN) volume remove $(ADDONS_VOLUME)
$(DOCKER_BIN) volume remove $(MEILISEARCH_VOLUME)
$(DOCKER_BIN) volume remove $(QDRANT_VOLUME)
rm -rf secrets

.PHONY: create_volumes
Expand All @@ -59,6 +61,7 @@ create_volumes:
$(DOCKER_BIN) volume create --name $(MAILER_VOLUME)
$(DOCKER_BIN) volume create --name $(ADDONS_VOLUME)
$(DOCKER_BIN) volume create --name $(MEILISEARCH_VOLUME)
$(DOCKER_BIN) volume create --name $(QDRANT_VOLUME)

.PHONY: create_secrets
create_secrets:
Expand Down
3 changes: 3 additions & 0 deletions templates/docker-compose/backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ mkdir -p "backup/${TIMESTAMP}/volumes-compose/mailer/" && docker cp "${MAILER_SE
if [[ "$(docker ps -aq -f name="${MEILISEARCH_SERVICE_NAME}")" ]]; then
mkdir -p "backup/${TIMESTAMP}/volumes-compose/meilisearch/" && docker cp "${MEILISEARCH_SERVICE_NAME}:/meili_data" "backup/${TIMESTAMP}/volumes-compose/meilisearch"
fi
if [[ "$(docker ps -aq -f name="${QDRANT_SERVICE_NAME}")" ]]; then
mkdir -p "backup/${TIMESTAMP}/volumes-compose/qdrant/" && docker cp "${QDRANT_SERVICE_NAME}:/qdrant" "backup/${TIMESTAMP}/volumes-compose/qdrant"
fi
docker cp "backup/${TIMESTAMP}/volumes-compose/" "${WEB_SERVICE_NAME}:${TEMP_BACKUP_DIR}/"
rm -rf "backup/${TIMESTAMP}/"

Expand Down
4 changes: 4 additions & 0 deletions templates/docker-compose/docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ services:
env_file:
- .env.custom

qdrant:
env_file:
- .env.custom

volumes:
supportpal_resources:
supportpal_app:
Expand Down
11 changes: 11 additions & 0 deletions templates/docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,14 @@ services:
networks:
- supportpal_backend

qdrant:
container_name: ${QDRANT_SERVICE_NAME}
image: qdrant/qdrant:v1.10.1
volumes:
- supportpal_qdrant:/qdrant
networks:
- supportpal_backend

volumes:
supportpal_db:
external: true
Expand All @@ -163,6 +171,9 @@ volumes:
supportpal_meilisearch:
external: true
name: ${MEILISEARCH_VOLUME}
supportpal_qdrant:
external: true
name: ${QDRANT_VOLUME}

networks:
supportpal_frontend:
Expand Down
5 changes: 4 additions & 1 deletion templates/docker-compose/restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ if echo "${TAR_OUTPUT}" | grep -qs '^volumes-compose/$'; then
docker cp "backup/${TIMESTAMP}/volumes-compose/mailer/exim4/" "${MAILER_SERVICE_NAME}:/var/spool/"
if echo "${TAR_OUTPUT}" | grep -qs '^volumes-compose/meilisearch'; then
docker cp "backup/${TIMESTAMP}/volumes-compose/meilisearch/meili_data" "${MEILISEARCH_SERVICE_NAME}:/"
fi
fi
if echo "${TAR_OUTPUT}" | grep -qs '^volumes-compose/qdrant'; then
docker cp "backup/${TIMESTAMP}/volumes-compose/qdrant/qdrant" "${QDRANT_SERVICE_NAME}:/"
fi
rm -rf "backup/${TIMESTAMP}/"
fi
3 changes: 3 additions & 0 deletions templates/docker-monolithic/backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ docker exec -u root supportpal bash -c "mkdir -p ${TEMP_BACKUP_DIR}/volumes-mono
if docker exec -u root supportpal bash -c "test -d /meilisearch"; then
docker exec -u root supportpal bash -c "mkdir -p ${TEMP_BACKUP_DIR}/volumes-monolithic/meilisearch && cp -r /meilisearch/ ${TEMP_BACKUP_DIR}/volumes-monolithic/meilisearch"
fi
if docker exec -u root supportpal bash -c "test -d /qdrant"; then
docker exec -u root supportpal bash -c "mkdir -p ${TEMP_BACKUP_DIR}/volumes-monolithic/qdrant && cp -r /qdrant/ ${TEMP_BACKUP_DIR}/volumes-monolithic/qdrant"
fi

echo 'Combining backups...'
docker exec -u root supportpal bash -c "cd ${TEMP_BACKUP_DIR} && tar -czf ${APP_BACKUP_NAME} ${FILESYSTEM_BACKUP_NAME} ${DB_FILE_NAME} volumes-monolithic/"
Expand Down
1 change: 1 addition & 0 deletions templates/docker-monolithic/create_volumes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ create_volume supportpal_logs
create_volume supportpal_addons
create_volume supportpal_caddy
create_volume supportpal_meilisearch
create_volume supportpal_qdrant
4 changes: 4 additions & 0 deletions templates/docker-monolithic/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ services:
- supportpal_addons:/var/www/supportpal/addons
- supportpal_caddy:/caddy
- supportpal_meilisearch:/meilisearch
- supportpal_qdrant:/qdrant

volumes:
supportpal_db:
Expand All @@ -45,3 +46,6 @@ volumes:
supportpal_meilisearch:
external: true
name: supportpal_meilisearch
supportpal_qdrant:
external: true
name: supportpal_qdrant
3 changes: 3 additions & 0 deletions templates/docker-monolithic/restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ if echo "${TAR_OUTPUT}" | grep -qs '^volumes-monolithic/$'; then
if echo "${TAR_OUTPUT}" | grep -qs '^volumes-monolithic/meilisearch'; then
docker exec -u root supportpal bash -c "cp -r ${TEMP_BACKUP_DIR}/volumes-monolithic/meilisearch/meilisearch /"
fi
if echo "${TAR_OUTPUT}" | grep -qs '^volumes-monolithic/qdrant'; then
docker exec -u root supportpal bash -c "cp -r ${TEMP_BACKUP_DIR}/volumes-monolithic/qdrant/qdrant /"
fi
rm -rf "backup/${TIMESTAMP}/"
fi

Expand Down

0 comments on commit 614184d

Please sign in to comment.