Install Drupal 8 on Acquia Cloud Free
I’ve had several people already asking me about this so I figured I should add some details here. But first, let me be clear about this: Acquia does NOT yet support Drupal 8. It’s a work in progress and there’s much testing and brainstorming, currently, on how to provide the best Drupal 8 experience on Acquia Cloud. When we say it’s ready, it really will. Stay tuned.
So, with this, how can you start playing with Drupal 8 on Acquia Cloud today? That’s easy, use Acquia Cloud Free! If you don’t know what that is, read my previous blog post.
Prepare your Drupal 8 repository
Start by cloning your git repo locally:
$ git clone firstname.lastname@example.org:d8.git Cloning into 'd8'... Warning: Permanently added 'svn-3625.devcloud.hosting.acquia.com' (RSA) to the list of known hosts. remote: Counting objects: 29, done. remote: Compressing objects: 100% (27/27), done. remote: Total 29 (delta 5), reused 0 (delta 0) Receiving objects: 100% (29/29), 13.91 KiB, done. Resolving deltas: 100% (5/5), done.
You’ll get the following default structure:
$ cd d8 ; ll total 32K drwxr-xr-x 6 www-data drupal 4.0K Sep 21 14:40 ./ drwxrwxr-x 4 www-data drupal 4.0K Sep 21 14:40 ../ drwxrwxr-x 2 www-data drupal 4.0K Sep 21 14:40 acquia-utils/ drwxrwxr-x 2 www-data drupal 4.0K Sep 21 14:40 docroot/ drwxrwxr-x 8 www-data drupal 4.0K Sep 21 14:40 .git/ -rw-rw-r-- 1 www-data drupal 113 Sep 21 14:40 .gitignore drwxrwxr-x 2 www-data drupal 4.0K Sep 21 14:40 library/ -rw-rw-r-- 1 www-data drupal 598 Sep 21 14:40 README.acquia
Now, let’s get to the real thing. Navigate to the docroot and add your Drupal 8 codebase there. Below, I’m simply rsync’ing Drupal alpha3 to the freshly checked out Acquia Cloud docroot. Note that I’m also excluding the
.git directory from the process as well as deleting any file that’s in the repo first. Proceed with care and always double check the path you’re triggering rsync from. A safer method would be to add the full destination path instead of “.” only. Your call.
$ cd docroot ; ls acquialogo.gif index.html $ rsync -avC --delete --exclude=.git /tmp/drupal-8.0-alpha3/ .
We can now commit our changes. I’m adding invisible files manually as it can sometimes be tricky with git. Note the
-f (force) command as well to make sure git will take into account every new file that’s been added to the repo.
$ git add -f * $ git add -f .editorconfig .gitattributes .htaccess .jshintignore .jshintrc $ git commit -am "First D8 commit"
We’re making good progress. Let’s push those changes upstream.
$ git push origin master Counting objects: 29, done. Delta compression using up to 4 threads. Compressing objects: 100% (23/23), done. Writing objects: 100% (27/27), 33.33 KiB, done. Total 27 (delta 2), reused 0 (delta 0) remote: INFO: you are using 580kB out of 512000kB available. To email@example.com:d8.git 3a28dcc..dccf8a1 master -> master
Let’s step back for a second. No need to move on with the remaining steps if you have an issue with your codebase. It should be part of your normal workflow to make sure there’s no missing file or directory in your codebase. You have plenty of GUI tools to perform a directory diff, but you can also use the command line for that:
$ diff -bur /tmp/drupal-8.0-alpha3/ ~/Sites/d8/docroot/
Our codebase is not yet usable. We first need to create a
settings.php file and give it correct permissions. Same deal for the default directory. We need to make sure the installer be able to create the
translations directory (if you’re not using english by default).
$ chmod 775 sites/default/ $ cp sites/default/default.settings.php sites/default/settings.php $ chmod 775 sites/default/settings.php
On top of that, to make a successful connection to the Acquia Cloud database, we have to edit the
settings.php file and add the Acquia
require() line at the very bottom of the file. You’ll find the PHP snippet under your Databases page, after clicking on the Connect to database button.
We’re almost there. Now we need to add the
settings.php file to our repo and push it upstream.
$ git add -f sites/default/settings.php $ git commit -am "Added settings.php file" ; git push
Note: you might come across git attributes issues such as below when committing modifications to your repo:
[attr]drupaltext text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 not allowed: docroot/.gitattributes:13 [attr]drupalbinary -text diff not allowed: docroot/.gitattributes:18
This is because Drupal 8 ships with a
.gitattributes file to improve git patches. If you’re getting errors, you might want to review your Git configuration. Change notice is available here: https://drupal.org/node/1803766
Install Drupal 8
We’re finally there! Visit your Acquia Cloud dashboard to see the commits in your activity stream or you can directly visit http://d8.devcloud.acquia-sites.com/core/install.php (replace “d8” by your sitename, obviously). If you’re seeing the Drupal install page, run the installer and enjoy:
Remember to change permissions back to what they were before for security reasons (don’t forget to commit the changes):
$ chmod 755 sites/default/ $ chmod 440 sites/default/settings.php
If you come across a WSOD it’ll be complicated to debug what’s going on since you don’t have access to an interactive Shell. Fortunately you can still get access to your log files from the Acquia Cloud dashboard and determine what’s going on that’s causing you troubles. Also, make sure to:
- Run a diff (really) to make sure there’s no missing file or directory
- Confirm that your permissions are set correctly (remember that Git does not store permissions, apart from the executable bit)
Not everything will work out of the box, but you should be able to have some fun already. Depending upon where we are with Drupal 8 support, this whole process might break anytime so really only use this for testing purposes. Isn’t that cool already?