Fork me on GitHub
#aws
<
2022-07-05
>
Benjamin14:07:29

if you would build a web app ala clj-kit, how would you deploy? Just lambda?

Benjamin15:07:04

https://kit-clj.github.io/ I just mean the style of app. Like you have some website, and it has some frontend, users click around maybe

Benjamin15:07:13

I guess it was called kit-clj

Karol Wójcik17:07:38

Lambda and hl ring adapter to host static files if the size of a single file is less than 11MB and you dont expect much traffic. But if you do then S3 + Cloudfront is the cheapest option on AWS.

Dimitar Uzunov07:07:43

What artifacts does clj-kit produce? I assume a JAR + some static assets?

Dimitar Uzunov07:07:53

seems like the static assets are in the jar, so only a jar

Dimitar Uzunov07:07:24

I would probably deploy on an ec2 instance

Dimitar Uzunov07:07:35

the new graviton ones can be really affordable

Dimitar Uzunov07:07:56

and the JVM doesn’t care its ARM 🙂

Dimitar Uzunov07:07:19

You need to configure nginx with some nice secure setting, lets encrypt + a systemd service for the jar. If I were to do it from scratch I would template the configs with sablono which is included in babashka and run all of that from cloud-init - nice and simple 🙂

Dimitar Uzunov07:07:28

or I will try Lightsail (the AWS VPS); of course I’m making a lot of assumptions on the needs.

Karol Wójcik07:07:47

@U02CV2P4J6S can you elaborate what is your use case and what you need? How frequently the API will be used etc? PS: You can always develop your app with clj-kit and add hl-ring-adapter to target Lambda, since I know you mostly build apps on this service.

Benjamin07:07:19

sounds interesting. It would be single users (team mates in house) clicking around for a few minutes. The thing would serve I think small html files. 1. a session might be more than 15min 2. I like the user to login with oauth2, so I would like to keep a session around. I guess with lambda I would need to log them in again after 15min, or persist the session.

Karol Wójcik08:07:45

> persist the session Isn't oauth2 a stateless authentication strategy? Therefore by persist you mean a "cookie" on frontend side? If yes why would you bother with how long the lambda lives?

Benjamin09:07:41

You probably make perfect sense, yea. Indeed the fronted cookie fixes it

Karol Wójcik09:07:35

Okay, so if you expect only few mates to use the service then maybe you don't need Cloudfront, EC2, Nginx or whatever. Single lambda will do the trick.

Benjamin09:07:10

yea thanks. I'll keep EC2 in mind for the next bigger thing

Karol Wójcik09:07:38

Yeah, you can also switch to EC2 if you didn't like the Lambda experience. Adding/removing adapter to a project is 2/3 lines of code 🙂