For your Cloud Platform application, you can either create and configure a new Code Studio project or reconfigure an existing Code Studio project.
To set up a project, you must have the Owner or Maintainer role in Code Studio. For information about roles and permissions, visit User roles and permissions.
You can connect your Cloud Platform application to your Code Studio project through one of the following:
Connecting your Cloud Platform application with Code Studio
- Configure your working environment by using one of the following steps:
- Create a new Cloud IDE for the desired application.
- Open an existing Cloud IDE on the desired application.
- Open a local environment, and install Acquia CLI.
- Generate a Cloud Platform API token, and make a note of the API key and API secret as you cannot retrieve them after closing your browser tab.
Generate a Code Studio personal access token:
- Log in to Code Studio.
- In the top left corner, click your profile icon.
Click Edit profile.
The system displays your user settings.
- Click Access Tokens.
- In the Add a personal access token section, provide the required details to create a new personal access token for authenticating with Code Studio.
- In Name, enter a name for the token.
- In Selected Scopes, select the api and write_repository checkboxes.
Click Create personal access token.
Code Studio creates your new personal access token and displays it on the screen.
- Copy your new token.
Important
You must save your personal access token as you cannot access it again.
- Authenticate with Code Studio:
Create and/or configure a Code Studio project for your Cloud Platform application with the following commands:
acli update acli cs:wizard --gitlab-host-name=code.acquia.com
The ACLI command walks you through the following process:
- (prompt) Creating an API token for Code Studio
- (automated) Creating an SSH key for Code Studio
- (automated) Setting GitLab CI/CD variables
- (automated) Creating a scheduled pipeline for automatic updates
- (automated) Pushing your Cloud Platform application code to Code Studio
When the setup wizard prompts for the token key and secret, paste the the API key and API secret that you noted while generating the token.
Note
Cloud Platform sends an email to your user account notifying that an SSH key labeled CODESTUDIO_+key
is added to your Acquia account. This is a normal, expected, and secure email that serves as a notification.
Pushing Drupal application code into your Code Studio project
Prerequisites:
- Set up a Code Studio project.
- Get a personal development workspace such as Cloud IDE or Lando, or DDev.
To push Drupal application code into your Code Studio project, use one of the following options:
- Option 1: Pushing code through an existing Drupal application repository
- Option 2: Pushing code through a new Drupal application repository
Option 1: Pushing code through an existing Drupal application repository
Prerequisites:
- Use an application running on the current Drupal version.
- Use Composer to manage your application dependencies.
- Clone your Drupal code on your local machine or on Cloud IDE.
To push an existing Drupal application repository into Code Studio:
Navigate to the Drupal project directory on your local machine or on Cloud IDE:
cd <git-repository-path>
- Add a new remote based on your requirement:
To use multiple remotes to manage the repository, add your repository to remote with the name codestudio:
git remote add codestudio https://code.acquia.com/[gitlab-group]/[gitlab-project-name].git
To use only Code Studio to manage the repository, add your repository to remote with the name origin:
git remote add origin https://code.acquia.com/[gitlab-group]/[gitlab-project-name].git
Push the code from the project root to Code Studio:
git add . git commit -m "Installed site" git push <REMOTE> <BRANCHNAME>
Ensure that your development environment has the database and files for the installed site:
acli push:db acli push:files
Code Studio is ready to manage your site.
Option 2: Pushing code through a new Drupal application repository
To generate a new Drupal application repository:
- Run the
acli new
command and selectacquia/drupal-recommended-project
. - Navigate to your new directory by running the
cd <directory name>
command. - Continue with the steps mentioned in Pushing code through an existing Drupal application repository.