How to configure your project to run on NeetoDeploy?

NeetoDeploy is made to be Heroku compliant. So if you app is setup to run on Heroku, it would more or less be compatible with NeetoDeploy as well. In this post, we will go through the basic setup that needs to be there in your application regardless of what stack you are using. Else, you can go through the stack specific tutorials for Rails + React applications and Node.js applications.

Requirements

  • Create neeto-deploy.json file

    • envs, addons, buildpacks

  • Add .node-version

  • Add engines to package.json

  • Create Procfile

  1. Create neeto-deploy.json file, with the following format:

{
  "name": "your-app-name",
  "scripts": {},
  "env": {
    "SECRET_KEY_BASE": {
      "generator": "secret"
    },
    "RACK_ENV": {
      "value": "heroku"
    },
    "RAILS_ENV": {
      "value": "heroku"
    },
    "AWS_ACCESS_KEY_ID": {
      "required": false
    },
    "AWS_SECRET_ACCESS_KEY": {
      "required": false
    },
    "HEROKU_APP_NAME": {
      "required": true
    },
    "LOG_LEVEL": {
      "value": "DEBUG"
    },
    "YARN_PRODUCTION": {
      "value": "true"
    },
    "YARN_CACHE": {
      "value": "true"
    },
    "NODE_MODULES_CACHE": {
      "value": "true"
    }
  },
  "formation": {},
  "addons": [
    {
      "plan": "heroku-postgresql",
      "options": {
        "version": "12"
      }
    },
    {
      "plan": "heroku-redis:hobby-dev"
    },
    {
      "plan": "bonsai:sandbox-6"
    }
  ],
  "buildpacks": [
    {
      "url": "heroku/nodejs"
    },
    {
      "url": "heroku/ruby"
    }
  ]
}

You can change the name, env, addons, buildpacks fields as per the requirement of your project.

For addons, here's a list of the addons currently supported:

  1. heroku-postgresql

  2. heroku-redis:hobby-dev

  3. bonsai:sandbox-6

For buildpacks, you can list them via neeto-deploy.json or you can select the buildpacks you need from the UI in the NeetoDeploy dashboard.

For deploying a Ruby on Rails application, we would mostly include all of the addons & buildpacks mentioned above in the same order. For static websites or Node.js applications, we must only include heroku/nodejs.

Read more about the neeto-deploy.json here.

  1. Add .node-version file

This file needs to be present, as it will be used during the build time to set the appropriate node version using which it can install the dependencies and run the build command

  1. package.json file must contain engines field

Here's an example of an engines config:

"engines": {
  "node": "18.12",
  "npm": "9.x",
  "yarn": "1.22.x"
}

.node-version file will allow NeetoDeploy to set the node version, but it does not give any information about which version of yarn to use, so this field must be present in package.json

If you are deploying a static website:

  • The scripts field in package.json must contain the build command

  • The scripts filed in package.json must contain a command which will serve the application in a specified port.

  1. Add Procfile

The Procfile lists all the processes or the dynos which are required to run your application. The release and web fields are mandatory. If we do not want anything to happen during the release phase, we can just simply include yarn -v as the command to be run, or any other command. The web command will be run once the build has been completed, which will start the application.

Example Procfile for Node.js app

In the below example we can see that we are using the serve command to start the application. We must make sure to include the serve command in package.json file.

release: yarn -v
web: yarn serve

Example Procfile for Rails + React app

web:  bundle exec puma -C config/puma.rb
worker: bundle exec sidekiq -C config/sidekiq.yml
release: bundle exec rake db:migrate setup_sample_data

If you've gone through the setup mentioned in Creating Projects in NeetoDeploy, commit all the above changes and open a PR. The review app for the PR should be deployed properly. You can then create a staging or production application from the NeetoDeploy dashboard and deploy your application.

Can't find what you're looking for?