2.7 KiB
2.7 KiB
Deployment
This document contains information about how to deploy to production, all of the different platforms and tools, and how to configure them.
WIP.
- Production Setup/Installation
- Travis
- Docker Hub
- Kubernetes
- S3
- Mailgun
- Cloudflare
- DNS/Dreamhost
- mLab
Deployment Process
These are the steps that happen when you deploy the application.
- Push to
master
branch, or merge in a pull request to themaster
branch. - This triggers a build on Travis CI.
- Travis CI builds a (development) Docker image of the whole application.
- Travis CI runs some tests, which in this case, is just
npm run lint
. This could be updated in the future to include more extensive tests. If the tests fail, the build stops here. - If the tests pass, then Travis CI builds a (production) Docker image of the whole application.
- This image is pushed to Docker Hub with a unique tag name (the Travis commit) and also to the
latest
tag. - The Kubernetes deployment is updated to image just pushed to Docker Hub on the cluster on Google Kubernetes Engine.
Production Installation
You'll only need to do this if you're testing the production environment locally.
- Clone this repository and
cd
into it $ npm install
- Install MongoDB and make sure it is running
$ cp .env.example .env
- (NOT Optional) edit
.env
and fill in all necessary values. $ npm run fetch-examples
- this downloads the example sketches into a user called 'p5'$ npm run build
- Since production assumes your environment variables are in the shell environment, and not in a
.env
file, you will have to runexport $(grep -v '^#' .env | xargs)
or a similar command, see this Stack Overflow answer. $ npm run start:prod
Self Hosting - Heroku Deployment
If you are interested in hosting and deploying your own p5.js Web Editor instance, you can! It would be the same as the official editor instance at editor.p5js.org, except with a different domain, and you would be in charge of the maintenance. We recommend using Heroku as you can host it for free.
- Sign up for a free account at: Heroku
- Click here:
- Enter a unique App name, this will become part of the url (i.e. https://app-name.herokuapp.com/)
- Update any configuration variables, or accept the defaults for a quick evaluation (they can be changed later to enable full functionality)
- Click on the "Deploy app" button
- When complete, click on the "View app" button