Commit 15037cbaae9f5f5bc853a0ea7270480607d12340
1 parent
95a533fe
Exists in
master
and in
3 other branches
Atualização Docker-compose Isolamento
Showing
8 changed files
with
84 additions
and
7 deletions
Show diff stats
| @@ -0,0 +1,77 @@ | @@ -0,0 +1,77 @@ | ||
| 1 | +FROM ubuntu:14.04 | ||
| 2 | +MAINTAINER Jonathan Brilhante | ||
| 3 | +#USER root | ||
| 4 | + | ||
| 5 | +#Dependencies installation - RabbitMQ / Graylog / Nodejs | ||
| 6 | + | ||
| 7 | +#Packages updates | ||
| 8 | +RUN apt-get -y upgrade | ||
| 9 | +RUN apt-get -y update | ||
| 10 | + | ||
| 11 | +#Install necessary packages | ||
| 12 | +RUN apt-get install -y build-essential libssl-dev sudo curl wget && apt-get clean | ||
| 13 | + | ||
| 14 | +#Install python packages | ||
| 15 | +RUN apt-get install -y python-setuptools && easy_install pip | ||
| 16 | + | ||
| 17 | +#Install RabbitMQ | ||
| 18 | +RUN echo 'deb http://www.rabbitmq.com/debian/ testing main' | sudo tee /etc/apt/sources.list.d/rabbitmq.list && wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add - | ||
| 19 | +RUN apt-get update && apt-get install rabbitmq-server -y && apt-get clean | ||
| 20 | + | ||
| 21 | +#Install python and python lib for RabbitMQ | ||
| 22 | +RUN apt-get install -y python && pip install pika | ||
| 23 | + | ||
| 24 | +#Enable RabbitMQ plugins | ||
| 25 | +RUN rabbitmq-plugins enable rabbitmq_management | ||
| 26 | + | ||
| 27 | +#Install Graylog | ||
| 28 | +RUN pip install graypy | ||
| 29 | +RUN pip install graypy[amqp] | ||
| 30 | + | ||
| 31 | +#Install aditional packages | ||
| 32 | +RUN apt-get install -y pkg-config libfreetype6-dev libpng-dev xvfb python-yaml libgomp1 python-numpy python-pyfits python-matplotlib idle && apt-get clean | ||
| 33 | +RUN pip install nltk==3.0.5 nltk_tgrep --upgrade | ||
| 34 | +RUN pip install pysrt ffmpy pyvirtualdisplay | ||
| 35 | +RUN apt-get install -y software-properties-common && apt-get clean | ||
| 36 | + | ||
| 37 | +#Install FFmpeg | ||
| 38 | +RUN add-apt-repository ppa:mc3man/trusty-media && apt-get -y update && apt-get install -y ffmpeg gstreamer0.10-ffmpeg && apt-get clean | ||
| 39 | + | ||
| 40 | +WORKDIR /root/ | ||
| 41 | +RUN mkdir -p ./storage/ | ||
| 42 | +RUN mkdir -p ./storage/libras | ||
| 43 | +RUN mkdir -p ./storage/frames | ||
| 44 | + | ||
| 45 | +#Copy workers to container | ||
| 46 | +ADD ./translator.py /root/translator.py | ||
| 47 | +ADD ./renderer.py /root/renderer.py | ||
| 48 | +ADD ./indexer.py /root/indexer.py | ||
| 49 | +ADD ./PikaManager.py /root/PikaManager.py | ||
| 50 | +ADD ./processManager.py /root/processManager.py | ||
| 51 | +ADD ./logger.py /root/logger.py | ||
| 52 | +ADD ./Trie.py /root/Trie.py | ||
| 53 | + | ||
| 54 | +ADD ./fonts/ /root/fonts/ | ||
| 55 | +ADD ./bundles/ /root/storage/bundles/ | ||
| 56 | +ADD ./vlibras-translate/ /root/vlibras-translate/ | ||
| 57 | +ADD ./vlibras-libs/ /root/vlibras-libs/ | ||
| 58 | +ADD ./unityVideo/ /root/unityVideo/ | ||
| 59 | + | ||
| 60 | +RUN chmod +x /root/unityVideo/videoCreator.x86_64 | ||
| 61 | + | ||
| 62 | +#Workers environment variables | ||
| 63 | +ENV VLIBRAS_VIDEO_CREATOR="/root/unityVideo/videoCreator.x86_64" | ||
| 64 | +ENV VLIBRAS_VIDEO_LIBRAS="/root/storage/libras" | ||
| 65 | +ENV VLIBRAS_VIDEO_SCREENS="/root/storage/frames" | ||
| 66 | +ENV SIGNS_VLIBRAS="/root/storage/bundles" | ||
| 67 | +ENV TEXT_FONTS="/root/fonts/FreeSans.ttf" | ||
| 68 | + | ||
| 69 | +#Translator environment variables | ||
| 70 | +ENV HUNPOS_TAGGER="/root/vlibras-libs/aelius/bin/hunpos-tag" | ||
| 71 | +ENV AELIUS_DATA="/root/vlibras-libs/aelius/aelius_data" | ||
| 72 | +ENV TRANSLATE_DATA="/root/vlibras-translate/data" | ||
| 73 | +ENV NLTK_DATA="/root/vlibras-libs/aelius/nltk_data" | ||
| 74 | +ENV PYTHONPATH=":/root/vlibras-libs/aelius:/root/vlibras-translate/src:/root/vlibras-libs/aelius:/root/vlibras-translate/src" | ||
| 75 | + | ||
| 76 | +#Comando de entrada quando inicializado | ||
| 77 | +ENTRYPOINT sleep 1m ; python /root/processManager.py |
No preview for this file type
core/indexer.py
| @@ -23,7 +23,7 @@ BUNDLES_PATH=None | @@ -23,7 +23,7 @@ BUNDLES_PATH=None | ||
| 23 | BUNDLES_LIST={} | 23 | BUNDLES_LIST={} |
| 24 | 24 | ||
| 25 | # Manager of queues connections. | 25 | # Manager of queues connections. |
| 26 | -manager = PikaManager.PikaManager("localhost") | 26 | +manager = PikaManager.PikaManager("rabbit") |
| 27 | 27 | ||
| 28 | def generate_trie(): | 28 | def generate_trie(): |
| 29 | global TRIE | 29 | global TRIE |
core/logger.py
| @@ -23,7 +23,7 @@ from time import sleep | @@ -23,7 +23,7 @@ from time import sleep | ||
| 23 | SERVER_URL = sys.argv[1] | 23 | SERVER_URL = sys.argv[1] |
| 24 | 24 | ||
| 25 | # Manager of queues connections. | 25 | # Manager of queues connections. |
| 26 | -manager = PikaManager.PikaManager("localhost") | 26 | +manager = PikaManager.PikaManager("rabbit") |
| 27 | 27 | ||
| 28 | # Logging configuration. | 28 | # Logging configuration. |
| 29 | logger = logging.getLogger('text_container') | 29 | logger = logging.getLogger('text_container') |
core/renderer.py
| @@ -29,7 +29,7 @@ from time import sleep | @@ -29,7 +29,7 @@ from time import sleep | ||
| 29 | from shutil import rmtree | 29 | from shutil import rmtree |
| 30 | 30 | ||
| 31 | # Manager of queues connections. | 31 | # Manager of queues connections. |
| 32 | -manager = PikaManager.PikaManager("localhost") | 32 | +manager = PikaManager.PikaManager("rabbit") |
| 33 | 33 | ||
| 34 | TCP_IP = '0.0.0.0' | 34 | TCP_IP = '0.0.0.0' |
| 35 | TCP_PORT = 5555 | 35 | TCP_PORT = 5555 |
core/translator.py
| @@ -20,7 +20,7 @@ from PortGlosa import traduzir | @@ -20,7 +20,7 @@ from PortGlosa import traduzir | ||
| 20 | from time import sleep | 20 | from time import sleep |
| 21 | 21 | ||
| 22 | # Manager of queues connections. | 22 | # Manager of queues connections. |
| 23 | -manager = PikaManager.PikaManager("localhost") | 23 | +manager = PikaManager.PikaManager("rabbit") |
| 24 | 24 | ||
| 25 | def run(ch, method, properties, body): | 25 | def run(ch, method, properties, body): |
| 26 | """ | 26 | """ |
translate-api/config/db.js
| @@ -18,7 +18,7 @@ mongoose.Promise = require('bluebird'); | @@ -18,7 +18,7 @@ mongoose.Promise = require('bluebird'); | ||
| 18 | /* | 18 | /* |
| 19 | * Connection | 19 | * Connection |
| 20 | */ | 20 | */ |
| 21 | -mongoose.connect('mongodb://localhost/container_contents', function(err) { | 21 | +mongoose.connect('mongodb://mongo/container_contents', function(err) { |
| 22 | if(err) { | 22 | if(err) { |
| 23 | console.log('MongoDB connection error: ', err); | 23 | console.log('MongoDB connection error: ', err); |
| 24 | } else { | 24 | } else { |
translate-api/helpers/amqpManager.js
| @@ -18,7 +18,7 @@ var amqplib = require('amqplib/callback_api'); | @@ -18,7 +18,7 @@ var amqplib = require('amqplib/callback_api'); | ||
| 18 | */ | 18 | */ |
| 19 | exports.sendToQueue = function(body, id, queue, durability, res, next) { | 19 | exports.sendToQueue = function(body, id, queue, durability, res, next) { |
| 20 | 20 | ||
| 21 | - amqplib.connect('amqp://localhost', function(err, conn) { | 21 | + amqplib.connect('amqp://rabbit', function(err, conn) { |
| 22 | if (err) | 22 | if (err) |
| 23 | return next(err, 'Cannot connect to RabbitMQ'); | 23 | return next(err, 'Cannot connect to RabbitMQ'); |
| 24 | 24 | ||
| @@ -46,7 +46,7 @@ exports.sendToQueue = function(body, id, queue, durability, res, next) { | @@ -46,7 +46,7 @@ exports.sendToQueue = function(body, id, queue, durability, res, next) { | ||
| 46 | */ | 46 | */ |
| 47 | exports.receiveFromQueue = function(id, queue, durability, res, next) { | 47 | exports.receiveFromQueue = function(id, queue, durability, res, next) { |
| 48 | 48 | ||
| 49 | - amqplib.connect('amqp://localhost', function(err, conn) { | 49 | + amqplib.connect('amqp://rabbit', function(err, conn) { |
| 50 | if (err) | 50 | if (err) |
| 51 | return next(err, 'Cannot connect to RabbitMQ'); | 51 | return next(err, 'Cannot connect to RabbitMQ'); |
| 52 | 52 |