Search code examples
amazon-web-servicesamazon-elastic-beanstalkjhipsterjhipster-registry

jHipster Registry on AWS Beanstalk


I've been looking for a way to deploy jhipster microservices to AWS. It seems like jhipster registry provides an easy way to monitor jhipster microservices but I am yet to find a way to deploy jhipster registry to AWS. Cloning jhipster-registry GitHub repo and running jhipster aws returns "Error: Sorry deployment for this database is not possible".

Alternatively, creating a Docker image with mvn compile jib:buildTar and using generated target/jib-image.tar as an AWS Beanstalk app version also fails because it's missing Dockerfile.

What's a good way to deploy jhipster registry to AWS Beanstalk and subsequently use it for monitoring other jhipster microservices deployed to AWS Beanstalk?

Thanks!


Solution

  • After some trial and error I ended up doing something like this:

    1. Clone https://github.com/jhipster/jhipster-registry

    2. Build a Docker container locally with ./mvnw package -Pprod verify jib:dockerBuild

    3. Create an ECR registry in AWS console or using AWS CLI as follows: aws --profile [AWS_PROFILE] ecr create-repository --repository-name [ECR_REGISTRY_NAME]

    4. Assuming that v6.3.0 was cloned in step 1, tag the local Docker as follows: image docker tag [IMAGE_ID] [AWS_ACCOUNT].dkr.ecr.[AWS_REGION].amazonaws.com/[ECR_REGISTRY_NAME]:jhipster-registry-6.3.0

    5. Authenticate to ECR as follows: eval $(aws --profile [AWS_PROFILE] ecr get-login --no-include-email --region [AWS_REGION])

    6. Push the local Docker image to ECR as follows: docker push [AWS_ACCOUNT].dkr.ecr.[AWS_REGION].amazonaws.com/[ECR_REGISTRY_NAME]:jhipster-registry-6.3.0

    7. Set up Elastic Beanstalk (EB) CLI

    8. Initialize local EB project as follows: eb init --profile [AWS_PROFILE]

    9. Create Dockerrun.aws.json with the following content:

    {
      "AWSEBDockerrunVersion": "1",
      "Image": {
        "Name": "[AWS_ACCOUNT].dkr.ecr.[AWS_REGION].amazonaws.com/[ECR_REGISTRY_NAME]:jhipster-registry-6.3.0",
        "Update": "true"
      },
      "Ports": [
        {
          "ContainerPort": 8761
        }
      ]
    }

    1. Run jhipster-locally as follows: eb local run --port 8761

    2. Verify that you can access jhipster-registry locally as follows: eb local open

    3. Create a new EB environment running the Docker image from the ECR as follows: eb create [EB_ENV_NAME] --instance-types t2.medium --keyname [EC2_KEY_PAIR_NAME] \ --vpc.id [VPC_ID] --vpc.ec2subnets [EC2_SUBNETS] --vpc.publicip --vpc.elbpublic --vpc.securitygroups [CUSTOM_ELB_SG]

    4. Access remote jhipster-registry as follows: eb open