feat: add minio dev docker config

This commit is contained in:
MiniDigger | Martin 2023-08-20 09:46:46 +02:00
parent 33d41b3893
commit 6bdb337b7f
8 changed files with 57 additions and 41 deletions

View File

@ -0,0 +1,18 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="backend json logging" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<envs>
<env name="JSON_LOGS_ENABLED" value="true" />
</envs>
<module name="hangar" />
<option name="SPRING_BOOT_MAIN_CLASS" value="io.papermc.hangar.HangarApplication" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="io.papermc.hangar.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

11
.run/docker.run.xml Normal file
View File

@ -0,0 +1,11 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="docker" type="docker-deploy" factoryName="docker-compose.yml" server-name="Docker">
<deployment type="docker-compose.yml">
<settings>
<option name="envFilePath" value="" />
<option name="sourceFilePath" value="docker/dev.yml" />
</settings>
</deployment>
<method v="2" />
</configuration>
</component>

View File

@ -32,7 +32,7 @@ Fork the project and pull it in your IDE.
To get the project running locally, you need to follow a few steps:
1. Get the dummy database and email server up and running. Move to the docker folder `cd docker` then run `docker-compose -f dev.yml up -d` (`-d` as an optional parameter
1. Get the dummy database, storage and email server up and running. Move to the docker folder `cd docker` then run `docker-compose -f dev.yml up -d` (`-d` as an optional parameter
to run the containers in the background).
Alternatively, if you are using IntelliJ you can press the green arrow in the `docker/dev.yml` file.
2. Move to the `backend` directory: `cd ../backend`. In that directory, run `mvn spring-boot:run`, or if you're using IntelliJ, it is included in the run
@ -75,10 +75,11 @@ to which dependencies are broken.
## Tracing
If you want to have traces available locally, you can run zipkin via Docker like this:
If you want to have traces available locally, you can run zipkin via the docker-compose file `zipkin.yml` in the docker folder like this:
```shell
docker run -d -p 9411:9411 openzipkin/zipkin
cd docker
docker-compose -f zipkin.yml up -d
```
Then just enable it in the `application.yml` under `management.tracing`.

View File

@ -191,10 +191,10 @@ hangar:
max-concurrent-jobs: 32
storage:
# type: "object" # uncomment to use object storage
access-key: "maaWFU0y2agLgJBD"
secret-key: "toOBAwlz3ZC6c4dvbFh7Ywk8Y2J4b3kS"
bucket: "test"
type: "object"
access-key: "hangar_root"
secret-key: "hangar_pass"
bucket: "hangar"
object-storage-endpoint: "http://127.0.0.1:9000"
cdn-endpoint: "http://127.0.0.1:9000"
cdn-include-bucket: true

View File

@ -1,12 +1,13 @@
version: '3.7'
version: "3.7"
name: hangar
services:
postgres:
build: ./postgres
image: postgres:15-alpine
environment:
POSTGRES_DB: hangar
POSTGRES_USER: hangar
POSTGRES_PASSWORD: 'hangar'
POSTGRES_PASSWORD: hangar
ports:
- "5432:5432"
volumes:
@ -16,12 +17,25 @@ services:
platform: linux/amd64
image: oryd/mailslurper:latest-smtps
ports:
- '4436:4436'
- '4437:4437'
- '1025:1025'
- "4436:4436"
- "4437:4437"
- "1025:1025"
minio:
image: "bitnami/minio:latest"
ports:
- "9000:9000"
- "9001:9001"
environment:
- MINIO_ROOT_USER=hangar_root
- MINIO_ROOT_PASSWORD=hangar_pass
- MINIO_DEFAULT_BUCKETS=hangar:public
volumes:
- minio_data:/data
volumes:
postgres_data:
minio_data:
networks:
default:

View File

@ -1,3 +0,0 @@
FROM postgres:alpine
COPY scripts /docker-entrypoint-initdb.d/

View File

@ -1,21 +0,0 @@
#!/bin/bash
set -e
set -u
function create_user_and_database() {
local database=$1
echo " Creating user and database '$database'"
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
CREATE DATABASE $database;
GRANT ALL PRIVILEGES ON DATABASE $database TO $POSTGRES_USER;
EOSQL
}
if [ -n "$POSTGRES_MULTIPLE_DATABASES" ]; then
echo "Multiple database creation requested: $POSTGRES_MULTIPLE_DATABASES"
for db in $(echo $POSTGRES_MULTIPLE_DATABASES | tr ',' ' '); do
create_user_and_database $db
done
echo "Multiple databases created"
fi

View File

@ -1,4 +0,0 @@
\c hangar;
CREATE EXTENSION hstore;
CREATE EXTENSION pgcrypto;