Skip to content

Commit

Permalink
Merge pull request #23 from hwangdaesun/feat/JNU-econovation#206
Browse files Browse the repository at this point in the history
배포
  • Loading branch information
hwangdaesun committed May 3, 2024
2 parents 071f198 + 91e76f4 commit f5d5d6e
Show file tree
Hide file tree
Showing 33 changed files with 1,462 additions and 199 deletions.
2 changes: 1 addition & 1 deletion BE/exceed/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ ARG JAR_FILE="./build/libs/*.jar"
COPY ${JAR_FILE} eatceed.jar

EXPOSE 8080
CMD ["java", "-jar", "-Dspring.profiles.active=dev", "eatceed.jar"]
CMD ["java", "-jar", "-Dspring.profiles.active=dev", "eatceed.jar", "../food_data.csv"]
9 changes: 9 additions & 0 deletions BE/exceed/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ dependencies {

//Swagger
implementation 'org.springdoc:springdoc-openapi-ui:1.6.11'

//OpenCsv
implementation group: 'com.opencsv', name: 'opencsv', version: '5.7.1'

// Actuator
implementation 'org.springframework.boot:spring-boot-starter-actuator'

// Prometheus
runtimeOnly 'io.micrometer:micrometer-registry-prometheus'
}

tasks.named('bootBuildImage') {
Expand Down
35 changes: 35 additions & 0 deletions BE/exceed/docker-compose.monitoring.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: '3'
services:

grafana:
image: grafana/grafana:latest
container_name: grafana
restart: always
ports:
- "3000:3000"
volumes:
- grafana-data:/var/lib/grafana
- ./resources/gaebaljip-develop-environment/grafana/provisioning/:/etc/grafana/provisioning/
environment:
- GF_SERVER_ROOT_URL=https://eatceed.net:3000
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD}
depends_on:
- prometheus

prometheus:
image: prom/prometheus:latest
container_name: prometheus
restart: always
ports:
- "9090:9090"
volumes:
- ./resources/gaebaljip-develop-environment/prometheus/config:/etc/prometheus/
- prometheus-data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'


volumes:
grafana-data:
prometheus-data:
9 changes: 3 additions & 6 deletions BE/exceed/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ services:
expose:
- "3306"
volumes:
- ./resources/gaebaljip-local-develop-environment/mariadb-conf:/etc/mysql/conf.d
- ./resources/gaebaljip-local-develop-environment/mariadb-init:/docker-entrypoint-initdb.d
- ./resources/gaebaljip-develop-environment/mariadb-conf:/etc/mysql/conf.d
- ./resources/gaebaljip-develop-environment/mariadb-init:/docker-entrypoint-initdb.d
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_ROOT_HOST=%
Expand All @@ -24,9 +24,7 @@ services:
- gaebaljip-network

eatceed-backend:
build:
context: .
dockerfile: Dockerfile
image: hwangdaesun/gaebaljip-dev:latest
container_name: gaebaljip-spring
ports:
- 8080:8080
Expand All @@ -52,6 +50,5 @@ services:
restart:
on-failure


networks:
gaebaljip-network:
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
global:
scrape_interval: 15s
evaluation_interval: 15s

rule_files:
scrape_configs:

- job_name: "spring-actuator"
metrics_path: '/actuator/prometheus'
scrape_interval: 1s
static_configs:
- targets: ['https://eatceed.net:8081']

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[client]
default-character-set = utf8mb4

[mysql]
default-character-set = utf8mb4

[mysqld]
character-set-server = utf8mb4
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CREATE
USER 'gaebaljip-local'@'localhost' IDENTIFIED BY 'gaebaljip-local';
CREATE
USER 'gaebaljip-local'@'%' IDENTIFIED BY 'gaebaljip-local';

GRANT ALL PRIVILEGES ON *.* TO
'gaebaljip-local'@'localhost';
GRANT ALL PRIVILEGES ON *.* TO
'gaebaljip-local'@'%';

CREATE
DATABASE gaebaljip DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
use gaebaljip;


CREATE TABLE `MEMBER_TB`
(
`MEMBER_PK` bigint(20) NOT NULL AUTO_INCREMENT,
`CREATED_DATE` datetime(6) NOT NULL,
`UPDATED_DATE` datetime(6) NOT NULL,
`MEMBER_ACTIVITY` varchar(255) DEFAULT NULL,
`MEMBER_AGE` int(11) DEFAULT NULL,
`MEMBER_ETC` varchar(255) DEFAULT NULL,
`MEMBER_GENDER` tinyint DEFAULT NULL,
`MEMBER_HEIGHT` double DEFAULT NULL,
`MEMBER_EMAIL` varchar(255) NOT NULL UNIQUE,
`MEMBER_PASSWORD` varchar(255) NOT NULL,
`MEMBER_ROLE` varchar(255) DEFAULT NULL,
`MEMBER_WEIGHT` double DEFAULT NULL,
`MEMBER_CHECKED` bit NOT NULL,
PRIMARY KEY (`MEMBER_PK`)
) ENGINE=InnoDB;

CREATE TABLE `WEIGHT_TB`
(
`WEIGHT_PK` bigint(20) NOT NULL AUTO_INCREMENT,
`CREATED_DATE` datetime(6) NOT NULL,
`UPDATED_DATE` datetime(6) NOT NULL,
`WEIGHT_WEIGHT` double DEFAULT NULL,
`WEIGHT_TARGET_WEIGHT` double DEFAULT NULL,
`MEMBER_FK` bigint(20) DEFAULT NULL,
PRIMARY KEY (`WEIGHT_PK`),
FOREIGN KEY (`MEMBER_FK`) REFERENCES `MEMBER_TB` (`MEMBER_PK`)
) ENGINE=InnoDB;


CREATE TABLE `FOOD_TB`
(
`FOOD_PK` bigint(20) NOT NULL AUTO_INCREMENT,
`FOOD_CALORIE` double NOT NULL,
`FOOD_CARBOHYDRATE` double NOT NULL,
`FOOD_FAT` double NOT NULL,
`FOOD_MAIN_CATEGORY` varchar(255) NOT NULL,
`FOOD_NAME` varchar(255) NOT NULL,
`FOOD_PROTEIN` double NOT NULL,
`FOOD_SERVING_SIZE` double NOT NULL,
`FOOD_SUB_CATEGORY` varchar(255) NOT NULL,
PRIMARY KEY (`FOOD_PK`)
) ENGINE=InnoDB;


CREATE TABLE `MEAL_TB`
(
`MEAL_PK` bigint(20) NOT NULL AUTO_INCREMENT,
`CREATED_DATE` datetime(6) NOT NULL,
`UPDATED_DATE` datetime(6) NOT NULL,
`MEAL_TYPE` varchar(255) NOT NULL,
`MEAL_FOOD_MULTIPLE` double NOT NULL,
`MEMBER_FK` bigint(20) DEFAULT NULL,
PRIMARY KEY (`MEAL_PK`),
FOREIGN KEY (`MEMBER_FK`) REFERENCES `MEMBER_TB` (`MEMBER_PK`)
) ENGINE = InnoDB;

CREATE TABLE `MEAL_FOOD_TB`
(
`MEAL_FOOD_PK` bigint(20) NOT NULL AUTO_INCREMENT,
`CREATED_DATE` datetime(6) NOT NULL,
`UPDATED_DATE` datetime(6) NOT NULL,
`FOOD_FK` bigint(20) DEFAULT NULL,
`MEAL_FK` bigint(20) DEFAULT NULL,
PRIMARY KEY (`MEAL_FOOD_PK`),
FOREIGN KEY (`FOOD_FK`) REFERENCES `FOOD_TB` (`FOOD_PK`),
FOREIGN KEY (`MEAL_FK`)REFERENCES `MEAL_TB` (`MEAL_PK`)
) ENGINE=InnoDB;

CREATE TABLE `EAT_HABITS_TB`
(
`EAT_HABITS_PK` bigint(20) NOT NULL AUTO_INCREMENT,
`MEMBER_FK` bigint(20) DEFAULT NULL,
`CREATED_DATE` datetime(6) NOT NULL,
`FLAG` tinyint(1) NOT NULL,
`WEIGHT_PREDICTION` text NOT NULL,
`WEIGHT_ADVICE` text NOT NULL,
PRIMARY KEY (`EAT_HABITS_PK`),
FOREIGN KEY (`MEMBER_FK`) REFERENCES `MEMBER_TB` (`MEMBER_PK`)
) ENGINE = InnoDB;

CREATE TABLE `HISTORY_TB`
(
`HISTORY_PK` bigint(20) NOT NULL AUTO_INCREMENT,
`CREATED_DATE` datetime(6) NOT NULL,
`UPDATED_DATE` datetime(6) NOT NULL,
`HISTORY_ACTIVITY` varchar(255) NOT NULL ,
`HISTORY_AGE` int(11) NOT NULL,
`HISTORY_GENDER` tinyint NOT NULL,
`HISTORY_HEIGHT` double NOT NULL,
`HISTORY_WEIGHT` double NOT NULL,
`MEMBER_FK` bigint(20) DEFAULT NULL,
PRIMARY KEY (`HISTORY_PK`),
FOREIGN KEY (`MEMBER_FK`) REFERENCES `MEMBER_TB` (`MEMBER_PK`)
) ENGINE=InnoDB;
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093
rule_files:
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
#추가
- job_name: "spring-actuator"
metrics_path: '/actuator/prometheus'
scrape_interval: 1s
static_configs:
- targets: ['host.docker.internal:8081']
66 changes: 66 additions & 0 deletions BE/exceed/resources/gaebaljip-local-environment/setting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
version: '3'
services:
eatceed-mariadb:
image: mariadb:10.6
container_name: gaebaljip-local-mariadb
ports:
- 3306:3306
volumes:
- ./mariadb-conf:/etc/mysql/conf.d
- ./mariadb-init:/docker-entrypoint-initdb.d
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_ROOT_HOST=%
- TZ=Asia/Seoul

eatceed-redis:
image: redis:alpine
container_name: gaebaljip-local-redis
command: redis-server --port 6379
ports:
- 6379:6379

eatceed-adminer:
container_name: gaebaljip-local-adminer
image: adminer:4
ports:
- 18080:8080
depends_on:
- eatceed-mariadb
- eatceed-redis
links:
- eatceed-mariadb
- eatceed-redis

grafana:
image: grafana/grafana:latest
container_name: grafana
restart: always
ports:
- "3000:3000"
volumes:
- grafana-data:/var/lib/grafana
- ./grafana/provisioning/:/etc/grafana/provisioning/
environment:
- GF_SERVER_ROOT_URL=http://localhost:3000
- GF_SECURITY_ADMIN_PASSWORD=admin
depends_on:
- prometheus

prometheus:
image: prom/prometheus:latest
container_name: prometheus
restart: always
ports:
- "9090:9090"
volumes:
- ./prometheus/config:/etc/prometheus/
- prometheus-data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'

volumes:
grafana-data:
prometheus-data:

2 changes: 1 addition & 1 deletion BE/exceed/scripts/reset.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cd ../resources/gaebaljip-local-develop-environment
cd ../resources/gaebaljip-local-environment
docker-compose -f setting.yml down
docker-compose -f setting.yml up -d
sleep 10
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.gaebaljip.exceed.common;

public class EatCeedStaticMessage {
public static final String REDIS_AUTO_COMPLETE_KEY = "autoComplete";
}

This file was deleted.

Loading

0 comments on commit f5d5d6e

Please sign in to comment.