Cloud Platform

Working with code

 

The Cloud Platform interface gives you powerful and easy-to-use tools for managing your application’s code in its version control system.

Understanding the repository directory structure

For each application, Cloud Platform creates a master branch with the following three folders:

  • /acquia-utils - Contains the application code and files for your development area. In the initial configuration, Cloud Platform deploys code from this directory to both your production and staging infrastructure.
  • /docroot - Stores the development copy of your Drupal codebase, from which Cloud Platform executes on your infrastructure if you select master as the deployment branch.
  • /library - Contains the PHP libraries for your application. This directory is in your PHP include path, so you can add PHP extensions here if needed.

Adhering to code management recommendations

Important

Back up your databases before deploying code. This database backup will create a stable and recent rollback point, minimizing data loss, if your code deployment must be reverted.

Develop your code management workflow on the following best practices and requirements to manage code in your version control system and environments:

  • Master is always a stable, up-to-date codebase. This means that the master is immediately able to be deployed to production unless updates are in process. The master is deployed to the Dev environment unless testing is in process.
  • Branches are used for developing and testing new code and updates. Branches will be taken from the production tag. Acquia labels branches according to the function, the date and time started.
  • Development can happen in parallel on different branches. Acquia recommends keeping track of changes that are eventually merged into master and regularly updating the branch with master to ensure that the working branch is up-to-date. This may or may not be possible depending on the type of development on the branch.
  • All tested and approved branches should be merged back into master. Once they are fully tested, you should merge development branches into master. This ensures that master always includes updated code.
  • Tags from tested and approved branches (including the master) are used for production. Tags are similar to snapshots of the code, frozen in time. The Cloud Platform interface doesn’t allow you to make commits on a tag. By not modifying tags, you can easily go back to a previous tag if an error is discovered on the most recent tag.
  • Deployed branches cannot be deleted. Ensure that your workflow accounts for Cloud Platform not allowing you to delete branches that are deployed to an environment.

Code deployment best practices in Cloud Next

Before deploying your code in the Cloud Next environment, follow these best practices:

  • Ensure that your deployment takes advantage of Cloud hooks.
  • Deploy your code only if continuous integration (CI) and associated validation and testing has passed.
  • Sync your production database to a lower environment and then deploy a code to that environment. Do not deploy a code to your production environment without syncing to a lower environment first.
  • Use Cloud Actions to automate common DevOps tasks when code is deployed to an environment.
  • Align release notes or version reports in issue tracking systems, such as Jira, with Git tags for easy review of what was released in a given deployment.
  • Group changes locally and test small iterations when deploying from a dev or stage environment. You can reduce the number of code deployments that are required.
  • Have smaller code bases as that results in faster deployment times. Having a smaller Git repository results in enhanced deployment times and improves scalability of your application. Acquia recommends that the size of your code base is kept under 1 GB.

 

Based on your environment, follow these additional best practices:

  • Deploy on the baseline develop branch of your development environment frequently, if not daily.
  • Remember that the develop database is not permanent and any content created in this database might be deleted.
  • Conduct QA in the develop branch.
  • Enable the develop modules, such as DBLog, with environment split. This might be required for development purposes.
  • Do not use the develop database when you pull down a database locally.
Note