Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
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
51 changes: 51 additions & 0 deletions taskfiles/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,54 @@ tasks:
compose:clean:
dir: "{{.G_SPIDER_COMPOSE_DIR}}"
cmd: "docker compose --file compose.yaml down --volumes --remove-orphans"

# Builds Spider and its images, then starts a local deployment.
Comment thread
sitaowang1998 marked this conversation as resolved.
Resolved
#
# @param {string} SPIDER_WORKER_LIBRARY_DIR The host directory containing the libraries.
compose:local:build-and-up:
Comment thread
sitaowang1998 marked this conversation as resolved.
Resolved
cmds:
- task: ":build:rust"
- task: "build"
Comment thread
sitaowang1998 marked this conversation as resolved.
Resolved
- task: "compose:local:up"
vars:
SPIDER_STORAGE_IMAGE_REF:
sh: "sed -n '1p' '{{.G_BUILD_DIR}}/spider-storage-image.id'"
SPIDER_SCHEDULER_IMAGE_REF:
sh: "sed -n '1p' '{{.G_BUILD_DIR}}/spider-scheduler-image.id'"
SPIDER_WORKER_IMAGE_REF:
sh: "sed -n '1p' '{{.G_BUILD_DIR}}/spider-worker-image.id'"
SPIDER_WORKER_LIBRARY_DIR: "{{.SPIDER_WORKER_LIBRARY_DIR}}"

# Starts a local Spider deployment with libraries mounted into every worker.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add image override to the docstring

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are already listed as parameters.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my latest review comment, that's what I mean by this

Comment thread
sitaowang1998 marked this conversation as resolved.
Resolved
#
# @param {string} SPIDER_STORAGE_IMAGE_REF The storage image reference.
# @param {string} SPIDER_SCHEDULER_IMAGE_REF The scheduler image reference.
# @param {string} SPIDER_WORKER_IMAGE_REF The worker image reference.
# @param {string} SPIDER_WORKER_LIBRARY_DIR The host directory containing the libraries.
compose:local:up:
env:
SPIDER_STORAGE_IMAGE_REF: "{{.SPIDER_STORAGE_IMAGE_REF}}"
SPIDER_SCHEDULER_IMAGE_REF: "{{.SPIDER_SCHEDULER_IMAGE_REF}}"
SPIDER_WORKER_IMAGE_REF: "{{.SPIDER_WORKER_IMAGE_REF}}"
SPIDER_WORKER_LIBRARY_DIR: >-
{{- if .SPIDER_WORKER_LIBRARY_DIR}}
{{- if osIsAbs .SPIDER_WORKER_LIBRARY_DIR}}
{{- osClean .SPIDER_WORKER_LIBRARY_DIR}}
{{- else}}
{{- joinPath .ROOT_DIR .SPIDER_WORKER_LIBRARY_DIR}}
{{- end}}
{{- end}}
dir: "{{.G_SPIDER_COMPOSE_DIR}}"
cmd: >-
docker compose --project-name spider-local --file compose.yaml
--file compose.local.yaml up --detach --wait --wait-timeout 300

compose:local:down:
dir: "{{.G_SPIDER_COMPOSE_DIR}}"
cmd: "docker compose --project-name spider-local --file compose.yaml down"

compose:local:clean:
dir: "{{.G_SPIDER_COMPOSE_DIR}}"
cmd: >-
docker compose --project-name spider-local --file compose.yaml down
--volumes --remove-orphans
4 changes: 4 additions & 0 deletions tools/deployment/spider-compose/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ SPIDER_STORAGE_DB_PASSWORD=spider-password
SPIDER_STORAGE_DB_USERNAME=spider-user

# Storage settings.
# A complete storage image reference takes precedence over `SPIDER_IMAGE_TAG` when set.
# SPIDER_STORAGE_IMAGE_REF=ghcr.io/y-scope/spider/storage:main
SPIDER_STORAGE_LOG_LEVEL=INFO
SPIDER_STORAGE_PORT=50051
SPIDER_STORAGE_PUBLISHED_IP=127.0.0.1
Expand All @@ -29,6 +31,8 @@ SPIDER_STORAGE_TASK_INSTANCE_POOL_GC_INTERVAL_SEC=30
SPIDER_STORAGE_TASK_INSTANCE_POOL_MESSAGE_CHANNEL_CAPACITY=128

# Scheduler settings.
# A complete scheduler image reference takes precedence over `SPIDER_IMAGE_TAG` when set.
# SPIDER_SCHEDULER_IMAGE_REF=ghcr.io/y-scope/spider/scheduler:main
SPIDER_SCHEDULER_LOG_LEVEL=INFO
SPIDER_SCHEDULER_PORT=50052
SPIDER_SCHEDULER_CONNECTION_POOL_SIZE=8
Expand Down
7 changes: 7 additions & 0 deletions tools/deployment/spider-compose/compose.local.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
services:
spider-worker:
volumes:
- type: "bind"
source: "${SPIDER_WORKER_LIBRARY_DIR:?}"
target: "${SPIDER_WORKER_PACKAGE_DIR:-/opt/spider/packages}"
read_only: true
6 changes: 4 additions & 2 deletions tools/deployment/spider-compose/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ services:

spider-storage:
<<: *service_defaults
image: "ghcr.io/y-scope/spider/storage:${SPIDER_IMAGE_TAG:-main}"
image: >-
${SPIDER_STORAGE_IMAGE_REF:-ghcr.io/y-scope/spider/storage:${SPIDER_IMAGE_TAG:-main}}
networks:
- "default"
- "spider-internal"
Expand Down Expand Up @@ -84,7 +85,8 @@ services:

spider-scheduler:
<<: *service_defaults
image: "ghcr.io/y-scope/spider/scheduler:${SPIDER_IMAGE_TAG:-main}"
image: >-
${SPIDER_SCHEDULER_IMAGE_REF:-ghcr.io/y-scope/spider/scheduler:${SPIDER_IMAGE_TAG:-main}}
networks:
- "spider-internal"
command: [
Expand Down
Loading