-
Notifications
You must be signed in to change notification settings - Fork 0
devx: Makefile helpers for Docker DB + local API #36
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
Conversation
…er-db) to Makefile
Summary of ChangesHello @zensgit, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly improves the local development experience by integrating new Makefile helpers for a Docker-based database setup. It enables developers to quickly spin up an isolated PostgreSQL, Redis, and Adminer stack, and seamlessly connect the local API to it. This change aims to standardize and simplify the development workflow, ensuring a consistent and efficient environment for all contributors. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Pull Request Overview
Adds Docker-based development workflow helpers to streamline local API development with containerized database services. This provides an alternative to running everything locally by using Docker for database infrastructure while keeping the API running natively for faster development cycles.
- Added three new Makefile targets for Docker DB + local API workflow
- Enhanced help documentation with Chinese descriptions for new targets
- Preserved all existing Makefile functionality and targets
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| @cd jive-api && docker-compose -f docker-compose.dev.yml up -d postgres redis adminer | ||
| @echo "✅ Postgres: postgresql://postgres:postgres@localhost:15432/jive_money" | ||
| @echo "✅ Redis: redis://localhost:16379" | ||
| @echo "✅ Adminer: http://localhost:19080" | ||
|
|
||
| db-dev-down: | ||
| @echo "停止 Docker 开发数据库/Redis/Adminer..." | ||
| @cd jive-api && docker-compose -f docker-compose.dev.yml down |
Copilot
AI
Sep 25, 2025
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.
Consider using docker compose (without hyphen) instead of docker-compose as the standalone docker-compose tool is deprecated in favor of the Docker CLI plugin. The hyphenated version may not be available in newer Docker installations.
| @cd jive-api && docker-compose -f docker-compose.dev.yml up -d postgres redis adminer | |
| @echo "✅ Postgres: postgresql://postgres:postgres@localhost:15432/jive_money" | |
| @echo "✅ Redis: redis://localhost:16379" | |
| @echo "✅ Adminer: http://localhost:19080" | |
| db-dev-down: | |
| @echo "停止 Docker 开发数据库/Redis/Adminer..." | |
| @cd jive-api && docker-compose -f docker-compose.dev.yml down | |
| @cd jive-api && docker compose -f docker-compose.dev.yml up -d postgres redis adminer | |
| @echo "✅ Postgres: postgresql://postgres:postgres@localhost:15432/jive_money" | |
| @echo "✅ Redis: redis://localhost:16379" | |
| @echo "✅ Adminer: http://localhost:19080" | |
| db-dev-down: | |
| @echo "停止 Docker 开发数据库/Redis/Adminer..." | |
| @cd jive-api && docker compose -f docker-compose.dev.yml down |
Copilot uses AI. Check for mistakes.
| @cd jive-api && docker-compose -f docker-compose.dev.yml up -d postgres redis adminer | ||
| @echo "✅ Postgres: postgresql://postgres:postgres@localhost:15432/jive_money" | ||
| @echo "✅ Redis: redis://localhost:16379" | ||
| @echo "✅ Adminer: http://localhost:19080" | ||
|
|
||
| db-dev-down: | ||
| @echo "停止 Docker 开发数据库/Redis/Adminer..." | ||
| @cd jive-api && docker-compose -f docker-compose.dev.yml down |
Copilot
AI
Sep 25, 2025
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.
Consider using docker compose (without hyphen) instead of docker-compose as the standalone docker-compose tool is deprecated in favor of the Docker CLI plugin. The hyphenated version may not be available in newer Docker installations.
| @cd jive-api && docker-compose -f docker-compose.dev.yml up -d postgres redis adminer | |
| @echo "✅ Postgres: postgresql://postgres:postgres@localhost:15432/jive_money" | |
| @echo "✅ Redis: redis://localhost:16379" | |
| @echo "✅ Adminer: http://localhost:19080" | |
| db-dev-down: | |
| @echo "停止 Docker 开发数据库/Redis/Adminer..." | |
| @cd jive-api && docker-compose -f docker-compose.dev.yml down | |
| @cd jive-api && docker compose -f docker-compose.dev.yml up -d postgres redis adminer | |
| @echo "✅ Postgres: postgresql://postgres:postgres@localhost:15432/jive_money" | |
| @echo "✅ Redis: redis://localhost:16379" | |
| @echo "✅ Adminer: http://localhost:19080" | |
| db-dev-down: | |
| @echo "停止 Docker 开发数据库/Redis/Adminer..." | |
| @cd jive-api && docker compose -f docker-compose.dev.yml down |
Copilot uses AI. Check for mistakes.
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.
Code Review
This pull request introduces helpful Makefile targets for a developer workflow using a Dockerized database with a local API. The changes are a good improvement for developer experience. However, there are critical issues with incorrect port configurations in the new targets, which will prevent the setup from working as described. The ports hardcoded in the Makefile do not match those in the docker-compose.dev.yml file. Additionally, a hooks target for setting up git hooks appears to have been unintentionally removed. I've provided suggestions to fix these issues.
Makefile
Outdated
| @echo "启动 Docker 开发数据库/Redis/Adminer (端口: PG=15432, Redis=16379, Adminer=19080)..." | ||
| @cd jive-api && docker-compose -f docker-compose.dev.yml up -d postgres redis adminer | ||
| @echo "✅ Postgres: postgresql://postgres:postgres@localhost:15432/jive_money" | ||
| @echo "✅ Redis: redis://localhost:16379" | ||
| @echo "✅ Adminer: http://localhost:19080" |
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.
The ports mentioned in the echo statements do not match the ports defined in jive-api/docker-compose.dev.yml. This will mislead developers and cause connection issues.
According to jive-api/docker-compose.dev.yml:
- PostgreSQL is on port
5433. - Redis is on port
6380. - Adminer is on port
9080.
Please update the ports in this target to reflect the actual configuration.
@echo "启动 Docker 开发数据库/Redis/Adminer (端口: PG=5433, Redis=6380, Adminer=9080)..."
@cd jive-api && docker-compose -f docker-compose.dev.yml up -d postgres redis adminer
@echo "✅ Postgres: postgresql://postgres:postgres@localhost:5433/jive_money"
@echo "✅ Redis: redis://localhost:6380"
@echo "✅ Adminer: http://localhost:9080"
Makefile
Outdated
| @echo "本地运行 API (连接 Docker 开发数据库 15432; CORS_DEV=1, SQLX_OFFLINE=true)..." | ||
| @cd jive-api && \ | ||
| CORS_DEV=1 \ | ||
| API_PORT=$${API_PORT:-8012} \ | ||
| SQLX_OFFLINE=true \ | ||
| RUST_LOG=$${RUST_LOG:-info} \ | ||
| DATABASE_URL=$${DATABASE_URL:-postgresql://postgres:postgres@localhost:15432/jive_money} \ | ||
| cargo run --bin jive-api |
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.
The DATABASE_URL is configured to use port 15432, but the db-dev-up target (using jive-api/docker-compose.dev.yml) exposes the PostgreSQL database on port 5433. This will cause the API to fail to connect to the database.
The port should be updated to 5433 to match the Docker configuration.
@echo "本地运行 API (连接 Docker 开发数据库 5433; CORS_DEV=1, SQLX_OFFLINE=true)..."
@cd jive-api && \
CORS_DEV=1 \
API_PORT=$${API_PORT:-8012} \
SQLX_OFFLINE=true \
RUST_LOG=$${RUST_LOG:-info} \
DATABASE_URL=$${DATABASE_URL:-postgresql://postgres:postgres@localhost:5433/jive_money} \
cargo run --bin jive-api
| @echo " make db-dev-up - 启动 Docker 开发数据库/Redis/Adminer (15432/16379/19080)" | ||
| @echo " make db-dev-down - 停止 Docker 开发数据库/Redis/Adminer" | ||
| @echo " make api-dev-docker-db - 本地 API 连接 Docker 开发数据库 (15432)" |
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.
The ports listed in the help messages are incorrect and do not match the ports configured in jive-api/docker-compose.dev.yml. This can cause confusion for developers.
The correct ports from jive-api/docker-compose.dev.yml are:
- PostgreSQL:
5433 - Redis:
6380 - Adminer:
9080
Please update the help text to show the correct ports.
@echo " make db-dev-up - 启动 Docker 开发数据库/Redis/Adminer (5433/6380/9080)"
@echo " make db-dev-down - 停止 Docker 开发数据库/Redis/Adminer"
@echo " make api-dev-docker-db - 本地 API 连接 Docker 开发数据库 (5433)"
| @cd jive-api && CORS_DEV=1 API_PORT=$${API_PORT:-8012} cargo run --features core_export --bin jive-api | ||
|
|
||
| # Enable local git hooks (pre-commit runs make api-lint) | ||
| .PHONY: hooks | ||
| hooks: | ||
| @git config core.hooksPath .githooks | ||
| @echo "✅ Git hooks enabled (pre-commit runs make api-lint)" |
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.
Summary
Add developer helpers for Docker DB + local API workflow:
New Makefile targets:
db-dev-up: Start Docker dev DB/Redis/Adminer (ports 15432/16379/19080)db-dev-down: Stop Docker dev stackapi-dev-docker-db: Run local API connecting to Docker DB (CORS_DEV=1, SQLX_OFFLINE=true)Benefits:
Usage:
Preserved existing targets:
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com