A simple distributed ID generator built in Kotlin & Ktor web framework.
Ensure you have gradle setup or you can use the gradle wrapper ( or gradle wrapper for windows if on windows platform) to setup and install dependencies. Also ensure you have Java setup on your local development machine
You can run the application with ./gradlew run
which will start the application on port 8080(this can be
changed here)
Alternatively, you can build a Jar file and run it directly from the Jar file.
Once you have a running application, simply make a HTTP GET request to get an ID:
$ curl --request GET --url http://localhost:8080/dig
{"id":"7003240899912138752"}
You can build the application with ./gradlew build
which will create a jar file that can be found in the build/libs
directory(not pushed to VCS).
Once you have a Jaf file built, you can run the application with:
java -jar dig-all.jar
To build for Docker, you will need to have Docker installed locally. The application can also be built to be run in a Docker container. There is a Dockerfile already setup & one can manually build a docker image with:
docker build -t <IMAGE_NAME> .
Note the
.
at the end of the command indicating that the root directory is being used.
Alternatively, you can build a docker image using gradle:
./gradlew buildImage
This uses the ktor plugin to handle building a docker image.
Tests can be run with the ./gradlew test
command
Linting has been setup with detekt and can be used with the command ./gradlew detekt
Github Actions is used to perform CI/CD for this project and the workflows can be found in the directory workflows. However, this is not limited to Github Actions as other setups also exist such as Gitlab & Bitbucket Pipelines whose config can be found here & here respectively.