feat : optional run backend on host for start_services.sh

This commit is contained in:
martin legrand
2025-05-29 10:51:08 +08:00
committed by Antoine Vivies
parent 819a3fb98d
commit abae98cf77
2 changed files with 34 additions and 26 deletions
+4
View File
@@ -3,6 +3,7 @@ version: '3'
services:
redis:
container_name: redis
profiles: ["core", "full"]
image: docker.io/valkey/valkey:8-alpine
command: valkey-server --save 30 1 --loglevel warning
restart: unless-stopped
@@ -24,6 +25,7 @@ services:
searxng:
container_name: searxng
profiles: ["core", "full"]
image: docker.io/searxng/searxng:latest
restart: unless-stopped
ports:
@@ -51,6 +53,7 @@ services:
frontend:
container_name: frontend
profiles: ["core", "full"]
build:
context: ./frontend
dockerfile: Dockerfile.frontend
@@ -68,6 +71,7 @@ services:
backend:
container_name: backend
profiles: ["backend", "full"]
build:
context: .
dockerfile: Dockerfile.backend
+17 -13
View File
@@ -90,16 +90,16 @@ sleep 4
docker stop $(docker ps -a -q)
echo "All containers stopped"
# First start backend and wait for it to be healthy
echo "Starting backend service..."
if ! $COMPOSE_CMD up -d backend; then
if [ "$1" = "full" ]; then
# First start backend and wait for it to be healthy
echo "Full docker deployement. Starting backend service..."
if ! $COMPOSE_CMD up -d backend; then
echo "Error: Failed to start backend container."
exit 1
fi
# Wait for backend to be healthy (check if it's running and not restarting)
echo "Waiting for backend to be ready..."
for i in {1..30}; do
fi
# Wait for backend to be healthy (check if it's running and not restarting)
echo "Waiting for backend to be ready..."
for i in {1..30}; do
if [ "$(docker inspect -f '{{.State.Running}}' backend)" = "true" ] && \
[ "$(docker inspect -f '{{.State.Restarting}}' backend)" = "false" ]; then
echo "backend is ready!"
@@ -111,13 +111,17 @@ for i in {1..30}; do
exit 1
fi
sleep 1
done
# start remaining services for searxng, redis, frontend services
if ! $COMPOSE_CMD up; then
done
if ! $COMPOSE_CMD --profile full up; then
echo "Error: Failed to start containers. Check Docker logs with '$COMPOSE_CMD logs'."
echo "Possible fixes: Run with sudo or ensure port 8080 is free."
exit 1
fi
else
if ! $COMPOSE_CMD --profile core up; then
echo "Error: Failed to start containers. Check Docker logs with '$COMPOSE_CMD logs'."
echo "Possible fixes: Run with sudo or ensure port 8080 is free."
exit 1
fi
fi
sleep 10