Skip to content

Commit

Permalink
Merge pull request #138 from yennanliu/dataPlatform-dev-001-add-becke…
Browse files Browse the repository at this point in the history
…nd-cluster

Data platform - Add BE app 2
  • Loading branch information
yennanliu authored Feb 18, 2024
2 parents 63f5cc0 + 5bf795d commit 6cb3363
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 11 deletions.
6 changes: 6 additions & 0 deletions SpringDataPlatform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ ARCHITECTURE :
```bash
docker-compose up

# rebuild (use updated java code) and run
docker-compose up --build

# restart
docker-compose restart

#--------------------------
# Macbook m1
#--------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# spring
server.port=9999
server.port=${SERVER_PORT:9999}

# upload file
server.tomcat.max-http-form-post-size=20MB
Expand Down
36 changes: 28 additions & 8 deletions SpringDataPlatform/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
version: '3'
services:
app:
app1:
restart: always
build: ./backend/DataPlatform
build: ./backend/DataPlatform/FlinkRestService # backend dockerfile
working_dir: /app
volumes:
- ./backend/DataPlatform:/app
- ~/.m2/repository:/root/.m2/repository # Mount Maven local repository
ports:
- "9999:9999"
environment:
Expand All @@ -16,7 +17,29 @@ services:
- SPRING_JPA_SHOW_SQL=true
- SPRING_JPA_HIBERNATE_DDL_AUTO=create # Set the Hibernate ddl-auto property here
- SPRING_JPA_GENERATE_DDL=true
#- JAVA_HOME=/usr/local/openjdk-11
- SERVER_PORT=9999
depends_on:
- mysql
command: mvn clean spring-boot:run -DskipTests

app2:
restart: always
build: ./backend/DataPlatform/FlinkRestService # backend dockerfile
working_dir: /app
volumes:
- ./backend/DataPlatform:/app
- ~/.m2/repository:/root/.m2/repository # Mount Maven local repository
ports:
- "9998:9998" # Port mapping for app2
environment:
- SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3306/data_platform
- SPRING_DATASOURCE_USERNAME=root
- SPRING_DATASOURCE_PASSWORD=
- SPRING_DATASOURCE_DRIVER_CLASS_NAME=com.mysql.cj.jdbc.Driver
- SPRING_JPA_SHOW_SQL=true
- SPRING_JPA_HIBERNATE_DDL_AUTO=create # Set the Hibernate ddl-auto property here
- SPRING_JPA_GENERATE_DDL=true
- SERVER_PORT=9998
depends_on:
- mysql
command: mvn clean spring-boot:run -DskipTests
Expand All @@ -35,8 +58,6 @@ services:
image: mysql:5.7
restart: always
environment:
#https://stackoverflow.com/questions/66831863/mysql-docker-container-keeps-restarting
#MYSQL_USER: root # NO NEED to create root user, since it is created automatically
MYSQL_DATABASE: data_platform
MYSQL_ROOT_PASSWORD:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
Expand All @@ -49,14 +70,13 @@ services:
image: nginx
restart: always
ports:
#- "8080:80"
- "8081:8081"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/index.html:/app/html:ro
depends_on:
- app
#- app2
- app1
- app2

volumes:
mysql-data:
4 changes: 2 additions & 2 deletions SpringDataPlatform/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ http {
keepalive_timeout 65;

upstream dataPlatform {
server app:9999;
#server app2:9998;
server app1:9999;
server app2:9998;
}

server {
Expand Down

0 comments on commit 6cb3363

Please sign in to comment.