Gatsby: Help - Has anyone hosted a gatsby.js site on Platform.sh?

Created on 2 Aug 2018  路  3Comments  路  Source: gatsbyjs/gatsby

Summary

Useful Links:

Relevant information

Trying to host a gatsbyjs site using platform.sh, reading the documentation (they don't officially support Gatsby) but the offer node support.

I've figured out I need a .platform.app.yaml in the root directory, but I'm struggling to set this up - I think I need a gatsby build in here.

Here is what I have so far - example taken from https://github.com/platformsh/platformsh-example-nodejs

name: nodegatsby
type: nodejs:10

dependencies:
  nodejs:
    pm2: "^2.0.0"

web:
  commands:
    start: "PM2_HOME=$PLATFORM_APP_DIR/run pm2 start index.js --no-daemon"
    #in this setup you will find your application stdout and stderr in /app/run/logs
  locations:
    "/public":
      passthru: false
      root: "public"
      # Whether to allow files not matching a rule or not.
      allow: true
      rules:
        \.(css|js|gif|jpe?g|png|ttf|eot|woff2?|otf|html|ico|svg?)$:
          allow: true
        ^/robots\.txt$:
          allow: true

mounts:
  "/run": "shared:files/run"

disk: 2048
question or discussion

All 3 comments

Look at point 5 of the Configuration section of the Platform Node documentation you link to.

You can use the build hook to run any build steps needed.

For anyone else, haven't tested yet but simple .platform.app.yaml config file.

name: app
type: "nodejs:10"

dependencies:
  nodejs:
    gatsby-cli: "^1.1.58"

disk: 2048

hooks:
  build: |
    gatsby build

web:
  locations:
    '/':
      root: 'public'
      index: [ 'index.html' ]

There is now an official example: Deploying GatsbyJS on Platformsh.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

kalinchernev picture kalinchernev  路  3Comments

dustinhorton picture dustinhorton  路  3Comments

Oppenheimer1 picture Oppenheimer1  路  3Comments

andykais picture andykais  路  3Comments