Skip to content

Instantly share code, notes, and snippets.

@markf3lton
Last active February 9, 2021 15:43
Show Gist options
  • Save markf3lton/71156db30739050ab63c5fa678e6b4ac to your computer and use it in GitHub Desktop.
Save markf3lton/71156db30739050ab63c5fa678e6b4ac to your computer and use it in GitHub Desktop.
Steps to set up a new IDE to work with acli and Github

Updated February 8, 2021

Acquia Cloud IDEs provide a workspace for developers that includes integration with your Acquia Cloud environments.

In other words, a developer should be ready to go if:

  • they have an Acquia Cloud account
  • they are a member a team that has access to the Acquia application on Acquia Cloud
  • they have the correct Role(s); specifically, they need the "Create and manage own Cloud IDEs" permission

Screenshot:

What are Cloud IDEs for?

Acquia Cloud IDEs provide developers with a containerized linux workspace, that has all of the following developer tools pre-installed:

Does Cloud IDE replace Lando or DrupalVM?

Cloud IDE does not replace anything!

But yes, Cloud IDE can be used instead of running Lando / DrupalVM on your laptop to develop Drupal sites.

Cloud IDE can be especially valuable for developers who may not have full administrator rights on the machine to install and run open source projects.

The Cloud IDE includes a fully functional code editor that is based on Microsoft's vsCode

The Cloud IDE also includes a Terminal.app where you can run the same Terminal commands that would run on your laptop.

Can I run BLT commands and Composer commands on Cloud IDE?

Of course!! That is what makes Cloud IDE special -- you can run all of things things that will not run in Acquia production or "on-demand" CD environments.

But can I work with my Github codebase?

Of course! Most BLT projects use Github -- or some other 3rd party code respository. The Acquia codebase and the Github codebase are different. Please see below for the instructions.

What are the pre-requisites?

Yyou need will need to have Acquia CLI installed on your laptop but this has minimal requirements and it is relatively easy to install: https://docs.acquia.com/acquia-cli/install/#installation-procedure

Then, run

acli auth:login

to link up your Acquia Cloud account.

The wizard walks you through creating an API Token on cloud.acquia.com, which is pretty easy! (You can create as many API Tokens as you need.)

Create the IDE

There is one IDE per application. If your organization has 9 applications, there should be one IDE for each application.

Run this command to create your IDE:

acli ide:create

This will take 15 minutes or so for the DNS to propogate

Set up the IDE to set up a new IDE to work with acli and Github

Please note, the steps below are performed within your IDE... not on your laptop.

Some of the steps may seem redundant, at first.

Step 1: Open the Terminal within the IDE and please confirm that your Acquia API access has been enabled.

Run acli auth:login

You will need a Cloud Platform API token from https://cloud.acquia.com/a/profile/tokens

Step 2: If you have access to multiple applications, you may have to link your IDE to the application you want to use.

Run acli link and select the application you are going to develop against.

Step 3: For a new IDE, click Configure IDE button displayed on the welcome screen.

This is a shortcut to run the acli ide:wizard:ssh-key:create-upload command which will create an SSH key pair and upload it to your account. This is necessary to run commands that interface directly with your Cloud environments.

Step 4: Proceed to pull your application into your IDE.

acli refresh

You will see dev and test and perhaps other environments like ode. (I recommend you use dev3 for this tutorial. You can always change it later.)

Follow the prompts as acli refresh will sync code, database, and files from your Acquia dev3 environment and this will take 5 to 7 minutes to complete.

At this point, you should be in your /project directory, like this:

/home/ide/project

And here is where you will work on your project...

Your Drupal codebase will be in your docroot, like this

/home/ide/project/docroot

Let's link up your Github source code now...

Run:

git remote -v

This will show you the Acquia git repo, but if you are working with Github you will want to adjust this in your IDE.

git remote add acquia <insert Acquia repo address>
git remote remove origin 
git remote add origin <insert GITHUB repo SSH address> 

In order to work with Github, you will also have to add your IDE public SSH key to your Github profile, here: https://github.com/settings/keys

Grab the public key from your IDE...

cat ~/.ssh/id_rsa.pub

Paste the public key in your Github profile...

When this is done, you should be able to run:

git pull

and then

git branch -r

Go ahead and checkout your project branch, such as:

git checkout vta_truncate

Now that you have the source code, you have some more adjustments to do.

Composer

The IDE comes with Composer v2 by default, but you can use Composer v1

composer1 install

PHP

The IDE comes with PHP74 by default but your project requires PHP 7.3, so you may the version as described in our documentation: https://docs.acquia.com/ide/#configuring-the-php-version

acli ide:php-version 7.3

Run BLT commands

Now, you can run BLT commands like

blt validate
blt doctor

Run Drush commands

You can also run drush commands like

drush status

(Be sure to run drush commands in /home/ide/project/docroot.)

View your website in the browser

The IDE menu includes an Open Drupal Site menu option. Use this to view your site in your browser.

Please reach out to your TAM, mark.felton@acquia.com for any clarification on these steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment