Skip to content

Latest commit

 

History

History
77 lines (57 loc) · 4.31 KB

heroku.md

File metadata and controls

77 lines (57 loc) · 4.31 KB

Installing Yaydoc on Heroku

Heroku is a cloud platform as a service (PaaS) that is used as a web application deployment model. The Yaydoc Web User Interface is a NodeJS application and Heroku makes it really easy to deploy and scale Node.js applications in the cloud.

One-click Heroku deployment

Deploy

Manual Deployment

Even though we offer the One-click Heroku deployment, performing a manual deployment is also quite simple. There is a need to define certain Buildpacks and Environment Variables, after which the app can be successfully deployed.

Install Heroku on your local machine

  • If you have a linux based Operating Systems, type the following command in the terminal

    wget -qO- https://cli-assets.heroku.com/install-ubuntu.sh | sh
    

Note:- Details for other Operating Systems can be found at https://devcenter.heroku.com/articles/heroku-cli

Login to Heroku Server (Create an account if it doesn’t exist)

  • Type in the following command in your server, enter credentials and login

    heroku login
    

Deploy Yaydoc to Heroku

  • Clone the original yaydoc repository or your own fork and move to the directory of the cloned repository

    git clone https://github.com/<username>/yaydoc.git
    cd yaydoc/
    
  • Create a Heroku application using the following command

    heroku create <your-app-name>
    
  • Add buildpacks to the application using the following commands

    heroku buildpacks:set heroku/nodejs
    heroku buildpacks:add --index 2 heroku/python
    heroku buildpacks:add --index 3 https://github.com/imujjwal96/heroku-buildpack-pandoc.git
    heroku buildpacks:add --index 4 https://github.com/heroku/heroku-buildpack-cli
    heroku buildpacks:add --index 5 https://github.com/heroku/heroku-buildpack-jvm-common
    
  • Set the required Environment Variables using the following commands

    heroku config:set DEPLOYMENT=true
    heroku config:set ENCRYPTION_KEY=AVERYSECRETTOKENOFTHIRTYTWOCHARACTERS
    heroku config:set GITHUB_CALLBACK_URL=https://<your-app-name>.herokuapp.com/auth/github/callback
    heroku config:set GITHUB_CLIENT_ID=<github-generated-client-id>
    heroku config:set GITHUB_CLIENT_SECRET=<github-generated-client-secret>
    heroku config:set HEROKU_CALLBACK_URL=https://<your-app-name>.herokuapp.com/auth/heroku/callback
    heroku config:set HEROKU_CLIENT_ID=<heroku-generated-client-id>
    heroku config:set HEROKU_CLIENT_SECRET=<heroku-generated-client-id>
    heroku config:set HOSTNAME=<your-app-name>.herokuapp.com
    heroku config:set MONGODB_URI=mongodb://<username>:<password>@ds151662.mlab.com:51662/<mlab-db-name>
    heroku config:set PYPANDOC_PANDOC=~/vendor/pandoc/bin/pandoc
    heroku config:set SECRET=<a-very-secret-token>
    heroku config:set SMTP_USERNAME=<smtp-username>
    heroku config:set SMTP_PASSWORD=<smtp-password>
    heroku config:set SMTP_HOST=<smtp-host>
    heroku config:set SMTP_PORT=<smtp-port>
    
  • Now deploy your code

    git push heroku master
    
  • Visit the app at the URL generated by its app name

    heroku open
    

Your app should be available at : https://your-app-name.herokuapp.com/

Setup Auto-Deployment from GitHub repository

Sometimes, we might want to update our web application every time a new PR is merged a commit pushed to the repository. Heroku has just the tool for that!

Login to heroku.com

Visit Heroku's website and login with your credentials. After you are logged in, select the yaydoc project from the list available. When you're on the project page, navigate to the deploy tab.

Connect to GitHub

Change the deployement method from the Heroku Git option to GitHub. A window will popup requiring OAuth authorization to your GitHub account which you must approve.

Setup auto deploy and Deploy the application!

Once you have successfully linked your GitHub account to Heroku, search for a repository to connect to right below. You should select your fork of the yaydoc repository.

Choose either the master or development branch and enable the 'Wait for CI to pass before deploy' option. Now you can select Automatic Deploys and it is successfully setup.

Your app will automatically update with each update to your repository at : https://your-app-name.herokuapp.com/