Heroku Drupal

Posted : admin On 1/26/2022

After following the first part of this series (How to create a Drupal 8 project for Heroku (Part 1)) you should have a composer managed Drupal project, which uses Amazon S3 as the file storage, and takes basic configuration settings from environmental variables. Now we are going to deploy Drupal to Heroku.

  1. Heroku Drools
  2. Heroku Php Getting Started
  3. Heroku Wordpress

Heroku Drupal MySQL. Home; User login. Username. Password. Create new account; Request new password; Welcome to Heroku Drupal MySQL. No front page content has been created yet. Powered by Drupal. In your settings.php add $conf 'nodejsservicekey' = 'beejeebusRocks';, which is the Drupal equivalent for the serviceKey in the JS configuration. Visit admin/config/nodejs/config and fill out the form, this time to let Drupal know about the node.js server. Again, pay attention to leading and trailing slashes. The TechnoMile Drupal on Heroku app provides a foundation for making a Drupal E-Commerce website on Heroku that will get your business up and running faster. This build pack has two varieties allowing you to utilize MySQL and Postgres databases. Includes defined Salesforce workflows.

In this guide we will:

  • # Setup local Git repository
  • # Link Drupal project to Heroku App
  • # Add additional Heroku dependencies
  • # Set environmental variables in Heroku
  • # Create the Procfile (commands file)
  • # Push and Install
Heroku drupal 8

Things you need before we start:

Heroku drupal 7
  • A Drupal project compatible with Heroku (see part 1)
  • Git installed locally
  • A Heroku account with an empty Heroku App
  • The Heroku CLI installed locally
  • An Amazon S3 bucket
  • An Amazon S3 user with read/write permissions for that bucket

All the commands executed from now on are done so in the project's directory, so open up a new terminal window and go there before continuing:

Setup local Git repository ¶

In order for us to be able to deploy our project to Heroku, we need to have it committed to a git repo.

If you already have a git repo setup and have committed your changes, then skip to the next step, if not, execute the following commands to initialize your repo and commit your project:

With our project committed, we can now continue.

Link Drupal project to Heroku App ¶

Heroku Drools

We need to login to the Heroku account that will be used to deploy the project and link the current Drupal project to the Heroku App where it will be deployed.

What we just did is tell Heroku that whatever heroku commands we execute from within this folder and its children are related to the linked app.

Add additional Heroku dependencies ¶

At the time of writing this, Heroku didn't provide GD as a standard PHP library, and without it, we can't install Drupal. We specify it as a dependency using composer.

Your composer.json file should then have the following lines:

And your composer.lock should have these lines:

These changes need to be committed to our repo:

Set environmental variables in Heroku ¶

Since we use environmental variables for some of our settings, we have to set their values in Heroku. That is done via the Heroku CLI 'heroku config:set' command.

We need to pass each VAR=value set as an argument. Use the following command, replacing with your values as appropriate:

Create the Procfile (commands file) ¶

Heroku uses a Procfile to declare what commands are to be executed by the application's dynos. We want to run Drupal under Apache in order to take advantage of Drupal's .htaccess files settings.

Push and Install ¶

Heroku Php Getting Started

Now with everything ready, it is time to push our code to Heroku and install Drupal.

Heroku Wordpress

And, done! You can now go to http://your-heroku-app.herokuapp.com and install Drupal.