Skip to content
Open
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
486 commits
Select commit Hold shift + click to select a range
e58512a
docs(quick-start): Add required containerd, Docker CE, CLI, and compo…
junhaoliao Oct 10, 2025
d3b34cf
Revert "Fix enum"
sitaowang1998 Oct 10, 2025
cc9a1f4
refactor(config): Rename type `Host` -> `DomainStr`; Add TODO docstri…
junhaoliao Oct 10, 2025
96ac165
Merge branch 'main' into pydantic-impf
junhaoliao Oct 10, 2025
04929ea
Add custom annotation for serialization
sitaowang1998 Oct 10, 2025
57b2789
Remove field without custom serialization
sitaowang1998 Oct 10, 2025
0b6f43c
Bug fix
sitaowang1998 Oct 10, 2025
d7b40b0
Merge branch 'main' into docker-compose
junhaoliao Oct 10, 2025
06d9c39
Add custom annotation for serialization
sitaowang1998 Oct 10, 2025
43c2295
Remove field without custom serialization
sitaowang1998 Oct 10, 2025
e09d497
Bug fix
sitaowang1998 Oct 10, 2025
8e0f163
Fix lint
sitaowang1998 Oct 10, 2025
37a0a8a
restore verbose logging option to start_clp script.
junhaoliao Oct 10, 2025
4878bd2
Fix merge
sitaowang1998 Oct 10, 2025
cc71ad1
Fix orchestration type
sitaowang1998 Oct 10, 2025
c608e7b
Bug fix
sitaowang1998 Oct 10, 2025
358fe4b
Fix compression scheduler
sitaowang1998 Oct 10, 2025
535b696
Add spider table creation
sitaowang1998 Oct 10, 2025
a405aea
Fix none tag id
sitaowang1998 Oct 10, 2025
7d18129
fix(docker): Move USER and ENV directives after image flattening in c…
junhaoliao Oct 13, 2025
ef046e5
fix(docker): Include `libmariadbcpp.so` (required by `spider_schedule…
junhaoliao Oct 13, 2025
cfa71d8
Make COPY arch-agnostic and include SONAME symlinks
junhaoliao Oct 13, 2025
b193c2f
Merge branch 'main' into fix-clp-package-docker
junhaoliao Oct 13, 2025
f83a4b6
Merge branch 'main' into bundle-mariadb
junhaoliao Oct 14, 2025
3195ef0
feat(docker): Update clp-package Dockerfile; add non-root user and se…
junhaoliao Oct 14, 2025
18a1b18
fix(docker): Reorder and restructure ENV directives in clp-package Do…
junhaoliao Oct 14, 2025
3ef8714
add \
junhaoliao Oct 14, 2025
5a4826f
Merge branch 'main' into spider-job-integration
sitaowang1998 Oct 14, 2025
37b4eda
Merge branch 'docker-compose' into spider-job-integration
sitaowang1998 Oct 14, 2025
3a57db7
Merge branch 'main' into pydantic-enum
sitaowang1998 Oct 14, 2025
e487f82
Fix enum
sitaowang1998 Oct 14, 2025
1b2d4cb
Merge branch 'main' into fix-clp-package-docker
junhaoliao Oct 14, 2025
3cdf245
Merge remote-tracking branch 'origin/main' into docker-compose
junhaoliao Oct 14, 2025
95d900a
refactor(clp-py-utils): Use DEFAULT_PORT for WebUi port configuration.
junhaoliao Oct 14, 2025
f6cbc7f
apply docs suggestions
junhaoliao Oct 15, 2025
5bf0887
refactor(controller): Rename clp_config -> _clp_config for consistent…
junhaoliao Oct 15, 2025
26dfaca
refactor(deployment): Rename Redis environment variables for improved…
junhaoliao Oct 15, 2025
99e983f
Apply suggestions - Reformat multiline statements and remove unnecess…
junhaoliao Oct 15, 2025
0b028dc
Apply suggestions - Rename UID/GID environment variables for improved…
junhaoliao Oct 15, 2025
f11963c
Apply suggestions - Use constants for jobs table names.
junhaoliao Oct 15, 2025
c98ba25
Merge branch 'bundle-mariadb' into spider-job-integration
sitaowang1998 Oct 15, 2025
50dc075
Add spider docker files and the use of them
sitaowang1998 Oct 15, 2025
f55e96c
Merge branch 'pydantic-enum' into spider-job-integration
sitaowang1998 Oct 15, 2025
d993b2e
Merge branch 'docker-compose' into spider-job-integration
sitaowang1998 Oct 15, 2025
2fc6a72
Bug fix
sitaowang1998 Oct 15, 2025
3a6dcd8
Fix private var
sitaowang1998 Oct 15, 2025
8253a1d
Update docker files
sitaowang1998 Oct 15, 2025
b7b4b7c
Fix docker
sitaowang1998 Oct 15, 2025
ad95784
Fix storage url
sitaowang1998 Oct 15, 2025
d79b58e
Fix docker file
sitaowang1998 Oct 15, 2025
91cb9fc
refactor(controller): Remove redundant `stderr` redirection from subp…
junhaoliao Oct 15, 2025
1d57a89
docs: move high-level comments to individual blocks
junhaoliao Oct 15, 2025
f4254fa
docs(controller): reference issue for revisiting worker count logic
junhaoliao Oct 15, 2025
932c334
refactor(controller): add `--wait` flag to `docker compose up` comman…
junhaoliao Oct 15, 2025
a8cee64
refactor(controller): replace `Dict` with a custom `EnvVarsDict` for …
junhaoliao Oct 16, 2025
f0e1740
lint
junhaoliao Oct 16, 2025
6679c2d
use local variable in assignment in _update_settings_object()
junhaoliao Oct 16, 2025
416c31a
refactor(controller): remove redundant try-except blocks around `subp…
junhaoliao Oct 16, 2025
9ab85d2
add warning log for failed Docker dependency check before attempting …
junhaoliao Oct 16, 2025
1345de3
refactor(controller): add explicit return type annotations for all me…
junhaoliao Oct 16, 2025
25c3812
Merge branch 'main' into docker-compose
junhaoliao Oct 16, 2025
3c3e23d
refactor(scripts): move `instance_id` assignment inside `try` block i…
junhaoliao Oct 16, 2025
7c43aad
revert `--config` argument removal in `stop_clp` to allow specifying …
junhaoliao Oct 16, 2025
63c700a
refactor(config): Rename CLP_DEFAULT_ARCHIVE_* -> CLP_DEFAULT_ARCHIVE…
junhaoliao Oct 16, 2025
0f7c78c
apply docs suggestions
junhaoliao Oct 16, 2025
5e07756
docs(clp-package-utils): Update docstrings for clarity and consistency.
junhaoliao Oct 16, 2025
ff4f06c
remove return type from dump_shared_container_config()
junhaoliao Oct 16, 2025
e381c3d
refactor(clp-package-utils): Rename base_config -> component_config i…
junhaoliao Oct 16, 2025
f426c82
Simplify raised error message for missing configuration file: redis
junhaoliao Oct 16, 2025
73ec68f
Apply suggestion - To alphabetize
junhaoliao Oct 16, 2025
4e707ae
Remove individual log file paths and use shared logging volume
junhaoliao Oct 16, 2025
6f53877
fix(controller): revert removal of "ClpQueryEngine" in server_setting…
junhaoliao Oct 16, 2025
e7addd3
refactor(clp-package-utils): Rename CLP_PACKAGE_CONTAINER -> CLP_PACK…
junhaoliao Oct 16, 2025
d4e81f3
fix(docker-compose): use `:?error` syntax to mark required non-empty …
junhaoliao Oct 16, 2025
a5a497d
disallow empty `username` and `password` in `Database` because our db…
junhaoliao Oct 16, 2025
0dd11ce
fix(docker-compose): Update default database image to mariadb:10-jammy.
junhaoliao Oct 16, 2025
d27a0b1
fix(docker-compose): Add stop_grace_period for compression-worker and…
junhaoliao Oct 16, 2025
a6478e6
apply docs suggestions
junhaoliao Oct 16, 2025
7bbd134
refactor(docker-compose): Rename volume_root_logs_readonly -> volume_…
junhaoliao Oct 16, 2025
04e56f0
ensure `healthcheck` goes after `command`
junhaoliao Oct 16, 2025
0fc91d7
fix(docker-compose): Add AWS credentials environment variables in web…
junhaoliao Oct 16, 2025
f307d94
fix(docker-compose): Update environment variables for archive and str…
junhaoliao Oct 16, 2025
e5a90dd
Replace "docker-compose" (usually refer to v1) with "Docker Compose" …
junhaoliao Oct 16, 2025
3015ec4
lint
junhaoliao Oct 16, 2025
ff43c78
refactor(clp-package-utils): Reorder functions and rename is_docker_c…
junhaoliao Oct 16, 2025
699979a
fix(docker-compose): Add mounts for archive and stream output in garb…
junhaoliao Oct 16, 2025
092a86c
refactor(clp-package-utils): Rename _is_docker_compose_running -> _is…
junhaoliao Oct 16, 2025
8d75171
fix(docker-compose): Rename CLP_AWS_ACCESS_KEY_ID -> CLP_STREAM_OUTPU…
junhaoliao Oct 16, 2025
f53339f
fix(docker-compose): Break long volume mount lines for improved reada…
junhaoliao Oct 16, 2025
18d1109
lint
junhaoliao Oct 16, 2025
84c011b
Add main for script
sitaowang1998 Oct 17, 2025
272706f
Bandit solution for column width
sitaowang1998 Oct 17, 2025
234f0f0
Fix docker compose
sitaowang1998 Oct 17, 2025
9d9bd46
refactor(clp-package-utils): Rename should_compose_run -> should_comp…
junhaoliao Oct 18, 2025
225c6c5
Merge branch 'main' into docker-compose
junhaoliao Oct 18, 2025
24db721
Merge branch 'main' into bundle-mariadb
junhaoliao Oct 18, 2025
127aacc
refactor(clp-package-utils): Reorder private functions
junhaoliao Oct 18, 2025
f5ea3e2
Replace EnvironmentError with OSError as per Ruff os-error-alias (UP024)
junhaoliao Oct 18, 2025
22593d8
refactor(general): Improve error handling for Docker and Docker Compose
junhaoliao Oct 18, 2025
bc69b26
refactor(general): Update dump_container_config call to remove return…
junhaoliao Oct 18, 2025
1d2ab61
refactor(docs): Update exception documentation to use 'raise' format
junhaoliao Oct 18, 2025
d4c921a
add missing `f` in f-string
junhaoliao Oct 18, 2025
31b6618
Merge branch 'docker-compose' into spider-job-integration
sitaowang1998 Oct 19, 2025
5bac1ff
Merge branch 'main' into spider-job-integration
sitaowang1998 Oct 19, 2025
e6bb002
Add retention periods check for garbage collector and disable the ser…
junhaoliao Oct 20, 2025
90ee7da
Merge branch 'main' into docker-compose
junhaoliao Oct 20, 2025
61b57b7
Merge branch 'docker-compose' into spider-job-integration
sitaowang1998 Oct 20, 2025
134e959
Fix merge
sitaowang1998 Oct 20, 2025
45b119e
Fix lint
sitaowang1998 Oct 20, 2025
8a8400f
Fix single return type
sitaowang1998 Oct 20, 2025
029b641
Merge branch 'spider-one-task' into spider-job-integration
sitaowang1998 Oct 20, 2025
50037cc
Merge docker file
sitaowang1998 Oct 20, 2025
079ff48
Fix LD_LIBRARY_PATH
sitaowang1998 Oct 20, 2025
2c08c94
Bug fix
sitaowang1998 Oct 20, 2025
812bb25
Use empty tag ids instead of None
sitaowang1998 Oct 20, 2025
46fcb98
Merge branch 'tag-id-none' into spider-job-integration
sitaowang1998 Oct 20, 2025
7ef1c94
Revert None support for tag_ids
sitaowang1998 Oct 20, 2025
6913123
Merge branch 'spider-one-task' into spider-job-integration
sitaowang1998 Oct 20, 2025
e210cea
Fix yaml lint
sitaowang1998 Oct 20, 2025
b19b1ec
Merge remote-tracking branch 'origin/main' into bundle-mariadb
junhaoliao Oct 20, 2025
78a7af3
Merge branch 'main' into fix-clp-package-docker
junhaoliao Oct 20, 2025
b3e673f
fix(docker): Use `--link` flag in COPY command for clp-package Docker…
junhaoliao Oct 20, 2025
65f2d1b
fix(docker): Reorder COPY command in clp-package Dockerfile
junhaoliao Oct 20, 2025
b522212
fix(docker): Add ARG for UID and set ownership in COPY command for cl…
junhaoliao Oct 20, 2025
42fba6c
merge with the latest from #1413
junhaoliao Oct 20, 2025
99d353a
Merge branch 'main' into bundle-mariadb
sitaowang1998 Oct 20, 2025
dba99b7
Merge branch 'main' into fix-clp-package-docker
junhaoliao Oct 21, 2025
8580b7a
Merge branch 'main' into bundle-mariadb
junhaoliao Oct 21, 2025
360cac6
Merge branch 'main' into fix-clp-package-docker
junhaoliao Oct 21, 2025
b0d0bcc
refactor(clp-package-utils): Remove unused `pass` statements from abs…
junhaoliao Oct 21, 2025
955a0ac
refactor(clp-config): Remove unused typing import 'Set'.
junhaoliao Oct 21, 2025
106fdda
apply doc suggestions
junhaoliao Oct 21, 2025
7a1ea6e
refactor(docker-compose): Update environment variable error messages …
junhaoliao Oct 21, 2025
a732939
Adjust volume bindings to fix directory mappings when CLP_STAGED_ARCH…
junhaoliao Oct 21, 2025
c687f78
fix string indents
junhaoliao Oct 21, 2025
19e8a9d
apply doc suggestions
junhaoliao Oct 21, 2025
c53c0f1
apply doc suggestions
junhaoliao Oct 21, 2025
a2fa02c
fix(clp-package-utils): Remove extra space in `.env` file comment.
junhaoliao Oct 21, 2025
05810be
apply doc suggestions
junhaoliao Oct 21, 2025
2a02ecb
apply doc suggestions
junhaoliao Oct 21, 2025
678de80
Update comment for `_get_num_workers` method - apply doc suggestion
junhaoliao Oct 21, 2025
c30adae
Simplify log message for CLP start action - apply suggestion
junhaoliao Oct 21, 2025
07d1e35
Update comments for consistency in `controller.py`.
junhaoliao Oct 21, 2025
0bf6b70
feat(clp-package-utils): Add custom exceptions for Docker dependency …
junhaoliao Oct 21, 2025
913dea3
Merge branch 'main' into fix-clp-package-docker
junhaoliao Oct 21, 2025
2986082
fix(clp-package-utils): Use `docker --version` to check docker availa…
junhaoliao Oct 21, 2025
e499443
Avoid mapping ~/.aws on host when CLP_AWS_CONFIG_DIR_HOST is undefined
junhaoliao Oct 21, 2025
b788c33
alphabetize mounts
junhaoliao Oct 21, 2025
6fc219c
Do not map logs input dir when CLP_LOGS_INPUT_DIR_HOST is undefined
junhaoliao Oct 21, 2025
0926180
lint
junhaoliao Oct 21, 2025
e2daf32
lint
junhaoliao Oct 21, 2025
736c805
Merge remote-tracking branch 'origin/main' into docker-compose
junhaoliao Oct 21, 2025
4956106
fix: Add AWS config directory mount to garbage collector
junhaoliao Oct 21, 2025
91cacb0
fix(clp-package-utils): Add return type annotations to custom excepti…
junhaoliao Oct 21, 2025
3ad7f70
Merge branch 'main' into docker-compose
junhaoliao Oct 21, 2025
8a991cc
Merge branch 'main' into fix-clp-package-docker
junhaoliao Oct 21, 2025
3a99370
Merge branch 'docker-compose' into spider-job-integration
sitaowang1998 Oct 21, 2025
a6598e6
Adapt spider docker file
sitaowang1998 Oct 21, 2025
89f0a1c
Merge branch 'main' into fix-clp-package-docker
sitaowang1998 Oct 21, 2025
2be2d5c
Fix docker file
sitaowang1998 Oct 21, 2025
dda9534
Merge branch 'fix-clp-package-docker' into spider-job-integration
sitaowang1998 Oct 21, 2025
36b0f9a
Fix docker file log env
sitaowang1998 Oct 21, 2025
8a7549a
Merge branch 'bundle-mariadb' into spider-job-integration
sitaowang1998 Oct 21, 2025
6901432
Merge branch 'main' into spider-job-integration
sitaowang1998 Oct 23, 2025
fb8c8e0
Parse spider related config selectively
sitaowang1998 Oct 23, 2025
cd2b8c2
Remove unused doc before merge main
sitaowang1998 Oct 23, 2025
a17b9b2
Update spider docker file
sitaowang1998 Oct 23, 2025
2888b63
Fix docker file
sitaowang1998 Oct 23, 2025
16a8f29
Fix merge
sitaowang1998 Oct 23, 2025
4879aa1
Fix spider docker merge
sitaowang1998 Oct 23, 2025
3a80b30
Merge branch 'main' of github.com:y-scope/clp into spider-job-integra…
sitaowang1998 Oct 23, 2025
bc901fc
Merge branch 'main' into spider-job-integration
sitaowang1998 Oct 24, 2025
fca9019
Merge branch 'main' into spider-job-integration
sitaowang1998 Oct 27, 2025
a587187
Fix merge
sitaowang1998 Oct 28, 2025
c9fbb46
Merge branch 'main' into spider-job-integration
sitaowang1998 Nov 3, 2025
551c309
Use bytes
sitaowang1998 Nov 3, 2025
ac660b2
Update spider library
sitaowang1998 Nov 14, 2025
9909731
Bump spider-py version
sitaowang1998 Nov 14, 2025
ed3ebb8
Merge branch 'main' into spider-job-integration
sitaowang1998 Nov 15, 2025
37e9639
Update mariadb version
sitaowang1998 Nov 15, 2025
2f75a06
Fix merge
sitaowang1998 Nov 15, 2025
999f834
Update lock file
sitaowang1998 Nov 15, 2025
375636b
Fix lint
sitaowang1998 Nov 15, 2025
ecf685d
Remove docker package in doc
sitaowang1998 Nov 15, 2025
dc808fd
Remove used function
sitaowang1998 Nov 15, 2025
b34acf3
Fix docstring
sitaowang1998 Nov 15, 2025
2e820be
Fix valdiator
sitaowang1998 Nov 15, 2025
9bf4c34
Fix clp config spider db check
sitaowang1998 Nov 15, 2025
e054086
Fix exception catching
sitaowang1998 Nov 15, 2025
75412d7
Remove name validation
sitaowang1998 Nov 15, 2025
75cab42
Add error checking for start spider worker script
sitaowang1998 Nov 15, 2025
d618074
Fix fstring
sitaowang1998 Nov 15, 2025
616dd47
Fix clp config
sitaowang1998 Nov 15, 2025
4845e92
Fix lint
sitaowang1998 Nov 15, 2025
e7cb62f
Apply suggestions from code review
sitaowang1998 Nov 18, 2025
bebb2e9
Fix logger name
sitaowang1998 Nov 19, 2025
5b3b0cf
Fix deleted row
sitaowang1998 Nov 19, 2025
c0db520
Use different credential for spider-db
sitaowang1998 Nov 19, 2025
e2a6889
Print error when password is not available
sitaowang1998 Nov 19, 2025
9ff80fa
Rename variable for clarity
sitaowang1998 Nov 19, 2025
2bc5a4f
Check for redis and queue
sitaowang1998 Nov 19, 2025
4ce8b53
Add check for redis and queue
sitaowang1998 Nov 19, 2025
4aab3f1
Add transform for container for spider scheduler
sitaowang1998 Nov 19, 2025
fbfd166
Add domain name
sitaowang1998 Nov 19, 2025
36c2a1e
Use enum
sitaowang1998 Nov 19, 2025
cc89521
Fix error message
sitaowang1998 Nov 19, 2025
a4d069f
Fix error message
sitaowang1998 Nov 19, 2025
62c338c
Apply suggestions from code review
sitaowang1998 Nov 19, 2025
77a8743
Merge branch 'spider-job-integration' of github.com:sitaowang1998/clp…
sitaowang1998 Nov 19, 2025
e786e75
Check concurrency argument
sitaowang1998 Nov 19, 2025
6312bfb
Use logger instead of print
sitaowang1998 Nov 19, 2025
99f1662
Remove unnecessary fix
sitaowang1998 Nov 19, 2025
ee6e5a4
Skip creating spider table if not configured
sitaowang1998 Nov 19, 2025
f1781ac
Use internal network address
sitaowang1998 Nov 19, 2025
7afe76e
Merge branch 'main' into spider-job-integration
sitaowang1998 Nov 19, 2025
0b652d7
Remove override
sitaowang1998 Nov 19, 2025
46a031b
Fix username
sitaowang1998 Nov 19, 2025
bf72451
Fix spider db password
sitaowang1998 Nov 19, 2025
0e9c1bb
Bug fix
sitaowang1998 Nov 20, 2025
3c08754
Pass user and password using env
sitaowang1998 Nov 20, 2025
8eb7e23
Fix env
sitaowang1998 Nov 20, 2025
d22b423
Fix error path return
sitaowang1998 Nov 20, 2025
07e44a5
Fix yml name
sitaowang1998 Nov 20, 2025
7379b61
lint
sitaowang1998 Nov 20, 2025
9f82f96
Fix
sitaowang1998 Nov 20, 2025
0502111
Fix lint
sitaowang1998 Nov 20, 2025
93a5af2
Merge branch 'main' into spider-job-integration
sitaowang1998 Nov 20, 2025
a52a266
Use relative path for sibling
sitaowang1998 Nov 20, 2025
b7668e3
Add spider config in config template
sitaowang1998 Nov 20, 2025
ae8a6ae
Add spider db in credential template
sitaowang1998 Nov 20, 2025
a2c449d
Fix script
sitaowang1998 Nov 20, 2025
92a9744
Use same volume
sitaowang1998 Nov 20, 2025
84f016d
Add missing template
sitaowang1998 Nov 20, 2025
2293d50
Construct spider db url in docker
sitaowang1998 Nov 20, 2025
e072dcb
Merge branch 'main' into spider-job-integration
sitaowang1998 Nov 20, 2025
60ef08b
Move get ip into start worker script
sitaowang1998 Nov 20, 2025
dcc834a
Bug fix
sitaowang1998 Nov 21, 2025
74a3149
Add back optional host, improve error handling
sitaowang1998 Nov 21, 2025
9177d4e
Merge branch 'main' into spider-job-integration
sitaowang1998 Nov 24, 2025
01c60a2
Apply suggestions from code review
sitaowang1998 Nov 25, 2025
3c502d2
Apply suggestion from code review
sitaowang1998 Nov 25, 2025
3d0c8ed
Rename argument
sitaowang1998 Nov 25, 2025
c312c19
Fix name
sitaowang1998 Nov 25, 2025
7b5f9ef
Merge branch 'main' into spider-job-integration
sitaowang1998 Nov 28, 2025
4a0e776
Bug fix
sitaowang1998 Nov 28, 2025
c20f321
Fix spider db credential
sitaowang1998 Nov 28, 2025
bd9a78d
Fix mariadb type hint
sitaowang1998 Nov 28, 2025
515a3d3
Fix db password
sitaowang1998 Nov 29, 2025
6a56869
Merge branch 'main' into spider-job-integration
sitaowang1998 Nov 29, 2025
5135fe8
Bug fix
sitaowang1998 Nov 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions components/clp-mcp-server/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

77 changes: 69 additions & 8 deletions components/clp-package-utils/clp_package_utils/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from clp_py_utils.clp_config import (
API_SERVER_COMPONENT_NAME,
AwsAuthType,
CLP_DB_PASS_ENV_VAR_NAME,
CLP_DB_USER_ENV_VAR_NAME,
CLP_QUEUE_PASS_ENV_VAR_NAME,
CLP_QUEUE_USER_ENV_VAR_NAME,
CLP_REDIS_PASS_ENV_VAR_NAME,
ClpConfig,
COMPRESSION_JOBS_TABLE_NAME,
COMPRESSION_SCHEDULER_COMPONENT_NAME,
Expand All @@ -21,6 +26,7 @@
DeploymentType,
GARBAGE_COLLECTOR_COMPONENT_NAME,
MCP_SERVER_COMPONENT_NAME,
OrchestrationType,
QUERY_JOBS_TABLE_NAME,
QUERY_SCHEDULER_COMPONENT_NAME,
QUERY_WORKER_COMPONENT_NAME,
Expand All @@ -29,6 +35,10 @@
REDIS_COMPONENT_NAME,
REDUCER_COMPONENT_NAME,
RESULTS_CACHE_COMPONENT_NAME,
SPIDER_DB_COMPONENT_NAME,
SPIDER_DB_PASS_ENV_VAR_NAME,
SPIDER_DB_USER_ENV_VAR_NAME,
SPIDER_SCHEDULER_COMPONENT_NAME,
StorageEngine,
StorageType,
WEBUI_COMPONENT_NAME,
Expand Down Expand Up @@ -139,8 +149,8 @@ def _set_up_env_for_database(self) -> EnvVarsDict:

# Credentials
env_vars |= {
"CLP_DB_PASS": self._clp_config.database.password,
"CLP_DB_USER": self._clp_config.database.username,
CLP_DB_PASS_ENV_VAR_NAME: self._clp_config.database.password,
CLP_DB_USER_ENV_VAR_NAME: self._clp_config.database.username,
}

# Paths
Expand Down Expand Up @@ -185,8 +195,8 @@ def _set_up_env_for_queue(self) -> EnvVarsDict:

# Credentials
env_vars |= {
"CLP_QUEUE_PASS": self._clp_config.queue.password,
"CLP_QUEUE_USER": self._clp_config.queue.username,
CLP_QUEUE_PASS_ENV_VAR_NAME: self._clp_config.queue.password,
CLP_QUEUE_USER_ENV_VAR_NAME: self._clp_config.queue.username,
}

# Paths
Expand Down Expand Up @@ -235,7 +245,7 @@ def _set_up_env_for_redis(self) -> EnvVarsDict:

# Credentials
env_vars |= {
"CLP_REDIS_PASS": self._clp_config.redis.password,
CLP_REDIS_PASS_ENV_VAR_NAME: self._clp_config.redis.password,
}

# Paths
Expand All @@ -247,6 +257,47 @@ def _set_up_env_for_redis(self) -> EnvVarsDict:

return env_vars

def _set_up_env_for_spider_db(self) -> EnvVarsDict:
"""
Sets up environment variables for the Spider database component.

:return: Dictionary of environment variables necessary to launch the component.
"""
component_name = SPIDER_DB_COMPONENT_NAME
logger.info(f"Setting up environment for {component_name}...")

env_vars = EnvVarsDict()

# Database
env_vars |= {"SPIDER_DB_NAME": self._clp_config.spider_db.name}

# Credentials
env_vars |= {
SPIDER_DB_PASS_ENV_VAR_NAME: self._clp_config.spider_db.password,
SPIDER_DB_USER_ENV_VAR_NAME: self._clp_config.spider_db.username,
}

return env_vars

def _set_up_env_for_spider_scheduler(self) -> EnvVarsDict:
"""
Sets up environment variables for the Spider scheduler component.

:return: Dictionary of environment variables necessary to launch the component.
"""
component_name = SPIDER_SCHEDULER_COMPONENT_NAME
logger.info(f"Setting up environment for {component_name}...")

env_vars = EnvVarsDict()

# Connection config
env_vars |= {
"SPIDER_SCHEDULER_HOST": _get_ip_from_hostname(self._clp_config.spider_scheduler.host),
"SPIDER_SCHEDULER_PORT": str(self._clp_config.spider_scheduler.port),
}

return env_vars

def _set_up_env_for_results_cache(self) -> EnvVarsDict:
"""
Sets up environment variables and directories for the results cache (MongoDB) component.
Expand Down Expand Up @@ -766,8 +817,13 @@ def set_up_env(self) -> None:

# Component-specific config
env_vars |= self._set_up_env_for_database()
env_vars |= self._set_up_env_for_queue()
env_vars |= self._set_up_env_for_redis()
if self._clp_config.queue is not None:
env_vars |= self._set_up_env_for_queue()
if self._clp_config.redis is not None:
env_vars |= self._set_up_env_for_redis()
if self._clp_config.compression_scheduler.type == OrchestrationType.spider:
env_vars |= self._set_up_env_for_spider_db()
env_vars |= self._set_up_env_for_spider_scheduler()
env_vars |= self._set_up_env_for_results_cache()
env_vars |= self._set_up_env_for_compression_scheduler()
env_vars |= self._set_up_env_for_query_scheduler()
Expand Down Expand Up @@ -855,8 +911,13 @@ def _get_docker_file_name(self) -> str:
:return: The Docker Compose file name to use based on the config.
"""
deployment_type = self._clp_config.get_deployment_type()
compression_scheduler_type = self._clp_config.compression_scheduler.type
if deployment_type == DeploymentType.BASE:
return "docker-compose-base.yaml"
if compression_scheduler_type == OrchestrationType.spider:
return "docker-compose-spider-base.yaml"
return "docker-compose.base.yaml"
if compression_scheduler_type == OrchestrationType.spider:
return "docker-compose-spider.yaml"
return "docker-compose.yaml"


Expand Down
9 changes: 9 additions & 0 deletions components/clp-package-utils/clp_package_utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
REDIS_COMPONENT_NAME,
REDUCER_COMPONENT_NAME,
RESULTS_CACHE_COMPONENT_NAME,
SPIDER_DB_COMPONENT_NAME,
StorageType,
WEBUI_COMPONENT_NAME,
WorkerConfig,
Expand Down Expand Up @@ -454,6 +455,7 @@ def generate_credentials_file(credentials_file_path: pathlib.Path):
DB_COMPONENT_NAME: {"username": "clp-user", "password": secrets.token_urlsafe(8)},
QUEUE_COMPONENT_NAME: {"username": "clp-user", "password": secrets.token_urlsafe(8)},
REDIS_COMPONENT_NAME: {"password": secrets.token_urlsafe(16)},
SPIDER_DB_COMPONENT_NAME: {"username": "spider-user", "password": secrets.token_urlsafe(8)},
}

with open(credentials_file_path, "w") as f:
Expand Down Expand Up @@ -499,6 +501,13 @@ def validate_and_load_redis_credentials_file(
clp_config.redis.load_credentials_from_file(clp_config.credentials_file_path)


def validate_and_load_spider_db_credentials_file(
clp_config: ClpConfig, clp_home: pathlib.Path, generate_default_file: bool
):
validate_credentials_file_path(clp_config, clp_home, generate_default_file)
clp_config.spider_db.load_credentials_from_file(clp_config.credentials_file_path)


def validate_db_config(
clp_config: ClpConfig,
component_config: pathlib.Path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pathlib
import sys

from clp_py_utils.clp_config import CLP_DEFAULT_CONFIG_FILE_RELATIVE_PATH
from clp_py_utils.clp_config import CLP_DEFAULT_CONFIG_FILE_RELATIVE_PATH, OrchestrationType
from clp_py_utils.core import resolve_host_path_in_container

from clp_package_utils.controller import DockerComposeController, get_or_create_instance_id
Expand All @@ -13,6 +13,7 @@
validate_and_load_db_credentials_file,
validate_and_load_queue_credentials_file,
validate_and_load_redis_credentials_file,
validate_and_load_spider_db_credentials_file,
validate_output_storage_config,
validate_retention_config,
)
Expand Down Expand Up @@ -60,8 +61,12 @@ def main(argv):
)

validate_and_load_db_credentials_file(clp_config, clp_home, True)
validate_and_load_queue_credentials_file(clp_config, clp_home, True)
validate_and_load_redis_credentials_file(clp_config, clp_home, True)
if clp_config.queue is not None:
validate_and_load_queue_credentials_file(clp_config, clp_home, True)
if clp_config.redis is not None:
validate_and_load_redis_credentials_file(clp_config, clp_home, True)
if clp_config.compression_scheduler.type == OrchestrationType.spider:
validate_and_load_spider_db_credentials_file(clp_config, clp_home, True)
clp_config.validate_logs_input_config(True)
validate_output_storage_config(clp_config)
validate_retention_config(clp_config)
Expand Down
Loading
Loading