Rasa课程、Rasa培训、Rasa面试、Rasa实战系列之Docker Duckling服务部署

Rasa课程、Rasa培训、Rasa面试、Rasa实战系列之Docker Duckling服务部署

vmvare 本地安装 docker Duckling服务

简介在windows 10 本地电脑上安装vmvare虚拟机,部署docker duckling服务,vmvare安装步骤可以参考网络资料,这里不再赘述。在虚拟机centos linux 7.9 版本中安装docker,部署duckling服务。

官网链接:https://docs.docker.com/engine/install/centos/

  • 删掉以前的docker相关包
login as: root
root@192.168.28.6's password:
Last login: Sun Apr  3 12:44:25 2022
[root@localhost ~]# yum remove docker*
Loaded plugins: fastestmirror, langpacks
No Match for argument: docker*
No Packages marked for removal

  • 配置yum源
[root@localhost ~]# sudo yum install -y yum-utils
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * extras: ftp.sjtu.edu.cn
 * updates: mirrors.aliyun.com
Package yum-utils-1.1.31-54.el7_8.noarch already installed and latest version
Nothing to do
[root@localhost ~]# sudo yum-config-manager \
> --add-repo \
> http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Loaded plugins: fastestmirror, langpacks
adding repo from: http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.rep
grabbing file http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to
repo saved to /etc/yum.repos.d/docker-ce.repo
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
  • 安装docker
[root@localhost ~]# sudo yum install -y docker-ce docker-ce-cli containerd.io
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * extras: ftp.sjtu.edu.cn
 * updates: mirrors.aliyun.com
docker-ce-stable
(1/2): docker-ce-stable/7/x86_64/primary_db
(2/2): docker-ce-stable/7/x86_64/updateinfo
Resolving Dependencies
--> Running transaction check
---> Package containerd.io.x86_64 0:1.5.11-3.1.el7 will be installed
--> Processing Dependency: container-selinux >= 2:2.74 for package: containerd.i
---> Package docker-ce.x86_64 3:20.10.14-3.el7 will be installed
--> Processing Dependency: docker-ce-rootless-extras for package: 3:docker-ce-20
---> Package docker-ce-cli.x86_64 1:20.10.14-3.el7 will be installed
--> Processing Dependency: docker-scan-plugin(x86-64) for package: 1:docker-ce-c
--> Running transaction check
---> Package container-selinux.noarch 2:2.119.2-1.911c772.el7_8 will be installe
---> Package docker-ce-rootless-extras.x86_64 0:20.10.14-3.el7 will be installed
--> Processing Dependency: fuse-overlayfs >= 0.7 for package: docker-ce-rootless
--> Processing Dependency: slirp4netns >= 0.4 for package: docker-ce-rootless-ex
---> Package docker-scan-plugin.x86_64 0:0.17.0-3.el7 will be installed
--> Running transaction check
---> Package fuse-overlayfs.x86_64 0:0.7.2-6.el7_8 will be installed
--> Processing Dependency: libfuse3.so.3(FUSE_3.2)(64bit) for package: fuse-over
--> Processing Dependency: libfuse3.so.3(FUSE_3.0)(64bit) for package: fuse-over
--> Processing Dependency: libfuse3.so.3()(64bit) for package: fuse-overlayfs-0.
---> Package slirp4netns.x86_64 0:0.4.3-4.el7_8 will be installed
--> Running transaction check
---> Package fuse3-libs.x86_64 0:3.6.1-4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                                     Arch                     Version
================================================================================
Installing:
 containerd.io                               x86_64                   1.5.11-3.1
 docker-ce                                   x86_64                   3:20.10.14
 docker-ce-cli                               x86_64                   1:20.10.14
Installing for dependencies:
 container-selinux                           noarch                   2:2.119.2-
 docker-ce-rootless-extras                   x86_64                   20.10.14-3
 docker-scan-plugin                          x86_64                   0.17.0-3.e
 fuse-overlayfs                              x86_64                   0.7.2-6.el
 fuse3-libs                                  x86_64                   3.6.1-4.el
 slirp4netns                                 x86_64                   0.4.3-4.el

Transaction Summary
================================================================================
Install  3 Packages (+6 Dependent packages)

Total download size: 94 M
Installed size: 378 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/extras/packages/container-selinux-2.119.2-1.911
Public key for container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm is not insta
(1/9): container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm
warning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/containerd.io-1.5.11-
Public key for containerd.io-1.5.11-3.1.el7.x86_64.rpm is not installed
(2/9): containerd.io-1.5.11-3.1.el7.x86_64.rpm
(3/9): docker-ce-20.10.14-3.el7.x86_64.rpm
(4/9): docker-ce-rootless-extras-20.10.14-3.el7.x86_64.rpm
(5/9): docker-scan-plugin-0.17.0-3.el7.x86_64.rpm
(6/9): fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm
(7/9): slirp4netns-0.4.3-4.el7_8.x86_64.rpm
(8/9): docker-ce-cli-20.10.14-3.el7.x86_64.rpm
(9/9): fuse3-libs-3.6.1-4.el7.x86_64.rpm
--------------------------------------------------------------------------------
Total
Retrieving key from https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
Importing GPG key 0x621E9F35:
 Userid     : "Docker Release (CE rpm) <[email protected]>"
 Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
 From       : https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-9.2009.0.el7.centos.x86_64 (@anaconda)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : docker-scan-plugin-0.17.0-3.el7.x86_64
  Installing : 1:docker-ce-cli-20.10.14-3.el7.x86_64
  Installing : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch
  Installing : containerd.io-1.5.11-3.1.el7.x86_64
  Installing : slirp4netns-0.4.3-4.el7_8.x86_64
  Installing : fuse3-libs-3.6.1-4.el7.x86_64
  Installing : fuse-overlayfs-0.7.2-6.el7_8.x86_64
  Installing : docker-ce-rootless-extras-20.10.14-3.el7.x86_64
  Installing : 3:docker-ce-20.10.14-3.el7.x86_64
  Verifying  : 3:docker-ce-20.10.14-3.el7.x86_64
  Verifying  : containerd.io-1.5.11-3.1.el7.x86_64
  Verifying  : fuse3-libs-3.6.1-4.el7.x86_64
  Verifying  : fuse-overlayfs-0.7.2-6.el7_8.x86_64
  Verifying  : docker-ce-rootless-extras-20.10.14-3.el7.x86_64
  Verifying  : slirp4netns-0.4.3-4.el7_8.x86_64
  Verifying  : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch
  Verifying  : 1:docker-ce-cli-20.10.14-3.el7.x86_64
  Verifying  : docker-scan-plugin-0.17.0-3.el7.x86_64

Installed:
  containerd.io.x86_64 0:1.5.11-3.1.el7                docker-ce.x86_64 3:20.10.

Dependency Installed:
  container-selinux.noarch 2:2.119.2-1.911c772.el7_8     docker-ce-rootless-extr
  fuse-overlayfs.x86_64 0:0.7.2-6.el7_8                  fuse3-libs.x86_64 0:3.6

Complete!
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
  • 启动 docker
[root@localhost ~]#
[root@localhost ~]# systemctl enable docker --now
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# pwd
/root
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# sudo mkdir -p /etc/docker
[root@localhost ~]# sudo tee /etc/docker/daemon.json <<-'EOF'
> {
    
    
>   "registry-mirrors": ["https://82m9ar63.mirror.aliyuncs.com"],
>   "exec-opts": ["native.cgroupdriver=systemd"],
>   "log-driver": "json-file",
>   "log-opts": {
    
    
>     "max-size": "100m"
>   },
>   "storage-driver": "overlay2"
> }
> EOF
{
    
    
  "registry-mirrors": ["https://82m9ar63.mirror.aliyuncs.com"],
  "exec-opts": ["native.cgroupdriver=systemd"],
  "log-driver": "json-file",
  "log-opts": {
    
    
    "max-size": "100m"
  },
  "storage-driver": "overlay2"
}
[root@localhost ~]# sudo systemctl daemon-reload
[root@localhost ~]# sudo systemctl restart docker
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# docker images
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE
[root@localhost ~]#
[root@localhost ~]# https://hub.docker.com/
-bash: https://hub.docker.com/: No such file or directory
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# docker pull rasa/duckling
Using default tag: latest
latest: Pulling from rasa/duckling
5e7b6b7bd506: Pull complete
ac8fb0c0f95f: Pull complete
282b76812dd6: Pull complete
Digest: sha256:6765f1d0d0e87e60c88984f367345ba634d8d90e64eea60ee72526224c233876
Status: Downloaded newer image for rasa/duckling:latest
docker.io/rasa/duckling:latest
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# docker images
REPOSITORY      TAG       IMAGE ID       CREATED        SIZE
rasa/duckling   latest    49acc1a38992   6 months ago   165MB
[root@localhost ~]#
[root@localhost ~]#
  • 启动rasa duckling
[root@localhost ~]# docker run --name=my_rasa_duckling  -d  --restart=always -p  8000:8000   rasa/duckling
9ab047feff74c862de23aa621adb497e3d5273b4df33f0bf26cf15f1bf8610ac
[root@localhost ~]#
[root@localhost ~]# docker ps
CONTAINER ID   IMAGE           COMMAND                  CREATED         STATUS         PORTS                                       NAMES
9ab047feff74   rasa/duckling   "duckling-example-ex…"   6 seconds ago   Up 5 seconds   0.0.0.0:8000->8000/tcp, :::8000->8000/tcp   my_rasa_duckling
[root@localhost ~]#
[root@localhost ~]#

安装测试一下nginx

[root@localhost ~]# docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
a2abf6c4d29d: Pull complete
a9edb18cadd1: Pull complete
589b7251471a: Pull complete
186b1aaa4aa6: Pull complete
b4df32aa5a72: Pull complete
a0bcbecc962e: Pull complete
Digest: sha256:0d17b565c37bcbd895e9d92315a05c1c3c9a29f762b011a10c54a66cd53c9b31
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# docker run --name=mynginx   -d  --restart=always -p  88:80   nginx
22e4bb6c4929c8995e23b855661993e0640381fd55e70f994a4651e00a639352
[root@localhost ~]#
[root@localhost ~]#

在这里插入图片描述

rasa duckling服务测试

在pycharm中启动rasa server
在这里插入图片描述
提示连接的是远程云服务器的duckling,提示报错
在这里插入图片描述

修改配置

recipe: default.v1
version: '3.0'
language: en
pipeline:
  - name: WhitespaceTokenizer
  - name: RegexFeaturizer
  - name: LexicalSyntacticFeaturizer
  - name: CountVectorsFeaturizer
  - name: CountVectorsFeaturizer
    analyzer: "char_wb"
    min_ngram: 1
    max_ngram: 4
  - name: DIETClassifier
    epochs: 100
  - name: FallbackClassifier
    threshold: 0.7
    ambiguity_threshold: 0.1
  - name: DucklingEntityExtractor
    #url: http://139.198.188.27:8000
    url: http://192.168.28.6:8000
    dimensions:
    - amount-of-money
    - time
    - number
  - name: SpacyNLP
    model: "en_core_web_md"
    case_sensitive: false
  - name: "SpacyEntityExtractor"
    # Note: It is not possible to use the SpacyTokenizer + SpacyFeaturizer in
    #       combination with the WhitespaceTokenizer, and as a result the
    #       PERSON extraction by Spacy is not very robust.
    #       Because of this, the nlu training data is annotated as well, and the
    #       DIETClassifier will also extract PERSON entities .
    dimensions: ["PERSON"]
  - name: EntitySynonymMapper
policies:
- name: AugmentedMemoizationPolicy
- name: TEDPolicy
  epochs: 40
- name: RulePolicy
  core_fallback_threshold: 0.4
  core_fallback_action_name: "action_default_fallback"
  enable_fallback_prediction: True

重新启动
在这里插入图片描述
在这里插入图片描述

启动rasa action 微服务
在这里插入图片描述

测试duckling服务
输入信息:whats my account balance

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

centos linux 7.9 镜像下载链接:http://mirrors.aliyun.com/centos/7.9.2009/isos/x86_64/

Rasa 3.x系列博客分享

猜你喜欢

转载自blog.csdn.net/duan_zhihua/article/details/123934271