Fork me on GitHub
#aws
<
2017-09-08
>
stvnmllr216:09:21

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.

mccraigmccraig16:09:06

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

mccraigmccraig16:09:17

but i use the ELB to do the ssl termination

stvnmllr216:09:40

and how do you redirect from http to https?

mccraigmccraig16:09:00

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

stvnmllr216:09:33

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

mccraigmccraig16:09:31

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

mccraigmccraig16:09:54

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

stvnmllr216:09:05

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

mccraigmccraig16:09:02

that's on my todo - i was looking at - https://github.com/martinklepsch/s3-beam , 'cos we use boot for building cljs stuff

mccraigmccraig16:09:47

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

bja16:09:37

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

stvnmllr216:09:01

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

mccraigmccraig16:09:19

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

andrewhr17:09:24

@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)

stvnmllr217:09:05

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.

timgilbert20:09:02

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