Skip to content

Commit a1d59bb

Browse files
committed
bugfix
1 parent 064a0b8 commit a1d59bb

10 files changed

+56
-61
lines changed

Dockerfile

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ RUN echo "$LOG_TAG Prepare the application" \
77
mkdir /usr/local/app
88

99
COPY ./build/libs/template-SpringBoot-*.jar /usr/local/app/template-SpringBoot.jar
10-
10+
COPY ./public.tar.gz /usr/local/app/
1111
WORKDIR /usr/local/app
1212
RUN ls -al
13-
EXPOSE 8080
13+
RUN tar -xvzf ./public.tar.gz
1414

15+
EXPOSE 8080
16+
ENV CLASSPATH .;
1517
CMD ["java","-jar","/usr/local/app/template-SpringBoot.jar"]

Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ compose:
2626
.PHONY: compose.all
2727
compose.all:
2828
@ echo "[$(TAG)] ($(shell TZ=UTC date -u '+%H:%M:%S')) - Running docker-compose & application"
29+
@ ./gradlew clean build
30+
@ rm -rf public.tar.gz
31+
@ tar -cvzf public.tar.gz ./public
2932
@ docker stop $(docker ps -a -q) || true
3033
@ docker rm -f $(docker ps -a -q) || true
3134
@ docker volume rm $(docker volume ls -f dangling=true -q) || true
@@ -36,4 +39,4 @@ compose.all:
3639
.PHONY: mycli
3740
mycli:
3841
@ echo "[$(TAG)] ($(shell TZ=UTC date -u '+%H:%M:%S')) - Connecting to mysql"
39-
@ $(MYSQLCLIENT) -u root -h localhost application -p root
42+
@ $(MYSQLCLIENT) -u root -h localhost application -p root

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
# Torres SpringBoot Project templates
22
- https://torreswoo.github.io/posts/springboot-jolokia/
3+
- check `http://localhost:8080/dashboard`
4+
```bash
5+
$ make compose.all # start all
6+
or
7+
$ docker run -it -p 8080:8080 gcr.io/torrestemplate/template-springboot:1.0.0-SNAPSHOT
8+
```
39

410
## Start project
511
- build, run
612
```
13+
$ make compose.all # start all
14+
15+
$ make mycli
16+
$ make compose
717
$ ./gradlew build
818
$ ./gradlew bootrun
919
```

build.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ dependencies {
6767
compile "com.h2database:h2:$versions.h2"
6868
// datasource - JDBC
6969
compile "org.springframework.boot:spring-boot-starter-jdbc:${springBootVersion}"
70+
compile "mysql:mysql-connector-java:5.1.38"
71+
7072
// datasource - JPA
7173
compile "org.springframework.boot:spring-boot-starter-data-jpa:${springBootVersion}"
7274
}

build_docker_image.sh

-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
TAG="[build_docker_image.sh]"
44
usage="Usage: PUSH=[false|true] ENV=[PROD|DEV] $0"
55

6-
if [ "$ENV" != "PROD" ] && [ "$ENV" != "DEV" ] ; then
7-
echo ${usage}
8-
exit 1
9-
fi
10-
116
if [ "$PUSH" == "" ]; then
127
PUSH="false"
138
fi

docker-compose.application.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ services:
2222
image: jwilder/dockerize
2323
depends_on:
2424
- mysql
25-
command: dockerize -wait tcp://couchdb:5984 -wait tcp://mysql:3306 -timeout 5m
25+
command: dockerize -wait tcp://mysql:3306 -timeout 5m

src/main/resources/application.yml

+11-13
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
spring.datasource:
22
plarform: h2
3-
# driverClassName: org.h2.Driver
4-
# url: jdbc:h2:mem:mydb;DB_CLOSE_ON_EXIT=FALSE;MODE=MYSQL
3+
# driverClassName: org.h2.Driver
4+
# url: jdbc:h2:mem:mydb;DB_CLOSE_ON_EXIT=FALSE;MODE=MYSQL
55
driverClassName: com.mysql.jdbc.Driver
6-
url: jdbc:mysql://localhost:3306/${MYSQL_DATABASE:application}
6+
url: jdbc:mysql://mysql:3306/${MYSQL_DATABASE:application}
77
username: ${MYSQL_ROOT_USER:root}
88
password: ${MYSQL_ROOT_PASSWORD:root}
99
initialize: true # classpath:/schema.sql, import.sql, data.sql
10-
# validationQuery: SELECT 1
11-
# maxActive: 10
12-
# testOnBorrow: true
13-
# testOnReturn: false
1410

1511
## Pool Info ##
16-
maxActive: 100
12+
validationQuery: SELECT 1
13+
testOnBorrow: true
14+
testOnReturn: false
15+
maxActive: 10
16+
maxIdle: 10
17+
minIdle: 10
1718
initialSize: 20
18-
minIdle: 20
19-
validationQuery: select 1
20-
testWhileIdle: true
2119
timeBetweenEvictionRunsMillis: 5000 #5 second
2220
minEvictableIdleTimeMillis: 10000 #10 second
2321
validationQueryTimeout: 5
@@ -26,6 +24,6 @@ spring.datasource:
2624
spring.jpa:
2725
database: MYSQL
2826
show-sql: true
29-
properties.hibernate.hbm2ddl.auto: create # create, update, none, validate
27+
properties.hibernate.hbm2ddl.auto: update # create, update, none, validate
3028
properties.hibernate.format_sql: true
31-
properties.hibernate.use_sql_comments: true
29+
properties.hibernate.use_sql_comments: true

src/main/resources/data.sql

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
INSERT INTO USER_ACTION_LOG(id, action_time, user_id) VALUES(1, '2018-01-03 10:11:37', 10021); -- 10021이 계좌개셜
2-
INSERT INTO USER_ACTION_LOG(id, action_time, user_id) VALUES(2, '2018-01-04 10:11:37', 10022); -- 10022이 계좌개셜
3-
INSERT INTO USER_ACTION_LOG(id, action_time, user_id) VALUES(3, '2018-01-04 11:12:50', 10023); -- 10023이 계좌개셜
4-
INSERT INTO USER_ACTION_LOG(id, action_time, user_id) VALUES(4, '2018-01-06 10:11:37', 10024); -- 10024이 계좌개셜
5-
INSERT INTO USER_ACTION_LOG(id, action_time, user_id) VALUES(5, '2018-01-06 18:12:50', 10023); -- 10023이 100,000원을 카카오계좌로 충전
6-
INSERT INTO USER_ACTION_LOG(id, action_time, user_id) VALUES(6, '2018-01-07 11:12:50', 10023); -- 10023가 -> 10021에게 20,000원을 송금 / 받기
7-
INSERT INTO USER_ACTION_LOG(id, action_time, user_id) VALUES(7, '2018-01-07 12:12:50', 10024); -- 10024가 200,000원을 카카오계좌로 충전
1+
INSERT INTO user_action_log(id, action_time, user_id) VALUES(1, '2018-01-03 10:11:37', 10021); -- 10021이 계좌개셜
2+
INSERT INTO user_action_log(id, action_time, user_id) VALUES(2, '2018-01-04 10:11:37', 10022); -- 10022이 계좌개셜
3+
INSERT INTO user_action_log(id, action_time, user_id) VALUES(3, '2018-01-04 11:12:50', 10023); -- 10023이 계좌개셜
4+
INSERT INTO user_action_log(id, action_time, user_id) VALUES(4, '2018-01-06 10:11:37', 10024); -- 10024이 계좌개셜
5+
INSERT INTO user_action_log(id, action_time, user_id) VALUES(5, '2018-01-06 18:12:50', 10023); -- 10023이 100,000원을 카카오계좌로 충전
6+
INSERT INTO user_action_log(id, action_time, user_id) VALUES(6, '2018-01-07 11:12:50', 10023); -- 10023가 -> 10021에게 20,000원을 송금 / 받기
7+
INSERT INTO user_action_log(id, action_time, user_id) VALUES(7, '2018-01-07 12:12:50', 10024); -- 10024가 200,000원을 카카오계좌로 충전
88

99

1010
-- 계좌계설 --------------------------------------------------------------------
11-
INSERT INTO SERVICE_ACCOUNT_LOG(user_action_log_id, account_number) VALUES (1, '100-111-000');
12-
INSERT INTO SERVICE_ACCOUNT_LOG(user_action_log_id, account_number) VALUES (2, '200-111-000');
13-
INSERT INTO SERVICE_ACCOUNT_LOG(user_action_log_id, account_number) VALUES (3, '300-111-000');
14-
INSERT INTO SERVICE_ACCOUNT_LOG(user_action_log_id, account_number) VALUES (4, '400-111-000');
11+
INSERT INTO service_account_log(user_action_log_id, account_number) VALUES (1, '100-111-000');
12+
INSERT INTO service_account_log(user_action_log_id, account_number) VALUES (2, '200-111-000');
13+
INSERT INTO service_account_log(user_action_log_id, account_number) VALUES (3, '300-111-000');
14+
INSERT INTO service_account_log(user_action_log_id, account_number) VALUES (4, '400-111-000');
1515

src/test/java/com/torres/AppSpringBootMainTest.java

-28
This file was deleted.

template-SpringBoot.iml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module external.linked.project.id="template-SpringBoot" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="com.torres" external.system.module.version="0.0.1-SNAPSHOT" type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" inherit-compiler-output="true">
4+
<exclude-output />
5+
<content url="file://$MODULE_DIR$">
6+
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
7+
<excludeFolder url="file://$MODULE_DIR$/build" />
8+
<excludeFolder url="file://$MODULE_DIR$/out" />
9+
</content>
10+
<orderEntry type="inheritedJdk" />
11+
<orderEntry type="sourceFolder" forTests="false" />
12+
</component>
13+
</module>

0 commit comments

Comments
 (0)