Skip to content

Commit

Permalink
Extended readme with manual on docker development
Browse files Browse the repository at this point in the history
  • Loading branch information
Fa8Bit committed Jun 13, 2024
1 parent a615926 commit 4e3daa2
Showing 1 changed file with 26 additions and 39 deletions.
65 changes: 26 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,75 +4,62 @@ The bugfinder backend stores the data of bugfinder instances and communicates re

# Development


## Getting started
> Beginning of additions (that work)
Make sure you have the following installed:

- Java: [JDK 1.17](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) or higher
- Maven: [Maven 3.6.3](https://maven.apache.org/download.cgi)
- Docker: [Docker](https://www.docker.com/)

Firstly, you have to change the `spring.datasource.username` and the `spring.datasource.password` in the `application.properties` file.
Then, if you changed the postgres URL/ port, you also have to change `spring.datasource.url`.
- PostgreSQL: [PostgreSQL](https://www.postgresql.org/download/)

### Run

#### Run with Docker-compose

Start all dependencies with our docker-compose files.
Check the [manual for docker-compose](https://github.com/Gamify-IT/docs/blob/main/dev-manuals/languages/docker/docker-compose.md).

To run the main branch with minimal dependencies use the `docker-compose.yaml` file.\
To run the latest changes on any other branch than `main` use the `docker-compose-dev.yaml` file.

#### Project build

### Project build
To build the project, run:
```sh
mvn install
```

in the folder of the project.
Go to the target folder and run

in the project folder.
Then go to the target folder:
```sh
java -jar bugfinder-service-0.0.1-SNAPSHOT.jar
cd target
```

### With Docker

Build the Docker container with

and run:
```sh
docker build -t bugfinder-backend-dev .
java -jar bugfinder-backend-0.0.1-SNAPSHOT.jar
```
to start the application.

And run it on port `8000` with

```
docker run -d -p 8000:80 -e POSTGRES_URL="postgresql://host.docker.internal:5432/postgres" -e POSTGRES_USER="postgres" -e POSTGRES_PASSWORD="postgres" --name bugfinder-backend-dev bugfinder-backend-dev
```

To monitor, stop and remove the container you can use the following commands:
### Build with docker
To run your local changes as a docker container, with all necessary dependencies,
build the Docker container with:

```sh
docker ps -a -f name=bugfinder-backend-dev
docker compose up --build
```

You can remove the containers with:
```sh
docker stop bugfinder-backend-dev
docker compose down
```

### Run local with dependencies
To run your local build within your IDE, but also have the dependencies running in docker, follow the steps
to build the project, then run the dependencies in docker with the following:
```sh
docker rm bugfinder-backend-dev
docker compose -f docker-compose-dev.yaml up
```

To run the prebuild container use

You can remove the containers with:
```sh
docker run -d -p 8000:80 -e POSTGRES_URL="postgresql://host.docker.internal:5432/postgres" -e POSTGRES_USER="postgres" -e POSTGRES_PASSWORD="postgres" --name bugfinder-backend ghcr.io/gamify-it/bugfinder-backend:latest
docker compose -f docker-compose-dev.yaml down
```

### testing database
> End of additions
### Testing database

to setup a database with docker for testing you can use

Expand Down

0 comments on commit 4e3daa2

Please sign in to comment.