Fork me on GitHub
#devops
<
2015-08-25
>
tom21:08:02

I'd like to get an uberjar deployed to an EC2 instance and switched over with minimal/zero downtime. I am hoping to enjoy something that feels as automated as possible and not writing java -jar uberjar.jar every time--like how capistrano or flightplan works in other languages/environments. I have nginx running in front of the jar and I'm thinking of how to juggle different ports and use proxy_port to get it done but that's also messy.

tom21:08:43

Naturally it would shut down the old one once the new one is up. And on reboot restart the right jar.

tom21:08:07

Do I just need to start writing bash scripts or daemon scripts to make that sort of behavior?

markmandel21:08:09

@tom - 3 questions (1) How are you deploying now? Do you use any particular tools? (2) How many machines do you have? (3) Do you have a load balancer?

tom21:08:34

@markmandel: 1) Publish over SSH with jenkins to get the jar sent over, then log in to do the java -jar command, switch port and restart nginx (or moving thing off the ELB depending on the service I'm deploying). 2) It varies, 6-10. 3) Si

markmandel21:08:10

1) Sounds like a great job for ansible

markmandel21:08:36

2) Why not just take the machines out of the load balancer, deploy, and then put it back in - no downtime

markmandel21:08:48

If you have that many machines

tom21:08:06

1) Just use ansible to restart nginx and start/stop the jars? that actually would probably work very well. 2) True, I'm just lazy I guess and spoiled from other dynamic and interpreted languages where you change a file and it's done haha, I guess it won't kill me to just move things around the load balancer each deployment.

markmandel21:08:16

It just feels like a more complicated problem otherwise

markmandel21:08:32

and you could use ansible to do the rolling deploy

markmandel21:08:56

the only other thought I had - deploy them out to each machine, but have it run on a different port

markmandel21:08:05

then configure the load balancer to switch to the new port in one go

markmandel21:08:44

but that could go wrong a lot faster than a rolling deploy - you can health check as you go, and if it fails, stop and rollback

markmandel21:08:51

and still no downtime

markmandel21:08:38

either that - or run on a service that manages all this stuff for you 😉

tom21:08:21

Move off aws? I'm not that powerful lol thanks for the insight!

markmandel21:08:31

Heh no worries

markmandel21:08:04

It may be worth eventually exploring the docker world - just because this type of thing becomes commoditized

Kira Sotnikov21:08:51

I recommend to take a look on CodeDeploy

tom21:08:56

I'll look into it. I used to use vagrant+puppet a long time ago but haven't had much of a chance to look into docker. Dockers runs on top of a Vagrant machine?

tom21:08:21

@lowl4tency: just google CodeDeploy?

Kira Sotnikov21:08:25

I deploy my jars from CircleCI via CodeDeploy

Kira Sotnikov21:08:33

tom: AWS CodeDeploy

tom21:08:35

well shit it's aws

Kira Sotnikov21:08:23

From your message >I'd like to get an uberjar deployed to an EC2 instance If you are using AWS using AWS’s services is good

tom21:08:57

makes sense, I'll look into that as well.

Kira Sotnikov21:08:38

tom: it works good in bundle with ELB, EC2 and AutoScaling.

Kira Sotnikov21:08:06

CircleCI has integration with CodeDeploy as well

markmandel21:08:53

Yeah sorry - I don't know AWS' services that well simple_smile

Kira Sotnikov21:08:16

I have been working with AWS services about 3 month

Kira Sotnikov21:08:12

Really best service simple_smile

Kira Sotnikov21:08:45

I extremely recommend use AWS services such RDS, Cloudformation, ElastiCache, CodeDeploy and anther instead 3d-party and own solutions

tom21:08:23

ok, I'll look into those. I've been using some of their other services but not as much with devops sort of things.

Kira Sotnikov22:08:50

tom: I highly recommend take a look on describing of all services by AWS simple_smile

Kira Sotnikov22:08:28

I’m periodically do it again and again. For example I’m waiting when AWS implement support CircleCI for CodePipeline simple_smile

Kira Sotnikov22:08:43

At the moment it supports only Jenkins as build provider 😞

tom22:08:56

nice, they have a lot of services

Kira Sotnikov22:08:24

It’s true simple_smile

Kira Sotnikov22:08:41

Lambda is awesome service as well

Kira Sotnikov22:08:56

Unfortunately I have not a case for this yet

Kira Sotnikov22:08:14

Lambda is able to run clojure code

tom22:08:01

that's awesome, I tried to use lambda but it wasn't available in one of the regions I needed it. One of these days.

Kira Sotnikov22:08:29

tom: yes, aws usually starts a service for one region

Kira Sotnikov22:08:54

Virginia or Oregon are first as rule

Kira Sotnikov22:08:16

Also, I use boto3 (A python3 library) by AWS

Kira Sotnikov22:08:26

Pretty good as well

Kira Sotnikov22:08:21

tom: feel free to ask questions about AWS simple_smile

tom22:08:01

I will haha, just reading on codepipeline. Do you work with docker at all?

Kira Sotnikov22:08:25

tom: actually I use simple ec2 servers

Kira Sotnikov22:08:43

tom: and if you use docker I can recommend to take a look on ECS

Kira Sotnikov22:08:53

I don’t see any benefits from docker for my projects at the moment but in future it’s possible I guess

Kira Sotnikov22:08:34

And docker brings additional questions about managing and orchestration of the containers

markmandel22:08:49

kuberntes 😉

markmandel22:08:15

But yes it does - but there is so much tooling around docker containers, the ecosystem is just getting better and better

markmandel22:08:22

but if it doesn't suit your needs yet - makes sense too

markmandel22:08:54

I'm waaaay down the docker hole these days 😉 so take it all with a grain of salt

tom22:08:58

I cannot find any good beginner guides that (dummies level) to get started with it. If I'm on windows, would I start a VM (like with vagrant) and connect docker to that?

markmandel22:08:21

boot2docker will be your friend

markmandel22:08:28

but I'm not a windows user (Linux all the way down)

Kira Sotnikov23:08:44

markmandel: agreed

markmandel23:08:37

I have to be honest, I don't know many Windows developers anymore. Unfortunately, I think you often get the short end of the stick