Skip to content

BankApp - update lock logic #141

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

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft
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
19 changes: 19 additions & 0 deletions SpringDataPlatform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,25 @@ ARCHITECTURE :

```bash
docker-compose up

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

# restart
docker-compose restart

#--------------------------
# Macbook m1
#--------------------------

# run
docker-compose -f docker-compose-m1.yml up

# rebuild (use updated java code) and run
docker-compose -f docker-compose-m1.yml up --build

# restart
docker-compose -f docker-compose-m1.yml restart
```

</details>
Expand Down
12 changes: 9 additions & 3 deletions SpringDataPlatform/backend/DataPlatform/FlinkRestService/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,16 @@

<artifactId>FlinkRestService</artifactId>

<!-- <properties>-->
<!-- <maven.compiler.source>11</maven.compiler.source>-->
<!-- <maven.compiler.target>11</maven.compiler.target>-->
<!--&lt;!&ndash; <java.version>11</java.version>&ndash;&gt;-->
<!-- </properties>-->

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<!-- <java.version>11</java.version>-->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<!-- <java.version>11</java.version>-->
</properties>

<dependencies>
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
12 changes: 9 additions & 3 deletions SpringDataPlatform/backend/DataPlatform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@
<name>DataPlatform</name>
<description>Demo project DataPlatform</description>

<!-- <properties>-->
<!-- <maven.compiler.source>11</maven.compiler.source>-->
<!-- <maven.compiler.target>11</maven.compiler.target>-->
<!--&lt;!&ndash; <java.version>11</java.version>&ndash;&gt;-->
<!-- </properties>-->

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<!-- <java.version>11</java.version>-->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<!-- <java.version>11</java.version>-->
</properties>

<dependencies>
Expand Down
66 changes: 66 additions & 0 deletions SpringDataPlatform/docker-compose-m1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
version: '3'
services:
app:
restart: always
build: ./backend/DataPlatform
working_dir: /app
volumes:
- ./backend/DataPlatform:/app
ports:
- "9999:9999"
platform: linux/amd64
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
#- JAVA_HOME=/usr/local/openjdk-11
depends_on:
- mysql
command: mvn clean spring-boot:run -DskipTests

vue:
restart: always
build: ./frontend/data-platform-ui
working_dir: /app
platform: linux/amd64
ports:
- "8080:8080" # Map host port 8080 to container port 8080
volumes:
- ./frontend/data-platform-ui:/app # Mount the current directory into the container
command: npm run serve

mysql:
image: mysql:5.7
restart: always
platform: linux/amd64
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"
ports:
- "3306:3306"
volumes:
- mysql-data:/var/lib/mysql

nginx:
image: nginx
restart: always
platform: linux/amd64
ports:
#- "8080:80"
- "8081:8081"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/index.html:/app/html:ro
depends_on:
- app
#- app2

volumes:
mysql-data:
43 changes: 38 additions & 5 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 @@ -45,5 +66,17 @@ services:
volumes:
- mysql-data:/var/lib/mysql

nginx:
image: nginx
restart: always
ports:
- "8081:8081"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/index.html:/app/html:ro
depends_on:
- app1
- app2

volumes:
mysql-data:
2 changes: 1 addition & 1 deletion SpringDataPlatform/frontend/data-platform-ui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Navbar from "./components/Navbar.vue";
export default {
data() {
return {
baseURL: "http://localhost:9999",
baseURL: "http://localhost:8081", //nginx port : 8081, BE port : 9999, 9998, "http://localhost:9999",
users: null,
departments: null,
key: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ export default {

await axios({
method: "post",
url: "http://localhost:9999/" + "job/add",
//url: "http://localhost:9999/" + "job/add",
url: `${this.baseURL}/job/add`,
data: JSON.stringify(newJob),
headers: {
"Content-Type": "application/json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ export default {
async getSchemas() {
// fetch users
await axios
.get("http://localhost:9999/schema/active/")
//.get("http://localhost:9999/schema/active/")
.get(`${this.baseURL}/schema/active/`)
.then((res) => {
this.schemas = res.data.filter((x) => x.schemaName === "interpreter");
console.log(
Expand Down
4 changes: 4 additions & 0 deletions SpringDataPlatform/nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# FROM nginx:alpine
#
# COPY default.conf /etc/nginx/conf.d/
# COPY index.html /usr/share/nginx/html/
13 changes: 13 additions & 0 deletions SpringDataPlatform/nginx/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
ssi on;
}
7 changes: 7 additions & 0 deletions SpringDataPlatform/nginx/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<html>
<body>
<h1>Host: <!--#echo var="HOSTNAME" --></h1>
Version: 1.1
<h2>helloooooo worldddddd</h2>
</body>
</html>
36 changes: 36 additions & 0 deletions SpringDataPlatform/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
worker_processes 1;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;

sendfile on;
keepalive_timeout 65;

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

server {
listen 8081;
server_name localhost;

location / {
proxy_pass http://dataPlatform;
root /usr/share/nginx/html;
index index.html index.htm;
}

#error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# root html;
# }
}

include servers/*;
}
6 changes: 6 additions & 0 deletions springBank/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ docker-compose up
# restart
docker-compose restart

# run
docker-compose -f docker-compose.yml up

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

#---------------------------
# Macbook apple M1 chip
#---------------------------
Expand Down
Loading