Skip to content

Getting Started

FKD13 edited this page Mar 28, 2024 · 13 revisions

Core dependencies

Openjdk-17

Before you do anything else, you should make sure openjdk-17 is installed and configured:

Arch Linux

sudo pacman -Sy jdk-openjdk
sudo archlinux-java set java-17-openjdk

Windows

As usual, the windows setup is a little more up to your own discretion, but the easiest way is downloading the following installer and running it:

Gradle

Just use the gradle wrapper script (see below) to run the commands. It will install the appropriate gradle version automatically.

Linux

./gradlew rundev

Windows

.\gradlew.bat rundev

Postgres database

To run development of the application you will need a working and preconfigured postgres instance.

Docker Compose

services:
  postgres:
    image: postgres
    environment:
      POSTGRES_DB: telraam_dev
      POSTGRES_USER: ${POSTGRES_USER:-telraam_user}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-iAMs00perSecrEET}
      PGDATA: /data/postgres
    volumes:
      - postgres:/data/postgres
    ports:
      - "5432:5432"
    restart: on-failure

volumes:
  postgres:

Arch Linux

Install the postgresql package

sudo -iu postgres
initdb --locale en_US.UTF-8 -D '/var/lib/postgres/data'
exit
sudo systemctl start postgresql.service
sudo -iu postgres
createdb telraam_dev
psql

>>> \c telraam_dev
>>> CREATE USER telraam_user WITH PASSWORD 'iAMs00perSecrEET';
>>> GRANT ALL PRIVILEGES ON DATABASE telraam_dev to telraam_user;
# If you your postgres version is >15 you should also run following command (You can find your current version with: postgres -V):
>>> GRANT USAGE, CREATE ON SCHEMA public TO telraam_user;

Windows

There is a prepackaged postgres installation by EDB which you can find here

Migrations

Run the gradle task to apply the migrations

Setting up your development environment

Below you can find setup instructions for the most common editors. Following these is not required to build or work on the project, but are rather highly recommended steps to make the development experience as smooth as possible. Feel free to add any instructions for more obscure editors.

Jetbrains Intellij

If you don't know which editor/ide you would like to use, Intellij comes with the highest recommendation. It has extensive gradle integration (and it even manages your gradle install for you), a simply awesome debugger, and a very smooth linter plugin which syncs with the linter settings on the build server.

Plugins

It is highly recommended to install the SonarLint plugin. This will make sure your commits will pass the linter checks on the build server. Just search for it in the Plugin interface.

Setup:

  • Open the project folder (if you cloned the repo without providing a name, this folder will be called "Telraam")

  • Intellij should prompt you with the message that is has found a gradle script, and ask you to import it. Click Import gradle project.

    • if you missed the prompt, right-click on the build.gradle file and select import gradle project.
  • You should now see a Gradle toolbar on the right side of the screen, below the Ant and Database buttons. From here you can run any gradle task that is configured.

    • We have provided preset Intellij run configurations in this project, which you should be able to select in the dropdown on the top left, next to the green play button.
  • Try to run the project by either selecting the Telraam [run] configuration and clicking the play button, or by running the Telraam->Tasks->application->run task from the Gradle toolbar. (They do exactly the same thing.)