(Archived) How to use Composer in the cloud

You have tried to access an archived page. Please go to the new https://root360.atlassian.net/wiki/spaces/KB to find more documents.




Composer is a powerful tool for configuring projects.

Values that are defined during the runtime of the composer over the runtime environment replace placeholders stored in the configuration files of the project.

Through this mechanism, a project achieves the dynamics necessary to install it in a cloud.



If you meet the following requirements, the Cloud Management experts from Root360 can deploy your project in the cloud using Composer.

  • The source code is accessible via a Git repository.

  • The configuration of your project has a template version, which ends with .dist.

    • Example configuration:


      # This file is a "template" of what your parameters.yml file should look like # Set parameters here that may be different on each deployment target of the app, e.g. development, staging, production. # http://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration parameters: database_host: ~ database_port: 3306 database_name: ~ database_user: ~ database_password: ~ mailer_transport: smtp mailer_host: ~ mailer_user: ~ mailer_password: ~ mailer_default_dev_address: noreply@yourdomain.de # A secret key that's used to generate certain security-related tokens secret: ~

 

  • Your composer supports filling the configuration via environment variables (the env-map option is used)

    • Extract of a sample configuration (composer.json) for Composer

      "extra": { "symfony-app-dir": "app", "symfony-web-dir": "web", "symfony-assets-install": "relative", "incenteev-parameters": { "file": "app/config/parameters.yml", "keep-outdated": true, "env-map": { "database_host": "SYMFONY__ENV__DATABASE__SERVER", "database_name": "SYMFONY__ENV__DATABASE__DATABASE", "database_user": "SYMFONY__ENV__DATABASE__USERNAME", "database_password": "SYMFONY__ENV__DATABASE__PASSWORD", "mailer_host": "SYMFONY__ENV__MAILER__HOST", "mailer_user": "SYMFONY__ENV__MAILER__USER", "mailer_password": "SYMFONY__ENV__MAILER__PASSWORD", "secret": "SYMFONY__ENV__SECRET" } } }



During the project implementation, you will exchange the following data with the experts of Root360:

  • Name of the Git branch from which the project should be loaded, eg master

  • Private SSH key to access the git.

  • Symlinks required by the project for structuring.

Usage of composer in install.sh during Deployment

Difference between composer install and update

install:

The following steps happen during the install command:

  • Check if a composer.lock exists

  • If not, the install command perform a composer update to create one

  • If composer.lock exists, the specified versions from the lock file would be installed.

update:

  • Check composer.json

  • Determine the latest versions to install based on your version specifications in composer.json

  • Install the latest versions

  • Update composer.lock to reflect the latest versions installed

 

Usage recommendation

We recommend to create composer.lock during your development process and place the file to your release.
The advantage is, that all package versions you have used for development and successful tested, are freezed in this file and will be exactly installed on your aws evironment.

With composer.lock you can simply use composer install in your install.sh .

 

 

 

root360 Knowledge Base - This portal is hosted by Atlassian (atlassian.com | Privacy Policy)