Skip to content

Commit

Permalink
초기세팅
Browse files Browse the repository at this point in the history
  • Loading branch information
ssojungg committed Jan 17, 2024
2 parents 4897e3d + 1e844a4 commit 541c649
Show file tree
Hide file tree
Showing 5 changed files with 159 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.env.test
pqdata
.DS_Store
data
.env
102 changes: 102 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#Docker 컨테이너를 정의하고 관리하기 위해 구성 파일
#여러 컨테이너와 한 곳에 정리 할 수 있게 해줌
#파일 버전
version: "3"
#services를 컨테이너를 정의
services:
db:
image: postgres
container_name: postgres
restart: always
environment:
POSTGRES_DB: ${DB_DATABASE}
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_PASSWORD: ${DB_PASSWORD}
#PGDATA: /var/lib/postgresql/data/pqdata
TZ: Asia/Seoul
ports:
- "5432:5432"
volumes:
- ./data/:/var/lib/postgresql/data

backend:
container_name: backend
build:
context: ./backend
dockerfile: Dockerfile
restart: always
environment:
- TZ=Asia/Seoul
- NODE_ENV=development
ports:
- "8000:8000"
depends_on:
- db
command: ["nodemon", "-L", "server/index.js"] # 컨테이너가 시작될 때 실행할 명령
volumes:
- ./backend:/app
- /app/node_modules

nginx:
container_name: nginx
build:
context: ./nginx
dockerfile: Dockerfile
restart: always
ports:
- "80:80"
depends_on:
- backend
volumes:
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf

prometheus:
image: prom/prometheus
restart: always
volumes:
- prometheus_data:/prometheus
- ./prometheus.yml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"

cadvisor:
image: gcr.io/cadvisor/cadvisor:v0.47.0
container_name: cadvisor
volumes:
- /:/rootfs:ro
- /var/run:/var/run:ro
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
- /dev/disk/:/dev/disk:ro
devices:
- /dev/kmsg
ports:
- 8080:8080
privileged: true
restart: unless-stopped
depends_on:
- prometheus

grafana:
image: grafana/grafana
restart: always
container_name: grafana
ports:
- "3000:3000"
depends_on:
- prometheus
volumes:
- grafana-data:/var/lib/grafana

node-exporter:
image: quay.io/prometheus/node-exporter:v1.5.0
container_name: node_exporter
command: "--path.rootfs=/host"
pid: host
restart: unless-stopped
volumes:
- /:/host:ro,rslave

volumes:
prometheus_data:
grafana-data:
6 changes: 6 additions & 0 deletions nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM nginx:latest

RUN rm /etc/nginx/conf.d/default.conf
COPY default.conf /etc/nginx/conf.d

CMD ["nginx", "-g", "daemon off;"]
9 changes: 9 additions & 0 deletions nginx/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
server {
listen 80;
server_name localhost;

location / {
root /usr/share/nginx/html;
index index.html;
}
}
37 changes: 37 additions & 0 deletions prometheus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]

- job_name: "cadvisor"
static_configs:
- targets: ["cadvisor:8080"]

- job_name: "grafana"
static_configs:
- targets: ["grafana:3000"]

- job_name: node-exporter
static_configs:
- targets: ["node-exporter:9100"]

0 comments on commit 541c649

Please sign in to comment.