Sign inSign up

yourrents/your-rents-api

By yourrents

•Updated almost 3 years ago

The backend API for the YourRents applications.

Image
0

113

yourrents/your-rents-api repository overview

Backend API for the YourRents applications

Look at the YourRents code repository for more infos: https://github.com/your-rents⁠

The image contains just the application, not the database, that must be provided separately.

⁠Running the service with Docker Compose

Create a docker-compose.yml file:

services:
  yrs-api:
    image: 'yourrents/your-rents-api:latest'
    restart: unless-stopped
    environment:
      - SPRING_PROFILES_ACTIVE=docker
    ports:
      - 8080:8080
    networks:
      - yrs-network
    depends_on:
      - yrs-db
  yrs-db:
    image: 'postgres:15'
    volumes:
      - yrs-db:/var/lib/postgresql/data
    environment:
      - 'POSTGRES_DB=your_rents_api'
      - 'POSTGRES_PASSWORD=your_rents_api'
      - 'POSTGRES_USER=your_rents_api'
    networks:
      - yrs-network
volumes:
  yrs-db:
    driver: local
networks:
  yrs-network:
    driver: bridge

A similar file is available also in the code repository: https://github.com/your-rents/your-rents-api/raw/main/docker-compose-yrs-api.yaml⁠

Then run it with:

docker compose up

Try the services at http://localhost:8080/swagger-ui.html⁠.

⁠Running the service alone

If you have a PostgreSQL database running on your machine, you can run the service alone.

First, create the database (using the postgres user):

postgres@yourhost:~$ createuser -P your_rents_api
Insert the password for the new role: <secret>
Confirm password: <secret>
postgres@yourhost:~$ createdb -O your_rents_api -E UTF-8 your_rents_api

Of course, you also need to grant the access to the database.

For example, in the postgresql.conf file:

listen_addresses = '*'

And in the pg_hba.conf file:

host    your_rents_api    your_rents_api    samenet    scram-sha-256

Then, run the service:

docker run --rm -it -p 8080:8080 --add-host host.docker.internal:host-gateway \
  -e SPRING_DATASOURCE_URL=jdbc:postgresql://host.docker.internal:5432/your_rents_api \
  -e SPRING_DATASOURCE_USERNAME=your_rents_api \
  -e SPRING_DATASOURCE_PASSWORD=<secret> \
  yourrents/your-rents-api

Tag summary

Content type

Image

Digest

sha256:a88fb2484…

Size

151.7 MB

Last updated

almost 3 years ago

docker pull yourrents/your-rents-api