• Overview
    Key features
    • Observability
    • Auto-scaling
    • Multi-framework
    • Security
    • Django
    • Next.js
    • Drupal
    • WordPress
    • Symfony
    • Magento
    • See all frameworks
    • PHP
    • Python
    • Node.js
    • Ruby
    • Java
    • Go
  • Industries
    • Consumer Goods
    • Media/Entertainment
    • Higher Education
    • Government
    • Ecommerce
  • Pricing
  • Overview
    Featured articles
    • Switching to Platform.sh can help IT/DevOps organizations drive 219% ROI
    • Organizations, the ultimate way to manage your users and projects
  • Support
  • Docs
  • Login
  • Request a demo
  • Free Trial

How can I make my applications self-updating with Source Operations?



Source Operations can be fully automated, which can be useful when projects need scheduled updates applied to their applications. These commands, once defined, can replace the need to push updates from a local repository by running composer update automatically. In a .platform.app.yaml file, the source operation update is defined to do exactly this. It includes the update command, as well as the two commands to add and commit those updates to the repository. Adding this feature is as simple as including these lines and pushing to a branch on Platform.sh. Once the source operation has been defined, you can trigger the update to take place using the CLI command platform source-operation:run update. As a result, the operation will execute, push the commit, and trigger the normal build process on that environment. Once you are satisfied with your update command, it can be modified to run automatically. Simply add an API Token to the project and install the CLI during the build hook. Then define a cron job to run the source operation as often as you would like it to check for updates. It is even possible to read from the PLATFORM_BRANCH environment variable to restrict the operation only to certain environments, such as the dedicated update-dependencies environment shown here. Running this operation is that environments sole purpose, and prior to running it syncs all code and data from master. Merge the newly defined source operation into master, and then create the update-dependencies environment that operation is looking to run on. That way, your project will rebuild with updated dependencies each day when they are available. Test the updates, and then merge into master as a part of the application's daily maintenance routine.

Build your greatest app

Get started
AboutSecurity and complianceTrust CenterCareersPressContact us
Thank you for subscribing!
Field required
Leader Winter 2023
System StatusPrivacyTerms of ServiceImpressumWCAG ComplianceAcceptable Use PolicyManage your cookie preferencesReport a security issue
© 2024 Platform.sh. All rights reserved.
Supported by Horizon 2020's SME Instrument - European Commission 🇪🇺