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

Add api #1

Merged
merged 11 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
Binary file added .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
# Images
# Start api

./mvnw clean package
В папке api: docker compose up -d



36 changes: 36 additions & 0 deletions api/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
SERVER_PORT=8081

# DATABASE
HOST=db-api
PORT_DB=5432
POSTGRES_SCHEMA=public
POSTGRES_DB=postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
LOG_SQL=true

# REDIS
REDIS_HOST=redis-api
REDIS_PORT=6379
REDIS_PASSWORD=cGFzc3dvcmxk
REDIS_CACHE_TIME=86400000

# MINIO
MINIO_BUCKET=files
MINIO_URL=http://minio-api:9000
MINIO_ROOT_USER=minioadmin
MINIO_ROOT_PASSWORD=minioadmin
MINIO_CONSOLE_PORT=9090
MINIO_PORT=9000

# MONGO
MONGO_INITDB_ROOT_USERNAME=admin
MONGO_INITDB_ROOT_PASSWORD=admin
MONGO_DB=mongo
MONGO_PORT=27017
MONGO_HOST=mongodb-note

# AUTH
ACCESS_EXPIRATION=86400000
REFRESH_EXPIRATION=604800000
JWT_SECRET=404E635266556A586E3272357538782F413F4428472B4B6250645367566B5970
7 changes: 7 additions & 0 deletions api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM openjdk:22

WORKDIR /app

COPY target/*.jar app.jar

CMD ["java", "-jar", "app.jar"]
5 changes: 5 additions & 0 deletions api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Info
.env файл со всем окружением/портами



52 changes: 52 additions & 0 deletions api/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
version: '3.8'

services:

backend-api:
container_name: backend-api
build:
context: .
dockerfile: Dockerfile
ports:
- "8081:8081"
depends_on:
- db-api
- redis-api
env_file:
- .env
db-api:
image: postgres:15.1-alpine
container_name: db-api
env_file:
- .env
ports:
- "5440:5432"
volumes:
- db-api-data:/var/lib/postgresql/data/

redis-api:
image: redis:7.2-rc-alpine
restart: always
container_name: redis-api
ports:
- '6379:6379'
command: redis-server --save 20 1 --loglevel debug --requirepass ${REDIS_PASSWORD}
volumes:
- redis-api-data:/data

minio-api:
image: minio/minio:latest
container_name: minio-api
env_file:
- .env
command: server ~/minio --console-address :9090
ports:
- '9090:9090'
- '9000:9000'
volumes:
- minio-api-data:/minio

volumes:
db-api-data:
redis-api-data:
minio-api-data:
Loading