2017-02-06 13:40:28 -05:00
|
|
|
#!/bin/bash
|
2017-06-19 17:30:06 -04:00
|
|
|
set -eu -o pipefail
|
2017-02-06 13:40:28 -05:00
|
|
|
|
2017-02-28 14:09:44 -05:00
|
|
|
# Set up env variables for production
|
2018-05-10 08:42:58 -04:00
|
|
|
export AIO_CIRCLE_CI_TOKEN=$(head -c -1 /aio-secrets/CIRCLE_CI_TOKEN 2>/dev/null || echo "MISSING_CIRCLE_CI_TOKEN")
|
2017-06-20 03:27:46 -04:00
|
|
|
export AIO_GITHUB_TOKEN=$(head -c -1 /aio-secrets/GITHUB_TOKEN 2>/dev/null || echo "MISSING_GITHUB_TOKEN")
|
2017-02-28 14:09:44 -05:00
|
|
|
|
2018-08-15 08:47:45 -04:00
|
|
|
# Start the preview-server instance
|
2017-02-06 13:40:28 -05:00
|
|
|
action=$([ "$1" == "stop" ] && echo "stop" || echo "start")
|
2018-08-15 08:47:45 -04:00
|
|
|
pm2 $action $AIO_SCRIPTS_JS_DIR/dist/lib/preview-server \
|
2017-09-23 08:24:41 -04:00
|
|
|
--uid $AIO_WWW_USER \
|
2018-08-15 08:47:45 -04:00
|
|
|
--log /var/log/aio/preview-server-prod.log \
|
|
|
|
--name aio-preview-server-prod \
|
2017-02-06 13:40:28 -05:00
|
|
|
${@:2}
|