Maven toolchain and heroku/cloud deployment

137 views Asked by At

This is going to be a broad topic so please bear with me. So I build a microservices app started as a hobby and now in the few months I put into it I made something useful. So, far I used STS (spring tool) with maven and Eureka client. I have an independent microservices talking to each other and a UI microservice that present the results to you. It's a single page app I will lay down the structure (GitHub repo also same) :

--my-app
  --my-microservice-discovery
  --my-microservice-domain (jdk12)
  --my-microservice-searcher
  --my-microservice-orchestrator
  --my-microservice-ui
  --my-transferobjects (common jar not microservice)
  --pom.xml (my main module pom)

So, this is what I am dealing with in GitHub I made a single repository of my-app containing all these spring boot projects, in IDE everything works, now comes the deployment part on some cloud provider. I choose Heroku as I had some experience with it in the past but also because I cannot make this work with Google (although they have an attractive starter scheme going on right now). Connecting to a private GitHub repo from Google Cloud build is pain, but Heroku does this with style.

I decided to go command line because that's how I have to deal on the cloud and that's where all hell broke loose, I got lots of dependencies issues between the version of JDKs managed well by IDE but not defined correctly for maven yet.

I am still managed to make my local build success (command line) but I had to do some hard-code configuration to fix jdk12 for a my-microservice-domain pom like below and similar fix for my-transfer objects but because of the Lombok issue no idea why I have to provide jdk8 specifically for this project.

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>12</source>
                <target>12</target>
                <executable>/home/Downloads/jdk-12</executable>
            </configuration>
        </plugin>
    </plugins>
</build>

My questions are as follows :

  1. Do we have a toolchain example to handle this different JDK compilation issue plus do we always have to provide the JDK local installation path?
  2. How to deploy this on Heroku, how it will know where is my jdk12 is, or just defining the source/target version in pom will do the trick on the cloud, also Heroku supports jdk12 or google cloud?
  3. Is it a good idea to have multi-repo or single repo deployment I can still change but I like it this way.
  4. I get it that I need to create docker images for each of my microservices, but someone has a tutorial to do so locally first, or some GitHub repo so that I can look some examples.
  5. Once I add all those docer files in each microservice is this sufficient to deploy its production level? I read a lot about APIGateway, load balancer .. where they fit into my architecture.
  6. I also use localhost everywhere for EurekaServer and Eureka/Feign client properties will it also work the same way on the cloud and Eureka server will be able to find all my services as it does locally with no config changes needed on cloud?
  7. What is better Google cloud or Heroku, google cloud seems a bit of a hassle for now.

These are my worries please advise.

1

There are 1 answers

0
SatSom On

Ok I am going to answer my own question I did bit of reading and what @cool suggested above and I ended up going multiple repository way and I achieved what was needed. I also chosen Heroku simply because the ease of things there felt like my local environment and such a simple app like mine on latest binaries has no problem whatsoever. I followed few links for setting up my Eureka server and client and Procfile and some environment variable direcrlt from your Apps settting page from dashboard. Needless to say I also maintained multiple profiles (dev,prod,test) and for ui I use vaadin hence some additional step needed in your UI app pom.xml for production.

I am bit of concerned with the way my services were terminated of no activity on heroku plus right now the issue with services discovery among each other. So my eureka server reports > all instances but they cannot contact each other.

Right now I am busy with other things [viz. fixing bugs] as launch is a month later. I will soon post a question about this ;).