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.
Naturally it would shut down the old one once the new one is up. And on reboot restart the right jar.
Do I just need to start writing bash scripts or daemon scripts to make that sort of behavior?
@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?
@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
1) Sounds like a great job for ansible
2) Why not just take the machines out of the load balancer, deploy, and then put it back in - no downtime
If you have that many machines
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.
It just feels like a more complicated problem otherwise
and you could use ansible to do the rolling deploy
the only other thought I had - deploy them out to each machine, but have it run on a different port
then configure the load balancer to switch to the new port in one go
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
and still no downtime
sure
either that - or run on a service that manages all this stuff for you 😉
Move off aws? I'm not that powerful lol thanks for the insight!
Heh no worries
It may be worth eventually exploring the docker world - just because this type of thing becomes commoditized
I recommend to take a look on CodeDeploy
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?
@lowl4tency: just google CodeDeploy?
I deploy my jars from CircleCI via CodeDeploy
tom: AWS CodeDeploy
well shit it's aws
lol
nice
http://docs.aws.amazon.com/codedeploy/latest/userguide/welcome.html
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
makes sense, I'll look into that as well.
tom: it works good in bundle with ELB, EC2 and AutoScaling.
CircleCI has integration with CodeDeploy as well
ok cool
Yeah sorry - I don't know AWS' services that well :simple_smile:
I have been working with AWS services about 3 month
Really best service :simple_smile:
I extremely recommend use AWS services such RDS, Cloudformation, ElastiCache, CodeDeploy and anther instead 3d-party and own solutions
ok, I'll look into those. I've been using some of their other services but not as much with devops sort of things.
tom: I highly recommend take a look on describing of all services by AWS :simple_smile:
I’m periodically do it again and again. For example I’m waiting when AWS implement support CircleCI for CodePipeline :simple_smile:
At the moment it supports only Jenkins as build provider 😞
nice, they have a lot of services
It’s true :simple_smile:
Lambda is awesome service as well
Unfortunately I have not a case for this yet
Lambda is able to run clojure code
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.
tom: yes, aws usually starts a service for one region
Virginia or Oregon are first as rule
Also, I use boto3 (A python3 library) by AWS
Pretty good as well
tom: feel free to ask questions about AWS :simple_smile:
I will haha, just reading on codepipeline. Do you work with docker at all?
tom: actually I use simple ec2 servers
tom: and if you use docker I can recommend to take a look on ECS
https://console.aws.amazon.com/ecs/home?region=us-east-1#/getStarted
I don’t see any benefits from docker for my projects at the moment but in future it’s possible I guess
And docker brings additional questions about managing and orchestration of the containers
kuberntes 😉
But yes it does - but there is so much tooling around docker containers, the ecosystem is just getting better and better
but if it doesn't suit your needs yet - makes sense too
I'm waaaay down the docker hole these days 😉 so take it all with a grain of salt
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?
boot2docker will be your friend
but I'm not a windows user (Linux all the way down)
I found this docker book really good: http://www.amazon.com/Docker-Book-Containerization-new-virtualization-ebook/dp/B00LRROTI4/
I haven't read it, but http://www.amazon.com/Docker-Up-Running-Karl-Matthias-ebook/dp/B00ZGRS4XM/ came out recently as well
@markmandel: thanks!
Np!
markmandel: agreed
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