enjin / platform

Enjin Platform is the most powerful and advanced open-source framework for building NFT platforms.
GNU Lesser General Public License v3.0
11 stars 10 forks source link

[PLA-1765] Adds relay-watcher to docker #40

Closed leonardocustodio closed 4 months ago

leonardocustodio commented 4 months ago

PR Type

enhancement, configuration changes


Description


Changes walkthrough ๐Ÿ“

Relevant files
Configuration changes
log-viewer.php
Remove Log Viewer Configuration                                                   

configs/core/config/log-viewer.php
  • Completely removed the configuration for the Log Viewer from the
    project.
  • +0/-212 
    .env
    Update Network Environment Variable                                           

    configs/core/.env - Changed the NETWORK environment variable to 'enjin-matrixchain'.
    +1/-1     
    config.json
    Add Relay Node Configuration                                                         

    configs/daemon/config.json - Added a new 'relay_node' configuration.
    +1/-0     
    docker-compose.yml
    Update Docker Compose Configuration                                           

    docker-compose.yml
  • Removed volume bindings for logs in multiple services.
  • Added a new 'relay' service configuration.
  • +14/-15 
    Enhancement
    start.sh
    Add Relay Watcher Startup Command                                               

    configs/core/start.sh
  • Added a new conditional branch for the 'relay' role to run a relay
    watcher.
  • +3/-0     
    Dependencies
    composer.json
    Update Composer Dependencies                                                         

    configs/core/composer.json
  • Updated version constraints for multiple packages.
  • Removed 'opcodesio/log-viewer' dependency.
  • +6/-7     

    ๐Ÿ’ก PR-Agent usage: Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    github-actions[bot] commented 4 months ago

    PR Description updated to latest commit (https://github.com/enjin/platform/commit/98a286334ec21328ca2f6b689efb0843cc3b596d)

    github-actions[bot] commented 4 months ago

    PR Review ๐Ÿ”

    โฑ๏ธ Estimated effort to review [1-5] 4, because the PR involves multiple configuration changes across different components including Docker, shell scripts, and PHP configurations. The removal of a complete feature (Log Viewer) and the introduction of a new service (relay watcher) add complexity and require careful review to ensure system stability and functionality.
    ๐Ÿงช Relevant tests No
    โšก Possible issues Possible Bug: The removal of log volume bindings in `docker-compose.yml` without corresponding changes in logging configurations might cause issues if the application still attempts to write logs to these directories.
    ๐Ÿ”’ Security concerns No
    Code feedback:
    relevant fileconfigs/core/start.sh
    suggestion       Consider adding error handling or status checks after running `php artisan platform:relay-watcher` to ensure that the relay watcher starts successfully and to manage any failures gracefully. [important]
    relevant linephp artisan platform:relay-watcher

    relevant fileconfigs/core/composer.json
    suggestion       Ensure that the version constraints for dependencies like `enjin/platform-core`, `enjin/platform-beam`, etc., are compatible with each other and with the Laravel framework version to avoid dependency conflicts. [important]
    relevant line"enjin/platform-core": "^1.0",

    relevant fileconfigs/core/.env
    suggestion       Verify that the new `NETWORK` value `enjin-matrixchain` is correctly configured in all parts of the system that interact with the network settings to prevent connectivity issues. [medium]
    relevant lineNETWORK=enjin-matrixchain

    relevant filedocker-compose.yml
    suggestion       Check if the new `relay` service requires any specific network configurations or volume bindings to function correctly, similar to other services, to ensure it operates as intended within the Docker environment. [medium]
    relevant linerelay:

    github-actions[bot] commented 4 months ago

    PR Code Suggestions โœจ

    CategorySuggestion                                                                                                                                    Score
    Best practice
    Add error handling to the relay watcher startup command ___ **Consider adding error handling for the 'php artisan platform:relay-watcher' command to
    ensure that the script handles potential failures gracefully.** [configs/core/start.sh [18]](https://github.com/enjin/platform/pull/40/files#diff-1ab5cfcfc8e032f585b6a70cb59659ea3d92417af421a27973951c09f32d90c4R18-R18) ```diff -php artisan platform:relay-watcher +php artisan platform:relay-watcher || { echo "Failed to start relay watcher"; exit 1; } ```
    Suggestion importance[1-10]: 8 Why: Adding error handling for the 'php artisan platform:relay-watcher' command is crucial for robustness and fault tolerance, especially in production environments.
    8
    Lock the versions of newly added packages to ensure compatibility ___ **It's recommended to lock the versions of the newly added 'enjin' packages to prevent
    potential compatibility issues with future updates.** [configs/core/composer.json [25-29]](https://github.com/enjin/platform/pull/40/files#diff-2c5e09e742287d6e5c5cae43fa69b3407e1547e04805457041dd39d0c8db1a57R25-R29) ```diff -"enjin/platform-core": "^1.0", -"enjin/platform-beam": "^1.0", -"enjin/platform-fuel-tanks": "^1.0", -"enjin/platform-marketplace": "^1.0", -"enjin/platform-ui": "^1.0", +"enjin/platform-core": "1.0.*", +"enjin/platform-beam": "1.0.*", +"enjin/platform-fuel-tanks": "1.0.*", +"enjin/platform-marketplace": "1.0.*", +"enjin/platform-ui": "1.0.*", ```
    Suggestion importance[1-10]: 7 Why: Locking the versions of the 'enjin' packages can prevent potential compatibility issues with future updates, which is important for maintaining stable dependencies.
    7
    Enhancement
    Add a health check to the 'relay' service for better service management ___ **Add a health check to the 'relay' service to ensure that the service is running correctly
    and to facilitate better management by Docker in case of failures.** [docker-compose.yml [82-93]](https://github.com/enjin/platform/pull/40/files#diff-e45e45baeda1c1e73482975a664062aa56f20c03dd9d64a827aba57775bed0d3R82-R93) ```diff relay: image: enjin/platform:latest build: context: . dockerfile: configs/core/Dockerfile restart: unless-stopped environment: CONTAINER_ROLE: relay depends_on: - ingest extra_hosts: - "host.docker.internal:host-gateway" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost/health"] + interval: 30s + timeout: 10s + retries: 3 ```
    Suggestion importance[1-10]: 7 Why: Adding a health check to the 'relay' service in the Docker configuration is a good practice for monitoring service health and ensuring reliability.
    7