- Live: https://mathmlcloud.org
- Staging: https://staging.mathmlcloud.org
- Live API: https://mathmlcloud.org
- Staging API: https://staging.mathmlcloud.org
- The API URLs are the same as the app because we are bypassing the Azure API Management gateway for now since it has some unresolved issues.
Both live and staging VMs have the same admin user, mmlc. See Meghan or John for credentials.
The API runtime is managed by pm2, a Node tool for keeping a Node instance running.
Note: The SECRET_TOKEN environment variable is needed for the Github commit hook, described below.
The Vagrant file is configured to provision VMs on either Azure or VirtualBox. To provision a server for local development on VirtualBox:
To provision a server on Azure:
You will need the keys directory and a file named secrets.yaml in the app's root directory, ex:
Sails will not do any database migrations when running as production. Sails.js, http://sailsjs.org/#/documentation/concepts/Deployment, recommends using 1 of 2 approaches for database migrations:
1. Create the database on the server and then run your sails app with migrate:alter locally, but configured to use the production server as your db. This will automatically set things up.
2. In case you can't connect to the server remotely, you'll simply dump your local schema and import it into the database server.
Up to this point, all production database migrations for mathmlcloud.org have been performed by cloning the release branch, updating config/connections.js with the url to production's MongoLab database, and running sails lift in your local checkout's home directory, ex ~/boss/mathmlcloud-v5.1.5
A Github hook has been configured to deploy to staging on all pushes to the master branch. Typical workflow:
- Make changes locally and push to your fork of mmlc-api or mmlc-app.
- On github, create a pull request.
- Have a fellow developer do a code reading of your changes and merge the pull request into benetech's master repository.
- Once the request has been merged, a request will be sent to staging to update all code and restart the server.
Each of the repositories has a hook defined similarly:
- mmlc-app: https://github.com/benetech/mmlc-app/settings/hooks/4418833#deliveries
- mmlc-api: https://github.com/benetech/mmlc-api/settings/hooks/3321880#deliveries
The hook is implemented within the API in the api/controllers/GitHookController.js file.
- ssh to the server
- checkout the latest releases for the app and for the api. The api is installed at ~/mathml-cloud and the app is installed at ~/mathml-cloud/assets.
- install any new node packages
- restart the server
Starting the app as production will not perform any database migrations so they will have to be done locally (See Database changes above).
Steps to follow if website is down :
- Try restarting from Azure
- Run command to check if process is running by:
Should see one process running. If not , need to restart server by running the following command :