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.jsonfileenvs, addons, buildpacks
Add .node-version
Add
enginestopackage.jsonCreate
Procfile
Create
neeto-deploy.jsonfile, 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:
heroku-postgresql
heroku-redis:hobby-dev
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.
Add
.node-versionfile
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
package.jsonfile must containenginesfield
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
scriptsfield inpackage.jsonmust contain thebuildcommandThe
scriptsfiled inpackage.jsonmust contain a command which will serve the application in a specified port.
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.