feat: error out on Procfile extraction if the procfile is invalid

Refs #2991
Refs #3196
This commit is contained in:
Jose Diaz-Gonzalez
2018-07-29 13:01:28 -04:00
parent aeeb2e138f
commit 2db8f93507
10 changed files with 72 additions and 2 deletions

View File

@@ -23,6 +23,9 @@ extract_procfile() {
copy_from_image "$IMAGE" "Procfile" "$DOKKU_PROCFILE" 2>/dev/null || true
if [[ -f "$DOKKU_PROCFILE" ]]; then
dokku_log_info1_quiet "App Procfile file found ($DOKKU_PROCFILE)"
# shellcheck disable=SC2069
PROCFILE_ERRORS="$(procfile-util check "$DOKKU_PROCFILE" 2>&1 >/dev/null || true)"
[[ -n "$PROCFILE_ERRORS" ]] && dokku_log_fail "${PROCFILE_ERRORS}"
else
dokku_log_info1_quiet "No Procfile found in app image"
fi

View File

@@ -0,0 +1,5 @@
WAIT=2 # wait 2 seconds
TIMEOUT=5 # set timeout to 5 seconds
ATTEMPTS=2 # try 2 times
/ nodejs/express

View File

@@ -0,0 +1,11 @@
FROM node:4
EXPOSE 3001/udp
EXPOSE 3000/tcp
EXPOSE 3003
COPY . /app
WORKDIR /app
RUN npm install
CMD npm start

View File

@@ -0,0 +1,12 @@
###############################
# DEVELOPMENT #
###############################
# Procfile for development using the new threaded worker (scheduler, twitter stream and delayed job)
cron: node worker.js
web: node web.js
<<<<<<< HEAD=0
worker: node worker.js
========0
worker: node worker-2.js
>>>>>>> 5bb7ec3e2a8f4f6565432a4fc82c92d4a3603d28=0

View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
set -e; output="$(curl -s -S "$1")"; echo "$output"; test "$output" == "nodejs/express"

View File

@@ -0,0 +1,13 @@
{
"name": "node-example",
"version": "0.0.1",
"dependencies": {
"express": "2.5.x"
},
"engines": {
"node": "4.2.x"
},
"scripts": {
"start": "false"
}
}

View File

@@ -0,0 +1,12 @@
var express = require('express');
var app = express.createServer(express.logger());
app.get('/', function(request, response) {
response.send('nodejs/express');
});
var port = process.env.PORT || 5000;
app.listen(port, function() {
console.log("Listening on " + port);
});

View File

@@ -0,0 +1,6 @@
function worker() {
console.log('sleeping for 60 seconds');
setTimeout(worker, 60 * 1000);
}
worker();

View File

@@ -117,4 +117,4 @@ teardown() {
echo "output: "$output
echo "status: "$status
assert_success
}
}

View File

@@ -166,6 +166,13 @@ teardown() {
done
}
@test "(ps) dockerfile with bad procfile" {
deploy_app dockerfile-procfile
echo "output: "$output
echo "status: "$status
assert_failure
}
@test "(ps:scale) dockerfile with procfile" {
run bash -c "dokku ps:scale $TEST_APP web=2 worker=2"
echo "output: "$output
@@ -225,4 +232,3 @@ teardown() {
assert_success
done
}