Kotlin Journal Prompt Server (KtJournalPrompts)
This is a simple Spring Boot REST server that provides an API to create and read Journal Prompts.
These Journal Prompts can help you to write your own journal entries. they provide ideas for what to write about in your journal.
The journal prompts are stored in a backend database.
the database table(s) are created on the first executing of the application
The server currently has two database configuration profiles:
These can be selected between by using the
SPRING_PROFILES_ACTIVE environment variable.
if you choose to use H2 as the database a new file will be created called
KtJournalPrompts.h2 to store the prompt data.
To use MariaDb I have run a docker container using the following commands from a wsl terminal.
- Create a directory for the database to store persistent data and set its user so that we can execute mariadb without needing root access:
export DB_FILES_ROOT_DIR=/var/lib/mysql sudo mkdir $DB_FILES_ROOT_DIR -p sudo chown -R $USER:$USER $DB_FILES_ROOT_DIR $DB_FILES_ROOT_DIR
- Run the MariaDb docker container:
export DB_CONTAINER_NAME=mariadb-server docker run -d --name $DB_CONTAINER_NAME -p 3306:3306 -v /var/lib/mysql:/var/lib/mysql -e "MYSQL_ROOT_PASSWORD=ktjpheaven" mariadb
If you intend to run this on a public server you will need to change the passwords used.
once the database is running you can use the statements in
mariadb_init_script.sql to create the database and users.
I used this guide to set up MariaDb in a docker container.
Executing the Server
to run the server you can use one of the following methods:
- Run from within IntelliJ IDEA IDE.
- Run the server from the command line using the following command.
- Run the server inside a docker container.