Skip to content

Commit db7211f

Browse files
committed
make action information more discoverable
1 parent 8b45ea4 commit db7211f

File tree

2 files changed

+95
-100
lines changed

2 files changed

+95
-100
lines changed

docs/user-guide/docker/deploying-in-docker-compose.rst

Lines changed: 2 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ REST channel, uncomment this section in the ``credentials.yml``:
4848
The REST channel will open your bot up to incoming requests at the ``/webhooks/rest/webhook`` endpoint.
4949

5050

51+
.. _running-multiple-services:
52+
5153
Using Docker Compose to Run Multiple Services
5254
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5355

@@ -127,106 +129,6 @@ corresponds to a :ref:`configured channel <docker-compose-configuring-channels>`
127129
-H "Content-type: application/json" \
128130
-d '{"sender": "test", "message": "hello"}'
129131
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>
230132
231133
Configuring a Tracker Store
232134
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

docs/user-guide/how-to-deploy.rst

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,96 @@ Rasa Assistant locally or in Docker. Then you can deploy your model in Docker Co
9090
Building a Rasa Assistant Locally <rasa-tutorial>
9191
docker/building-in-docker
9292
docker/deploying-in-docker-compose
93+
94+
95+
Deploying Your Action Server
96+
----------------------------
97+
98+
.. _building-an-action-server-image:
99+
100+
Building an Action Server Image
101+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
102+
103+
This documentation assumes you are pushing your images to `DockerHub <https://hub.docker.com/>`_.
104+
DockerHub will let you host multiple public repositories and
105+
one private repository for free. Be sure to first `create an account <https://hub.docker.com/signup/>`_
106+
and `create a repository <https://hub.docker.com/signup/>`_ to store your images. You could also push images to
107+
a different Docker registry, such as `Google Container Registry <https://cloud.google.com/container-registry>`_,
108+
`Amazon Elastic Container Registry <https://aws.amazon.com/ecr/>`_, or
109+
`Azure Container Registry <https://azure.microsoft.com/en-us/services/container-registry/>`_.
110+
111+
To create your image:
112+
113+
#. Move your actions code to a folder ``actions`` in your project directory.
114+
Make sure to also add an empty ``actions/__init__.py`` file:
115+
116+
.. code-block:: bash
117+
118+
mkdir actions
119+
mv actions.py actions/actions.py
120+
touch actions/__init__.py # the init file indicates actions.py is a python module
121+
122+
The ``rasa/rasa-sdk`` image will automatically look for the actions in ``actions/actions.py``.
123+
124+
#. If your actions have any extra dependencies, create a list of them in a file,
125+
``actions/requirements-actions.txt``.
126+
#. Create a file named ``Dockerfile`` in your project directory,
127+
in which you'll extend the official SDK image, copy over your code, and add any custom dependencies (if necessary).
128+
For example:
129+
130+
.. parsed-literal::
131+
132+
# Extend the official Rasa SDK image
133+
FROM rasa/rasa-sdk:\ |version|.0
134+
135+
# Use subdirectory as working directory
136+
WORKDIR /app
137+
138+
# Copy any additional custom requirements, if necessary (uncomment next line)
139+
# COPY actions/requirements-actions.txt ./
140+
141+
# Change back to root user to install dependencies
142+
USER root
143+
144+
# Install extra requirements for actions code, if necessary (uncomment next line)
145+
# RUN pip install -r requirements-actions.txt
146+
147+
# Copy actions folder to working directory
148+
COPY ./actions /app/actions
149+
150+
# By best practices, don't run the code with root user
151+
USER 1001
152+
153+
You can then build the image via the following command:
154+
155+
.. code-block:: bash
156+
157+
docker build . -t <account_username>/<repository_name>:<custom_image_tag>
158+
159+
The ``<custom_image_tag>`` should reference how this image will be different from others. For
160+
example, you could version or date your tags, as well as create different tags that have different code for production
161+
and development servers. You should create a new tag any time you update your code and want to re-deploy it.
162+
163+
164+
Using your Custom Action Server Image
165+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
166+
167+
If you're building this image to make it available from another server,
168+
for example a Rasa X or Rasa Enterprise deployment, you should push the image to a cloud repository.
169+
You can push the image to DockerHub via:
170+
171+
.. code-block:: bash
172+
173+
docker login --username <account_username> --password <account_password>
174+
docker push <account_username>/<repository_name>:<custom_image_tag>
175+
176+
To authenticate and push images to a different container registry, please refer to the documentation of
177+
your chosen container registry.
178+
179+
How you reference the custom action image will depend on your deployment. Pick the relevant documentation for
180+
your deployment:
181+
182+
- `One-Line Deployment <https://rasa.com/docs/rasa-x/installation-and-setup/one-line-deploy-script/#customizing-the-script>`_
183+
- `Kubernetes or Openshift <https://rasa.com/docs/rasa-x/installation-and-setup/openshift-kubernetes/#adding-a-custom-action-server>`_
184+
- `Docker Compose <https://rasa.com/docs/rasa-x/installation-and-setup/docker-compose-script/#connect-a-custom-action-server>`_
185+
- :ref:`Rasa Open Source Only <running-multiple-services>`

0 commit comments

Comments
 (0)