Skip to content

Commit

Permalink
Merge pull request #24 from heesane/server
Browse files Browse the repository at this point in the history
Server
  • Loading branch information
heesane authored Aug 14, 2024
2 parents 9cc52dd + c57c81e commit a5650ae
Show file tree
Hide file tree
Showing 26 changed files with 724 additions and 58 deletions.
27 changes: 15 additions & 12 deletions back/docker-compose.back.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ services:
SPRING_DATASOURCE_USERNAME: root
SPRING_DATASOURCE_PASSWORD: 1234
SPRING_PROFILES_ACTIVE: prod
volumes:
- spring-log:/logs
networks:
- home_network
batch:
Expand All @@ -25,6 +27,8 @@ services:
SPRING_DATASOURCE_USERNAME: root
SPRING_DATASOURCE_PASSWORD: 1234
SPRING_PROFILES_ACTIVE: prod
volumes:
- spring-log:/logs
networks:
- home_network
discord:
Expand All @@ -38,20 +42,19 @@ services:
SPRING_DATASOURCE_USERNAME: root
SPRING_DATASOURCE_PASSWORD: 1234
SPRING_PROFILES_ACTIVE: prod
networks:
- home_network

fastapi:
image: heesane/python-fastapi:latest
restart: always
ports:
- "8010:8010"
container_name: fastapi
command: uvicorn main:app --host 0.0.0.0 --port 8010 --reload
volumes:
- ./fastapi:/app
- spring-log:/logs
networks:
- home_network

networks:
home_network:
external: true
external: true

volumes:
spring-log:
driver: local
driver_opts:
o: bind
type: none
device: ./home_server/logs
46 changes: 0 additions & 46 deletions back/docker-compose.temp.yml

This file was deleted.

2 changes: 2 additions & 0 deletions logging/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Declare files that will always have LF line endings on checkout.
*.sh text eol=lf
122 changes: 122 additions & 0 deletions logging/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
version: '3.7'

services:
# setup:
# profiles:
# - setup
# build:
# context: setup/
# args:
# ELASTIC_VERSION: 7.6.2
# init: true
# volumes:
# - ./setup/entrypoint.sh:/entrypoint.sh:ro,Z
# - ./setup/lib.sh:/lib.sh:ro,Z
# - ./setup/roles:/roles:ro,Z
# environment:
# ELASTIC_PASSWORD: ${ELASTIC_PASSWORD:-}
# LOGSTASH_INTERNAL_PASSWORD: ${LOGSTASH_INTERNAL_PASSWORD:-}
# KIBANA_SYSTEM_PASSWORD: ${KIBANA_SYSTEM_PASSWORD:-}
# METRICBEAT_INTERNAL_PASSWORD: ${METRICBEAT_INTERNAL_PASSWORD:-}
# FILEBEAT_INTERNAL_PASSWORD: ${FILEBEAT_INTERNAL_PASSWORD:-}
# HEARTBEAT_INTERNAL_PASSWORD: ${HEARTBEAT_INTERNAL_PASSWORD:-}
# MONITORING_INTERNAL_PASSWORD: ${MONITORING_INTERNAL_PASSWORD:-}
# BEATS_SYSTEM_PASSWORD: ${BEATS_SYSTEM_PASSWORD:-}
# networks:
# - elk
# depends_on:
# - elasticsearch

elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
container_name: elasticsearch
volumes:
- ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro,Z
- elasticsearch:/usr/share/elasticsearch/data:Z
ports:
- 9200:9200
- 9300:9300
environment:
node.name: elasticsearch
ES_JAVA_OPTS: -Xms512m -Xmx512m
# Bootstrap password.
# Used to initialize the keystore during the initial startup of
# Elasticsearch. Ignored on subsequent runs.
ELASTIC_PASSWORD: ${ELASTIC_PASSWORD:-}
# Use single node discovery in order to disable production mode and avoid bootstrap checks.
# see: https://www.elastic.co/guide/en/elasticsearch/reference/current/bootstrap-checks.html
discovery.type: single-node
networks:
- elk
restart: unless-stopped

logstash:
image: docker.elastic.co/logstash/logstash:7.6.2
container_name: logstash
volumes:
- ./logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml:ro,Z
- ./logstash/pipeline:/usr/share/logstash/pipeline:ro,Z
ports:
- 5044:5044
- 50000:50000/tcp
- 50000:50000/udp
- 9600:9600
environment:
LS_JAVA_OPTS: -Xms256m -Xmx256m
LOGSTASH_INTERNAL_PASSWORD: ${LOGSTASH_INTERNAL_PASSWORD:-}
networks:
- elk
depends_on:
- elasticsearch
restart: unless-stopped

kibana:
image: docker.elastic.co/kibana/kibana:7.6.2
container_name: kibana
volumes:
- ./kibana/config/kibana.yml:/usr/share/kibana/config/kibana.yml:ro,Z
ports:
- 5601:5601
environment:
KIBANA_SYSTEM_PASSWORD: ${KIBANA_SYSTEM_PASSWORD:-}
networks:
- elk
depends_on:
- elasticsearch
restart: unless-stopped

filebeat:
image: docker.elastic.co/beats/filebeat:7.6.2
container_name: filebeat
user: root
command:
- -e
- --strict.perms=false
volumes:
- back_spring-log:/var/log/host_logs:ro
- ./filebeat/config/filebeat.yml:/usr/share/filebeat/filebeat.yml:ro,Z
- type: bind
source: /var/lib/docker/containers
target: /var/lib/docker/containers
read_only: true
- type: bind
source: /var/run/docker.sock
target: /var/run/docker.sock
read_only: true
environment:
FILEBEAT_INTERNAL_PASSWORD: ${FILEBEAT_INTERNAL_PASSWORD:-}
BEATS_SYSTEM_PASSWORD: ${BEATS_SYSTEM_PASSWORD:-}
networks:
- elk
depends_on:
- elasticsearch

networks:
elk:
driver: bridge

volumes:
elasticsearch:
back_spring-log:
external: true

6 changes: 6 additions & 0 deletions logging/elasticsearch/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Ignore Docker build files
Dockerfile
.dockerignore

# Ignore OS artifacts
**/.DS_Store
4 changes: 4 additions & 0 deletions logging/elasticsearch/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# https://www.docker.elastic.co/
FROM docker.elastic.co/elasticsearch/elasticsearch:7.6.2
RUN elasticsearch-plugin install analysis-nori

7 changes: 7 additions & 0 deletions logging/elasticsearch/config/elasticsearch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Default Elasticsearch configuration from Elasticsearch base image.
## https://github.com/elastic/elasticsearch/blob/main/distribution/docker/src/docker/config/elasticsearch.yml
#
cluster.name: docker-cluster
network.host: 0.0.0.0

xpack.security.enabled: false
6 changes: 6 additions & 0 deletions logging/filebeat/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Ignore Docker build files
Dockerfile
.dockerignore

# Ignore OS artifacts
**/.DS_Store
10 changes: 10 additions & 0 deletions logging/filebeat/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ARG ELASTIC_VERSION

FROM docker.elastic.co/beats/filebeat:7.6.2

COPY config/filebeat.yml /usr/share/filebeat/filebeat.yml
USER root

RUN mkdir /var/logs

RUN chown -R root /usr/share/filebeat
8 changes: 8 additions & 0 deletions logging/filebeat/config/filebeat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
filebeat.inputs:
- type: log
enabled: true
paths:
- /var/log/host_logs/*.log

output.logstash:
hosts: ["logstash:5044"]
29 changes: 29 additions & 0 deletions logging/filebeat/filebeat-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: '3.7'

services:
filebeat:
build:
context: filebeat/
args:
ELASTIC_VERSION: ${ELASTIC_VERSION}
user: root
command:
- -e
- --strict.perms=false
volumes:
- ./filebeat/config/filebeat.yml:/usr/share/filebeat/filebeat.yml:ro,Z
- type: bind
source: /var/lib/docker/containers
target: /var/lib/docker/containers
read_only: true
- type: bind
source: /var/run/docker.sock
target: /var/run/docker.sock
read_only: true
environment:
FILEBEAT_INTERNAL_PASSWORD: ${FILEBEAT_INTERNAL_PASSWORD:-}
BEATS_SYSTEM_PASSWORD: ${BEATS_SYSTEM_PASSWORD:-}
networks:
- elk
depends_on:
- elasticsearch
6 changes: 6 additions & 0 deletions logging/kibana/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Ignore Docker build files
Dockerfile
.dockerignore

# Ignore OS artifacts
**/.DS_Store
7 changes: 7 additions & 0 deletions logging/kibana/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ARG ELASTIC_VERSION

# https://www.docker.elastic.co/
FROM docker.elastic.co/kibana/kibana:7.6.2

# Add your kibana plugins setup here
# Example: RUN kibana-plugin install <name|url>
3 changes: 3 additions & 0 deletions logging/kibana/config/kibana.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
server.name: kibana
server.host: 0.0.0.0
elasticsearch.hosts: http://elasticsearch:9200
6 changes: 6 additions & 0 deletions logging/logstash/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Ignore Docker build files
Dockerfile
.dockerignore

# Ignore OS artifacts
**/.DS_Store
7 changes: 7 additions & 0 deletions logging/logstash/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ARG ELASTIC_VERSION

# https://www.docker.elastic.co/
FROM docker.elastic.co/logstash/logstash:7.6.2

# Add your logstash plugins setup here
# Example: RUN logstash-plugin install logstash-filter-json
5 changes: 5 additions & 0 deletions logging/logstash/config/logstash.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
## Default Logstash configuration from Logstash base image.
## https://github.com/elastic/logstash/blob/main/docker/data/logstash/config/logstash-full.yml
#
http.host: 0.0.0.0
16 changes: 16 additions & 0 deletions logging/logstash/pipeline/logstash.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
input {
beats {
port => 5044
}
}

## Add your filters / logstash plugins configuration here

output {
elasticsearch {
hosts => "elasticsearch:9200"
index => "logstash-%{+YYYY.MM.dd}"
user => "elastic"
password => "${LOGSTASH_INTERNAL_PASSWORD}"
}
}
9 changes: 9 additions & 0 deletions logging/setup/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Ignore Docker build files
Dockerfile
.dockerignore

# Ignore OS artifacts
**/.DS_Store

# Ignore Git files
.gitignore
6 changes: 6 additions & 0 deletions logging/setup/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ARG ELASTIC_VERSION

# https://www.docker.elastic.co/
FROM docker.elastic.co/elasticsearch/elasticsearch:${ELASTIC_VERSION}

ENTRYPOINT ["/entrypoint.sh"]
Loading

0 comments on commit a5650ae

Please sign in to comment.