@@ -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
@@ -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, if necessary (uncomment next line)
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 (uncomment next line)
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're building this image to make it available from another server,
201
- for example a Rasa X or Rasa Enterprise deployment, you should push the image to a cloud repository.
202
- You can push the image to DockerHub via:
203
-
204
- .. code-block :: bash
205
-
206
- docker login --username < account_username> --password < account_password>
207
- docker push < account_username> /< repository_name> :< custom_image_tag>
208
-
209
- To authenticate and push images to a different container registry, please refer to the documentation of
210
- your chosen container registry.
211
-
212
- Then, reference the new image tag in your ``docker-compose.override.yml ``:
213
-
214
- .. code-block :: yaml
215
-
216
- version : ' 3.0'
217
- services :
218
- app :
219
- image : <account_username>/<repository_name>:<custom_image_tag>
220
-
221
- If you are using Docker Compose locally, you can use this image directly in your
222
- ``docker-compose.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