@@ -48,6 +48,8 @@ REST channel, uncomment this section in the ``credentials.yml``:
48
48
The REST channel will open your bot up to incoming requests at the ``/webhooks/rest/webhook `` endpoint.
49
49
50
50
51
+ .. _running-multiple-services :
52
+
51
53
Using Docker Compose to Run Multiple Services
52
54
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
53
55
@@ -101,7 +103,7 @@ an action server image, see :ref:`building-an-action-server-image`.
101
103
command:
102
104
- run
103
105
app:
104
- image: <your action server image>
106
+ image: <image:tag >
105
107
expose: 5055
106
108
107
109
The ``expose: 5005 `` is what allows the ``rasa `` service to reach the ``app `` service on that port.
@@ -127,106 +129,6 @@ corresponds to a :ref:`configured channel <docker-compose-configuring-channels>`
127
129
-H " Content-type: application/json" \
128
130
-d ' {"sender": "test", "message": "hello"}'
129
131
130
- .. _building-an-action-server-image :
131
-
132
- Building an Action Server Image
133
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
134
-
135
- If you build an image that includes your action code and store it in a container registry, you can run it locally
136
- or as part of your deployment, without having to move code between servers.
137
- In addition, you can add any additional dependencies of systems or Python libraries
138
- that are part of your action code but not included in the base ``rasa/rasa-sdk `` image.
139
-
140
- This documentation assumes you are pushing your images to `DockerHub <https://hub.docker.com/ >`_.
141
- DockerHub will let you host multiple public repositories and
142
- one private repository for free. Be sure to first `create an account <https://hub.docker.com/signup/ >`_
143
- and `create a repository <https://hub.docker.com/signup/ >`_ to store your images. You could also push images to
144
- a different Docker registry, such as `Google Container Registry <https://cloud.google.com/container-registry >`_,
145
- `Amazon Elastic Container Registry <https://aws.amazon.com/ecr/ >`_, or
146
- `Azure Container Registry <https://azure.microsoft.com/en-us/services/container-registry/ >`_.
147
-
148
- To create your image:
149
-
150
- #. Move your actions code to a folder ``actions `` in your project directory.
151
- Make sure to also add an empty ``actions/__init__.py `` file:
152
-
153
- .. code-block :: bash
154
-
155
- mkdir actions
156
- mv actions.py actions/actions.py
157
- touch actions/__init__.py # the init file indicates actions.py is a python module
158
-
159
- The ``rasa/rasa-sdk `` image will automatically look for the actions in ``actions/actions.py ``.
160
-
161
- #. If your actions have any extra dependencies, create a list of them in a file,
162
- ``actions/requirements-actions.txt ``.
163
- #. Create a file named ``Dockerfile `` in your project directory,
164
- in which you'll extend the official SDK image, copy over your code, and add any custom dependencies (if necessary).
165
- For example:
166
-
167
- .. parsed-literal ::
168
-
169
- # Extend the official Rasa SDK image
170
- FROM rasa/rasa-sdk:\ |version |.0
171
-
172
- # Use subdirectory as working directory
173
- WORKDIR /app
174
-
175
- # Copy any additional custom requirements
176
- COPY actions/requirements-actions.txt ./
177
-
178
- # Change back to root user to install dependencies
179
- USER root
180
-
181
- # Install extra requirements for actions code, if necessary (otherwise comment this out)
182
- RUN pip install -r requirements-actions.txt
183
-
184
- # Copy actions folder to working directory
185
- COPY ./actions /app/actions
186
-
187
- # By best practices, don't run the code with root user
188
- USER 1001
189
-
190
- You can then build the image via the following command:
191
-
192
- .. code-block :: bash
193
-
194
- docker build . -t < account_username> /< repository_name> :< custom_image_tag>
195
-
196
- The ``<custom_image_tag> `` should reference how this image will be different from others. For
197
- example, you could version or date your tags, as well as create different tags that have different code for production
198
- and development servers. You should create a new tag any time you update your code and want to re-deploy it.
199
-
200
- If you are using Docker Compose locally, you can use this image directly in your
201
- ``docker-compose.yml ``:
202
-
203
- .. code-block :: yaml
204
-
205
- version : ' 3.0'
206
- services :
207
- app :
208
- image : <account_username>/<repository_name>:<custom_image_tag>
209
-
210
- If you're building this image to make it available from another server,
211
- for example a Rasa X or Rasa Enterprise deployment, you should push the image to a cloud repository.
212
- You can push the image to DockerHub via:
213
-
214
- .. code-block :: bash
215
-
216
- docker login --username < account_username> --password < account_password>
217
- docker push < account_username> /< repository_name> :< custom_image_tag>
218
-
219
- To authenticate and push images to a different container registry, please refer to the documentation of
220
- your chosen container registry.
221
-
222
- Then, reference the new image tag in your ``docker-compose.override.yml ``:
223
-
224
- .. code-block :: yaml
225
-
226
- version : ' 3.0'
227
- services :
228
- app :
229
- image : <account_username>/<repository_name>:<custom_image_tag>
230
132
231
133
Configuring a Tracker Store
232
134
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0 commit comments