Skip to content

Commit

Permalink
Merge pull request #127 from lappis-unb/devel
Browse files Browse the repository at this point in the history
Atualização dos containers
  • Loading branch information
arthurTemporim authored Jan 29, 2020
2 parents b781341 + c070fc0 commit ca915cb
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 37 deletions.
41 changes: 22 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ clean:
############################## BOILERPLATE ##############################
first-run:
make build
make train
make run-webchat

build:
Expand All @@ -23,46 +24,48 @@ build-coach:
docker-compose build --no-cache coach

build-analytics:
docker-compose up -d elasticsearch
docker-compose up -d rabbitmq
docker-compose up -d rabbitmq-consumer
docker-compose up -d kibana
sudo docker-compose up -d elasticsearch
sudo docker-compose up -d rabbitmq
sudo docker-compose up -d rabbitmq-consumer
sudo docker-compose up -d kibana
# This sleep time is a work arround the main objetive is run the following command when elasticsearch is ready
# The following command is needed just once for project. It's just a setup onfiguration script.
sleep 30
docker-compose run --rm -v $(current_dir)/modules/analytics/setup_elastic.py:/analytics/setup_elastic.py bot python /analytics/setup_elastic.py
docker-compose run --rm -v $(current_dir)/modules/analytics/:/analytics/ bot python /analytics/import_dashboards.py
sudo docker-compose run --rm -v $(current_dir)/modules/analytics/setup_elastic.py:/analytics/setup_elastic.py bot python /analytics/setup_elastic.py
sudo docker-compose run --rm -v $(current_dir)/modules/analytics/:/analytics/ bot python /analytics/import_dashboards.py
echo "Não se esqueça de atualizar o arquivo endpoints.yml"
sensible-browser --no-sandbox http://localhost:5601

run-analytics:
docker-compose up -d rabbitmq
docker-compose up -d rabbitmq-consumer
docker-compose up -d elasticsearch
docker-compose up -d kibana
sudo docker-compose up -d rabbitmq
sudo docker-compose up -d rabbitmq-consumer
sudo docker-compose up -d elasticsearch
sudo docker-compose up -d kibana
sensible-browser --no-sandbox http://localhost:5601

run-shell:
docker-compose run --rm --service-ports bot make shell
sudo docker-compose run --rm --service-ports bot make shell

run-webchat:
docker-compose run -d --rm --service-ports bot-webchat
sensible-browser --no-sandbox modules/webchat/index.html
sudo docker-compose run -d --rm --service-ports bot-webchat
sensible-browser modules/webchat/index.html

run-telegram:
docker-compose run -d --rm --service-ports bot_telegram make telegram
sudo docker-compose run -d --rm --service-ports bot_telegram make telegram

run-notebooks:
docker-compose up -d notebooks
sudo docker-compose up -d notebooks
sensible-browser --no-sandbox http://localhost:8888

train:
docker-compose build coach
docker-compose build bot
mkdir -p bot/models
sudo chmod -R +777 bot/models
docker-compose up coach
sudo chmod -R +777 bot/models

validate:
docker-compose run --rm coach rasa data validate --domain domain.yml --data data/ -vv
sudo docker-compose run --rm coach rasa data validate --domain domain.yml --data data/ -vv

visualize:
docker-compose run --rm -v $(current_dir)/bot:/coach coach rasa visualize --domain domain.yml --stories data/stories.md --config config.yml --nlu data/nlu.md --out ./graph.html -vv
sudo docker-compose run --rm -v $(current_dir)/bot:/coach coach rasa visualize --domain domain.yml --stories data/stories.md --config config.yml --nlu data/nlu.md --out ./graph.html -vv
sensible-browser --no-sandbox bot/graph.html
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Para ter seu chatbot Rasa no ar e funcionando rápidamente no `shell` execute o seguinte comando:

```sh
sudo make first-run
make first-run
```

Este comando irá construir o seu chatbot (containers necessários) e abrir a conversação em um `livechat`
Expand Down Expand Up @@ -51,13 +51,13 @@ criar um repositório para as imagens e substitua os nomes das imagens "lappis/b
**Atenção**: o comando de treinamento é usado para criar os modelos necessários na conversação do bot para treinar o seu chatbot execute o comando:

```sh
sudo make train
make train
```

### Console

```sh
sudo make run-console
make run-console
```

### Telegram
Expand All @@ -78,13 +78,13 @@ telegram:
Se ainda não tiver treinado seu bot execute antes:

```sh
sudo make train
make train
```

Depois execute o bot no telegram:

```sh
sudo make run-telegram
make run-telegram
```

### Analytics
Expand All @@ -96,15 +96,15 @@ Para a visualização dos dados da interação entre o usuário e o chatbot nós
* Para uma **configuração rápida** execute o seguinte comando:

```sh
sudo make build-analytics
make build-analytics
```

O comando acima só precisa ser executado apenas 1 vez e já vai deixar toda a infra de `analytics` pronta para o uso.

Nas próximas vezes que desejar utilizar o `analytics` execute o comando:

```sh
sudo make run-analytics
make run-analytics
```

Por fim acesse o **kibana** no `locahost:5601`
Expand Down Expand Up @@ -206,7 +206,7 @@ Você pode acessar o kibana no `locahost:5601`
Levante o container `notebooks`

```sh
sudo make run-notebooks
make run-notebooks
```

Acesse o notebook em `localhost:8888`
Expand Down
12 changes: 7 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ services:
# =============================== Coach =================================
# All the models are trained by this coach.
coach:
image: lappis/coach:boilerplate
build:
context: .
dockerfile: ./docker/coach.Dockerfile
volumes:
- ./bot/models/:/bot/models/
command: sh -c "make train"
command: "make train"


# ================================= Bot =====================================
# Generic Rasa bot, used to run console for example.
bot:
image: lappis/bot:boilerplate
build:
context: .
dockerfile: ./docker/bot.Dockerfile
restart: unless-stopped
volumes:
- ./bot/:/bot/
ports:
- 5004:5004
depends_on:
Expand All @@ -44,6 +44,8 @@ services:
build:
context: .
dockerfile: ./docker/bot.Dockerfile
volumes:
- ./bot/:/bot/
ports:
- 5005:5005
depends_on:
Expand Down Expand Up @@ -112,14 +114,14 @@ services:
build:
context: .
dockerfile: ./docker/bot.Dockerfile
volumes:
- ./bot/:/bot/
env_file:
- env/bot-telegram.env
ports:
- 5001:5001
depends_on:
- actions
volumes:
- ./bot:/bot
command: sh -c "make telegram"

# =============================== Notebooks =================================
Expand Down
2 changes: 0 additions & 2 deletions docker/bot.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
FROM lappis/coach:boilerplate as coach
FROM botrequirements

WORKDIR /bot
COPY ./bot /bot
COPY --from=coach /bot/models /bot/models
COPY ./modules /modules

RUN find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
2 changes: 0 additions & 2 deletions docker/coach.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@ FROM botrequirements
WORKDIR /bot

COPY ./bot/ /bot/

RUN make train
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rasa==1.4.2
rasa==1.6.2
nltk==3.4.5
elasticsearch==7.0.4
flake8==3.7.8

0 comments on commit ca915cb

Please sign in to comment.