Repository navigation
Expand file tree
/
Copy pathconstants.py
More file actions
71 lines (59 loc) · 2.71 KB
/
Copy pathconstants.py
File metadata and controls
71 lines (59 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from enum import StrEnum
COMPOSE_PROJECT_NAME = "cgr"
COMPOSE_FILENAME = "docker-compose.yaml"
STATE_FILENAME = "state.json"
DOCKER_BIN = "docker"
DOCKER_COMPOSE_SUBCOMMAND = "compose"
DEFAULT_HEALTH_TIMEOUT_S = 60.0
DEFAULT_HEALTH_INTERVAL_S = 1.0
DEFAULT_DOCKER_TIMEOUT_S = 120.0
DEFAULT_STATUS_TIMEOUT_S = 10.0
SERVICE_MEMGRAPH = "memgraph"
SERVICE_QDRANT = "qdrant"
SERVICE_LAB = "lab"
LOOPBACK_HOST = "127.0.0.1"
class StackState(StrEnum):
RUNNING = "running"
PARTIAL = "partial"
STOPPED = "stopped"
UNKNOWN = "unknown"
ERR_DOCKER_NOT_INSTALLED = (
"docker not found on PATH. Install Docker Desktop or the docker CLI."
)
ERR_DOCKER_DAEMON_DOWN = (
"docker is installed but the daemon is not responding. Start Docker and retry."
)
ERR_COMPOSE_NOT_AVAILABLE = "`docker compose` plugin not available. Install Docker Desktop v2+ or the compose plugin."
ERR_STACK_START_FAILED = "Failed to bring stack up: {detail}"
ERR_STACK_STOP_FAILED = "Failed to bring stack down: {detail}"
ERR_STACK_NOT_HEALTHY = (
"Stack started but {service} did not become healthy within {timeout}s."
)
ERR_COMPOSE_FILE_MISSING = "Compose file not found at {path}."
MSG_USING_COMPOSE_FILE = "Using compose file at {path}"
MSG_STARTING_STACK = "Starting cgr stack..."
MSG_STACK_HEALTHY = "Stack is healthy ({memgraph}, {qdrant})."
MSG_STACK_ALREADY_RUNNING = "Stack already running."
MSG_STOPPING_STACK = "Stopping cgr stack..."
MSG_STACK_STOPPED = "Stack stopped."
MSG_RESTARTING_STACK = "Restarting cgr stack..."
MSG_RENDERING_COMPOSE = "Rendering compose file to {path}"
MSG_WAITING_FOR_HEALTH = "Waiting for {service} on {host}:{port}..."
PACKAGE_COMPOSE_RELATIVE = "../docker-compose.yaml"
# The substitution that pins published ports to a host address. Its absence
# marks a compose file rendered before the loopback default (issue #1012).
COMPOSE_BIND_HOST_VAR = "CGR_STACK_BIND_HOST"
WARN_COMPOSE_PORTS_PUBLIC = (
"The compose file at {path} publishes these ports on ALL interfaces, so "
"any host on your network can read the code graph from these "
"unauthenticated services: {mappings}. Run 'cgr daemon down' first, then "
"delete the file and run 'cgr daemon up' to re-render it with the loopback "
"bind, or add a '127.0.0.1:' prefix to each published port listed above "
"and then run 'cgr daemon down' followed by 'cgr daemon up'. Editing the "
"file alone changes nothing either: Docker fixes a container's published "
"ports when it is CREATED, so the running containers keep the old "
"bindings until they are recreated. "
"Deleting the file while the stack is UP changes nothing: the running "
"containers keep the old bindings and 'cgr daemon up' returns early "
"without re-rendering."
)