From 55e483ba45b251d469c7a12bbaecf7a8a2ced9cf Mon Sep 17 00:00:00 2001 From: mirr254 Date: Tue, 7 Jun 2022 15:11:51 -0500 Subject: [PATCH 1/5] use official heroku nginx buildpack --- app.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.json b/app.json index c882eac..a09c03f 100644 --- a/app.json +++ b/app.json @@ -19,7 +19,7 @@ "url": "https://github.com/iAnanich/heroku-buildpack-vault" }, { - "url": "https://github.com/pallavkothari/heroku-buildpack-nginx" + "url": "https://github.com/heroku/heroku-buildpack-nginx.git" } ], "formation": { From 641752ca4f9549895a2b011c46b315e97d0f1fc7 Mon Sep 17 00:00:00 2001 From: mirr254 Date: Tue, 7 Jun 2022 15:30:43 -0500 Subject: [PATCH 2/5] remove .git --- app.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.json b/app.json index a09c03f..97a7e8a 100644 --- a/app.json +++ b/app.json @@ -19,7 +19,7 @@ "url": "https://github.com/iAnanich/heroku-buildpack-vault" }, { - "url": "https://github.com/heroku/heroku-buildpack-nginx.git" + "url": "https://github.com/heroku/heroku-buildpack-nginx" } ], "formation": { From 98ebf1988615fe7537e0c6374e3010e1876017ea Mon Sep 17 00:00:00 2001 From: mirr254 Date: Tue, 7 Jun 2022 15:35:33 -0500 Subject: [PATCH 3/5] remove missing file --- Procfile | 2 +- config/unicorn.rb | 5 +++++ unsealer.sh | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 config/unicorn.rb diff --git a/Procfile b/Procfile index 85c44d9..e267bfe 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: ./nginx-start.sh && bash start.sh +web: bin/start-nginx && bash start.sh \ No newline at end of file diff --git a/config/unicorn.rb b/config/unicorn.rb new file mode 100644 index 0000000..bc351d9 --- /dev/null +++ b/config/unicorn.rb @@ -0,0 +1,5 @@ +require 'fileutils' +listen '/tmp/nginx.socket' +before_fork do |server,worker| + FileUtils.touch('/tmp/app-initialized') +end \ No newline at end of file diff --git a/unsealer.sh b/unsealer.sh index 5e85652..c9f0aee 100755 --- a/unsealer.sh +++ b/unsealer.sh @@ -22,7 +22,7 @@ do echo "status = ${STATUS}" if [ ${STATUS} -eq 404 ]; then echo "listener is up" - curl -X PUT -d "$(generate_post_data)" http://127.0.0.1:${PORT:?}/v1/sys/unseal + curl -X PUT -d "$(generate_post_data)" http://127.0.0.1:8080/v1/sys/unseal echo "done unsealing" break else From 8bf90b3e6af4684b1f7998eb0aacea27204b66eb Mon Sep 17 00:00:00 2001 From: mirr254 Date: Tue, 7 Jun 2022 16:37:54 -0500 Subject: [PATCH 4/5] use PORT --- .nginx-start.sh | 11 +++++++++++ Procfile | 2 +- app.json | 2 +- config/unicorn.rb | 5 ----- dev-config.sh | 2 +- start.sh | 2 +- unsealer.sh | 6 +++--- 7 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 .nginx-start.sh delete mode 100644 config/unicorn.rb diff --git a/.nginx-start.sh b/.nginx-start.sh new file mode 100644 index 0000000..f72682c --- /dev/null +++ b/.nginx-start.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -eu + +if [ -f .nginx/bin/nginx-start ]; then + cd .nginx > /dev/null 2>&1 + eval "bin/nginx-start &" + cd - > /dev/null 2>&1 +else + echo "No .nginx/bin/nginx-start file found!" + exit 1 +fi \ No newline at end of file diff --git a/Procfile b/Procfile index e267bfe..9eeb22f 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: bin/start-nginx && bash start.sh \ No newline at end of file +web: bin/start-nginx bash ./start.sh diff --git a/app.json b/app.json index 97a7e8a..01c8ca7 100644 --- a/app.json +++ b/app.json @@ -16,7 +16,7 @@ }, "buildpacks": [ { - "url": "https://github.com/iAnanich/heroku-buildpack-vault" + "url": "https://github.com/crowdbotics/heroku-buildpack-vault#1.7.1" }, { "url": "https://github.com/heroku/heroku-buildpack-nginx" diff --git a/config/unicorn.rb b/config/unicorn.rb deleted file mode 100644 index bc351d9..0000000 --- a/config/unicorn.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'fileutils' -listen '/tmp/nginx.socket' -before_fork do |server,worker| - FileUtils.touch('/tmp/app-initialized') -end \ No newline at end of file diff --git a/dev-config.sh b/dev-config.sh index 2439fc0..ea36da5 100755 --- a/dev-config.sh +++ b/dev-config.sh @@ -9,7 +9,7 @@ storage "s3" { } listener "tcp" { - address = "127.0.0.1:8080" + address = "0.0.0.0:${PORT}" tls_disable = 1 } diff --git a/start.sh b/start.sh index af20050..8786b91 100755 --- a/start.sh +++ b/start.sh @@ -6,7 +6,7 @@ echo "starting vault..." ./dev-config.sh > /tmp/dev.json -# ./unsealer.sh & +./unsealer.sh & vault server -config=/tmp/dev.json diff --git a/unsealer.sh b/unsealer.sh index c9f0aee..fb68b71 100755 --- a/unsealer.sh +++ b/unsealer.sh @@ -18,11 +18,11 @@ FIRST=1 while true do - STATUS=$(curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:8080) + STATUS=$(curl -s -o /dev/null -w '%{http_code}' http://0.0.0.0:${PORT}) echo "status = ${STATUS}" if [ ${STATUS} -eq 404 ]; then echo "listener is up" - curl -X PUT -d "$(generate_post_data)" http://127.0.0.1:8080/v1/sys/unseal + curl -X PUT -d "$(generate_post_data)" http://0.0.0.0:$PORT/v1/sys/unseal echo "done unsealing" break else @@ -33,4 +33,4 @@ do echo -n "." fi sleep 1 -done +done \ No newline at end of file From 835d3b85f10566dc76d93c286f310ba2b8707efe Mon Sep 17 00:00:00 2001 From: mirr254 Date: Tue, 7 Jun 2022 18:09:24 -0500 Subject: [PATCH 5/5] remove unwanted file --- .nginx-start.sh | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 .nginx-start.sh diff --git a/.nginx-start.sh b/.nginx-start.sh deleted file mode 100644 index f72682c..0000000 --- a/.nginx-start.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -set -eu - -if [ -f .nginx/bin/nginx-start ]; then - cd .nginx > /dev/null 2>&1 - eval "bin/nginx-start &" - cd - > /dev/null 2>&1 -else - echo "No .nginx/bin/nginx-start file found!" - exit 1 -fi \ No newline at end of file