Skip to content

lawkai/http4k-template

Repository files navigation

Continuous Integration (CI)

The GitHub action ci.yml contains the following:

  1. run ./gradlew check to make sure all tests pass.
  2. use semantic-release to manage release versions.
    • CHANGELOG will be updated if a new release being generated.
    • version in gradle.properties will be updated with the new version number.
    • new version tag will be created.
  3. dockerise the application
    • ./gradlew assemble to package the artifact (uber-jar).
    • use docker build to build the application and image tag with SHA and version.
      • Dockerfile will package the uber-jar from ./gradle assemble to the image.
    • use docker push to push the image to Amazon ECR.
      • the image will have two tags, one is the application version, the other one is the SHA of the commit as tag.

Setup

  1. This project uses pre-commit with the following hooks.
    pre-commit install --install-hooks -t pre-commit -t commit-msg -t pre-push
  2. If installed correctly, it will:
    1. check whether the commit message is following conventional-commit format.
    2. run ./gradlew build before push to make sure all tests passes.
  3. Please update settings.gradle.kts and gradle.properties to the correct name and version (0.0.1) of the project.
  4. remove the CHANGELOG.md file
  5. This project also uses spotless to make sure the project is properly formatted.
    • uses ktfmt dropboxStyle for formatting.
    • uses ktlint for linting.
    • uses diktat for additional code linting (check diktat-analysis.yml).

Amazon ECR Credentials

As this project uses Amazon ECR as the application image repository, it will require all the necessary credentials being setup in AWS.

  1. Create a dedicated system user in AWS which contains these permissions.
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "ecr:PutLifecyclePolicy",
                "ecr:CreateRepository",
                "ecr:DescribeRepositories"
            ],
            "Resource": "arn:aws:ecr:*:<your-account-id>:repository/*"
        },
        {
            "Sid": "VisualEditor1",
            "Effect": "Allow",
            "Action": "ecr:DescribeRegistry",
            "Resource": "*"
        }
    ]
}
  1. Generate API Key and Secret for this user.
  2. Import the API Key as AWS_ACCESS_KEY_ID and API Secret as AWS_SECRET_ACCESS_KEY into the GitHub Project Settings.
  3. TODO

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published