arunoda / meteor-up-legacy

Production Quality Meteor Deployments
MIT License
2.26k stars 394 forks source link

MUP Fails running out of cron #860

Open jeffhmngi opened 8 years ago

jeffhmngi commented 8 years ago

I have a set of scripts that watch a git repo for changes. If changes are detected, it does a git pull to fetch the updated files, then invokes another script to run the mup deploy.

The script is passed 2 arguments, the path of the meteor project, and the branch to deploy.

Script looks like so:

#!/bin/bash -x
#
# Deploy meteor using MUP
#

PROJPATH=$1
BRANCH=$2

case $BRANCH in
        master)
         cd /app/meteor/git
         mup deploy
         ;;
        beta)
         cd /app/meteor/git/mobile-dashboard/mup/beta
         DEBUG=* mup deploy
         ;;
        dev)
         cd /app/meteor/git/mobile-dashboard/mup/dev
         DEBUG=* mup deploy
         ;;
esac

This script works 100% of the time if manually invoked from a shell.

The script fails 100% of the time when run from cron. The log looks like so:

    Meteor Up: Production Quality Meteor Deployments
    ------------------------------------------------

    “ Checkout Kadira!
    It's the best way to monitor performance of your app.
    Visit: https://kadira.io/mup ”

    Building Started: /app/meteor/git/mobile-dashboard

With no other output in /var/log/upstart logs or elsewhere.

MasterJames commented 8 years ago

I've considered building that directly into the deployment itself. So just replace the files directly, but maybe more complicated then the script you showed. Maybe you could use scp directly overwrite the built files if doing from the deployment is not feasible. If using mupx you might find this process easy via docker exec command as well. It otherwise sounds mayne like a permissions issue. There's various Googleable ideas to check up on.

jeffhmngi commented 8 years ago

I did manage to get some more output from when this is running from cron.

I have 4 different meteor projects with different codebases and they all return this error when MUP is run from cron.

''' events.js:72 throw er; // Unhandled 'error' event ^ Error: spawn ENOENT at errnoException (child_process.js:1011:11) at Process.ChildProcess._handle.onexit (child_process.js:802:34) '''

This is running with the same user in cron as it is when run from an interactive shell. So It's not a permissions issue. Feels like MUP is looking for an env variable or something in a path that isn't there when invoked from cron, but is there when run from a normal shell.