Drupal Installation: From Scratch to Fully Functional with Humpback Dev

Luis Cascante
Sep 8, 2018 · 5 min read
Humpback

For those of you who have never performed a Drupal installation, before installing Drupal, you need an AMP(Apache, MySQL, PHP) stack or EMP((E)nginx + MySQL + PHP) installation, if you’re relatively new, that AMP stack could mean a while of debugging.

Then you need to go to the Drupal website, download the latest version of it. Copy everything(including hidden files, yeah, watch out for these files) and then attempt the installation. Some people need to go to php.ini on their local php just to alter their timeout and memory limit settings, so that the installation won’t crash in the process. And all of that, just to get it running.

But what if I told you that you could just reduce all of that hard work to a few commands on your terminal? Well, how? My awesome co-workers at Manatí created something called Humpback Dev.

Humpback is a docker-based environment for building Drupal 8 websites. It saves you a lot of trouble in the installation process and also comes with some extra tools and configurations that may come in handy during the development of your website, thus saving precious time that can be used on the website development. And what happens after you’re done and you want to delete the site from your local environment? Well, you just delete the folder and you’re done. No troublesome database uninstall, no looking around for folders created on your directories, because everything is contained inside the project folder.


Before Installing

All we need installed before we start is NPM, Ahoy and of course Docker.

Linux installation steps:

NPM

I recommend following this guide from the ‘Installing using NVM’ section. Because if you just install nodejs and npm with sudo apt install I’ll sometimes ask for sudo permissions, with nvm you don’t need to give sudo access:

Docker

I found this installation guide really helpful:

After you’re done with the guide, you need to install docker-compose separately, for this on Ubuntu you can run:

sudo apt install docker-compose

Ahoy

sudo wget -q https://github.com/ahoy-cli/ahoy/releases/download/2.0.0/ahoy-bin-`uname -s`-amd64 -O /usr/local/bin/ahoy && sudo chown $USER /usr/local/bin/ahoy && chmod +x /usr/local/bin/ahoy

Mac installation steps:

NPM

If you’re on Mac you just have to install node with brew, it’ll install npm as well:

brew install node

Docker

If you’re on Mac, you can just download the dmg and install it, from this link:

Ahoy

If you’re using Mac, you can install it with Homebrew:

brew tap ahoy-cli/tap
brew install ahoy

Let’s install Humpback Generator

To install Humpback Generator we just need 2 commands:

npm install -g yo 

npm install -g generator-humpback

Let’s create our Drupal 8 local site

First we need to create the folder that will contain our project and move to that directory. For the sake of this tutorial I’ll call my Project humpback-tutorial:

mkdir humpback-tutorial
cd humpback-tutorial

Once we’re inside the project, we let Humpback do it’s thing (you could just leave the default values if this is a dummy project):

yo humpback
Expected yo humpback output

We need to start our environment with:

ahoy up

When that’s done, we need to run a script to create some local settings for the Drupal installation:

ahoy site local-settings
Expected ahoy site local-settings output

Now, to prepare the local site we need to run a couple of commands to install all the dependencies(composer install can take a while):

ahoy composer install
npm install

And finally, once both are done, we can install Drupal(this can also take a while):

ahoy site install

If everything goes well, you should see this page in your browser:

Expected look of you site after installation.

You can login with:

User: admin
Password: admin

Once you’ve authenticated yourself you should have complete access to the Drupal Installation:

Expected look of the site once you’re logged in.

AND THAT’S IT!


…oh, you want to install a module? Well, let’s say you want to install Admin Toolbar for example, normally you would download from the project site https://www.drupal.org/project/admin_toolbar. All we need is the part after the “project/”, for this example we’d need “admin_toolbar”. To install this module, inside the project folder, we need to run:

ahoy composer require drupal/admin_toolbar

Or for the general case, we need:

ahoy composer require drupal/<module_name>

As easy as that, this will automatically update your composer.json


…oh, you want to export your configuration so you co-workers can run your project on their local? Well, just run this inside your project folder:

ahoy drush cex

Then, push your changes to the repo, have them clone the repo/pull the changes, run the installation section of this tutorial, or if they already installed your site in their local, have them run:

ahoy drush cim

If you installed any new modules from the last time they pull your changes, have them run this command again, it’ll look inside your composer.json file for dependencies and install them:

ahoy composer install

Once they’re done with the configuration import, they should have the same site as you…except for the content, content stays local, if they want to test your view they’ll have to add content themselves.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade