Skip to content

Commit

Permalink
be/ReadMe (#28)
Browse files Browse the repository at this point in the history
* fix: remove jpa stuff from configuration

* doc: Add backend README.md
  • Loading branch information
OskarWiedeweg authored Dec 15, 2023
1 parent 85880d4 commit c18b79e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 8 deletions.
39 changes: 39 additions & 0 deletions backend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Backend

## Environment Variables

### Database

**``SPRING_DATASOURCE_URL``**: JDBC url to a postgres database. E.g.: `jdbc:postgresql://HOST:PORT/DATABASE`

**``SPRING_DATASOURCE_USERNAME``**: Account username for the postgres database.

**``SPRING_DATASOURCE_PASSWORD``**: Account password for the postgres database.

### Other

**``JWT_KEY``**: Key to sign all jwts. **A change in production would invalidate all json web tokens!**

## Local Development

We recommend using JetBrains IDE `IntelliJ IDEA`. The backend is a `Spring Boot Application`.
For local development we've set up a docker-compose file and a local application config.

Run the local docker-compose file:
```bash
docker-compose -f docker-compose-local.yml up -d
```

And **then** start the application with the `local` profile.
```bash
./mvnw spring-boot:run -Dspring-boot.run.profiles=local
```

**NOTE**: You can run the application in IntelliJ with a `Spring Boot` Run Configuration. There you have to set `Active Profiles` to `local`.

## Deployment

The application includes a `Dockerfile` and can be run everywhere. This project initially aimed to teach us the basics of
cloud work, so it will be automatically deployed to [Render](https://render.com).

**Please make sure to set all required environment variables before running the application.**
3 changes: 0 additions & 3 deletions backend/src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,5 @@ spring:
url: jdbc:postgresql://127.0.0.1:5432/local
username: user
password: pw
jpa:
hibernate:
ddl-auto: create-drop
jwt:
key: "Lo16Oo15M150c13mTlgdJUxj7ZlaBdteZsbkUClLN2I"
6 changes: 1 addition & 5 deletions backend/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
spring:
datasource:
driver-class-name: org.postgresql.Driver
jpa:
hibernate:
ddl-auto: update
database-platform: org.hibernate.dialect.PostgreSQLDialect
driver-class-name: org.postgresql.Driver

0 comments on commit c18b79e

Please sign in to comment.