Fork me on GitHub

For anyone running an uberjar on an ec2 instance, behind AWS ELB, do you still put nginx in front of the app? Having a strange issue with infinite 301 redirect when trying it with ring-ssl, so thought that having nginx do the redirect might be better. It's an extra hop, but might be useful for other things i'm not aware of yet.


@stvnmllr2 i used to put nginx in front, but then i realised - there is no point


but i use the ELB to do the ssl termination


and how do you redirect from http to https?


i don't - the only port i have open is 443 - this is an API - all the html/js/css is static/SPA and served from s3/cloudfront, and cloudfront does the http->https redirect for free


@mccraigmccraig That sounds fun. I guess i could do that as well. Just more learning of aws first 🙂


oh, one final detail - we are using classic ELB, because history, and to get websockets to work we use ELB as a TCP proxy rather than an HTTP proxy... i think the newer ELB version says it will proxy websockets ok, but i haven't tried it


cloudfront is pretty straightforward - it will proxy different paths to origins like S3 or your API as you configure, you can terminate ssl with it, do http->https redirect, and set caching policies for your different origins


guessing there is no lein task to bundle up static resources for me? To upload to s3


that's on my todo - i was looking at - , 'cos we use boot for building cljs stuff


hmm. that's not what i was meaning to post


I never used a lein task, we just use awscli via aws s3 cp ...


and what do you use to gather the static resources together? Might be obvious, but it's all new to me


our boot build compiles cljs, less and gathers all resources into an output dir


@stvnmllr2 for SPA deployments, I just put everything inside a single directory (using things like the cljsbuild‘s :output-to) then aws s3 sync like @bja mentioned. The end result was pretty clean and integrates well with my CI (I use CircleCI for instance)


Thanks @andrewhr, Still not sure i'll end up down the s3 road, but I'll definitely look into it. Doubt it'd be that hard to put the output together manually even, but thought I'd ask.


I also use aws s3 sync. I was using lein-essthree for a while, which is nice because it also handles the "put your shared libraries onto S3" bit of Clojure development, but it seems to be abandonware so we're moving off of it