Categories
development

Magento 2 on Heroku

Magento 2

Magento 2 on Heroku is what powers the metatooth.com online shop. This is a WordPress.org blog running on Heroku. Look for a post on integrating the two in the future. My first step was to deploy to Heroku. Here’s one of the few resources I found, but it is a good one.

https://www.chrisgrice.com/blog/magento-on-heroku-part-1/

In a nutshell, download the latest 2.x version from https://magento.com/tech-resources/download Then unpack, create a local git repository & commit.


$ mkdir Magento
$ cd Magento
$ tar xjvf ~/Downloads/Magento-CE-2.3.4-2020-01-16-11-26-09.tar.bz2
$ git init
$ git add .
$ git commit -m "Initial commit of Magento"

Normally, you would have to move auth.json.sample to auth.json in the repository to allow Composer to pull from the Magento repository. The PHP buildpack for Heroku will use the value of the COMPOSER_AUTH environment variable instead. It should also be in JSON format, as shown below.


$ heroku create
$ heroku config:set COMPOSER_AUTH='{ "http-basic": { "repo.magento.com": { "username": "<public-key>", "password": "<private-key>" }}}'
$ git push heroku master

Need an authentication key? I relied on the following documentation.

https://devdocs.magento.com/guides/v2.3/install-gde/prereq/connect-auth.html

Are you using WordPress and Magento 2 on Heroku? Tell me about it in the comments!

Leave a Reply

Your email address will not be published. Required fields are marked *