Deploying your Web Sites/Apps to Heroku

With Wappler you can easily deploy your web site and apps to Heroku with a single click.

What is Heroku?

Heroku is a cloud platform as a service supporting several programming languages. One of the first cloud platforms, Heroku has been in development since June 2007, when it supported only the Ruby programming language, but now supports Java, Node.js, Scala, Clojure, Python, PHP, and Go.

In our example we will show you how to use NodeJS with Heroku.

Creating a Heroku Project

In order to use Heroku with Wappler you need to setup an account and then create your project.

Register a Free Account

The first step is to create an account (it’s free) on Heroku website. Go to: https://www.heroku.com/ and click the Sign Up For Free button:

Follow the steps and create your account.

Create a Heroku App

The next step is to create your app. Log in with your newly created account and click Create new app button:

Add a name for your app. It will be used to access your app like: https://your-app-name.herokuapp.com/:

Select your region:

And click the Create App button:

Your app is now ready:

Creating a Wappler Project

Open the Project Manager:

Select New Project tab and create a new blank project:

Add a name for your project:

Select a project folder:

Open the Hosting Type menu and select Heroku Hosting:

Then open the Server Model menu and select NodeJS:

Enter your Heroku Project name here. If you don’t know what is it, you can click the Manage Heroku Apps button:

It will open your Heroku projects in the browser, so you can check your project name:

Enter it and click Save:

You are done. Your new project is ready, it will ask you to deploy to Heroku - select yes:

Then you will see a message, saying you need to log in - select yes:

The terminal opens asking you to press any key, so click inside the terminal and press any key:

This will open your browser, where you will see a Log In button. Click it:

You will see a success message, when you are logged in:

Close the browser window and go back to Wappler. The Commit dialog appears - enter your comment and version, then click Commit:

Heroku Project Targets

Wappler automatically creates 2 targets for your project - development and production. The development target points to a local NodeJS server and the production target points to your Heroku project.

You can see the targets by clicking the project settings icon:

You can see your targets in targets menu:

Deploying to Heroku

When you are done setting up your page(s) and preview them on your development target you can then switch to the Production target and deploy your project.

Open the Targets menu, then select Production:

And click the Deploy to Heroku button:

The commit dialog appears. Enter your comment and version, then click the Commit button:

Your app has been uploaded to Heroku and you can preview it in your browser:

5 Likes

I just tried this for the first time on Mac OS X Catalina 10.15.4, after the step Enter Heroku Project ID and click save I got a message saying
Screenshot 2020-06-06 at 01.07.02

I click yes and then get

To get around the error I had to adjust permissions, I used terminal to do this but in OS X GUI just navigate to the path shown in Wappler, Get Info on the node_modules folder and add yourself as another user with Read/Write permissions.

In Wappler just click Check and all should go through now.

1 Like

Had little time to properly try out heroku in Wappler, but got an errors during some quick test on heroku login.

Only thing that shows up in my console:
zsh:1: command not found: heroku
Error Logging out!

On my system I use ZSH and iTerm, osx catalina.
Tried to set my default shell to bash and restarted both terminal and Wappler but same error.
Logged out from Heroku in my terminal
heroku cli is in my path on both zsh and bash.

Are there places in Wappler where I can check/set path/config etc ?

Seems the Heroku tools aren’t installed by Wappler automatically on the Mac as they require administrator privileges.

You can just go to Heroku and download and install them manually:

They restart Wappler and everything should work fine :slight_smile:

3 Likes

I was sure that I had the CLI installed already… :see_no_evil:

brew tap heroku/brew && brew install heroku

And all good.

Thanks George :v:

2 Likes

Followed these instructions as I wait for DO to figure my DNS issue. Get to the end and my the Heroku default page is listed. I find no activity listed on Heroku. Each attempt to deploy says successful.

My localhost provides the following in the terminal:

node:internal/modules/cjs/loader:936
throw err;
^

Error: Cannot find module ‘C:\wamp64\www\lb_hk\node_modules\nodemon\bin\nodemon.js’
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
at node:internal/main/run_main_module:17:47 {
code: ‘MODULE_NOT_FOUND’,
requireStack:
}

The Git manager shows activity with the commit titles I used for Heroku, but no activity on Heroku.

Any guidance would be appreciated…