Mup Troubleshooting

Posted by {"display_name"=>"greg", "login"=>"greg", "email"=>"greg@udon.org", "url"=>""} on January 08, 2017 · 1 min read

This is a cheatsheet on troubleshooting Mup, the Meteor deploy tool.

Since 2015, Mup started using Docker for deployments.

Docker Commands

[table]
command,use
sudo docker ps,show running containers
[/table]

Other Useful Commands

[table]
command,use
htop,Show resource use - sortable
[/table]

Server Directories & File Locations

Applications are stored under /opt.

Project Scripts & Config Files

These are the key scripts used by the Mup project:
[table]
meteor-deploy-check.sh,Check if deployment was successful
docker-setup.sh,Installs Docker if it isn't already installed
meteor-setup.sh,Create /opt/meteor and subdirs
meteor-start.sh,cd /opt/<AppName>; config/start.sh
meteor-stop.sh,sudo docker rm -f <AppName>; docker rm -f <AppName>-frontend
[/table]

Server Commands Used by Scripts

Here's an example
[table]
function,command
start app,/opt/<appName>/config/start.sh
show logs,docker logs --tail=50 /opt/
[/table]

Docker Containers

[table]
Runtime Name,Docker Image
mongodb,mongo:latest
<appName>,abernix/meteord:base
<appName>-frontend,abernix/meteord:base
[/table]

Startup Script

Here's an example startup script from an app called AppName:

#!/bin/bash

APPNAME=AppName
APP_PATH=/opt/$APPNAME
BUNDLE_PATH=$APP_PATH/current
ENV_FILE=$APP_PATH/config/env.list
PORT=8008

# Remove previous version of the app, if exists
docker rm -f $APPNAME

# Remove frontend container if exists
docker rm -f $APPNAME-frontend

# We don't need to fail the deployment because of a docker hub downtime
set +e
docker pull abernix/meteord:base
set -e

docker run \
  -d \
  --restart=always \
  --publish=$PORT:80 \
  --volume=$BUNDLE_PATH:/bundle \
  --hostname="$HOSTNAME-$APPNAME" \
  --env-file=$ENV_FILE \
  --link=mongodb:mongodb --env=MONGO_URL=mongodb://mongodb:27017/$APPNAME \
  \
  --log-opt max-size=100m --log-opt max-file=10 \
  \
  \
  --name=$APPNAME \
  abernix/meteord:base