forked from JNU-econovation/EATceed
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat/JNU-econovation#206 : docker-compose를 사용해 prometheus와 grafana 세팅
환경 분리를 위해 gaebaljip-local-develop을 gaebaljip-devlop과 gaebaljip-local로 분리
- Loading branch information
1 parent
d720436
commit b63f2ac
Showing
13 changed files
with
255 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions
12
BE/exceed/resources/gaebaljip-develop-environment/prometheus/config/prometheus.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'] |
34 changes: 0 additions & 34 deletions
34
BE/exceed/resources/gaebaljip-local-develop-environment/setting.yml
This file was deleted.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
BE/exceed/resources/gaebaljip-local-environment/mariadb-conf/mariadb.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
12 changes: 12 additions & 0 deletions
12
BE/exceed/resources/gaebaljip-local-environment/mariadb-init/00_init.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
99 changes: 99 additions & 0 deletions
99
BE/exceed/resources/gaebaljip-local-environment/mariadb-init/01_schma.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
19 changes: 19 additions & 0 deletions
19
BE/exceed/resources/gaebaljip-local-environment/prometheus/config/prometheus.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
66
BE/exceed/resources/gaebaljip-local-environment/setting.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |