Logging enabled, telemetry disabled, waits for Postgres

This commit is contained in:
ncd
2025-12-05 23:06:44 +01:00
parent ab4a753979
commit 7e5e5b4b8d

View File

@@ -46,12 +46,34 @@ podman run -d --name "$POSTGRES_CTR_NAME" --pod "$POD_NAME" \
"$POSTGRES_IMAGE" "$POSTGRES_IMAGE"
echo "Container '$POSTGRES_CTR_NAME' started (rc=$?)" echo "Container '$POSTGRES_CTR_NAME' started (rc=$?)"
# Wait for Postgres to be ready before starting Langflow
# This avoids initial connection-refused errors in Langflow logs
# and ensures DB-backed features (like Global Variables) are
# available as soon as Langflow starts.
echo "Waiting for Postgres to be ready..."
for attempt in $(seq 1 30); do
if podman exec "$POSTGRES_CTR_NAME" pg_isready -U langflow -d langflow >/dev/null 2>&1; then
echo "Postgres is ready."
break
fi
sleep 2
if [ "$attempt" -eq 30 ]; then
echo "ERROR: Postgres did not become ready in time." >&2
exit 1
fi
done
# Langflow container # Langflow container
# In a Podman pod all containers share the same network namespace, # In a Podman pod all containers share the same network namespace,
# so Postgres is reachable via localhost instead of the container name. # so Postgres is reachable via localhost instead of the container name.
podman run -d --name "$LANGFLOW_CTR_NAME" --pod "$POD_NAME" \ podman run -d --name "$LANGFLOW_CTR_NAME" --pod "$POD_NAME" \
-e LANGFLOW_DATABASE_URL=postgresql://langflow:langflow@localhost:5432/langflow \ -e LANGFLOW_DATABASE_URL=postgresql://langflow:langflow@localhost:5432/langflow \
-e LANGFLOW_CONFIG_DIR=/app/langflow \ -e LANGFLOW_CONFIG_DIR=/app/langflow \
-e LANGFLOW_LOG_FILE=/app/langflow/langflow.log \
-e LANGFLOW_LOG_ENV=default \
-e LANGFLOW_PRETTY_LOGS=true \
-e LANGFLOW_LOG_LEVEL=INFO \
-e DO_NOT_TRACK=True \
-v "$LANGFLOW_DATA_DIR:/app/langflow:Z" \ -v "$LANGFLOW_DATA_DIR:/app/langflow:Z" \
"$LANGFLOW_IMAGE" "$LANGFLOW_IMAGE"
echo "Container '$LANGFLOW_CTR_NAME' started (rc=$?)" echo "Container '$LANGFLOW_CTR_NAME' started (rc=$?)"
@@ -62,7 +84,7 @@ podman generate systemd --name --new --files "$POD_NAME"
echo "Generated systemd service files (rc=$?)" echo "Generated systemd service files (rc=$?)"
# Stop & remove live pod and containers # Stop & remove live pod and containers
podman pod stop --ignore --time 30 "$POD_NAME" podman pod stop --ignore --time 15 "$POD_NAME"
podman pod rm -f --ignore "$POD_NAME" podman pod rm -f --ignore "$POD_NAME"
if podman pod exists "$POD_NAME"; then if podman pod exists "$POD_NAME"; then
echo "ERROR: Pod $POD_NAME still exists." >&2 echo "ERROR: Pod $POD_NAME still exists." >&2