-
Notifications
You must be signed in to change notification settings - Fork 1
chore(ZMS): optimize devcontainer setup #1824
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
base: next
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughDevcontainer and admin-frontend updates: Node.js setup bumped to 24.x; SSL enabling, self-signed cert generation, and SSL VirtualHost setup disabled in the Containerfile; devcontainer adds Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.devcontainer/devcontainer.json (1)
22-22: Consider improving error handling in postCreateCommand.The postCreateCommand chains multiple operations with
&&, which means failure in any step silently prevents subsequent steps from executing. This could leave the container in a partially initialized state without clear error messages.🔎 Proposed refactor with better error handling
- "postCreateCommand": "bash -c './cli modules loop composer install && ./cli modules loop npm install && ./cli modules loop npm build && cd zmsapi && vendor/bin/migrate --update && cd ../zmscitizenview && npm install'", + "postCreateCommand": "bash -c 'set -e; echo \"Running composer install...\"; ./cli modules loop composer install; echo \"Running npm install...\"; ./cli modules loop npm install; echo \"Running npm build...\"; ./cli modules loop npm build; echo \"Running migrations...\"; (cd zmsapi && vendor/bin/migrate --update); echo \"Installing zmscitizenview dependencies...\"; (cd zmscitizenview && npm install); echo \"✓ Post-create setup complete\"'",This approach:
- Uses
set -eto fail fast on errors- Adds logging for each step to aid debugging
- Uses subshells
(cd ...)to avoid leaving the shell in a different directory- Provides clear success message when complete
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.devcontainer/Containerfile.devcontainer/devcontainer.json.devcontainer/docker-compose.yaml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Analyze (java-kotlin)
- GitHub Check: call-zmsautomation-tests / zmsapiautomation
- GitHub Check: call-php-unit-tests / zmsdb-test
🔇 Additional comments (3)
.devcontainer/devcontainer.json (1)
8-18: LGTM! Appropriate VSCode extensions for the stack.The selected extensions (PHP Intelephense, GitLens, Twig Language, Vue Volar, and Xdebug) are well-suited for a PHP/Node.js/Vue development environment.
.devcontainer/docker-compose.yaml (1)
28-28: No action needed. The SQL initialization script at.resources/zms.sqlexists and contains valid SQL content. The docker-compose.yaml volume mount is correctly configured..devcontainer/Containerfile (1)
51-52: Node.js 24.x is a released version and is on track for LTS status; no action needed.Node.js 24 was released as a Current release in May 2025 and is scheduled to enter Active LTS in October 2025, with long-term support through April 2028. This follows the expected LTS release pattern (even-numbered versions: 18, 20, 22, 24). Using Node.js 24.x in the container is appropriate and will not cause build failures due to version unavailability or instability.
Likely an incorrect or invalid review comment.
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.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
zmsadmin/js/index.js (1)
146-146: Remove or replace console.log() statement.According to the coding guidelines,
console.log()should be removed or replaced withconsole.debug()for development purposes. Production code should not contain console.log statements.🔎 Suggested fix
-// Say hello -console.log("Welcome to the ZMS admin interface..."); +// Development logging can be added here if needed +// console.debug("ZMS admin interface initialized");Or remove the lines entirely if the welcome message isn't necessary.
Based on coding guidelines for JavaScript files.
🧹 Nitpick comments (1)
zmsadmin/js/index.js (1)
72-77: Clarify the environment variable default behavior.The current opt-out pattern (
process.env.ZMS_ADMIN_FORCE_HTTPS !== 'false') defaults to enabled unless explicitly set to the string'false'. This is intentional for security—HTTPS forcing is the default behavior. However, verify that this matches your security requirements:
- If HTTPS forcing should always be enabled by default (security-first), the current implementation is correct but could be more explicit. Consider documenting that only the string
'false'disables it, and any other value (undefined,'0','no') results in HTTPS being forced.- If HTTPS forcing should be optional by default, switch to opt-in:
process.env.ZMS_ADMIN_FORCE_HTTPS === 'true'.Note:
zmsstatistic/js/index.jsunconditionally forces HTTPS, suggesting this is a core security requirement. Ensure thezmsadminbehavior aligns with this design.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
.devcontainer/Containerfile.devcontainer/devcontainer.json.devcontainer/docker-compose.yamlzmsadmin/.env.examplezmsadmin/.gitignorezmsadmin/js/index.js
✅ Files skipped from review due to trivial changes (2)
- zmsadmin/.gitignore
- zmsadmin/.env.example
🚧 Files skipped from review as they are similar to previous changes (1)
- .devcontainer/devcontainer.json
🧰 Additional context used
📓 Path-based instructions (2)
**/*
⚙️ CodeRabbit configuration file
**/*: Apply the following Clean Code guidelines to all files, as summarized by wojteklu's Clean Code gist:Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
General rules
- Follow standard conventions.
- Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
- Boy scout rule. Leave the campground cleaner than you found it.
- Always find root cause. Always look for the root cause of a problem.
Design rules
- Keep configurable data at high levels.
- Prefer polymorphism to if/else or switch/case.
- Separate multi-threading code.
- Prevent over-configurability.
- Use dependency injection.
- Follow Law of Demeter. A class should know only its direct dependencies.
Understandability tips
- Be consistent. If you do something a certain way, do all similar things in the same way.
- Use explanatory variables.
- Encapsulate boundary conditions. Boundary conditions are hard to keep track of. Put the processing for them in one place.
- Prefer dedicated value objects to primitive type.
- Avoid logical dependency. Don't write methods which works correctly depending on something else in the same class.
- Avoid negative conditionals.
Names rules
- Choose descriptive and unambiguous names.
- Make meaningful distinction.
- Use pronounceable names.
- Use searchable names.
- Replace magic numbers with named constants.
- Avoid encodings. Don't append prefixes or type information.
Functions rules
- Small.
- Do one thing.
- Use descriptive names.
- Prefer fewer arguments.
- Have no side effects.
- Don't use flag arguments. Split method into several independent methods that can b...
Files:
zmsadmin/js/index.js
**/*.{js,jsx,ts,tsx}
⚙️ CodeRabbit configuration file
**/*.{js,jsx,ts,tsx}: Flag any usage of console.log() as it should be replaced with proper logging or removed:
- For development: console.debug()
- For production: Remove console.log() statements or use structured logging
- For errors: Use error console.error()
Example replacement:
// Instead of: console.log('User data:', userData); // Use: console.debug('Processing user data', { userData }); // or for development only: Remove the console.log entirelyFlag specific logging violations:
- console.log(), console.debug(), console.warn() usage (except console.error in catch blocks)
- Any debug output that should use proper logging frameworks
Example replacements:
// Instead of: console.log('User data:', userData); console.debug('Processing...'); // Use: // Remove console.log entirely or use proper logging // Only console.error in catch blocks is acceptable try { processData(userData); } catch (error) { console.error('Processing failed:', error); }Flag JavaScript security and UX issues:
- alert(), confirm(), prompt() usage (poor UX)
- eval() usage (security risk)
- innerHTML with user input (XSS risk)
- Unfiltered user input in DOM manipulation
Example replacements:
// Instead of: alert('Error occurred'); eval(userInput); // Use: // Use proper error handling and UI components this.showErrorNotification('Error occurred'); // Avoid eval() entirelyFlag TODO/FIXME comments that indicate technical debt:
- TODO comments without clear action items
- FIXME comments indicating broken functionality
- HACK comments indicating temporary workarounds
- XXX comments indicating problematic code
These should be converted to proper issues or addressed:
// Instead of: // TODO: fix this later // FIXME: this is broken // Use: // Create proper issue and reference it // @see Issue #123: Refactor validation logicFlag code complexity issues:
- Functions longer than 50 lines
- Deep nesting (...
Files:
zmsadmin/js/index.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (java-kotlin)
- GitHub Check: call-php-unit-tests / zmsapi-test
- GitHub Check: call-php-unit-tests / zmsdb-test
- GitHub Check: call-zmsautomation-tests / zmsapiautomation
🔇 Additional comments (3)
.devcontainer/docker-compose.yaml (2)
10-10: Port mapping simplified appropriately.The port mapping has been updated to expose only HTTP (8091:80), removing the previous HTTPS port (8091:443). This aligns with the SSL removal changes in the Containerfile and the conditional HTTPS forcing in the application code.
27-27: SQL initialization script verified successfully.The SQL file exists at
.resources/zms.sql(172K) and contains valid database initialization content with proper schema definitions for MariaDB 10.4.34..devcontainer/Containerfile (1)
52-53: Node.js 24.x is the current LTS version and the appropriate choice for this project.As of January 2026, Node.js 24.x is the Active LTS release (since October 2025) and is recommended for production. The project has no explicit Node.js version constraints in any package.json file, indicating compatibility across a range of versions. This update aligns with adopting the latest stable LTS line.
| RUN a2enmod rewrite proxy_fcgi alias headers | ||
| # RUN a2enmod rewrite proxy_fcgi alias headers ssl | ||
|
|
||
| # ————————————————————————————————————————— | ||
| # 4. Generate self-signed SSL certificate | ||
| # ————————————————————————————————————————— | ||
| RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 \ | ||
| -keyout /etc/ssl/private/apache-selfsigned.key \ | ||
| -out /etc/ssl/certs/apache-selfsigned.crt \ | ||
| -subj "/C=DE/ST=Dev/L=Dev/O=Dev/OU=Dev/CN=localhost" | ||
| # RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 \ | ||
| # -keyout /etc/ssl/private/apache-selfsigned.key \ | ||
| # -out /etc/ssl/certs/apache-selfsigned.crt \ | ||
| # -subj "/C=DE/ST=Dev/L=Dev/O=Dev/OU=Dev/CN=localhost" | ||
|
|
||
| # ————————————————————————————————————————— | ||
| # 5. Copy and enable SSL VirtualHost config | ||
| # ————————————————————————————————————————— | ||
| COPY apache-ssl.conf /etc/apache2/sites-available/default-ssl.conf | ||
| RUN a2ensite default-ssl | ||
| # # ————————————————————————————————————————— | ||
| # # 5. Copy and enable SSL VirtualHost config | ||
| # # ————————————————————————————————————————— | ||
| # COPY apache-ssl.conf /etc/apache2/sites-available/default-ssl.conf | ||
| # RUN a2ensite default-ssl |
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.
🛠️ Refactor suggestion | 🟠 Major
Remove commented code instead of leaving it in place.
According to clean code principles, commented-out code should be removed entirely rather than left in the codebase. If you need to reference the SSL setup in the future, it's available in version control history.
🔎 Suggested cleanup
-RUN a2enmod rewrite proxy_fcgi alias headers
-# RUN a2enmod rewrite proxy_fcgi alias headers ssl
+RUN a2enmod rewrite proxy_fcgi alias headers
# —————————————————————————————————————————
-# 4. Generate self-signed SSL certificate
+# 4. Node.js installation (formerly SSL setup - now removed)
# —————————————————————————————————————————
-# RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-# -keyout /etc/ssl/private/apache-selfsigned.key \
-# -out /etc/ssl/certs/apache-selfsigned.crt \
-# -subj "/C=DE/ST=Dev/L=Dev/O=Dev/OU=Dev/CN=localhost"
-
-# # —————————————————————————————————————————
-# # 5. Copy and enable SSL VirtualHost config
-# # —————————————————————————————————————————
-# COPY apache-ssl.conf /etc/apache2/sites-available/default-ssl.conf
-# RUN a2ensite default-ssl
-
-# —————————————————————————————————————————
-# 6. Install Node.js
-# —————————————————————————————————————————Then renumber subsequent sections accordingly.
Based on Clean Code guidelines: "Don't comment out code. Just remove."
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| RUN a2enmod rewrite proxy_fcgi alias headers | |
| # RUN a2enmod rewrite proxy_fcgi alias headers ssl | |
| # ————————————————————————————————————————— | |
| # 4. Generate self-signed SSL certificate | |
| # ————————————————————————————————————————— | |
| RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 \ | |
| -keyout /etc/ssl/private/apache-selfsigned.key \ | |
| -out /etc/ssl/certs/apache-selfsigned.crt \ | |
| -subj "/C=DE/ST=Dev/L=Dev/O=Dev/OU=Dev/CN=localhost" | |
| # RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 \ | |
| # -keyout /etc/ssl/private/apache-selfsigned.key \ | |
| # -out /etc/ssl/certs/apache-selfsigned.crt \ | |
| # -subj "/C=DE/ST=Dev/L=Dev/O=Dev/OU=Dev/CN=localhost" | |
| # ————————————————————————————————————————— | |
| # 5. Copy and enable SSL VirtualHost config | |
| # ————————————————————————————————————————— | |
| COPY apache-ssl.conf /etc/apache2/sites-available/default-ssl.conf | |
| RUN a2ensite default-ssl | |
| # # ————————————————————————————————————————— | |
| # # 5. Copy and enable SSL VirtualHost config | |
| # # ————————————————————————————————————————— | |
| # COPY apache-ssl.conf /etc/apache2/sites-available/default-ssl.conf | |
| # RUN a2ensite default-ssl | |
| RUN a2enmod rewrite proxy_fcgi alias headers | |
| # ————————————————————————————————————————— | |
| # 4. Node.js installation (formerly SSL setup - now removed) | |
| # ————————————————————————————————————————— |
🤖 Prompt for AI Agents
.devcontainer/Containerfile around lines 32 to 47: the file contains
commented-out Apache SSL setup and an alternative a2enmod invocation; remove
these commented blocks (the commented openssl command, COPY/RUN for
default-ssl.conf, and the commented a2enmod line) so the Dockerfile contains
only active, necessary instructions; after removal, adjust any section headings
or numbering comments nearby if they reference removed steps to keep the file
consistent.
c165730 to
7ac9f8a
Compare
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.htaccess (1)
6-7: Excellent optimization: internal rewrite is more efficient than external redirect.The change from external redirect (R=302) to internal rewrite eliminates an HTTP round-trip, improving performance—well-aligned with the PR's optimization goal.
However, note the behavior change: the previous rule dropped query strings (via the trailing
?), while the new rule preserves them. Verify this is intended—if a user visits/?foo=bar, they'll now get/terminvereinbarung/admin?foo=barinternally instead of a clean redirect to/terminvereinbarung/admin.Optional: More specific RewriteRule pattern for clarity
The pattern
^matches any string, though the condition restricts execution to REQUEST_URI =/. For improved readability, consider:-RewriteRule ^ /terminvereinbarung/admin [L] +RewriteRule ^/?$ /terminvereinbarung/admin [L]This makes the intent clearer without changing behavior.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.htaccess
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Analyze (java-kotlin)
- GitHub Check: call-zmsautomation-tests / zmsapiautomation
- GitHub Check: call-php-unit-tests / zmsdb-test
Pull Request Checklist (Feature Branch to
next):nextBranch in meinen Feature-Branch gemergt.Summary by CodeRabbit
Chores
New Features
✏️ Tip: You can customize this high-level summary in your review settings.