šŸ“–
MatchPro
  • Install Libs
  • Release Android
  • Mobile App Config
  • Backend Setup
Powered by GitBook
On this page

Was this helpful?

Backend Setup

PreviousMobile App Config

Last updated 5 years ago

Was this helpful?

Heroku Hosting (Adonis Project)

Now that we have our basic app set up, we can go ahead to initialize git and create our heroku app, if you don’t already have heroku setup on your computer or you are completely new to heroku, follow this ( to create an account and setup your computer.

$ git init
$ git add .
$ git commit -m "Initialize git repo"

//creates heroku app and adds heroku to git remote 
$ heroku create

Now when you login to your heroku dashboard, you should see your newly created app there like mine

lets make a quick list of things we need to do to configure our heroku app to work properly:

  1. Create a Procfile

  2. Setup postgres database

  3. Configure our app to use the postgres database

1. Create a Procfile

All Heroku applications run in a collection of lightweight Linux containers called dynos. Creating a ā€˜ Procfile’ at the root of our app directory would enable us to specify the commands that are exceuted by the app’s dynos. You can read up on dynos here . Also for more information on Procfile read this article .

Next create a procfile at the root of the app’s directory, and enter the following:

release: ENV_SILENT=true node ace migration:run — force
web: ENV_SILENT=true npm start

Here, we are telling heroku to run a command for the ā€˜release’ process type and the ā€˜web’ process type.

A Procfile declares its process types on individual lines, each with the following format:

<process type>: <command>
  • <process type> is an alphanumeric name for your command, such as web, worker, urgentworker, clock, and so on.

  • <command> indicates the command that every dyno of the process type should execute on startup, such as rake jobs:work.

The web process type is used to start up our adonis js app. we are using the command npm start since our app is essentially a node js app.

lastly we are setting ENV_SILENT=true in order to suppress any environment errors.

2. Setup mysql database by adding the JawsDB MySQL addon

Navigate to the resources tab in the heroku dashboard, search for ā€œJawsDB MySQLā€ under addons and select ā€œJawsDB MySQLā€.

Select the plan you want, we would use the free hobby dev plan here and click provision.

We should now have a new entry in our environment variables. Navigate to the settings tab and click ā€œReveal configā€ vars button to display the environment variables.

3.Final Step

git push heroku master

The release process type is used to specify the command to run during your app’s , in this case we are telling heroku to run our migrations with the ā€˜-force’ flag to force it since our app is in a production environment.

article
https://devcenter.heroku.com/articles/heroku-cli)
https://devcenter.heroku.com/articles/dynos
https://devcenter.heroku.com/articles/procfile
release phase