Commit c3ff14a2 authored by Tom Jorquera's avatar Tom Jorquera

Create docker-compose configuration for hubl.ot

Add docker-compose.yaml file

- Add ports, volumes, env_file and environment options
- Update the .gitignore to add .env file
- Access URL for the external services now uses docker-compose hostnames.
- selenium-server is now a container service dependency

Selenium is no longer directly managed by directly by hublot, but is instead an
external service dependency.
This dependency is managed in docker-compose with a selenium server image.

This simplifies a LOT of things and make the project organization cleaner.
parent 1561182f
Dockerfile
.dockerignore
.git
node_modules/*
MODELS_PATH=./models/
YAML=/opt/models/gmm_hmm3.yaml
NB_WORKERS=2
......@@ -54,8 +54,5 @@ typings/
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
tmp/
nohup.out
FROM node:8-stretch
RUN apt-get -q update && apt-get -y -q install \
chromium \
libgconf-2-4 \
openjdk-8-jre-headless \
xvfb \
&& npm set -g progress=false \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /usr/src/app/hublot
COPY package.json .
RUN npm install
RUN npm run setup
COPY docker-chromium-xvfb/xvfb-chromium /usr/bin/xvfb-chromium
RUN ln -s /usr/bin/xvfb-chromium /usr/bin/google-chrome && \
ln -s /usr/bin/xvfb-chromium /usr/bin/chromium-browser
RUN yarn install
COPY . /usr/src/app/hublot
RUN chmod +x start.sh
CMD ./start.sh
ENTRYPOINT ["yarn", "start"]
#!/bin/sh
if [ -f ./tmp/webdriver_pid ]
then
echo "./tmp/webdriver_pid already exists. Is the server running?" 1>&2
else
nohup ./node_modules/.bin/selenium-standalone start &
mkdir -p ./tmp
echo $! > ./tmp/webdriver_pid
fi
#!/bin/sh
if [ -f ./tmp/webdriver_pid ]
then
kill $( cat ./tmp/webdriver_pid );
rm ./tmp/webdriver_pid
fi
......@@ -4,16 +4,18 @@
},
"runner": {
"driver" : {
"host": "selenium",
"port": 4444,
"desiredCapabilities": {
"browserName": "chrome",
"chromeOptions": {
"args" : [
"--disable-web-security",
"--user-data-dir=./tmp/chromium",
"--allow-running-insecure-content",
"--user-data-dir=./tmp/chromium",
"--allow-running-insecure-content",
"--use-fake-device-for-media-stream",
"--use-file-for-fake-audio-capture=./media/silence.wav",
"--use-file-for-fake-video-capture=./media/logo.y4m",
"--use-file-for-fake-audio-capture=/opt/media/silence.wav",
"--use-file-for-fake-video-capture=/opt/media/logo.y4m",
"--use-fake-ui-for-media-stream"
]
}
......@@ -23,15 +25,15 @@
"client": {
"name": "hublot",
"avatar": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEoAAABECAYAAAAm2qMBAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH4QYNDTU7dwT3OwAABUtJREFUeNrtnF1oHFUUx38zjUlabWKtELU3WLQPFrSOgopaRawmIZdqLVTtQ1R8sVqsH9SvQptKBaWF6oMiLYhUKiLYtMVOGqu0Kgnq260txQejEIZU0BRrqsaQZH2YO3Hczu7Ofszs1/xhyWaZPXvnN+fOPffcc8cgBlm2g5LCe38xcBtgAdcAi4HLgUuAi4BG/bVJ4BxwBhgFfgZ+ABQwpKQYT7cdpYyY4KwCHgDuB1pL9BNjwEFgv5LiUNTQogTVCTwF3Ec86gPeVlIciwKaEQGgp4HtQDPl0TiwUUmxu5TAjBJ2r2eAt6gcpYAnlRS7LNsBKAqYUSwky3Y6gAPAXCpTfwArlRRfF+NdRhGA5gH7gC6qQ33AWj2a5g3MKBDSzcB32r2NKgGV0q8blBTf5/tlswBImzQkqgiS11YTOG7ZznrvnErqUT5I+4DV1IY+UFI8Gva+ZeQBaUhH1LWkz5UUHWFgGSEhfQPcUmVdLayOKilW5IJlhIA0AHTUKCRPnygp1hTjUTuB56gPbVZSvFaIR3UCA9SXblVSfBsKlB4ym4AJ6lNGUEB6XhylD/iiTiGlgMNBN3UzwKPWAsvr2Ju6LNvpDhOZf0iij7KCsmxna42HAWHVYtnO89k8qjdhNKsdgaAs23k2YfP/3mbZzmNBHrUxYXOeXpi9y+u46VrgRMIlUO1KCsfUMUNPwiOj1vm7XgIqs1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+7nJUObwvBZwF7s703JZ/AccI0dMbvIyTAAAAAElFTkSuQmCC",
"gstreamerURL": "ws://localhost:8888",
"gstreamerURL": "ws://kaldi-gstreamer:80",
"externalLibs": [
"https://cdnjs.cloudflare.com/ajax/libs/sockjs-client/1.1.4/sockjs.min.js",
"https://cdnjs.cloudflare.com/ajax/libs/stomp.js/2.3.3/stomp.min.js"
],
"archive": "http://localhost:8080/api",
"reco": {
"host": "localhost",
"port": 8090,
"host": "recommender",
"port": 8080,
"reconnectInterval": 5000
}
}
......
The MIT License (MIT)
Copyright (c) 2015 Mark Adams
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
The xvfb-chromium script is part of the docker-chromium-xvfb project of Mark Adams.
The MIT licence of his project is included in this directory.
You can find his whole project at https://github.com/mark-adams/docker-chromium-xvfb
#!/bin/bash
_kill_procs() {
kill -TERM $chromium
wait $chromium
kill -TERM $xvfb
}
# Setup a trap to catch SIGTERM and relay it to child processes
trap _kill_procs SIGTERM
XVFB_WHD=${XVFB_WHD:-1280x720x16}
# Start Xvfb
Xvfb :99 -ac -screen 0 $XVFB_WHD -nolisten tcp &
xvfb=$!
export DISPLAY=:99
chromium --no-sandbox $@ &
chromium=$!
wait $chromium
wait $xvfb
version: '3.2'
services:
hublot:
build: .
image: linagora/hublot
depends_on:
- recommender
- kaldi-gstreamer
- selenium
recommender:
image: linagora/recommender
ports:
- "8080"
kaldi-gstreamer:
image: linagora/kaldi-gstreamer
ports:
- "80"
volumes:
- ${MODELS_PATH}:/opt/models
env_file: .env
environment:
- NB_WORKERS
- YAML
- MODELS_PATH
selenium:
image: selenium/standalone-chrome
ports:
- "4444"
volumes:
- ./media:/opt/media
......@@ -9,15 +9,12 @@
"test": "xo && jest",
"test:watch": "jest --watch",
"ci": "yarn && xo && jest --runInBand",
"setup": "yarn run selenium-standalone install && webdriver-manager update --versions.chrome=2.31 --gecko=false",
"webdriver-start": "./bin/webdriver-start",
"webdriver-stop": "./bin/webdriver-stop"
},
"dependencies": {
"mz": "2.6.0",
"selenium-standalone": "^6.5.0",
"webdriverio": "4.7.1",
"webdriver-manager": "12.0.6"
"webdriverio": "4.7.1"
},
"devDependencies": {
"jest": "20.0.0",
......
npm run webdriver-start
npm start
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment