Deploying DocuSeal on Azure web apps

Before you begin, ensure that you have an active Azure account. If you do not have one, you can create it on the Azure website. Although DocuSeal is open-source, you will still incur costs for using Azure services, such as PostgreSQL databases, servers, and file storage. The total cost will vary depending on your specific needs. However, DocuSeal operates efficiently even on smaller servers, so you can opt for the smallest server offering from Azure.

How to deploy DocuSeal on Azure?

  1. Create a Resource Group
  2. Create a PostgreSQL Server
  3. Create a Web App
  4. Configure Environment Variables
  5. Create File Storage
  6. Set up Access to Storage

Create a Resource Group

Before creating any resources, you need to establish a resource group. A resource group is a container that holds various resources you create on Azure, facilitating better interaction among them. To create a resource group, go to the Azure website, log into your account, and navigate to the Resource groups page. You can also locate this page using the search function.

  1. On the Resource groups page, click the Create button.
  2. This will open the resource group creation page.
  3. Enter a name for your resource group. You can choose any name, but it should be unique and allow you to quickly identify resources associated with DocuSeal.
  4. Select the region. Choose a region based on your location or the location of your target audience. Select a resource group
  5. Click the Review + create button.
  6. Review the information and then click the Create button.

Create a PostgreSQL Server

After creating the resource group, you need to set up a PostgreSQL server. This will serve as the database used by DocuSeal.

  1. Navigate to the Azure Database for PostgreSQL servers page via the search function.
  2. On the Azure Database for PostgreSQL servers page, click the Create button.
  3. On the PostgreSQL server creation page, select the resource group you previously created.
  4. Also, select the region. It is recommended that the region of the resource group and the PostgreSQL server be the same to optimize performance and reduce latency. Create a resource group
  5. Select the version of PostgreSQL. It is recommended to choose the latest available version for better performance and security features.
  6. Enter a name for the server. This can be any name, but it should be unique and clearly identifiable within the context of your project.
  7. Then, choose the type of workload you intend to use. This decision depends on your specific needs, but keep in mind that it’s usually better to opt for a larger capacity rather than more power, as DocuSeal does not require high computing power. Azure PostgreSQL server Workload type
  8. For authentication, select “PostgreSQL authentication only” if your company’s security policy allows the use of passwords. Otherwise, choose the option that applies to your company’s standards.
  9. Enter a username and password. This will be the database administrator credentials (you can change this password later). Setting up PostgreSQL authentication
  10. Click the Review + create button.
  11. Review the details and click the Create button.
  12. After successfully creating the PostgreSQL server, go to the PostgreSQL server page and navigate to the Settings - Databases tab.
  13. You need to create a database. To do this, click the Add button. Create PostgreSQL database
  14. Enter the desired name for the database and click the Save button.
  15. Now you need to configure access to the database. To do this, go to your PostgreSQL server page and navigate to the Favorites - Networking tab.
  16. Check the box next to Allow public access to this resource through the internet using a public IP address and Allow public access from any Azure service within Azure to this server. Also, click on the link + Add 0.0.0.0 - 255.255.255.255 to open access to the database from any IP address, but ensure it meets your security requirements and that you are using a strong, complex password for database access. Azure PostgreSQL server Networking
  17. Click the Save button.
  18. Done! You now have a PostgreSQL server and a database set up.

Create a Web App

Now you have everything you need to deploy a web application. We’ll use Azure Web Apps and Docker for this.

  1. Go to the App Services page either through search or from the Azure homepage by selecting Create a resource and then find Web App.
  2. Click the Create button.
  3. On the web app creation page, select the resource group you created earlier.
  4. Enter a name for the web app. It can be any name but must be unique (possibly even a unique set of characters).
  5. For the Publish option, choose “Container” and select the “Linux” operating system.
  6. Also, select the region. It is recommended that the region for the resource group and the web app be the same. Azure Web App instance details
  7. Click the Next: Container button.
  8. In the opened tab, select Docker Hub and other registries.
  9. Subsequently, an additional field called Options will appear where you should choose “Single Container”.
  10. Choose “Public” for Access type.
  11. Leave the Server URL unchanged.
  12. Enter the name of the DocuSeal image for Image and tag:

      docuseal/docuseal:latest
    

    You can use any version of the image, but it is recommended to use the latest one. Azure Web App container options

  13. Click the Review + create button.
  14. Review the information and click the Create button.
  15. Wait for the web app to finish deploying.

Configure Environment Variables

To ensure that DocuSeal operates on Azure, you need to configure just 2 environment variable - DATABASE_URL and SECRET_KEY_BASE.

  1. First, generate the SECRET_KEY_BASE using the command:

    openssl rand -hex 64
    

    Save this value, as you will use it later. Note that you can use any other method to generate this key.

  2. After that, gather all the necessary information for connecting to the PostgreSQL database.
  3. Go to your PostgreSQL server page. You can do this by searching for Azure Database for PostgreSQL servers and selecting your server. You can also find this page via the Resource groups page.
  4. On the PostgreSQL server page, navigate to the Settings - Connect tab and in the database name selector, choose your database. Azure PostgreSQL server Connect
  5. You will be provided with the connection details for the database, such as PGHOST, PGPORT, PGUSER, PGPASSWORD, and PGDATABASE. Azure PostgreSQL server connection details
  6. Once you have gathered all the data, you need to construct the connection URL for the database. The URL should be formatted as follows:

    postgres://[PGUSER]:[PGPASSWORD]@[PGHOST]:[PGPORT]/[PGDATABASE]
    

    As a result, you will obtain a URL that looks something like this:

    postgres://ds_admin:123456789@docusealdb.postgres.database.azure.com:5432/docuseal
    
  7. Save this URL, as you will need it later.
  8. Navigate to your web app’s page.
  9. In the left menu, select Settings - Configuration.
  10. Click the New application setting button.
  11. Enter the variable name DATABASE_URL and input the value you previously constructed. Azure PostgreSQL server connection details
  12. Click the OK button. After this, the new environment variable DATABASE_URL will appear in the list of environment settings.
  13. Click the Save button.
  14. Similarly, create a new environment variable SECRET_KEY_BASE and enter the value you generated previously.
  15. Navigate to the Overview page and click the Restart button to restart the web application.
  16. Done! Your web application is now ready to operate.

Create File Storage

DocuSeal offers several methods for file storage, but since Azure has its own file storage service, you can utilize it. Here’s how to set it up:

  1. Navigate to the Storage accounts page either through search or from the Azure homepage by selecting Create a resource and then finding Storage account.
  2. On the storage account creation page, select the resource group to which your deployed DocuSeal and PostgreSQL server belong.
  3. Enter a name for the storage account. It can be any name, but it must be unique. Save this name, as you will need it later.
  4. Select the region. It is recommended that the region for the resource group and the storage account be the same to optimize performance and reduce latency. Azure new storage account
  5. For the Performance option, select Standard.
  6. Click the Review + create button.
  7. Review the details and click the Create button.
  8. Wait for the storage account to be created.
  9. Once created, open the storage account page and navigate to the Data storage - Containers tab.
  10. Click on Container and enter a name for the container. This can be any name, but it must be unique. Save this name, as you will need it later. Azure storage account new container
  11. Click the Create button.
  12. Now you have a file storage container that can be accessed from DocuSeal.
  13. Next, you need to obtain the access key for this storage to enable DocuSeal to access it. To do this, go to the Data storage - Access keys tab in the storage account. Save this key, as you will need it later. Azure storage account new container

Set up Access to Storage

  1. Log in to DocuSeal as an administrator.
  2. Navigate to the Settings - Storage page.
  3. Select Azure under the Storage section.
  4. Enter the storage account name, container name, and access key that you previously saved. DocuSeal Azure storage settings
  5. Click the Save button.
  6. Done! DocuSeal can now store files in the Azure storage.

In this guide, we explored how to deploy DocuSeal on Azure, but it’s important to remember that this is just one of the deployment options available. Your company might use other methods to organize resources and access them.