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

Data platform - Add BE app 2 #138

Merged
merged 3 commits into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
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
Loading