Setup

All steps mentioned here have to be executed in the backend/ folder.

Setup

  1. Rename .env.sample to .env and enter the data according to your setup.
  • DATABASE_URL is the Connection URI to your PostgreSQL database
  • BIND_ADDRESS_HOST defines the host on which the server will run on
  • BIND_ADDRESS_PORT defines the port on which the server will run on
  • AUTH_HOST defines the host on which the auth server is running on
  • AUTH_CLIENT_ID the client id the frontend should use to log in
  • KEYCLOAK_CLIENT_ID the client id the server uses to communicate with keycloak (needs to be configured in keycloak)
  • KEYCLOAK_CLIENT_SECRET the client secret the server uses to communicate with keycloak (needs to be configured in keycloak)
  • RUST_LOG used to set the logging config for env_logger

To install an extension, a user needs to be a 'superuser',

The user 'permaplant' doesn't have the required permissions to create the 'postgis' extension.

Set it up using the postgres user.

Ensure that you grant the necessary permissions for the user to use Postgres.

One way to do this, is by using the following command:

sudo -u postgres psql
CREATE USER permaplant WITH CREATEDB PASSWORD 'permaplant';
ALTER USER permaplant WITH SUPERUSER;
  1. Install

To install dependencies.

make install
  1. migration

To update the database.

make migration
  1. build
make build
  1. Start Keycloak

To use the preconfigured Keycloak instance simply copy the newest version of .env.sample to .env

  1. run

To start the server

make run

Test server using Swagger

Go to http://localhost:8080/doc/api/swagger/ui/.
Now follow the steps described in the API documentation page.

You can find other ways to make requests by following How to obtain access tokens.