Skip to content

Commit c700538

Browse files
committed
Speed up service startup.
1 parent 61f17b1 commit c700538

519 files changed

Lines changed: 207 additions & 5 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docker/build/docker-compose-x86.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ services:
33
face_detector:
44
image: shareai/face_detector:x86
55
build:
6-
context: ./face_detection
6+
context: ../../src/face_detection
77
dockerfile: Dockerfile.x86
88
redis:
99
image: shareai/redis:x86
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
version: '2'
2+
services:
3+
redis:
4+
image: redis:latest
5+
restart: always
6+
container_name: "redis"
7+
command: sh -c "rm -rf /data/*.rdb && redis-server --maxmemory 40mb --maxmemory-policy allkeys-lru --save \"\" --appendonly no --dbfilename \"\""
8+
#ports:
9+
# - 6379:6379
10+
logging:
11+
driver: json-file
12+
options:
13+
max-size: "10m"
14+
max-file: "10"
15+
networks:
16+
main:
17+
aliases:
18+
- redis
19+
broker:
20+
image: shareai/broker:x86
21+
restart: always
22+
container_name: "broker"
23+
ports:
24+
- 1883:1883
25+
- 9001:9001
26+
logging:
27+
driver: json-file
28+
options:
29+
max-size: "10m"
30+
max-file: "10"
31+
networks:
32+
main:
33+
aliases:
34+
- mqttserver
35+
camera:
36+
container_name: "camera"
37+
command: sh -c "if [ ! -f /opt/nvr/conf/conf.sqlite ]; then cp /opt/nvr/sql/shinobi.sample.sqlite /opt/nvr/conf/conf.sqlite -a ; fi && sleep 3 && (node /opt/nvr/cron.js &) && node /opt/nvr/camera.js"
38+
image: shareai/shinobi:x86
39+
restart: always
40+
privileged: true
41+
environment:
42+
ADMIN_PASSWORD: ${ADMIN_PASSWORD}
43+
TIMEZONE_OFFSET: ${TIMEZONE_OFFSET}
44+
IMAGE_DIR: "/opt/nvr/detector/images"
45+
logging:
46+
driver: json-file
47+
options:
48+
max-size: "10m"
49+
max-file: "10"
50+
ports:
51+
- 8080:8080
52+
networks:
53+
main:
54+
aliases:
55+
- camera
56+
volumes:
57+
- ./videos:/opt/nvr/videos
58+
- ./workaipython/sql:/opt/nvr/conf
59+
- ./dev/shm/streams:/dev/shm/streams
60+
- ./opt/nvr/detector/images:/opt/nvr/detector/images
61+
- ../src/shinobi/2018.03.15.14.50_patchs/camera.js:/opt/nvr/camera.js
62+
flower:
63+
command: sh -c "flower --port=5555"
64+
image: shareai/flower:x86
65+
restart: always
66+
ports:
67+
- 5555:5555
68+
depends_on:
69+
- "redis"
70+
environment:
71+
CELERY_BROKER_URL: redis://redis/0
72+
CELERY_RESULT_BACKEND: redis://redis/0
73+
networks:
74+
main:
75+
aliases:
76+
- flower
77+
face_detector:
78+
command: sh -c "cd /root/detection && python test.py && python worker.py worker --loglevel INFO -E -n detect -c 1 -Q detect"
79+
image: shareai/face_detector:x86
80+
container_name: "face_detector"
81+
env_file:
82+
- ./production_1.env
83+
environment:
84+
REDIS_HOST: "redis"
85+
REDIS_PORT: "6379"
86+
restart: always
87+
depends_on:
88+
- "redis"
89+
logging:
90+
driver: json-file
91+
options:
92+
max-size: "10m"
93+
max-file: "10"
94+
volumes:
95+
- ./workaipython/ro_serialno:/dev/ro_serialno
96+
- ./workaipython/groupid.txt:/data/usr/com.deep.workai/cache/groupid.txt
97+
- ./workaipython/cache:/data/runtime/cache
98+
- ./opt/nvr/detector/images:/opt/nvr/detector/images
99+
- ./opt/nvr/detector/frames:/opt/nvr/videos/frames
100+
- ../src/face_detection:/root/detection
101+
- ./dev/shm/streams:/dev/shm/streams
102+
networks:
103+
main:
104+
aliases:
105+
- facd_detector
106+
embedding:
107+
command: sh -c "cd /data/runtime/src/ && ls /data/runtime -l && ls /data/runtime/src && ./start_embedding_only.sh"
108+
image: shareai/embedding:x86_latest
109+
container_name: "embedding"
110+
env_file:
111+
- ./cluster.env
112+
- ./servers.env
113+
- ./aws.env
114+
environment:
115+
RUNTIME_BASEDIR: "/data/runtime/src/"
116+
HAS_OPENCL: "false"
117+
restart: always
118+
depends_on:
119+
- "redis"
120+
logging:
121+
driver: json-file
122+
options:
123+
max-size: "10m"
124+
max-file: "10"
125+
networks:
126+
main:
127+
aliases:
128+
- workaipython
129+
privileged: true
130+
ports:
131+
- 5000:5000
132+
volumes:
133+
- ./workaipython/ro_serialno:/dev/ro_serialno
134+
- ./workaipython/groupid.txt:/data/usr/com.deep.workai/cache/groupid.txt
135+
- ./workaipython/cache:/data/runtime/cache
136+
- ./workaipython/data:/data/runtime/src/data
137+
- ./opt/nvr/detector/images:/opt/nvr/detector/images
138+
- ../src/embedding:/data/runtime/src
139+
- ./opt/nvr/detector/frames:/opt/nvr/videos/frames
140+
- ../model/model-0000.params:/data/runtime/model-0000.params
141+
- ../model/model-symbol.json:/data/runtime/model-symbol.json
142+
detector_plugin:
143+
container_name: "detector_plugin"
144+
depends_on:
145+
- "camera"
146+
- "flower"
147+
- "redis"
148+
- "broker"
149+
command: sh -c "export && cd /opt/nvr/detector && npm install && node /opt/nvr/detector/index.js"
150+
logging:
151+
driver: json-file
152+
options:
153+
max-size: "10m"
154+
max-file: "10"
155+
image: shareai/shinobi:x86
156+
restart: always
157+
privileged: true
158+
env_file:
159+
- ./production_1.env
160+
- ./cluster.env
161+
- ./servers.env
162+
- ./aws.env
163+
environment:
164+
TIMEZONE_OFFSET: ${TIMEZONE_OFFSET}
165+
IMAGE_DIR: "/opt/nvr/detector/images"
166+
networks:
167+
main:
168+
aliases:
169+
- detector_plugin
170+
ports:
171+
- 3030:3000
172+
volumes:
173+
- ./videos:/opt/nvr/videos
174+
- ./workaipython/ro_serialno:/dev/ro_serialno
175+
- ./workaipython/groupid.txt:/data/usr/com.deep.workai/cache/groupid.txt
176+
- ./opt/nvr/detector/images:/opt/nvr/detector/images
177+
- ./opt/nvr/detector/face_motion:/opt/nvr/detector/face_motion
178+
- ./opt/nvr/detector/face_cropped:/opt/nvr/detector/face_cropped
179+
- ../src/detector/deepeye.js:/opt/nvr/detector/deepeye.js
180+
- ../src/detector/index.js:/opt/nvr/detector/index.js
181+
- ../src/detector/motion.js:/opt/nvr/detector/motion.js
182+
#- ../src/detector/maintainer.js:/opt/nvr/detector/maintainer.js
183+
- ../src/detector/workai-v2.js:/opt/nvr/detector/workai-v2.js
184+
- ../src/detector/workai.js:/opt/nvr/detector/workai.js
185+
- ../src/detector/upload_aws.js:/opt/nvr/detector/upload.js
186+
- ../src/detector/makegif.js:/opt/nvr/detector/makegif.js
187+
- ../src/detector/package.json:/opt/nvr/detector/package.json
188+
- ../src/detector/conf.json:/opt/nvr/detector/conf.json
189+
- ../src/detector/waitqueue.js:/opt/nvr/detector/waitqueue.js
190+
- ../src/detector/timeline.js:/opt/nvr/detector/timeline.js
191+
- ../src/detector/visit.js:/opt/nvr/detector/visit.js
192+
- ../src/detector/face_motions.js:/opt/nvr/detector/face_motions.js
193+
- ../src/detector/mqttgif.js:/opt/nvr/detector/mqttgif.js
194+
- ../src/detector/realtime_message.js:/opt/nvr/detector/realtime_message.js
195+
- ../src/detector/upload_listener.js:/opt/nvr/detector/upload_listener.js
196+
- ../src/detector/config:/opt/nvr/detector/config
197+
networks:
198+
main:

docker/docker-compose-x86.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ services:
7575
aliases:
7676
- flower
7777
face_detector:
78-
command: sh -c "cd /root/detection && python test.py && python worker.py worker --loglevel INFO -E -n detect -c 1 -Q detect"
78+
command: sh -c "python test.py && python worker.py worker --loglevel INFO -E -n detect -c 1 -Q detect"
7979
image: shareai/face_detector:x86
8080
container_name: "face_detector"
8181
env_file:
@@ -97,7 +97,6 @@ services:
9797
- ./workaipython/cache:/data/runtime/cache
9898
- ./opt/nvr/detector/images:/opt/nvr/detector/images
9999
- ./opt/nvr/detector/frames:/opt/nvr/videos/frames
100-
- ../src/face_detection:/root/detection
101100
- ./dev/shm/streams:/dev/shm/streams
102101
networks:
103102
main:
File renamed without changes.

docker/build/face_detection/Dockerfile.x86 renamed to src/face_detection/Dockerfile.x86

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,18 @@ RUN apt-get install --no-install-recommends -y python python-pip python-opencv
77
RUN apt-get update && apt-get install -y git scons cmake wget unzip curl build-essential \
88
libprotobuf-dev protobuf-compiler libopencv-dev python-pip python-setuptools python-dev
99

10-
ADD face_detector /root/detector
10+
ADD ./assets/detection/face_detector /root/detector
1111
RUN cd /root/detector/3rdparty/ncnn && mkdir build && cd build && \
1212
cmake ../ && make -j6
1313
RUN cp /root/detector/3rdparty/ncnn/build/src/libncnn.a /root/detector/lib/ncnn/libncnn.a
1414

1515
WORKDIR /root/detector/
1616
RUN python setup.py install
1717
RUN python ./test.py
18-
ADD requirements.txt /root/requirements.txt
18+
ADD ./assets/detection/requirements.txt /root/requirements.txt
1919
RUN pip install -r /root/requirements.txt
20+
ADD . /root/detection
21+
WORKDIR /root/detection
22+
RUN pip install -r requirements.txt && \
23+
rm -rf /root/detection/assets && \
24+
python test.py
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)