0

I've setup stongloop on an ec2. Everything is running well. I can access the api explorer.

I use Strong Arc composer to discover models in the local mysql db, and make them public. I can see the exposed model on the file model-config.json in my app server folder.

But the explorer is not refreshing. I can't see the new models on the explorer. The solution I've found is to reboot the whole server, but I can't imagine this is the only solution. Is someone has a clue ?

Thanks,

Phillux
  • 33
  • 6
  • Based on the documentation seems like restarting is the suggested way: "After making changes to the application, click Restart button to restart the application so you can see the changes." http://docs.strongloop.com/display/APIS/Running+an+app – Alex V May 26 '15 at 17:34

1 Answers1

0

So the easiest solution I found is to kill the process and then relaunch using the following command: nohup service slc-initd start

Noting that my slc-initd is the following script in my init.d folder (no credit to me for this script):

#!/usr/bin/env bash

# chkconfig: 345 99 01
# description: startup of slc loopback

NAME="Init.d SLC"
NODE_BIN_DIR="/usr/bin"
NODE_PATH="/usr/lib/node_modules"
APPLICATION_DIRECTORY="/home/ec2-user/dev/mpos"
#APPLICATION_START="src/cluster-worker.js"
PIDFILE="/var/run/initd-example.pid"
LOGFILE="/var/log/slc-initd.log"

start() {
    echo "Starting $NAME"
    echo "cd $APPLICATION_DIRECTORY"
    cd $APPLICATION_DIRECTORY
    echo "slc run --pid $PIDFILE --log $LOGFILE"
    slc run  --pid $PIDFILE --log $LOGFILE
    RETVAL=$?
}

stop() {
    if [ -f $PIDFILE ]; then
        echo "Shutting down $NAME"
        echo "cd $APPLICATION_DIRECTORY"
        cd $APPLICATION_DIRECTORY
        echo "slc runctl stop"
    slc runctl stop
        # No need to get rid of the pidfile, slc does that for us.
        RETVAL=$?
    else
        echo "$NAME is not running."
        RETVAL=0
    fi
}

restart() {
    if [ -f $PIDFILE ]; then
        echo "Restarting $NAME"
        echo "cd $APPLICATION_DIRECTORY"
        cd $APPLICATION_DIRECTORY
        echo "slc runctl restart"
        slc runctl restart
    else
        echo "$NAME isn't currently running.  Starting from scratch ..."
        start
    fi
}

status() {
    echo "Status for $NAME:"
    cd $APPLICATION_DIRECTORY
    slc runctl status
    RETVAL=$?
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    status)
        status
        ;;
    restart)
        restart
        ;;
    *)
        echo "Usage: {start|stop|status|restart}"
        exit 1
        ;;
esac
exit $RETVAL
Phillux
  • 33
  • 6