Skip to content

Commit

Permalink
Added container definitions and test environment
Browse files Browse the repository at this point in the history
  • Loading branch information
MichielTukker committed Feb 18, 2024
1 parent 68ad927 commit 48858e0
Show file tree
Hide file tree
Showing 5 changed files with 176 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ FROM python:3.11-bookworm

WORKDIR /app

COPY ./requirements.txt .
COPY requirements.txt /app/requirements.txt

RUN pip install -r requirements.txt
RUN pip install -r /app/requirements.txt

COPY . .
COPY src/simulator_worker /app/

ENTRYPOINT ./run.sh
ENTRYPOINT python -m simulator_worker.simulator_worker
77 changes: 77 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
version: "3.8"

networks:
omotes:


volumes:
db-data:
broker-data:
influxdb_storage:


services:
rabbitmq:
image: bitnami/rabbitmq:3.8.27
ports:
- "15672:15672"
- "5673:5672"
networks:
- omotes
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:15672" ]
interval: 10s
timeout: 10s
retries: 5

omotes_influxdb:
image: influxdb:1.7
ports:
- "${INFLUXDB_PORT}:${INFLUXDB_PORT}"
- "${INFLUXDB_RPC_PORT}:${INFLUXDB_RPC_PORT}"
networks:
- omotes
environment:
- INFLUXDB_ADMIN_USER=${INFLUXDB_ADMIN_USER}
- INFLUXDB_ADMIN_PASSWORD=${INFLUXDB_ADMIN_PASSWORD}
- INFLUXDB_HTTP_BIND_ADDRESS=:${INFLUXDB_PORT}
- INFLUXDB_BIND_ADDRESS=:${INFLUXDB_RPC_PORT}
- INFLUXDB_DB=omotes_timeseries
- INFLUXDB_WRITE_USER=${INFLUXDB_WRITE_USER}
- INFLUXDB_WRITE_USER_PASSWORD=${INFLUXDB_WRITE_USER_PASSWORD}
healthcheck:
test:
[
"CMD",
"curl",
"-f",
"http://omotes_influxdb:${INFLUXDB_PORT}/ping"
]
interval: 10s
timeout: 5s
volumes:
- influxdb_storage:/var/lib/influxdb

simulator_worker:
build:
context: .
env_file: .env
networks:
- omotes
deploy:
replicas: 1
depends_on:
rabbitmq:
condition: service_healthy
omotes_influxdb:
condition: service_healthy

local_test:
build:
context: ./local_test
dockerfile: Dockerfile
networks:
- omotes
depends_on:
simulator_worker:
condition: service_started
11 changes: 11 additions & 0 deletions local_test/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM python:3.11-bookworm

WORKDIR /app

COPY ./requirements.txt .

RUN pip install -r requirements.txt

COPY . .

ENTRYPOINT python -u test_app.py
2 changes: 2 additions & 0 deletions local_test/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
celery==5.3.5
jsonpickle==3.0.2
82 changes: 82 additions & 0 deletions local_test/test_app.py

Large diffs are not rendered by default.

0 comments on commit 48858e0

Please sign in to comment.