Add emitter and missing mongo-init.sh
All checks were successful
continuous-integration/drone Build is passing
All checks were successful
continuous-integration/drone Build is passing
This commit is contained in:
parent
82b91e7161
commit
b90ae0c18d
@ -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)
|
||||
|
11
mongo-init.sh
Normal file
11
mongo-init.sh
Normal file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
mongo <<EOF
|
||||
|
||||
rs.initiate({
|
||||
_id: 'rs0',
|
||||
members: [
|
||||
{_id: 0, host: '127.0.0.1:27017'}
|
||||
]
|
||||
})
|
||||
|
||||
EOF
|
Loading…
Reference in New Issue
Block a user