Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

be/ReadMe #28

Merged
merged 2 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading