From d93d7d6ee5601087e01d4c9fc100e2efb882b3a4 Mon Sep 17 00:00:00 2001 From: Arthur Temporim Date: Wed, 27 Nov 2019 20:00:17 -0300 Subject: [PATCH 1/7] Change coach container behavior Signed-off-by: Arthur Temporim --- Makefile | 2 +- docker-compose.yml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 839e4c8e..bfaaa4ae 100644 --- a/Makefile +++ b/Makefile @@ -57,7 +57,7 @@ run-notebooks: sensible-browser --no-sandbox http://localhost:8888 train: - docker-compose up coach + docker-compose build coach docker-compose build bot validate: diff --git a/docker-compose.yml b/docker-compose.yml index 13620cec..9b93067e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,7 +9,6 @@ services: dockerfile: ./docker/coach.Dockerfile volumes: - ./bot/models/:/bot/models/ - command: sh -c "make train" # ================================= Bot ===================================== From 29396ced76e2a6c2d52bd059ad74f28c954de015 Mon Sep 17 00:00:00 2001 From: Arthur Temporim Date: Thu, 28 Nov 2019 19:43:17 -0300 Subject: [PATCH 2/7] Add sudo to Makefile commands Signed-off-by: Arthur Temporim --- Makefile | 40 ++++++++++++++++++++-------------------- README.md | 16 ++++++++-------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index bfaaa4ae..97676229 100644 --- a/Makefile +++ b/Makefile @@ -17,52 +17,52 @@ build-requirements: docker build . -f docker/requirements.Dockerfile -t botrequirements build-bot: - docker-compose build bot + sudo docker-compose build bot build-coach: - docker-compose up coach + sudo docker-compose up 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 + sudo docker-compose run -d --rm --service-ports bot-webchat sensible-browser --no-sandbox 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 + sudo docker-compose up coach + sudo docker-compose build bot 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 diff --git a/README.md b/README.md index dbb1c53a..9d806b0e 100644 --- a/README.md +++ b/README.md @@ -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` @@ -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 @@ -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 @@ -96,7 +96,7 @@ 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. @@ -104,7 +104,7 @@ O comando acima só precisa ser executado apenas 1 vez e já vai deixar toda a i 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` @@ -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` From c5c86bb40fa7ce3a2ba16cf81e7f442b5ff7dd30 Mon Sep 17 00:00:00 2001 From: Arthur Temporim Date: Fri, 29 Nov 2019 09:29:31 -0300 Subject: [PATCH 3/7] Update Makefile Signed-off-by: Arthur Temporim --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 97676229..44fced77 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ clean: ############################## BOILERPLATE ############################## first-run: - make build + sudo make build make run-webchat build: @@ -47,7 +47,7 @@ run-shell: run-webchat: sudo docker-compose run -d --rm --service-ports bot-webchat - sensible-browser --no-sandbox modules/webchat/index.html + sensible-browser modules/webchat/index.html run-telegram: sudo docker-compose run -d --rm --service-ports bot_telegram make telegram From 2b6d49c249f0e1352e5027bcfc85e36d7c3915ba Mon Sep 17 00:00:00 2001 From: Arthur Temporim Date: Fri, 29 Nov 2019 09:40:30 -0300 Subject: [PATCH 4/7] Ident docker-compose.yml Signed-off-by: Arthur Temporim --- docker-compose.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 9b93067e..a0834816 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -39,14 +39,14 @@ services: # ============================ WebChat Bot ================================= # Specific Rasa bot integrated with WebChat. bot-webchat: - build: - context: . - dockerfile: ./docker/bot.Dockerfile - ports: - - 5005:5005 - depends_on: - - actions - command: sh -c "make webchat" + build: + context: . + dockerfile: ./docker/bot.Dockerfile + ports: + - 5005:5005 + depends_on: + - actions + command: sh -c "make webchat" # =============================== Analytics ================================= # Analitics ElasticSearch Stack. From 0d7f3544b95e0ce11b060f528af795fe72c70a6f Mon Sep 17 00:00:00 2001 From: Pablo Diego Date: Fri, 29 Nov 2019 09:45:51 -0300 Subject: [PATCH 5/7] change webchat build to image --- docker-compose.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index a0834816..1807d8db 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -39,9 +39,7 @@ services: # ============================ WebChat Bot ================================= # Specific Rasa bot integrated with WebChat. bot-webchat: - build: - context: . - dockerfile: ./docker/bot.Dockerfile + image: lappis/bot:boilerplate ports: - 5005:5005 depends_on: From cb509036fa2bcd095508a59e5e3a813843ce1da6 Mon Sep 17 00:00:00 2001 From: Arthur Temporim Date: Fri, 29 Nov 2019 11:06:31 -0300 Subject: [PATCH 6/7] Add make train to coach Signed-off-by: Arthur Temporim --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index a0834816..422a62fd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,6 +9,7 @@ services: dockerfile: ./docker/coach.Dockerfile volumes: - ./bot/models/:/bot/models/ + command: "make train" # ================================= Bot ===================================== From ccf60667cfd17002930c5359b1affef868c33eef Mon Sep 17 00:00:00 2001 From: Arthur Temporim Date: Wed, 29 Jan 2020 00:53:52 -0300 Subject: [PATCH 7/7] Update project to locally build all containers Signed-off-by: Arthur Temporim --- Makefile | 7 +++++-- docker-compose.yml | 10 ++++++---- docker/bot.Dockerfile | 2 -- docker/coach.Dockerfile | 2 -- requirements.txt | 2 +- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 1a1beb30..3886d2de 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ clean: ############################## BOILERPLATE ############################## first-run: make build + make train make run-webchat build: @@ -57,8 +58,10 @@ run-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 diff --git a/docker-compose.yml b/docker-compose.yml index 9d783f8f..34a95ccb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,7 +4,6 @@ services: # =============================== Coach ================================= # All the models are trained by this coach. coach: - image: lappis/coach:boilerplate build: context: . dockerfile: ./docker/coach.Dockerfile @@ -16,11 +15,12 @@ services: # ================================= 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: @@ -44,6 +44,8 @@ services: build: context: . dockerfile: ./docker/bot.Dockerfile + volumes: + - ./bot/:/bot/ ports: - 5005:5005 depends_on: @@ -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 ================================= diff --git a/docker/bot.Dockerfile b/docker/bot.Dockerfile index 3dc87b79..0bdf9c42 100644 --- a/docker/bot.Dockerfile +++ b/docker/bot.Dockerfile @@ -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 diff --git a/docker/coach.Dockerfile b/docker/coach.Dockerfile index 625e1f89..0208cea1 100644 --- a/docker/coach.Dockerfile +++ b/docker/coach.Dockerfile @@ -3,5 +3,3 @@ FROM botrequirements WORKDIR /bot COPY ./bot/ /bot/ - -RUN make train diff --git a/requirements.txt b/requirements.txt index 3e0ac3bd..6937bfb5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -rasa==1.4.2 +rasa==1.6.2 nltk==3.4.5 elasticsearch==7.0.4 flake8==3.7.8