Skip to content

Production Deployment

Jessica Van Brummelen edited this page Jul 25, 2020 · 3 revisions

AppInventor has provided a server for Convo at userstudy.appinventor.mit.edu where the system can be deployed.

Prepare the WebSocket Connections

By default, the pages served by the UI connect via WebSockets to local servers, instead of explicitly connecting to the ones at userstudy.appinventor.mit.edu. To have the UI explicitly connect to the production servers, you have to comment and uncomment a couple of lines in a couple of the JS files.

  • In frontend/public/js/experiment.js:
    • Uncomment line 2 (const server = 'https://userstudy.appinventor.mit.edu/api';)
    • Comment out line 4 (const server = 'http://localhost:5000';)
  • In frontend/public/js/socket.js:
    • Uncomment lines 2-3 (const socket = io.connect("https://... and const socketApi = io.connect("https:...)
    • Comment out lines 5-6 (const socket = io.connect('http://localhost:8080'); and const socketApi = io.connect('http://localhost:5000');)

Deploy the Production System

To deploy the production system on the server, run

# Backs up the logs and deploys the production system
# Recommended
./deploy_prod.sh

# OR

# Just deploys the production system
docker-compose -f docker-compose.prod.yml up --build

If you are simply testing the system and want to deploy, use

# Backs up the logs and deploys the development system
# Recommended
./deploy.sh

# OR

# Just deploys the development system
docker-compose -f docker-compose.yml up --build

Scripts

There are three scripts that can be used to help streamline and automate tasks involving retrieving logs and deploying the production server.

  1. get_logs.sh moves all Docker logs from the default location mentioned above to a logs directory in the project directory. More specifically, a directory with its name being the time when the script was invoked will be created and all logs will be copied to that directory. For example, if time in milliseconds was 382382328, all logs at that moment will be copied to logs/382382328. This way, logs are backed up and not accidentally removed.
  2. deploy_prod.sh and deploy.sh both retrieve the logs (by calling get_logs.sh) before deploying the respective Docker containers in case containers are overwritten or logs get lost

Clone this wiki locally