From 294f52aa66f51311baefd113111465c252694bf2 Mon Sep 17 00:00:00 2001 From: Justin Ross Date: Wed, 6 Feb 2019 09:13:25 -0800 Subject: [PATCH 1/3] Update Heroku deployment instructions - Added CLI instructions for adding buildpacks - Removed misleading instructions. --- docs/docs/deploying-to-heroku.md | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/docs/docs/deploying-to-heroku.md b/docs/docs/deploying-to-heroku.md index bdb3c78a574e2..5362d765c0e26 100644 --- a/docs/docs/deploying-to-heroku.md +++ b/docs/docs/deploying-to-heroku.md @@ -19,7 +19,14 @@ Set the `heroku/node.js` and `heroku-buildpack-static` buildpacks on your applic } ``` -Sometimes specifying buildpacks via the `app.json` file doesn’t work. If this is your case try to add them in the Heroku dashboard or via the CLI. +Sometimes specifying buildpacks via the `app.json` file doesn’t work. If this is your case, try to add them in the Heroku dashboard or via the CLI with the following commands: + +```sh +$ heroku buildpacks:set heroku/node +$ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-static.git +``` + + Add a `heroku-postbuild` script in your `package.json`: @@ -31,23 +38,7 @@ Add a `heroku-postbuild` script in your `package.json`: } ``` -It is worth noting that, by default, creating a new project with `gatsby new ` creates a `package.json` with a `start` script as `npm run develop`. Without creating a Procfile to specify your commands to run for your process types, Heroku will run the web process via the `npm start` command by default. Since we've compiled our production-optimized build with `gatsby build`, the command we want to run is actually `gatsby serve`. To do this, either add the following script to your `package.json`: - -```json:package.json -{ - "scripts": { - "start": "gatsby serve --port ${PORT}" - } -} -``` - -Or, create a `Procfile`: - -```title=Procfile -web: gatsby serve --port ${PORT} -``` -The port needs to be specified to use the Heroku dyno's runtime environment variable in order to bind to the port correctly. Finally, add a `static.json` file in the root of your project to define the directory where your static assets will be. You can check all the options for this file in the [heroku-buildpack-static](https://github.com/heroku/heroku-buildpack-static#configuration) configuration. From 7f6709b2e8da4d4fa9db97df5ce027681ff3b067 Mon Sep 17 00:00:00 2001 From: Justin Ross Date: Wed, 6 Feb 2019 10:36:56 -0800 Subject: [PATCH 2/3] Remove extra breakspaces. --- docs/docs/deploying-to-heroku.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/docs/deploying-to-heroku.md b/docs/docs/deploying-to-heroku.md index 5362d765c0e26..5709f3db6f252 100644 --- a/docs/docs/deploying-to-heroku.md +++ b/docs/docs/deploying-to-heroku.md @@ -26,8 +26,6 @@ $ heroku buildpacks:set heroku/node $ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-static.git ``` - - Add a `heroku-postbuild` script in your `package.json`: ```json:title=package.json From c49b474e643a62b345b0352915343877279621c3 Mon Sep 17 00:00:00 2001 From: Justin Ross Date: Wed, 6 Feb 2019 10:43:51 -0800 Subject: [PATCH 3/3] Remove extra breakspaces. --- docs/docs/deploying-to-heroku.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/docs/deploying-to-heroku.md b/docs/docs/deploying-to-heroku.md index 5709f3db6f252..b79a880fdb07b 100644 --- a/docs/docs/deploying-to-heroku.md +++ b/docs/docs/deploying-to-heroku.md @@ -36,8 +36,6 @@ Add a `heroku-postbuild` script in your `package.json`: } ``` - - Finally, add a `static.json` file in the root of your project to define the directory where your static assets will be. You can check all the options for this file in the [heroku-buildpack-static](https://github.com/heroku/heroku-buildpack-static#configuration) configuration. ```json:title=static.json