Build and Deploy
Learn how to build and deploy your own version of Chartbrew
With time, this guide will be updated with more ways of deploying. Any PR is welcome!
Building the app
Follow the Getting Started guide to set up the project somewhere on your server.
Please note that you have to set all the production environmental variables in this case.
Keep in mind that the tools used in this guide are used as an example but they work really well. There might be multiple other tools that you can use, so feel free to do so if you wish.
Serving the app
This guide is tried and tested with Ubuntu. The settings should be the same on all operating systems, but some of the files and commands may vary.
Backend
The backend doesn’t need to undergo a build process. You need the following things to make sure it can be served:
- MySQL running
- A database is created so that Chartbrew can use it (it must be empty if it wasn’t used by Chartbrew before)
npm install
ran in the server folder ornpm run setup
in the project root folder- Environmental variables are set for Production (check
.env-template
in the root folder to see which)
Once all these are checked, we can either run npm run start
, or use an external tool like pm2
to monitor and manage Node apps better.
You can also start pm2 as a cluster to take advantage of your server’s multi-threading capabilities and 0-downtime reloads. If you wish to do this, replace the last command above with:
This will then run the server on the port
specified in server/settings.js
.
Frontend
The Frontend app needs to be built and then served using pm2 like above.
Create the pm2
configuration file:
Now you can start the front-end app with pm2 start app.config.json
Using the methods above, the app can be accessed on localhost. To serve it on a domain, check the deployment guides for different platforms in the sidebar.