Skip to content

Conversation

@Sreeju7733
Copy link

1. Why is this change necessary?

Previously, the Docker entrypoint script lacked automated handling for environment setup, database readiness, and dependency management. This caused several issues during container startup — such as the application failing to boot if the database wasn’t ready, manual installation steps being required, and inconsistent behavior between environments (development vs production).

Additionally, the script didn’t handle Composer dependencies efficiently, leading to higher memory usage and occasional installation failures. File permissions and environment configurations also had to be manually fixed after each build or container restart.

These changes were necessary to streamline deployment, ensure reliable automated installations, and improve stability and maintainability of the containerized UVDesk setup — especially for first-time users or CI/CD environments.

2. What does this change do, exactly?

  • Updated the entrypoint script to automatically:

    • Wait for the database to be ready before installation.
      Previously, the script attempted to run database migrations immediately after the container started, which often caused errors if MySQL wasn’t fully initialized.
      Now, it continuously checks database readiness using mysqladmin ping before proceeding, ensuring a stable installation process.

    • Install UVDesk if not already present.
      Earlier, the container assumed UVDesk was pre-installed in the mounted directory, leading to broken builds if the directory was empty.
      The new script automatically runs composer create-project uvdesk/community-skeleton when no installation exists, making it self-contained and easier to deploy.

    • Manage Composer dependencies and cache clearing with increased memory limits.
      Composer installation and cache-clearing steps sometimes failed due to PHP memory exhaustion in restricted container environments.
      The updated script sets COMPOSER_MEMORY_LIMIT=-1 and PHP_MEMORY_LIMIT=512M, allowing Composer to complete large dependency installs and Symfony cache clears without memory-related errors.

    • Apply correct file permissions and environment settings.
      Earlier setups required manual permission adjustments, causing issues with file writes and uploads under the Apache user.
      The new logic automatically fixes ownership and permissions for /var/www/html, ensuring www-data can access cache, config, and upload directories securely.

  • Defaulted environment to production mode with easy override via .env.
    Previously, containers defaulted to dev mode, which enabled debugging and verbose logging — not ideal for live deployments.
    The update defaults to APP_ENV=prod for better performance and security, but still allows easy switching back to dev for testing through the .env file.

  • Improved readability, security, and reduced image complexity.
    The older scripts contained redundant commands, unnecessary mounts, and lacked clear comments.
    The refactored version simplifies the workflow, adds descriptive logging for each setup phase, and ensures a cleaner, more maintainable Docker environment suitable for both local and production use.

3. Please link to the relevant issues (if any).

This script automates the installation and setup of UVDesk, including database readiness checks, environment configuration, dependency installation, and permission adjustments.
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