Skip to content

Commit 90dde9d

Browse files
authored
Merge pull request RasaHQ#5566 from RasaHQ/1.9.x
merge 1.9.x into master
2 parents 1367121 + 301d0a5 commit 90dde9d

File tree

11 files changed

+441
-152
lines changed

11 files changed

+441
-152
lines changed

CHANGELOG.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,35 @@ This project adheres to `Semantic Versioning`_ starting with version 1.0.
1717

1818
.. towncrier release notes start
1919
20+
[1.9.5] - 2020-04-01
21+
^^^^^^^^^^^^^^^^^^^^
22+
23+
Improvements
24+
------------
25+
- `#5533 <https://github.com/rasahq/rasa/issues/5533>`_: Support for
26+
`PostgreSQL schemas <https://www.postgresql.org/docs/11/ddl-schemas.html>`_ in
27+
:ref:`sql-tracker-store`. The ``SQLTrackerStore``
28+
accesses schemas defined by the ``POSTGRESQL_SCHEMA`` environment variable if
29+
connected to a PostgreSQL database.
30+
31+
The schema is added to the connection string option's ``-csearch_path`` key, e.g.
32+
``-options=-csearch_path=<SCHEMA_NAME>`` (see
33+
`<https://www.postgresql.org/docs/11/contrib-dblink-connect.html>`_ for more details).
34+
As before, if no ``POSTGRESQL_SCHEMA`` is defined, Rasa uses the database's default
35+
schema (``public``).
36+
37+
The schema has to exist in the database before connecting, i.e. it needs to have been
38+
created with
39+
40+
.. code-block:: postgresql
41+
42+
CREATE SCHEMA schema_name;
43+
44+
Bugfixes
45+
--------
46+
- `#5547 <https://github.com/rasahq/rasa/issues/5547>`_: Fixed ambiguous logging in ``DIETClassifier`` by adding the name of the calling class to the log message.
47+
48+
2049
[1.9.4] - 2020-03-30
2150
^^^^^^^^^^^^^^^^^^^^
2251

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

Lines changed: 3 additions & 101 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

@@ -101,7 +103,7 @@ an action server image, see :ref:`building-an-action-server-image`.
101103
command:
102104
- run
103105
app:
104-
image: <your action server image>
106+
image: <image:tag>
105107
expose: 5055
106108
107109
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>`
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
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>
230132
231133
Configuring a Tracker Store
232134
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

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

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ exclude = "((.eggs | .git | .pytype | .pytest_cache | build | dist))"
99

1010
[tool.poetry]
1111
name = "rasa"
12-
version = "1.9.4"
12+
version = "1.9.5"
1313
description = "Open source machine learning framework to automate text- and voice-based conversations: NLU, dialogue management, connect to Slack, Facebook, and more - Create chatbots and voice assistants"
1414
authors = [ "Rasa Technologies GmbH <[email protected]>",]
1515
maintainers = [ "Tom Bocklisch <[email protected]>",]

rasa/core/constants.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,11 @@
6565

6666
# RabbitMQ message property header added to events published using `rasa export`
6767
RASA_EXPORT_PROCESS_ID_HEADER_NAME = "rasa-export-process-id"
68+
69+
# Name of the environment variable defining the PostgreSQL schema to access. See
70+
# https://www.postgresql.org/docs/9.1/ddl-schemas.html for more details.
71+
POSTGRESQL_SCHEMA = "POSTGRESQL_SCHEMA"
72+
73+
# Names of the environment variables defining PostgreSQL pool size and max overflow
74+
POSTGRESQL_POOL_SIZE = "SQL_POOL_SIZE"
75+
POSTGRESQL_MAX_OVERFLOW = "SQL_MAX_OVERFLOW"

0 commit comments

Comments
 (0)