From 89b782957e67950a3ffcfac5f4f43cc75ce7735d Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Wed, 25 Feb 2015 11:56:58 +0100 Subject: [PATCH] Add ability to run dev ruby server with SSL --- SSL_LOCALLY.md | 14 ++++++++++++++ waiter/script/server | 3 +++ 2 files changed, 17 insertions(+) create mode 100644 SSL_LOCALLY.md diff --git a/SSL_LOCALLY.md b/SSL_LOCALLY.md new file mode 100644 index 00000000..2e257751 --- /dev/null +++ b/SSL_LOCALLY.md @@ -0,0 +1,14 @@ +Sometimes there is a need to test the app with an SSL connection, for example for +testing pusher on Travis CI Pro. + +In order to run the app with SSL enabled you need to: + +* generate self signed certificate as described here: https://gist.github.com/trcarden/3295935 + * one difference is that you need to use localhost.ssl, because travis-api + doesn't whitelist localhost.ssl at the moment +* run ruby server with `SSL=true TRAVIS_PRO=true waiter/script/server` +* run Ember app in build mode only `TRAVIS_PRO=true ember build --watch` + +Now open the app on whatever port ruby server is running (3001 by default). The +ruby app will serve files generated by `ember build` and it will allow SSL +connections diff --git a/waiter/script/server b/waiter/script/server index 87b80f10..cc0ccbc4 100755 --- a/waiter/script/server +++ b/waiter/script/server @@ -4,5 +4,8 @@ cd "$(dirname "$0")/.." [ $RACK_ENV ] || RACK_ENV=development cmd="ruby -I lib -S bundle exec ruby -I lib -S puma -p $PORT" +if [ "$SSL" = true ] ; then + cmd="$cmd -b ssl://127.0.0.1:$PORT?key=server.key&cert=server.crt" +fi # [[ $RACK_ENV == "development" ]] && exec rerun "$cmd" -p '{lib,public}/**/*' exec $cmd