Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.



A Spring Boot-based project meant both as a learning project (aka a WiP) and some or all of it as a template for other projects. The code comes as-is (aka I take no responsibility for it) and is always a work in progress.

Some of the tech used:

  • Spring Boot
  • Kotlin
  • Docker
  • Kafka
  • PostgreSQL
  • OAuth2

Install, Setup and Run


This project uses Docker. It is assumed that you have Docker installed and running on your system.


In the project's main directory, there is a file named "docker-infrastructure-base.yml". This contains the setup for the containers to be used in this project.

To start it up, from the project's main directory run the following at the commandline:

$ docker-compose -f docker-infrastructure-base.yml up -d

The first time this runs, you will see output showing the different images specified in the yml file starting and it will create a subdirectory in the project's main directory named:


In this directory will be files created & used by the PostgreSQL database run by Docker, allowing data to persist between Docker starts & stops.


With Docker started as shown above, we can now access and setup Postgresql for the project.

For this you will need some PostgreSQL client installed so that you can access & setup the database. I have PostgreSQL installed on my machine and thus can/will be using psql from the commandline.

From the commandline, run this script as root and with the (should-be-changed) root password "changeme!" .. which is specified in docker-infrastructure.yml)

$ psql -h localhost -p 5432 -d postgres -U postgres --password -f ./resources/db/create-database-and-user.sql

And this should create the projectx database, the projectx_adin role and the granting of needed admin privileges to that role.

Next, we need to bootstrap the database with the schema to be used and some data to get started. The SQL for this is in the file "create-schema-and-populate.sql".


For all of the passwords in this script whose value is "changeme!", you can generate your own by opening the
class SecurityUtil.kt, finding & replacing the string "changeme!" with one for yourself and then running it.  The
output can be used as the encrypted password in place of "changeme!"

Now run this script (which is using the database & credentials from the previous instruction):

$ psql -h localhost -p 5432 -d projectx -U projectx_admin --password -f ./resources/db/create-schema-and-populate.sql 

And the output should reflect that no errors occurred and that several tables were created and several rows were inserted.

To check that all is right, log in as the projectx_admin user and make sure it is alright:

$ psql -h localhost -p 5432 -d projectx -U projectx_admin --password

projectx=> \dt

    which should show you a list of tables
projectx=> select * from role;

    which should show you a list of roles
projectx=> \q        


Again with Docker started as shown above, we can now access Kafka for the project.

In the Kafka portion of the docker-compose setup file, it is specified that 3 topics be created: StartOrder, ProcessOrder and FinishOrder

Just like with PostgreSQL, you will want some kind of client to see what is going on inside of the Kafka instance. You can do this using an application like Conduktor (what I am using on my Mac) or from the commandline. I will demonstrate connecting and querying using the commandline.

First of all, we need to find the Kafka container name:

$ docker ps

CONTAINER ID        IMAGE                           COMMAND                  CREATED             STATUS              PORTS                                                NAMES

256a8e3d51f6        wurstmeister/kafka:2.12-2.2.1   ""         3 minutes ago       Up 3 minutes>9092/tcp                               projectx-kotlin_kafka_1
ab1740c29dc7        wurstmeister/zookeeper          "/bin/sh -c '/usr/sb…"   5 hours ago         Up 5 hours          22/tcp, 2888/tcp, 3888/tcp,>2181/tcp   projectx-kotlin_zookeeper_1
c5809bea35ba        postgres:11.4-alpine            "docker-entrypoint.s…"   6 hours ago         Up 5 hours>5432/tcp                               postgresql

In this case, it is "projectx-kotlin_kafka_1".

Log onto the Kafka container and it will take you to its bash prompt:

$ docker exec -it projectx-kotlin_kafka_1 bash

To see if the topics are there as expected, you can run this from the bash prompt:

# --list --bootstrap-server localhost:9092


There are any number of Kafka-related tasks you could do now. That's outside the scope of this. FWIW, I found these pages helpful:

Now, we want to exit the Kafka instance.

# exit

Another thing to note is that if you are using Intellij (or at the paid-for version), there is Docker support built-in:

You can’t perform that action at this time.