# Deploying Your Rasa Assistant

This page explains when and how to deploy an assistant built with Rasa. It will allow you to make your assistant available to users and set you up with a production-ready environment.

- [When to Deploy Your Assistant](https://legacy-docs-v1.rasa.com/1.10.2/user-guide/how-to-deploy/#when-to-deploy-your-assistant)  
- [Recommended Deployment Methods](https://legacy-docs-v1.rasa.com/1.10.2/user-guide/how-to-deploy/#recommended-deployment-methods)  
  - [One-Line Deploy Script](https://legacy-docs-v1.rasa.com/1.10.2/user-guide/how-to-deploy/#one-line-deploy-script)  
  - [Kubernetes/Openshift](https://legacy-docs-v1.rasa.com/1.10.2/user-guide/how-to-deploy/#kubernetes-openshift)  
- [Alternative Deployment Methods](https://legacy-docs-v1.rasa.com/1.10.2/user-guide/how-to-deploy/#alternative-deployment-methods)  
  - [Docker Compose](https://legacy-docs-v1.rasa.com/1.10.2/user-guide/how-to-deploy/#docker-compose)  
  - [Rasa Open Source Only Deployment](https://legacy-docs-v1.rasa.com/1.10.2/user-guide/how-to-deploy/#rasa-open-source-only-deployment)  
- [Deploying Your Action Server](https://legacy-docs-v1.rasa.com/1.10.2/user-guide/how-to-deploy/#deploying-your-action-server)  
  - [Building an Action Server Image](https://legacy-docs-v1.rasa.com/1.10.2/user-guide/how-to-deploy/#building-an-action-server-image)  
  - [Using your Custom Action Server Image](https://legacy-docs-v1.rasa.com/1.10.2/user-guide/how-to-deploy/#using-your-custom-action-server-image)

## [When to Deploy Your Assistant](https://legacy-docs-v1.rasa.com/1.10.2/user-guide/how-to-deploy/#when-to-deploy-your-assistant)

The best time to deploy your assistant and make it available to test users is once it can handle the most important happy paths or is what we call a [minimum viable assistant](/content/docs/rasa/glossary/index.html).

The recommended deployment methods described below make it easy to share your assistant with test users via the [share your assistant feature in Rasa X](/content/docs/rasa-x/user-guide/enable-workflows#conversations-with-test-users/index.html). Then, when you’re ready to make your assistant available via one or more [Messaging and Voice Channels](https://legacy-docs-v1.rasa.com/1.10.2/user-guide/messaging-and-voice-channels/#messaging-and-voice-channels), you can easily add them to your existing deployment set up.

## [Recommended Deployment Methods](https://legacy-docs-v1.rasa.com/1.10.2/user-guide/how-to-deploy/#recommended-deployment-methods)

The recommended way to deploy an assistant is using either the One-Line Deployment or Kubernetes/Openshift options we support. Both deploy Rasa X and your assistant. They are the easiest ways to deploy your assistant, allow you to use Rasa X to view conversations and turn them into training data, and are production-ready.

### [One-Line Deploy Script](https://legacy-docs-v1.rasa.com/1.10.2/user-guide/how-to-deploy/#one-line-deploy-script)

The one-line deployment script is the easiest way to deploy Rasa X and your assistant. It installs a Kubernetes cluster on your machine with sensible defaults, getting you up and running in one command.

> Default: Make sure you meet the [OS Requirements](/content/docs/rasa-x/installation-and-setup/one-line-deploy-script/#hardware-os-requirements/index.html), then run:
>
> ```
> curl -s get-rasa-x.rasa.com | sudo bash
> ```  
> 
> Custom: See [Customizing the Script](/content/docs/rasa-x/installation-and-setup/one-line-deploy-script/#customizing-the-script/index.html) in the [One-Line Deploy Script](/content/docs/rasa-x/installation-and-setup/one-line-deploy-script/#customizing-the-script/index.html) docs.

### [Kubernetes/Openshift](https://legacy-docs-v1.rasa.com/1.10.2/user-guide/how-to-deploy/#kubernetes-openshift)

For assistants that will receive a lot of user traffic, setting up a Kubernetes or Openshift deployment via our helm charts is the best option. This provides a scalable architecture that is also straightforward to deploy. However, you can also customize the Helm charts if you have specific requirements.

> Default: Read the [Deploying in Openshift or Kubernetes](/content/docs/rasa-x/installation-and-setup/openshift-kubernetes/index.html) docs.
> 
> Custom: Read the above, as well as the [Advanced Configuration](/content/docs/rasa-x/installation-and-setup/openshift-kubernetes/#advanced-configuration/index.html) documentation, and customize the [open source Helm charts](https://github.com/RasaHQ/rasa-x-helm) to your needs.

## [Alternative Deployment Methods](https://legacy-docs-v1.rasa.com/1.10.2/user-guide/how-to-deploy/#alternative-deployment-methods)

### [Docker Compose](https://legacy-docs-v1.rasa.com/1.10.2/user-guide/how-to-deploy/#docker-compose)

You can also run Rasa X in a Docker Compose setup, without the cluster environment. We have a quick install script for doing so, as well as manual instructions for any custom setups.

> Default: Read the [Docker Compose Quick Install](/content/docs/rasa-x/installation-and-setup/docker-compose-script/index.html) docs or watch the [Masterclass Video](https://www.youtube.com/watch?v=IUYdwy8HPVc) on deploying Rasa X.
> 
> Custom: Read the docs [Docker Compose Manual Install](/content/docs/rasa-x/installation-and-setup/docker-compose-manual/index.html) documentation for full customization options.

### [Rasa Open Source Only Deployment](https://legacy-docs-v1.rasa.com/1.10.2/user-guide/how-to-deploy/#rasa-open-source-only-deployment)

It is also possible to deploy a Rasa assistant without Rasa X using Docker Compose. To do so, you can build your Rasa Assistant locally or in Docker. Then you can deploy your model in Docker Compose.

- [Building a Rasa Assistant Locally](https://legacy-docs-v1.rasa.com/1.10.2/user-guide/rasa-tutorial/)  
- [Building a Rasa Assistant in Docker](https://legacy-docs-v1.rasa.com/1.10.2/user-guide/docker/building-in-docker/)  
- [Deploying a Rasa Open Source Assistant in Docker Compose](https://legacy-docs-v1.rasa.com/1.10.2/user-guide/docker/deploying-in-docker-compose/)

## [Deploying Your Action Server](https://legacy-docs-v1.rasa.com/1.10.2/user-guide/how-to-deploy/#deploying-your-action-server)

### [Building an Action Server Image](https://legacy-docs-v1.rasa.com/1.10.2/user-guide/how-to-deploy/#building-an-action-server-image)

If you build an image that includes your action code and store it in a container registry, you can run it as part of your deployment, without having to move code between servers. In addition, you can add any additional dependencies of systems or Python libraries that are part of your action code but not included in the base `rasa/rasa-sdk` image.

To create your image:

> 1. Move your actions code to a folder `actions` in your project directory. Make sure to also add an empty `actions/__init__.py` file:
>  
> > ```
> > mkdir actions
> > mv actions.py actions/actions.py
> > touch actions/__init__.py  # the init file indicates actions.py is a python module
> > ```
>  
> The `rasa/rasa-sdk` image will automatically look for the actions in `actions/actions.py`.
> 2. If your actions have any extra dependencies, create a list of them in a file, `actions/requirements-actions.txt`.
> 3. Create a file named `Dockerfile` in your project directory, in which you’ll extend the official SDK image, copy over your code, and add any custom dependencies (if necessary). For example:
>  
> > ```
> > # Extend the official Rasa SDK image
> > FROM rasa/rasa-sdk:1.10.3
> > 
> > # Use subdirectory as working directory
> > WORKDIR /app
> > 
> > # Copy any additional custom requirements, if necessary (uncomment next line)
> > # COPY actions/requirements-actions.txt ./
> > 
> > # Change back to root user to install dependencies
> > USER root
> > 
> > # Install extra requirements for actions code, if necessary (uncomment next line)
> > # RUN pip install -r requirements-actions.txt
> > 
> > # Copy actions folder to working directory
> > COPY ./actions /app/actions
> > 
> > # By best practices, don't run the code with root user
> > USER 1001
> > ```

You can then build the image via the following command:

> ```
> docker build . -t <account_username>/<repository_name>:<custom_image_tag>
> ```

The `<custom_image_tag>` should reference how this image will be different from others. For example, you could version or date your tags, as well as create different tags that have different code for production and development servers. You should create a new tag any time you update your code and want to re-deploy it.

### [Using your Custom Action Server Image](https://legacy-docs-v1.rasa.com/1.10.2/user-guide/how-to-deploy/#using-your-custom-action-server-image)

If you’re building this image to make it available from another server, for example a Rasa X or Rasa Enterprise deployment, you should push the image to a cloud repository.

This documentation assumes you are pushing your images to [DockerHub](https://hub.docker.com/). DockerHub will let you host multiple public repositories and one private repository for free. Be sure to first [create an account](https://hub.docker.com/signup/) and [create a repository](https://hub.docker.com/signup/) to store your images. You could also push images to a different Docker registry, such as [Google Container Registry](https://cloud.google.com/container-registry), [Amazon Elastic Container Registry](https://aws.amazon.com/ecr/), or [Azure Container Registry](https://azure.microsoft.com/en-us/services/container-registry/).

You can push the image to DockerHub via:

> ```
> docker login --username <account_username> --password <account_password>
> docker push <account_username>/<repository_name>:<custom_image_tag>
> ```
  
To authenticate and push images to a different container registry, please refer to the documentation of your chosen container registry.
