Deploy on Render β
Let's deploy your app on Render π
GitHub Repo β
Push your app to a repo on GitHub.
Create database β
Create the database you want to use for production on Render and take note of the connection url.
Database creation guides
See guides for MySQL, PostgreSQL, and, MongoDB on the Render docs.
Create Redis instance β
Create the production Redis instance and take note of the connection url.
Redis instance guide
See the guide to create a Redis instance on the Render docs.
Set up database β
Depending on the database you want to use for production, set up that adapter in config/environment/production.js
module.exports = {
datastores: {
default: {
adapter: 'sails-postgresql',
url: process.env.DATABASE_URL
}
}
}
module.exports = {
datastores: {
default: {
adapter: 'sails-mysql',
url: process.env.DATABASE_URL
}
}
}
module.exports = {
datastores: {
default: {
adapter: 'sails-mongo',
url: process.env.DATABASE_URL
}
}
}
WARNING
Don't forget to install the adapter if you haven't already. See the database docs for more info.
Set up Redis β
INFO
Create a new Redis instance on Render by following the Render docs.
Set up the Redis adapter in config/environment/production.js
module.exports = {
session: {
secret: process.env.REDIS_SECRET
adapter: '@sailshq/connect-redis',
url: process.env.REDIS_URL
}
}
Create a web service β
Create a new Node.js Web Service on Render, and give Render permission to access the repo of your app.
Use the following values during creation:
- Runtime:
Node
- Build command:
npm i
- Start command:
npm start
Set environment variables β
Add the following evironment variables to your web service:
DATABASE_URL
: This should point to the connection string of the database you created.REDIS_URL
: This should point to the connection string to the Redis instance you created.SESSION_SECRET
: A unique production session secret to override the one inconfig/session.js
.
Thatβs it! Your app will be live on your Render URL as soon as the build finishes π
Celebrate with a β β
Star The Boring JavaScript Stack repo on GitHub β
Let's celebrate deploying your app on Render by giving The Boring JavaScript Stack a star on GitHub.