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.
Log in to Cloud Platform as an administrator.
Click Develop and select your application.
Select App Configurations.
Move the Enable Code Assembly toggle to the right.
Configure your local machine or Cloud IDE to communicate with Cloud Platform through SSH and Git.
Clone your Acquia Cloud Git repository.
For more information, visit Checking out a local copy of your code.
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
Commit and push the composer.json
and composer.lock
files to Cloud Platform.
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.
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.
Log in to Cloud Platform as an administrator.
Click Develop and select your application.
Select App Configurations.
Move the Enable Code Assembly toggle to the right.
Configure your local machine or Cloud IDE to communicate with Cloud Platform through SSH and Git.
Clone your Acquia Cloud Git repository.
For more information, visit Checking out a local copy of your code.
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": "./"
}
}
}
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.
Switch to the branch where you want to push your changes.
Commit and push the package.json
and package-lock.json
files to Cloud Platform.
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.
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.
If this content did not answer your questions, try searching or contacting our support team for further assistance.
Thu Oct 17 2024 12:16:43 GMT+0000 (Coordinated Universal Time)