Skip to content
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

Update services #48

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

MarioIvancik
Copy link
Member

@MarioIvancik MarioIvancik commented Nov 8, 2024

All services in docker-compose are updated to latest versions with improved logging. Config files are adjusted for these new versions.

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a new logging structure across various configuration files, enhancing clarity and organization.
  • Improvements

    • Updated console logging level from "debug" to "info" in multiple configurations, reducing log verbosity.
    • Renamed and reorganized keys in the virtual-vehicle-utility configuration for better consistency.
  • Bug Fixes

    • Removed trailing newline in the database cleanup section of the HTTP API configuration.
  • Chores

    • Upgraded service images in the docker-compose.yml file for improved performance and stability.
    • Modified entrypoint commands for the module-gateway and initialize-log-folders services to streamline operations.

@MarioIvancik MarioIvancik self-assigned this Nov 8, 2024
Copy link

coderabbitai bot commented Nov 8, 2024

Walkthrough

The pull request introduces changes to multiple configuration files, primarily focusing on logging settings. The logging level for console output has been modified from "debug" to "info" in several configuration files, while the file logging settings remain unchanged. Additionally, some configuration files have undergone structural changes, including the addition of new logging sections and the removal of obsolete settings. The docker-compose.yml file has also been updated to reflect new service image versions and modifications to the entrypoint commands.

Changes

File Path Change Summary
configuration/external-server/config.json Logging level changed from "debug" to "info" for console output.
configuration/http-api/config.json Logging level changed from "debug" to "info" for console output; trailing newline removed in "cleanup".
configuration/integration-layer/config.json Logging level changed from "debug" to "info" for console output.
configuration/management-api/config.json Logging level changed from "debug" to "info" for console output.
configuration/module-gateway/config.json Removed "general-settings" section; added new "logging" section with console and file configurations.
configuration/virtual-plc/config.json Added new "logging" section with console and file configurations; removed log-path and verbose settings.
configuration/virtual-vehicle-utility/config.json Added new "logging" section; multiple keys renamed and removed from general-settings.
docker-compose.yml Updated service images to newer versions; modified entrypoint commands for module-gateway and initialize-log-folders.

Possibly related PRs

  • Update components #44: The changes in configuration/external-server/config.json include modifications to the logging structure, which are related to the logging level adjustments made in the main PR.
  • Baf 991/detailed logging configuration #46: This PR also modifies the logging configuration in configuration/external-server/config.json, aligning with the logging level changes in the main PR.

Suggested labels

enhancement

Suggested reviewers

  • koudis

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (9)
configuration/virtual-plc/config.json (1)

8-10: Consider using a relative or configurable path for log files.

The hardcoded absolute path /home/bringauto/virtual-plc/log/ might cause issues in different deployment environments. Consider:

  1. Using a relative path
  2. Making it configurable through environment variables
  3. Using a standard logging directory (e.g., /var/log/)

Example using environment variable:

-        "path": "/home/bringauto/virtual-plc/log/"
+        "path": "${VIRTUAL_PLC_LOG_PATH:-/var/log/virtual-plc/}"
configuration/integration-layer/config.json (2)

Line range hint 15-29: Consider security improvements for API keys.

The configuration contains hardcoded API keys ("ProtocolStaticAccessKey", "ManagementStaticAccessKey"). While this might be acceptable for development, it's recommended to use environment variables or secrets management for production deployments.

Consider using environment variable substitution in the config:

    "protocol": {
        "host": "http://http-api:8080/v2/protocol",
-       "api_key": "ProtocolStaticAccessKey",
+       "api_key": "${PROTOCOL_API_KEY}",
        ...
    },
    "management": {
        "host": "http://management-api:8081/v2/management",
-       "api_key": "ManagementStaticAccessKey"
+       "api_key": "${MANAGEMENT_API_KEY}"
    }

Line range hint 8-10: Review log path configuration for containerization.

The hardcoded log path /home/bringauto/log/ might not be optimal for containerized environments. Consider making it configurable through environment variables or mounting it to a volume path that follows container best practices.

Consider using environment variable substitution:

        "file": {
            "level": "debug",
            "use": true,
-           "path": "/home/bringauto/log/"
+           "path": "${LOG_PATH:-/var/log/bringauto/}"
        }
configuration/http-api/config.json (2)

Line range hint 15-20: Consider externalizing sensitive configuration.

The configuration file contains sensitive information like database credentials and Keycloak settings. Consider moving these to environment variables or a secure configuration management system.

Example approach using environment variables:

{
    "database": {
        "server": {
            "username": "${DB_USERNAME}",
            "password": "${DB_PASSWORD}"
        }
    },
    "security": {
        "client_id": "${KEYCLOAK_CLIENT_ID}",
        "client_secret_key": "${KEYCLOAK_SECRET}"
    }
}

Also applies to: 33-39


Line range hint 41-43: Remove trailing newlines.

The JSON file contains multiple trailing newlines at the end. While this doesn't affect functionality, it's recommended to maintain a single newline at the end of the file for consistency with JSON formatting standards.

configuration/module-gateway/config.json (1)

2-11: Consider making the log path configurable via environment variables.

The logging configuration structure looks good and aligns with the standardization across other services. However, the hard-coded log path /home/bringauto/log/ might cause issues in different environments.

Consider:

  1. Making the path configurable via environment variables
  2. Documenting the required permissions for the log directory
  3. Standardizing the trailing slash usage in paths
 "file": {
     "level": "debug",
     "use": true,
-    "path": "/home/bringauto/log/"
+    "path": "${LOG_PATH:-/home/bringauto/log}"
 }
configuration/virtual-vehicle-utility/config.json (1)

2-12: LGTM! Consider making the log path configurable.

The new logging structure is well-organized with separate console and file configurations. However, the hardcoded log path /virtual-vehicle-utility/log/ might be inflexible for different deployment scenarios.

Consider making it configurable through environment variables:

 "file": {
   "level": "debug",
   "use": true,
-  "path": "/virtual-vehicle-utility/log/"
+  "path": "${LOG_PATH:-/virtual-vehicle-utility/log/}"
 }
configuration/external-server/config.json (2)

Line range hint 21-42: Security: Consider using environment variables for API keys.

The configuration contains hardcoded API keys that are identical across all modules. This poses a security risk and makes key rotation difficult.

Consider:

  1. Using environment variables for API keys
  2. Using unique keys for each module
  3. Implementing a secure key management solution

Example modification:

      "config": {
        "api_url": "http://http-api:8080/v2/protocol",
-        "api_key": "ProtocolStaticAccessKey",
+        "api_key": "${MISSION_MODULE_API_KEY}",

Line range hint 21-42: Refactor: Consider extracting common module configurations.

The configuration for each module contains identical settings for request thresholds, delays, and API endpoints.

Consider:

  1. Moving common settings to a shared configuration section
  2. Having module-specific sections only override necessary values
  3. Using JSON schema validation to ensure consistency

Example structure:

{
  "common_module_defaults": {
    "api_url": "http://http-api:8080/v2/protocol",
    "max_requests_threshold_count": "10",
    "max_requests_threshold_period_ms": "5000",
    "delay_after_threshold_reached_ms": "5000",
    "retry_requests_delay_ms": "200"
  },
  "common_modules": {
    "1": {
      "lib_path": "/home/bringauto/modules/mission_module/lib/libmission-external-server-shared.so",
      "config": {
        "api_key": "${MISSION_MODULE_API_KEY}"
      }
    }
    // Other modules follow the same pattern
  }
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 65cd298 and 9305cb9.

📒 Files selected for processing (8)
  • configuration/external-server/config.json (1 hunks)
  • configuration/http-api/config.json (1 hunks)
  • configuration/integration-layer/config.json (1 hunks)
  • configuration/management-api/config.json (1 hunks)
  • configuration/module-gateway/config.json (1 hunks)
  • configuration/virtual-plc/config.json (1 hunks)
  • configuration/virtual-vehicle-utility/config.json (3 hunks)
  • docker-compose.yml (6 hunks)
🔇 Additional comments (12)
configuration/virtual-plc/config.json (1)

2-12: LGTM: Improved logging structure.

The new structured logging configuration is a good improvement:

  • Separates console and file logging concerns
  • Provides granular control over logging levels
  • Aligns with the project-wide logging standardization
configuration/integration-layer/config.json (1)

4-4: LGTM: Appropriate logging level adjustment.

The change from "debug" to "info" level for console logging is a good practice that reduces log verbosity while maintaining important operational information. This aligns well with the logging changes across other services.

configuration/http-api/config.json (1)

4-4: LGTM! Appropriate logging level adjustment.

The change from "debug" to "info" for console logging while maintaining debug-level file logging is a good practice. This reduces console noise in production while maintaining detailed logs for troubleshooting.

configuration/module-gateway/config.json (1)

8-10: Verify log directory permissions and existence.

The file logging is enabled with debug level, but we need to ensure the specified directory exists and has proper write permissions.

✅ Verification successful

Log directory is properly mounted via Docker volumes

The log directory /home/bringauto/log/ is correctly handled through Docker volume mounts in docker-compose.yml. The directory is mounted from local docker_volumes directories for each service:

  • ./docker_volumes/module-gateway:/home/bringauto/log/
  • ./docker_volumes/external-server/:/home/bringauto/log/
  • ./docker_volumes/http-api:/home/bringauto/log
  • ./docker_volumes/integration-layer:/home/bringauto/log
  • ./docker_volumes/management-api:/home/bringauto/log

This is a proper setup as:

  1. The host machine handles directory creation and permissions
  2. Logs are persisted outside the container
  3. Multiple services can write logs independently in their own mounted volumes
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the log directory exists in the container and verify permissions

# Search for Dockerfile or docker-compose entries that might create this directory
echo "Checking for log directory setup in Docker files..."
rg -l "/home/bringauto/log" --type dockerfile --type yaml

# Search for any permission or directory creation commands
echo "Checking for directory creation or permission commands..."
rg -l "mkdir.*bringauto/log|chmod.*bringauto/log" --type dockerfile --type yaml

Length of output: 447


Script:

#!/bin/bash
# Let's try a different approach to find Docker-related files and log directory setup
echo "Searching for Dockerfile and docker-compose files..."
fd -e dockerfile -e yml -e yaml

echo -e "\nSearching for log directory references..."
rg "/home/bringauto/log"

echo -e "\nSearching for directory creation or permission commands..."
rg "mkdir.*log|chmod.*log"

Length of output: 1259

configuration/virtual-vehicle-utility/config.json (3)

32-32: LGTM! Consistent naming convention applied.

The rename to provider-simulation-settings follows the established pattern of prefixing provider-specific configurations.


41-42: LGTM! Verify module gateway connectivity.

The renaming to fleet-provider-type and provider-internal-protocol-settings maintains consistency. Since this PR updates services, please ensure the module gateway connection settings remain compatible.

✅ Verification successful

Module gateway connectivity configuration is consistent

The module gateway port 1636 is consistently configured across the services:

  • In virtual-vehicle-utility as the client port
  • In virtual-plc connecting to the same port
  • Module gateway service is properly referenced in docker compose configuration

The renaming of fleet provider settings maintains compatibility while the underlying connection parameters remain unchanged.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the module gateway port is consistently configured across services
rg '"module-gateway-port":\s*1636' --type json

Length of output: 130


Script:

#!/bin/bash
# Let's check for any other module gateway port configurations across the codebase
rg '"module-gateway-port"' --type json -A 1

Length of output: 207


Script:

#!/bin/bash
# Also check for any module gateway related settings in the codebase
rg 'module[- ]gateway' --type json -A 2

Length of output: 1404


Script:

#!/bin/bash
# Check if there are any other fleet provider configurations
rg '"fleet-provider-type"|"provider-internal-protocol-settings"' --type json -A 2

Length of output: 445


29-30: Verify the new in-stop-delay value.

A new configuration parameter in-stop-delay-s has been added with a value of 10 seconds. Please confirm if this delay is appropriate for your use case, as it will affect vehicle behavior at stops.

configuration/external-server/config.json (2)

4-4: LGTM: Logging level change aligns with PR objectives.

The change from "debug" to "info" for console logging while maintaining "debug" level for file logging is a good balance between reducing console verbosity and maintaining detailed logs for troubleshooting.


Line range hint 1-58: Verify: Ensure configuration compatibility with updated services.

Since this PR updates all services to their latest versions, we should verify that this configuration file remains compatible.

Let's check for any version-specific configuration changes in the documentation:

✅ Verification successful

Configuration changes are compatible with updated services

The recent changes in the configuration files are minimal and maintain backward compatibility:

  • Only logging level changes from "debug" to "info" in console output across all services
  • Module Gateway's logging structure was standardized to match other services
  • All core configuration parameters (endpoints, modules, paths) remain unchanged
  • No breaking changes or new required fields were introduced

The configuration structure remains consistent with all interconnected services (http-api, management-api, module-gateway) and maintains the required parameters for proper system operation.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for configuration-related changes in documentation and changelog files
echo "Searching for configuration changes in documentation..."
rg -i -g "CHANGELOG*|README*|docs/*" "config.*changes|breaking.*changes|upgrade"

Length of output: 352


Script:

#!/bin/bash
# Let's try a broader search for documentation files first
echo "Finding documentation files..."
fd -e md -e txt

# Search for configuration files to understand the structure
echo -e "\nFinding configuration files..."
fd -e json -e yaml -e yml

# Look for any upgrade or migration guides
echo -e "\nSearching for upgrade/migration content..."
rg -i "upgrade|migration|breaking.?change|config" -g "*.md" -g "*.txt"

Length of output: 3418


Script:

#!/bin/bash
# Let's compare the configuration structure with other services
echo "Checking http-api config structure..."
cat configuration/http-api/config.json

echo -e "\nChecking management-api config structure..."
cat configuration/management-api/config.json

echo -e "\nChecking module-gateway config structure..."
cat configuration/module-gateway/config.json

# Let's also check if there are any recent changes to these config files
echo -e "\nChecking recent config file changes..."
git log -p -- configuration/external-server/config.json configuration/http-api/config.json configuration/management-api/config.json configuration/module-gateway/config.json

Length of output: 11850

docker-compose.yml (3)

3-3: LGTM: Version updates for virtual-vehicle and virtual-plc services.

The version updates follow semantic versioning with minor version increments, suggesting backward compatibility is maintained.

Also applies to: 18-18


80-80: LGTM: Patch version updates for API services.

The patch version updates for both http-api and management-api services indicate bug fixes or minor improvements without breaking changes.

Also applies to: 112-112


33-33: Verify impact of removing --verbose flag from module-gateway.

While the version update looks good, the removal of the --verbose flag might affect debugging capabilities. This change aligns with the PR's logging improvements, but please ensure:

  1. The new version (v1.3.0) has adequate default logging
  2. There's documentation on how to enable verbose logging if needed

Also applies to: 41-41

configuration/virtual-plc/config.json Show resolved Hide resolved
configuration/management-api/config.json Show resolved Hide resolved
docker-compose.yml Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant