Meeting participants

Deploy to Heroku

Someone told me that npm run build builds the application for production, i.e. for being deployed in a place where your customers will use it.

I heard that it is even possible to deploy such app on Heroku! :-)

However, deployment on Heroku may be a bit tricky, because our app needs to have two environments now.

  1. Node.js environment to build your application.
  2. PHP environment to run the server (just like before).

But we should be able to succeed :-)

  1. Try executing npm run build locally. What happens?

  2. If you don't have the composer.json file in the project, create it with {} content to meet PHP's requirements.

  3. If you don't have the Procfile file in the project, create it with the following contents to tell web server to serve files from the dist directory.

    web: vendor/bin/heroku-php-apache2 dist/
  4. Commit both new files (if any).

  5. Go to your apps on Heroku

  6. Add an application with a name meetings-vue-YOURLASTNAME and connect it to your Github's repository.

  7. In the console, use the heroku CLI tool to configure buildpacks (i.e. run configurations) for you app. You may need to install heroku-cli if you use your own computer.

    heroku buildpacks:add heroku/php -a YOUR_APP_NAME
    heroku buildpacks:add heroku/nodejs -a YOUR_APP_NAME
  8. Deploy the app.

And see mine instance :-)