Add emitter and missing mongo-init.sh

wip
Léo Carpentier 12 months ago
parent 82b91e7161
commit b90ae0c18d
  1. 1
      docker-compose.yml
  2. 5
      emitter/Dockerfile
  3. 9
      emitter/emitter.py
  4. 11
      mongo-init.sh

@ -66,4 +66,3 @@ services:
network_mode: host
build:
context: ./emitter
entrypoint: /emitter/camtiler.py

@ -1,6 +1,7 @@
FROM python
WORKDIR /emitter
RUN pip install pymongo
COPY ./emitter.py ./
ENTRYPOINT emitter.py
CMD ["python", "./emitter.py"]
LABEL name="emitter"

@ -2,12 +2,11 @@ from pymongo import MongoClient
from bson.objectid import ObjectId
from time import sleep
MONGO_URI="mongodb://127.0.0.1:27017"
MONGO_URI="mongodb://127.0.0.1:27017/default"
client = MongoClient(MONGO_URI)
db = client['default']
col = db['eventlog']
db = MongoClient(MONGO_URI).get_default_database()
while True:
col.insertOne({"foo": "bar"})
db.eventlog.insert_one({ "timestamp": "...", "event": "motion-detected", "started": "...", "finished": "...", "component": "motion-detect", "camera": "Server room", "action": "event",
})
sleep(1)

@ -0,0 +1,11 @@
#!/bin/bash
mongo <<EOF
rs.initiate({
_id: 'rs0',
members: [
{_id: 0, host: '127.0.0.1:27017'}
]
})
EOF
Loading…
Cancel
Save