Skip to content

Commit

Permalink
Minimal compose file, healthcheck, redis and loki requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
ReallyWeirdCat committed Nov 27, 2024
1 parent f9f395c commit 7042079
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.env

# Kate
*.kate-swp

Expand Down
6 changes: 6 additions & 0 deletions Backend/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@

app = FastAPI()

@app.get("/healthcheck")
def healthcheck():
"""
Health check endpoint
"""
return {"status": "healthy"}

def main():
"""
Expand Down
4 changes: 3 additions & 1 deletion Backend/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
fastapi[standard]
peewee
pendulum
python-dotenv
python-dotenv
python-logging-loki
redis[hiredis]
70 changes: 70 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
services:
postgres:
image: postgres:latest
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- my_network

redis:
image: redis:latest
environment:
- REDIS_PASSWORD=${REDIS_PASSWORD}
command: ["redis-server", "--requirepass", "${REDIS_PASSWORD}"]
networks:
- my_network

# loki:
# image: grafana/loki:latest
# command: -config.file=/etc/loki/local-config.yaml
# volumes:
# - ./loki-config.yaml:/etc/loki/local-config.yaml
# networks:
# - my_network

# grafana:
# image: grafana/grafana:latest
# environment:
# GF_SECURITY_ADMIN_PASSWORD: ${GF_SECURITY_ADMIN_PASSWORD}
# ports:
# - "3000:3000"
# networks:
# - my_network
# depends_on:
# - loki

fastapi:
build:
context: ./Backend
dockerfile: Dockerfile
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
JWT_KEY: ${JWT_KEY}
JWT_ACCESS_EXPIRE_MINUTES: ${JWT_ACCESS_EXPIRE_MINUTES}
JWT_REFRESH_EXPIRE_MINUTES: ${JWT_REFRESH_EXPIRE_MINUTES}
JWT_ISSUER: ${JWT_ISSUER}
JWT_AUDIENCE: ${JWT_AUDIENCE}
ports:
- "8000:8000"
networks:
- my_network
depends_on:
- postgres
- redis
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/healthcheck"]
interval: 10s
timeout: 5s
retries: 3

volumes:
postgres_data:

networks:
my_network:
Empty file added loki-config.yaml
Empty file.

0 comments on commit 7042079

Please sign in to comment.