Skip to content

Deploying a dynamic website

Let's go through the process of deploying a dynamic website / API on Patr, shall we? We've tried to make this process as simple as it could be. We realised that when it comes to production, containerization is an important aspect of deployments, so we decided to build on that. All you need to deploy is a docker container, and we'll take care of the rest.

Step 1: Create an account on Patr

Let's head on to, create a new account:

Sign up

Fill in your details on the sign up form and hit Sign-Up. An email will be sent to your registered email address with a one-time password. Use that OTP to complete the sign-up process.

Once the signup is complete, you'll be taken to your workspace which displays all the projects you and your team are currently working on.

Step 2: Create a Docker Repository

When you create an account on Patr, you automatically get a secure, private docker registry by default. All you need to do is create a repository.

Let's start with navigating to the Docker Registry tab:

Side nav Docker Repositories

Create Repository

Give your new docker repository any name of your choice. Once you're done, hit Create Repository.

Your new docker repository will show up on your list of repositories:

Docker repositories

You can click on each repository to get information about it:

Specific repositories

Step 3: Create a Deployment

Now let's move on to creating an actual deployment. A deployment is merely a container running on a server. All you need to do is provide the docker image, mention where you want to run it, and bam! The rest is all automatically taken care of. Your container will be up and running in no time!

In order to create your deployment, head over to the Deployments tab:

Side Nav Deployments

Click on Create Deployment:

New Deployment

Fill in the following fields accordingly:

  • Name: The name of your deployment. This is something you would use to identify the deployment for your internal purposes.
  • Registry: Specify which registry you want to pull the image from. We also provide the option of integrating your Docker Hub Registry.

  • Image Details: Choose the respostiory which contains the image you would like to deploy.

  • Region: Choose a region is closest to your users. This will determine the latency of your application.

Repository Info

Click on Next Step:

  • Ports: The port you want your app to exposed to.
  • Environment Variables: Mention the environment variables that have been used in your application with a proper key and a value.
  • Config Mounts: In case you need to create a certificate file or complex secret that cannot be handled via an environment variable or create a text based configuration files like .json, .html, .css, .yaml you can upload a file with your configuration parameters in the Config Mounts field.
  • Startup Probe: A startup probe checks if an application has successfully started. This probe will be executed when the container indicates it is capable of handling a liveness probe. Choose the Port on which your deployment is running and define the Path that needs to be checked by the Startup probe.
  • Liveness Probe: A liveness probe makes a http request to detect whether a pod is healthy. When a container fails the check, it is restarted. Choose the Port on which your deployment is running and define the Path that needs to be checked by the Liveness probe.

Port And Env Info

Click on Next Step:

  • Deploy options: You can tick one or both of the option in the checkbox. deploy on push means the deployment will be created as soon as you push to docker repository. And deploy on create will deploy as soon as the deployment is created. If check box not selected you have to do it by clicking on start button manually.
  • Horizontal scale: This specifies the number of instances of your image you want running. These will be automatically load-balanced.
  • Resource Allocation: This specifies the RAM and CPU specs of the machine that's going to run your docker container. We currently support AWS, as well as DigitalOcean, with support for more cloud providers in the works.

Create New Deployment

Click on Create.

Your new deployment will now be created with the image and tag you had mentioned, but will have the status as created. This is because you actually haven't pushed any image to the registry, for it to deploy.

Step 4: Push an image

Now that we have a deployment, let's push an image to it to run it.

Install Docker CLI from here

Once you have docker installed, from your terminal, type the following:

docker login

You will be asked for a username and password. Use the same credentials you had used to sign for your account in Step 1 (when prompted for a username, enter the username you'd used to sign up and not your email address).

Docker Login

Now, let's take an image you have locally and push it (this tutorial assumes your local image is tagged as demo:latest).

On the website, you'll find a button to copy the full image details of the deployment you just created, next to the delete button. This button will copy the full image name + tag of the repository to push to, which will trigger the deployment.

Deployment Image Copied

Now that you have the full image details copied, let's retag your local image:

docker tag demo:latest {full-image-details-here}

Now that your image is retagged, you can now push it:

docker push {full-image-details-here}

And that's it! Your deployment will now automatically get deployed!

Once the image is pushed, patr will automatically detect the push, recognize the deployment that corresponds to the given image name and tag, and will automatically deploy it. The status will change from created, to pushed, to deploying and to finally running. You can click on the Manage Deployment button to view more details of your deployment. By default, your deployment will be assigned a randomly-generated URL that you can use to access it. You can access your deployment by using the following URL format - {your-port}-{deployment-id} where your-port is the one that you mentioned while creating deployement and the deployement-id is the randomly generated unique id that will be in your address bar. You can also view the deployment logs, change the environment variables, update the domain, etc. You can also push another image to the same image name and tag and the deployment will automatically get updated.

Deployment Running

Now you can also revert to your previous version of Deployment by clicking on Revert to this version under Image History.

Revert Deployment

Step 5: Create a Managed URL


Click on Create managed URL:


Sub Domain: Add your sub domain here. For example if you want to set your URL as then your sub domain would be test.

Domain: Choose your domain from the dropdown. Beside domain, there's another field that allows you to add a custom path as well

Type: From the given four options you can choose the type of URL you would like to create.

URL: If it's a static site or a deployment then you can choose from a list of static sites/existing deployments to add a URL.

Port Number: Select your port number that you've exposed on the deployment.

Step 6: Adding a database (optional)

If you're deploying an API, chances are you are using a database. We currently support MySQL and PostgreSQL as a managed database hosting. In order to configure a database, check out Configuring a database.