-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
431 additions
and
53 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 |
---|---|---|
@@ -1,11 +1,23 @@ | ||
# postgres credentials | ||
SECRET_KEY='django-insecure-(fffc75h_s6tm=%7a&r8vc2lf7*0q+w2k+=*g=@82nube9s*a-' | ||
DEBUG=True | ||
|
||
POSTGRES_PASSWORD='postgres_password' | ||
POSTGRES_DB='postgres_db' | ||
POSTGRES_USER='postgres_user' | ||
FORTYTWO_CLIENT_ID='u-s4t2ud-ab8fff39c8779f781296f279fd71d49a1ae34cb59003ad44bb0dc94d475ceffc' | ||
FORTYTWO_CLIENT_SECRET='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' | ||
FORTYTWO_REDIRECT_URI='http://localhost:4444' | ||
|
||
# django superuser credentials | ||
DJANGO_SECRET_KEY='django_secret_key' | ||
DJANGO_SUPERUSER_USERNAME='django_admin_user' | ||
DJANGO_SUPERUSER_EMAIL='django_admin_email' | ||
DJANGO_SUPERUSER_PASSWORD='django_admin_password' | ||
# google social_auth | ||
GOOGLE_CLIENT_ID='GOOGLE_CLIENT_ID' | ||
GOOGLE_REDIRECT_URI='GOOGLE_REDIRECT_URI' | ||
|
||
|
||
# github social_auth | ||
GITHUB_CLIENT_ID='GITHUB_CLIENT_ID' | ||
GITHUB_REDIRECT_URI='GITHUB_REDIRECT_URI' | ||
|
||
POSTGRES_USER="postgres" | ||
POSTGRES_PASSWORD="A9wadPassW0rd/" | ||
POSTGRES_DB="db" | ||
DATABASE_URL="postgres://postgres:A9wadPassW0rd/@db:5432/db" | ||
|
||
LOGSTASH_HOST="logstash" | ||
LOGSTASH_PORT="50000" |
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 |
---|---|---|
|
@@ -42,4 +42,4 @@ htmlcov/ | |
# Migrations | ||
**/migrations/* | ||
!**/migrations/__init__.py | ||
todo* | ||
*todo* |
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,91 @@ | ||
version: '3' | ||
|
||
services: | ||
elasticsearch: | ||
container_name: elasticsearch | ||
image: docker.elastic.co/elasticsearch/elasticsearch:8.10.1 | ||
environment: | ||
- ELASTIC_PASSWORD=${ELASTIC_PASSWORD} | ||
- KIBANA_SYSTEM_PASSWORD=${KIBANA_PASSWORD} | ||
- discovery.type=single-node | ||
- xpack.security.enabled=true | ||
- ELASTIC_USERNAME=elastic | ||
- ES_JAVA_OPTS=-Xms1g -Xmx1g | ||
healthcheck: | ||
test: ["CMD-SHELL", "curl -s -u elastic:lol123 http://localhost:9200/_cat/health >/dev/null || exit 1"] | ||
interval: 30s | ||
timeout: 30s | ||
retries: 3 | ||
start_period: 60s | ||
volumes: | ||
- ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml | ||
- es_data:/usr/share/elasticsearch/data | ||
ports: | ||
- "9200:9200" | ||
- "9300:9300" | ||
networks: | ||
- elk | ||
restart: always | ||
|
||
setup_kibana: | ||
image: curlimages/curl:latest | ||
volumes: | ||
- ./tools/init-kibana.sh:/init-kibana.sh | ||
command: ["sh", "/init-kibana.sh"] | ||
networks: | ||
- elk | ||
env_file: | ||
- .env | ||
depends_on: | ||
elasticsearch: | ||
condition: service_healthy | ||
|
||
logstash: | ||
container_name: logstash | ||
image: docker.elastic.co/logstash/logstash:8.10.1 | ||
volumes: | ||
- ./logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml | ||
- ./logstash/pipeline:/usr/share/logstash/pipeline | ||
ports: | ||
- "50000:50000" | ||
- "9600:9600" | ||
env_file: | ||
- .env | ||
environment: | ||
- ELASTIC_PASSWORD=${ELASTIC_PASSWORD} | ||
- ELASTICSEARCH_USERNAME=elastic | ||
- ELASTICSEARCH_PASSWORD=${ELASTIC_PASSWORD} | ||
- LS_JAVA_OPTS=-Xms256m -Xmx256m | ||
networks: | ||
- elk | ||
depends_on: | ||
elasticsearch: | ||
condition: service_healthy | ||
|
||
kibana: | ||
container_name: kibana | ||
image: docker.elastic.co/kibana/kibana:8.10.1 | ||
depends_on: | ||
setup_kibana: | ||
condition: service_completed_successfully | ||
environment: | ||
- ELASTICSEARCH_HOSTS=http://elasticsearch:9200 | ||
- ELASTICSEARCH_USERNAME=kibana_system | ||
- ELASTICSEARCH_PASSWORD=${KIBANA_PASSWORD} | ||
- ELASTICSEARCH_SSL_VERIFICATIONMODE=none | ||
volumes: | ||
- ./kibana/config/kibana.yml:/usr/share/kibana/config/kibana.yml | ||
ports: | ||
- "5601:5601" | ||
networks: | ||
- elk | ||
|
||
volumes: | ||
es_data: | ||
driver: local | ||
|
||
networks: | ||
elk: | ||
external: true | ||
name: elk_net | ||
# driver: bridge |
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 @@ | ||
cluster.name: "docker-cluster" | ||
network.host: 0.0.0.0 | ||
discovery.type: single-node | ||
xpack.security.enabled: true | ||
xpack.security.authc.api_key.enabled: true | ||
|
||
# Add these memory settings | ||
bootstrap.memory_lock: true |
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,7 @@ | ||
server.host: "0.0.0.0" | ||
elasticsearch.hosts: ["http://elasticsearch:9200"] | ||
elasticsearch.username: "kibana_system" | ||
elasticsearch.password: "lil123" | ||
elasticsearch.ssl.verificationMode: none | ||
xpack.security.enabled: true | ||
xpack.reporting.roles.enabled: false |
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,5 @@ | ||
http.host: "0.0.0.0" | ||
xpack.monitoring.elasticsearch.hosts: ["http://elasticsearch:9200"] | ||
xpack.monitoring.elasticsearch.username: "elastic" | ||
xpack.monitoring.elasticsearch.password: "lol123" | ||
xpack.monitoring.enabled: true |
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,36 @@ | ||
input { | ||
tcp { | ||
port => 50000 | ||
codec => json | ||
type => "django" | ||
} | ||
} | ||
|
||
filter { | ||
if [type] == "django" { | ||
# Lowercase the level field and rename it to match the standard 'level' in Elasticsearch | ||
mutate { | ||
lowercase => ["levelname"] # Convert 'levelname' to lowercase | ||
rename => { "levelname" => "level" } # Rename for consistent index field name | ||
} | ||
|
||
# Parse the timestamp from Django to ensure it's used as @timestamp in Elasticsearch | ||
date { | ||
match => ["asctime", "YYYY-MM-dd HH:mm:ss"] | ||
target => "@timestamp" | ||
remove_field => ["asctime"] # Clean up to avoid duplicate timestamp fields | ||
} | ||
} | ||
} | ||
|
||
output { | ||
elasticsearch { | ||
hosts => ["elasticsearch:9200"] | ||
index => "django-logs-%{+YYYY.MM.dd}" # Adjusted to only include date in the index | ||
user => "elastic" # Use environment variables for security | ||
password => "${ELASTIC_PASSWORD}" | ||
} | ||
stdout { | ||
codec => rubydebug | ||
} | ||
} |
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,16 @@ | ||
#!/bin/bash | ||
|
||
echo "Waiting for Elasticsearch to be ready..." | ||
while true; do | ||
if curl -s elasticsearch:9200 >/dev/null; then | ||
break | ||
fi | ||
sleep 5 | ||
done | ||
|
||
echo "Setting up kibana_system user..." | ||
# echo "${ELASTIC_PASSWORD} ${KIBANA_PASSWORD}" | ||
curl -X POST -u elastic:${ELASTIC_PASSWORD} "elasticsearch:9200/_security/user/kibana_system/_password" -H "Content-Type: application/json" -d" | ||
{ | ||
\"password\": \"${KIBANA_PASSWORD}\" | ||
}" |
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
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
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,3 @@ | ||
db.sqlite3 | ||
*__pycache__/ | ||
*.pyc |
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
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
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
Oops, something went wrong.