-
Notifications
You must be signed in to change notification settings - Fork 0
feat(todo-worker): add todo worker quickstart template #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,4 +3,5 @@ target/ | |
| .claude/ | ||
| .idea/ | ||
| .DS_Store | ||
| docs | ||
| docs | ||
| node_modules | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Stage 1: build | ||
| FROM node:22-slim AS build | ||
| WORKDIR /app | ||
| COPY package.json package-lock.json ./ | ||
| RUN npm ci | ||
| COPY src/ src/ | ||
| COPY tsconfig.json . | ||
| RUN npx tsc | ||
|
|
||
| # Stage 2: runtime | ||
| FROM node:22-slim | ||
| WORKDIR /app | ||
| COPY package.json package-lock.json ./ | ||
| RUN npm ci --omit=dev | ||
| COPY --from=build /app/dist ./dist | ||
| ENV III_URL=ws://localhost:49134 | ||
| CMD ["node", "/app/dist/index.js"] | ||
|
Comment on lines
+11
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Run the runtime container as a non-root user. Line 11–17 currently execute as root, which weakens container isolation and violates baseline hardening guidance. Suggested hardening patch FROM node:22-slim
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --omit=dev
COPY --from=build /app/dist ./dist
+RUN chown -R node:node /app
+USER node
ENV III_URL=ws://localhost:49134
CMD ["node", "/app/dist/index.js"]🤖 Prompt for AI Agents |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| .PHONY: build run dev clean | ||
|
|
||
| build: | ||
| docker build -t todo-worker . | ||
|
|
||
| run: | ||
| docker run --rm -e III_URL todo-worker | ||
|
|
||
| dev: | ||
| npm run dev | ||
|
|
||
| clean: | ||
| rm -rf dist node_modules |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| workers: | ||
| - name: iii-http | ||
| config: | ||
| port: 3111 | ||
| host: 127.0.0.1 | ||
| default_timeout: 30000 | ||
| concurrency_request_limit: 1024 | ||
| cors: | ||
| allowed_origins: | ||
| - '*' | ||
| allowed_methods: | ||
| - GET | ||
| - POST | ||
| - PUT | ||
| - DELETE | ||
| - OPTIONS | ||
|
|
||
| - name: iii-observability | ||
| config: | ||
| enabled: ${OTEL_ENABLED:true} | ||
| service_name: ${OTEL_SERVICE_NAME:iii} | ||
| service_version: ${SERVICE_VERSION:0.1.0} | ||
| exporter: ${OTEL_EXPORTER_TYPE:memory} | ||
| endpoint: ${OTEL_EXPORTER_OTLP_ENDPOINT:http://localhost:4317} | ||
| sampling_ratio: 1.0 | ||
| memory_max_spans: ${OTEL_MEMORY_MAX_SPANS:10000} | ||
| metrics_enabled: true | ||
| metrics_exporter: ${OTEL_METRICS_EXPORTER:memory} | ||
| logs_enabled: ${OTEL_LOGS_ENABLED:true} | ||
| logs_exporter: ${OTEL_LOGS_EXPORTER:memory} | ||
| logs_console_output: ${OTEL_LOGS_CONSOLE_OUTPUT:true} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| iii: v1 | ||
| name: todo-worker | ||
| version: 0.1.0 | ||
|
|
||
| env: | ||
| III_URL: "ws://localhost:49134" | ||
|
|
||
| runtime: | ||
| language: typescript | ||
| entry: src/index.ts | ||
|
|
||
| resources: | ||
| memory: 256 | ||
| cpus: 1 | ||
|
|
||
| scripts: | ||
| install: "npm install" | ||
| start: "npm run dev" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: iii-hq/workers
Length of output: 19067
🏁 Script executed:
Repository: iii-hq/workers
Length of output: 1473
🏁 Script executed:
Repository: iii-hq/workers
Length of output: 123
🏁 Script executed:
Repository: iii-hq/workers
Length of output: 1520
🏁 Script executed:
Repository: iii-hq/workers
Length of output: 1148
🏁 Script executed:
Repository: iii-hq/workers
Length of output: 1839
🏁 Script executed:
Repository: iii-hq/workers
Length of output: 603
🏁 Script executed:
Repository: iii-hq/workers
Length of output: 209
🏁 Script executed:
Repository: iii-hq/workers
Length of output: 118
🏁 Script executed:
Repository: iii-hq/workers
Length of output: 117
🏁 Script executed:
Repository: iii-hq/workers
Length of output: 216
Remove
config: III_ENGINE_URL— the binary expects--urlCLI argument orIII_URLenv var, not a config field.The image-resize binary (main.rs, line 21) accepts engine URL via
--urlflag only; there is no code path consumingIII_ENGINE_URLfrom a config payload. The Dockerfile correctly passes--urlin CMD (line 51), but the config.yaml entry (lines 67–68) has no effect.Compare with the working Dockerfile pattern and the binary's actual argument parsing:
--url ws://host:port(CLI flag)CMD ["--url", "ws://host.containers.internal:49134"]✓config: III_ENGINE_URL: ws://localhost:49134✗ (ignored)Replace the config entry with the mechanism your orchestrator uses to pass environment variables or CLI arguments to the container (e.g.,
env:orargs:if supported for Docker workers in your engine configuration schema).🤖 Prompt for AI Agents