Skip to content

Commit

Permalink
ADD :: nginx, bug fix (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
gimhanul committed Sep 22, 2022
1 parent c432892 commit dbda533
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 98 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.DS_Store
.env
HELP.md
.gradle
build/
Expand Down
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ COPY ./ ./
RUN ./gradlew clean
RUN chmod +x ./gradlew
RUN ./gradlew bootJAR

ENV TZ=Asia/Seoul
FROM openjdk:11-jdk
COPY --from=builder build/libs/*.jar app.jar
EXPOSE 8080
ENV TZ=Asia/Seoul
ENTRYPOINT ["java","-jar","/app.jar"]
ENTRYPOINT ["java", "-jar", "/app.jar"]
6 changes: 2 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'org.springframework.boot' version '2.6.4'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'org.springframework.boot' version '2.7.3'
id 'io.spring.dependency-management' version '1.0.13.RELEASE'
id 'java'
}

Expand Down Expand Up @@ -34,8 +34,6 @@ dependencies {
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.2'
implementation 'org.springframework.boot:spring-boot-starter-data-redis'

implementation 'org.hibernate:hibernate-core:5.6.5.Final'

implementation 'org.apache.commons:commons-lang3:3.0'

implementation 'io.springfox:springfox-swagger-ui:2.9.2'
Expand Down
68 changes: 29 additions & 39 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,47 @@
version: '3.7'
version: "3"

services:

gati-db:
container_name: bamdoliro_gati_db
gati-web:
image: nginx
ports:
- 80:80
volumes:
- ./nginx/conf.d:/etc/nginx/conf.d
depends_on:
- gati-application

gati-database:
image: mysql:8.0
networks:
- gati-network
environment:
MYSQL_ROOT_HOST: '%'
MYSQL_DATABASE: ${DB_NAME}
MYSQL_USER: ${DB_USERNAME}
MYSQL_PASSWORD: ${DB_PASSWORD}
MYSQL_DATABASE: ${DB_NAME}
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
MYSQL_ROOT_PASSWORD: root
MYSQL_ROOT_HOST: '%'
expose:
- 3306
volumes:
- gati-volume:/var/lib/mysql
command:
- "mysqld"
- "--character-set-server=utf8mb4"
- "--collation-server=utf8mb4_unicode_ci"
volumes:
- dbvol:/var/lib/mysql
ports:
- ${DB_PORT}:${DB_PORT}
restart: always

gati-backend:
container_name: bamdoliro_gati_server
build:
context: .
dockerfile: ./Dockerfile
ports:
- "8080:8080"
networks:
- gati-network
depends_on:
- gati-db
env_file:
- .env
restart: always

redis:
container_name: bamdoliro_gati_redis

gati-redis:
image: redis:latest
hostname: ${REDIS_HOST}
command: redis-server --port ${REDIS_PORT}
ports:
- ${REDIS_PORT}:6379
networks:
- gati-network


networks:
gati-network:
name: gati-network
gati-application:
build: .
expose:
- 8080
env_file:
- .env
depends_on:
- gati-database

volumes:
dbvol:
gati-volume: {}
12 changes: 12 additions & 0 deletions nginx/conf.d/app.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
server {
listen 80;
access_log off;

location / {
proxy_pass http://gati-application:8080;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
56 changes: 4 additions & 52 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,18 @@
spring:
profiles:
active: local
mvc:
pathmatch:
matching-strategy: ant_path_matcher
---
spring:
config:
activate:
on-profile: local

datasource:
url: jdbc:mysql://127.0.0.1:3307/bamdoliro_gati
driver-class-name: com.mysql.cj.jdbc.Driver
username: bamdoliro
password: bamdoliro

jpa:
show-sql: true
generate-ddl: true
hibernate:
ddl-auto: update
properties:
hibernate:
format_sql: true


jwt:
secret: asdfasdfasdfasfasdfadsfadsfasdfsadfsdfasfsfasdfsafasdfasdfasfasfasdsafsdffadsfasdfasfasf

cache:
type: redis

redis:
host: localhost
port: 6379


socket:
config:
port: 9090

debug: true


logging:
level:
org.springframework.orm.jpa: DEBUG
org.springframework.transaction: DEBUG
---
spring:
config:
activate:
on-profile: prod

datasource:
url: jdbc:mysql://gati-db:${DB_PORT}/${DB_NAME}?useSSL=false&allowPublicKeyRetrieval=true
url: jdbc:mysql://gati-database:${DB_PORT}/${DB_NAME}?useSSL=false&allowPublicKeyRetrieval=true
driver-class-name: com.mysql.cj.jdbc.Driver
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
dialect: org.hibernate.dialect.MySQL8Dialect

jpa:
database: mysql
database-platform: org.hibernate.dialect.MySQL8Dialect
hibernate:
ddl-auto: update
properties:
Expand Down

0 comments on commit dbda533

Please sign in to comment.