11

Well it's been a while I suppose. Sorry I haven't been around for over a month guys. That's what happens when you're a full-time student with a full-time job.

Unfortunately, or fortunately depending on how you look at it, I need some advice/help. I've been working on a senior thesis project that I'm trying to deploy but I'm going crazy trying to figure out how to do it. It's a Spring Boot Java application built as a micro service. I've tried for the past 5 days to get this sucker working on Cloud Foundry with no luck. I've got a deadline to get this fucking thing live in 2 weeks and I'm getting closer to being in a panic. My question basically is, would it be easier to learn a different service/build my own solution from scratch then trying to fuck around with this? I'd appreciate anyone's advice who's had more experience with deploying Java web applications.

Here's a link to the project if anyone's interested: https://github.com/starrynights89/...

Comments
  • 1
    build from scratch its more fun
  • 1
    I'd be happy to help you out with regards to deployment.

    Since you are asking for advice. Wouldn't it be the same effort trying to learn how to do it in a different language or service? If you know other language or frameworks better than spring boot, you should go with that.
  • 2
    Nevermind. Just saw that Java is listed as the top one on your profile. So when you meant a different service, did you mean cloud foundry?
  • 2
    No cloud foundry experience I'm afraid, but have experience with Java and spring boot if I can be of help.
  • 0
    @badcoder Yeah, I mean a different service from Cloud Foundry. A lot of the sites are built for enterprises and I'm looking for something simple and easy as this is a one man project.
  • 1
    @AlmondSauce Have you had any prior experience pushing spring boot microservices to production?
  • 1
    @starrynights89 Not specifically spring boot in production I'm afraid - I have deployed small internal tools, but nothing major. Still, I'll help if I can.
  • 0
    @AlmondSauce I've also deployed smallish projects into production in the past too. I've used Heroku before to do that. What have you used?
  • 1
    @starrynights89 AWS or digital ocean, mainly. Heroku gets a bit too expensive too quickly.
  • 0
    If you want simplicity, then here's my two cents.

    1. Get rid of monorepo. It sounds amazing when Google devs say they love monorepo. What they don't tell you is that they have tons of automation scripts written around it that makes lives easier. And none of it is open source. Go with one to one for service to repository. I have been down the monorepo road. It's a pain in the ass.
    2. Why do you need a hystrix dashboard? Again... Netflix only tells you about the core. The automation around it is all hidden. If you are okay with reinventing the tooling, then go ahead. Otherwise choose something that is already available. Like datadog. It's cheap and works out of the box. I did some heavy lifting with stagemonitor and wrote a dozen plug-ins to automate things. But in the end datadog was cheaper considering development effort and maintaining an infrastructure.
    3. Forget eureka. I had my stint with consul too. DNS with Load balancer does the trick. Don't complicate stuff.
  • 0
    @AlmondSauce That's about the route I was thinking of going. Could I build a linux server relatively quickly in a week and a half?
  • 0
    4. Config server: how much of custom configuration are you looking at? There will be problems with config server. Spring boot has no way to discover a new config server after startup. Springcloud keeps pinging a config server up for new config after startup for new config. If one of the config servers go down it will log errors on every alternate call(round robin). I wrote a plug in for consul to fix that. Unless you have pretty complicated config, steer away from that. Static encrypted config is fine. It's good enough. Even environment variables are fine.

    If you are okay with spending some money on AWS, use ECS WITH EC2. To save money you can use autospotting. It's an amazing open source tool to replace all EC2 instances with spot instances. It saves tons of money. I have written many terraform scripts to automate the creation of infrastructure and deployment. If you are interested, let me know.
  • 1
    @starrynights89 If you just want to spin up a Linux VPS then you can do it in seconds on either platform.
  • 0
    @badcoder If I take out eureka, the config server, and hysteric than I basically just have 3 java micro service's that I'm looking to run. I don't know how much of my code would have to be rebuilt to work with docker and AWS, but I'm open to the idea.
  • 1
    I know it's been more than two cents. Having been in production with over two dozen microservices for two years, here's what I can tell you. Config server, eureka are dependencies. They will become bottlenecks and cause you loads of pain. Every microservice should be responsible for its own configuration and it's own setup.

    The microservice should be able to startup by itself. It shouldnt require other services for startup. Runtime dependencies are fine.

    Spring cloud is great to start with. But choose your tools carefully. Most of the projects are just core basics and don't mention the tons of automation and infrastructure maintainence you'd have to deal with.

    I use spring boot with cloud provided tooling. Like AWS ALB, DNS, routing etc. Unless you have very complicated routing rules, the default is fine. Most of the spring cloud projects would be overkill. Sure it locks me to AWS, but it gets the job done. Creating a cloud agnostic service requires a lot of effort.
  • 1
    @starrynights89 I am sorry I didn't look deeper into your code. Eureka would be for service discovery. You can use DNS with a load balancer to replace that. That'd be specific to deployment strategy.

    You can replace config server completely by just having profile specific configuration in resources directory for each service. If there are secrets, you can either pass them using environment variables or commit them by encrypting them and pass the decryption key using an environment variable during deployment.

    The code would remain unchanged because of these. Unless you are using ribbon based load balancing, the code should remain the same.
  • 0
    @badcoder Right, I see no real reason it would have to be modified for this. Would I need to build the applications into docker containers first or could AWS just work out the box with jar/war?
  • 1
    @starrynights89 and you can replace hystrix with more functional code by using retry functions(i am guessing thats what you are using it for) . They are pretty easy to write and monitor. You can also use reselience4j if you want something readymade.
  • 1
    @starrynights89 AWS can work with jar directly. Beanstalk is one option. But I found it way too expensive to run one service per EC2 instance. So I went ahead with a cluster with placement strategies. It's upto you how you want to do it. Docker containers are just 7 liner files for almost all the apps I have written.
  • 0
    @badcoder Gotcha. That gives me something to start working with. I think I'll go the AWS route with what code I have and go from there.
  • 0
    @starrynights89 if you need any help, let me know. In case you are interested in the terraform scripts for ECS, you can find it in my Github - https://github.com/sumitsarkar
Add Comment