Code Assembly

Configuring Code Assembly

Configuring Code Assembly for Drupal

Use the following steps to enable the Code Assembly service and ensure that the repository is properly structured. For an example of using Code Assembly as part of a standard development workflow, visit Scenario: Workflow Using Code Assembly.

  1. Log in to Cloud Platform as an administrator.

  2. Click Develop and select your application.

  3. Select App Configurations.

  4. Move the Enable Code Assembly toggle to the right.

  5. Configure your local machine or Cloud IDE to communicate with Cloud Platform through SSH and Git.

  6. Clone your Acquia Cloud Git repository.

    For more information, visit Checking out a local copy of your code.

  7. Run the following command to add the intended PHP version to the composer.json file:

    composer config extra.acquia.code-assembly.php_version 8.1
    • You can only use the supported PHP versions.
    • Code Assembly, your local or Cloud IDE development environment, and Cloud Platform must have the same version of PHP.
  8. Switch to the branch where you want to push your changes.
  9. Commit and push the composer.json and composer.lock files to Cloud Platform.

  10. Commit and push a .gitignore file with the appropriate exclusions for a Composer scaffold.

    Do not commit or push the vendor directory or any other Composer-managed files or directories. If your environment already contains a repository that did not previously use Composer and the .gitignore rules for the vendor  directory or any other Composer-managed directories, you might need to remove it from version control. To download a sample .gitignore file and learn about what must and must not be committed to the project, visit Acquia’s Drupal Recommended Project.

Configuring Code Assembly for Node.js

Use the following steps to enable the Code Assembly service and ensure that the repository is properly structured. For an example of using Code Assembly as part of a standard development workflow, visit Scenario: Workflow Using Code Assembly.

  1. Log in to Cloud Platform as an administrator.

  2. Click Develop and select your application.

  3. Select App Configurations.

  4. Move the Enable Code Assembly toggle to the right.

  5. Configure your local machine or Cloud IDE to communicate with Cloud Platform through SSH and Git.

  6. Clone your Acquia Cloud Git repository.

    For more information, visit Checking out a local copy of your code.

  7. Add the following lines to the package.json file:

    "extra": {
      "acquia": {
         "code-assembly.node_version": "18",
         "code-assembly.install_command": "npm install",
         "code-assembly.build_command": "npm run build",
         "code-assembly.output_directory": "./html/",
         "code-assembly.root_directory": "./"
         }
      }
    }
  8. Replace the variables in the code snippet with the variables that are relevant to your project. For example, the correct version of Node.js, output directory, and root directory.

    Important
    • You can only use the supported Node.js versions.
    • Code Assembly, your local or Cloud IDE development environment, and Cloud Platform must have the same version of Node.js.
  9. Switch to the branch where you want to push your changes.

  10. Commit and push the package.json and package-lock.json files to Cloud Platform.

  11. Commit and push a .gitignore file with the appropriate exclusions for an NPM-managed project, specifically the node_modules directory.

    Do not commit or push the node_modules directory or any other NPM-managed files or directories.

Important
  • Unlike Drupal applications, installing dependencies is not sufficient for Javascript applications. Code Assembly runs the npm install command that is necessary to generate a hosting artifact. Acquia’s Next Generation Node hosting also runs the npm run build command to finalize the necessary hosting artifact and cached file generation. For more information, visit Deploying Static Site Generator applications.

  • Deploy branches to non-production environments before deploying them to production environments.

    After deploying a branch to a non-production environment, you can use the Cloud Platform user interface to drag and drop the code to the production environment. This creates a tag from the most recent commit. For more information, visit Moving code from one environment to another.

  • Use Cloud Actions to automate common Drupal tasks in environments during deployments.

Did not find what you were looking for?

If this content did not answer your questions, try searching or contacting our support team for further assistance.

Acquia Help

Filter by product:

Code Assembly common questions