Features/updates #11
features/updates into main Code Review
This pull request significantly expands the local AI development environment by adding several new services (LocalAI, Memos, noVNC, Open WebUI, SearXNG, ttyd, and VS Code) and refactoring the shared Docker Compose infrastructure to support subdomain-based routing via Caddy. The changes also include enhanced AI agent workflows and system-level optimizations like enabling zswap. Review feedback highlights several critical issues, including missing 'include' directives in new Makefiles and a typo in a network variable name. Improvement opportunities were also identified regarding the portability of hardcoded absolute paths, the security of sudoers modifications, and the efficiency of container startup commands.
@ -0,0 +62,4 @@
- `gh pr comment [<NUMBER | URL | BRANCH>] [--body <COMMENT>] [--edit-last [--create-if-none]] [--delete-last]` - Add a comment to a pull request
- `gh api graphql -f query='query($owner: String!, $repo: String!, $pr: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $pr) { reviewThreads(first: 50) { nodes { id isResolved comments(first: 1) { nodes { body } } } } } } }' -f owner='<OWNER>' -f repo='<REPO>' -F pr=<PR_NUMBER>` - API call to find review thread IDs for a pull request
- `gh api graphql -f query='mutation($threadId: ID!) { resolveReviewThread(input: { threadId: $threadId }) { thread { id isResolved } } }' -f threadId='<THREAD_ID>'` - API call to update a pull request comment/conversation thread THREAD_NODE_ID as resolved
- `gh release list [--exclude-drafts] [--exclude-pre-releases] [--order <asc|desc>]` - Update a pull request branch with changes from the base branch
The description for gh release list appears to be a copy-paste error from another command. It should be updated to reflect the command's actual function, which is to list releases.
- `gh release list [--exclude-drafts] [--exclude-pre-releases] [--order <asc|desc>]` - List releases in a repository
@ -0,0 +6,4 @@
DOCKER_COMPOSE_FILE := compose.linux-vulkan.yml
ADD_GROUPS = 110:render
The GID for the render group is hardcoded as 110. This GID can differ across Linux distributions, which could cause issues with GPU access inside the container. To make this more portable, you can dynamically get the GID from the host system.
ADD_GROUPS = $(shell getent group render | cut -d: -f3 || echo 110):render
@ -0,0 +9,4 @@
if [ "$(id -u)" = "0" ] ; then
groupadd -g ${GID} ${USER} || true
useradd -l -u ${UID} -g ${GID} -m ${USER} -d "/home/${USER}.linux" || true
printf "%s\t%s\n" "${USER}" "ALL=(ALL:ALL) ALL" >> /etc/sudoers
Directly modifying /etc/sudoers is generally discouraged as it can be risky. A safer and more maintainable approach is to add a separate configuration file in the /etc/sudoers.d/ directory. This isolates your changes and prevents accidental corruption of the main sudoers file.
echo "${USER} ALL=(ALL:ALL) NOPASSWD: ALL" > "/etc/sudoers.d/90-user-sudo" && chmod 0440 "/etc/sudoers.d/90-user-sudo"
@ -0,0 +1 @@
../../make/docker-compose.Makefile
This Makefile appears to be missing the include directive. To inherit the common Docker Compose targets, it should be include ../../make/docker-compose.Makefile.
include ../../make/docker-compose.Makefile
@ -0,0 +1 @@
../../make/docker-compose.Makefile
This Makefile appears to be missing the include directive. To inherit the common Docker Compose targets, it should be include ../../make/docker-compose.Makefile.
include ../../make/docker-compose.Makefile
@ -0,0 +1 @@
../../make/docker-compose.Makefile
This Makefile appears to be missing the include directive. To inherit the common Docker Compose targets, it should be include ../../make/docker-compose.Makefile.
include ../../make/docker-compose.Makefile
@ -0,0 +1,4 @@
DOCKER_CONTEXT := colima-ai-agent-1
DOCkER_NETWORK_NAME := ai-agent-lab
There's a typo in the variable name DOCkER_NETWORK_NAME. It should be DOCKER_NETWORK_NAME to be correctly recognized by the main docker-compose.Makefile.
DOCKER_NETWORK_NAME := ai-agent-lab
@ -0,0 +14,4 @@
# If you do not, your requests to remote OpenAI API servers will be sent (and charged to you),
# but you will get a JSON error in response. Check the server logs when it starts up
# to make sure there are no CORS errors.
- "CORS_ALLOW_ORIGIN=https://openwebui.thinkpaddy.local;https://openwebui.thinkpaddy;https://thinkpaddy.local;https://thinkpaddy;https://open-webui:8080;http://open-webui:8080"
The CORS_ALLOW_ORIGIN value is hardcoded with a long list of domains. This can be difficult to manage and adapt for different environments. Consider parameterizing this value using an environment variable from a .env file for better flexibility.
- "CORS_ALLOW_ORIGIN=${OPENWEBUI_CORS_ORIGINS}"
@ -0,0 +22,4 @@
--add-host=host.docker.internal:host-gateway \
-v open-webui:/app/backend/data \
--name open-webui \
ghcr.io/open-webui/open-webui:main
This shell script seems to be a redundant and incomplete method for starting the open-webui service. It duplicates some settings from docker-compose.yaml but omits critical environment variables like CORS_ALLOW_ORIGIN and OLLAMA_BASE_URL. This could lead to a misconfigured or non-functional service. To ensure consistency and avoid confusion, it would be best to rely solely on the docker-compose.yaml file for service management. I recommend removing this script.
@ -10,3 +10,4 @@
- ai-agent-lab
command:>
/bin/sh -lc "npx -y playwright@1.58.2 run-server --port 3000 --host 0.0.0.0"
The mcr.microsoft.com/playwright image comes with Playwright pre-installed. The current command uses npx to download and run a specific version of Playwright, which is redundant and inefficient as it will re-download it on every container start. You can directly use the binary included in the image.
/bin/sh -lc "playwright run-server --port 3000 --host 0.0.0.0"
@ -0,0 +41,4 @@
networks:
- ai-agent-lab
# Linux: uncomment to make host services reachable as host.docker.internal
The docker-compose.yml file uses hardcoded absolute paths with ~ for volumes and the env_file. This makes the setup dependent on the project being cloned into a specific location (~/aia1), which is not portable. Using relative paths would make the configuration more robust and work regardless of the project's location.
To fix this, you could:
- Change the paths in this file to be relative (e.g.,
./Caddyfile,./certs,./.env). - Adjust the
caddy-installand other targets insvcs/reverse-proxy/caddy/Makefileto work with these relative paths, for instance by settingCADDY_CONFIG_DIR := .insvcs/reverse-proxy/caddy/Makefile.inc.
@ -0,0 +2,4 @@
include ../../make/docker-compose.Makefile
install:
cp config/settings.yml ~/aia1/svcs/searxng/
The install target uses a hardcoded path ~/aia1/svcs/searxng/. This is not portable and makes the setup fragile. It's better to use a variable for this path, defined in Makefile.inc, and ensure the directory exists before copying.
install:
mkdir -p $(SEARXNG_CONFIG_DIR)
cp config/settings.yml $(SEARXNG_CONFIG_DIR)/
@ -0,0 +9,4 @@
- ~/aia1/svcs/searxng:/etc/searxng:ro
environment:
- SEARXNG_SECRET=password
- SEARXNG_BASE_URL=https://thinkpaddy.local/searxng/
The SEARXNG_BASE_URL is set to a value that implies path-based routing (.../searxng/). However, the new Caddy reverse proxy is configured for subdomain-based routing (e.g., searxng.thinkpaddy.local). This mismatch will likely cause routing and URL generation issues within SearXNG. The base URL should be updated to match the subdomain configuration.
- SEARXNG_BASE_URL=https://searxng.${PROXY_DOMAIN}/
@ -0,0 +1 @@
../../make/docker-compose.Makefile
This Makefile appears to be missing the include directive. To inherit the common Docker Compose targets, it should be include ../../make/docker-compose.Makefile.
include ../../make/docker-compose.Makefile
@ -0,0 +14,4 @@
volumes:
- ~/aia1/svcs/vscode:/config
- ~/git:/config/workspace/git:ro
- ~/aia1:/config/workspace/aia1
The volume mounts use hardcoded absolute paths with ~ (e.g., ~/aia1/...). This makes the setup not portable as it assumes a specific directory structure on the host. It would be better to use environment variables defined in a .env file to specify these paths, making the configuration more flexible.
- ${VSCODE_CONFIG_DIR}:/config- ${GIT_DIR}:/config/workspace/git:ro- ${AIA1_DIR}:/config/workspace/aia1
No due date set.
No dependencies set.
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?