Skip to main content
Azure does not currently support NFS file sharing between Azure volumes, which is a required component for API Self Hosted. Because of this, “native” deployment on Azure Container Apps is not supported. The supported method is to host a Linux virtual machine and run the container within it.

Stage 1: Configuring the Azure environment

Many components need to be ready before configuring the virtual machine and setting up the container. You may already have some of these configured, so skip any steps that are already complete.

Resource group

Ensure you have a resource group configured so that Azure resources can be allocated to it as they are created.
1
Click Create to create a resource group, give it a name, and complete the setup.

Managed identity

You will need a managed identity for the Key Vault process.
1
Click Create to create the managed identity, give it a name, and complete the setup.

Key Vault

Create a Key Vault to store keys, secrets, access policies, and certificates.
1
Click Create to create the Key Vault, give it a name, and complete the setup.
Once the Key Vault is created, you need to configure the following components within it. These are required for the virtual machine gateway provisioning.

Keys

1
Select Generate/Import and give the key a name. No additional setup is required.

Secrets

1
Select Generate/Import and give the secret a name. No additional setup is required.

Access policies

1
Select Create to begin creating an access policy.
2
Assign permissions to the policy. The Key, Secret, and Certificate management permissions are all required. You can select all permissions depending on your use case.
3
Assign the managed identity you created earlier as the principal. Search for the identity name and select it.
4
Skip the optional Application step and proceed to create the access policy.
5
Review the information, and if correct, select Create.

Certificates

1
Select Generate/Import to begin adding your certificate.
2
You have two methods for certificate setup:Generate a certificate: Fill in the required fields, noting the Subject field which is important for configuring a CN.
Import a certificate: Select the Import method, upload the certificate file with the password. The certificate file must be in PKCS format.
Once the certificate has been added, you can move on to setting up the virtual machine.

Stage 2: Setting up the virtual machine

1
Select Create in the Virtual Machine section of Azure to begin.
2
In the Basics tab, configure the following:
  • Resource group — Select your existing resource group or the one created earlier
  • Image — We recommend Ubuntu
  • Name — Provide a name for the virtual machine
  • Region — Set the region where the machine will be hosted
3
For the Size, ensure you select at least Standard_D2s_V3. Choosing a smaller size will cause the instance to fail due to lack of resources. The Username and Key pair name should auto-fill, but provide names for these if needed.
4
Configure your ports. This depends on your use case, but a typical setup includes:
  • Port 80 (HTTP)
  • Port 443 (HTTPS)
  • Port 22 (SSH)
Then move on to the Disks section.
5
Configure the OS disk size and disk type:
  • Disk size — At least 30 GiB (scale to your use case)
  • Disk type — We recommend Standard SSD
Then move on to Networking.
6
We recommend creating new resources for the Virtual network, Subnet, and Public IP, unless you wish to use existing resources.
7
For load balancing, select Application Gateway — this will act as a load balancer and allow you to use the custom certificates configured earlier. Select Application Gateway, then choose Create an application gateway.
In the gateway configuration panel:
  • Provide a name for the gateway
  • Set the port to 443
  • Set the Protocol to HTTPS
  • For Choose a certificate, select Choose a certificate from Key Vault
  • Select the relevant Managed identity, Key vault, and Certificate
  • Click Create
Then move on to the Management section.
8
There is no required configuration in the Management, Advanced, or Tags tabs (default settings are shown below). You can configure settings here as needed.
9
In the Review + Create tab, verify all the settings and confirm the validation check has passed. If everything is correct, select Create to begin deployment.
Deployment may take some time. Once complete, click Go to resource to proceed with container configuration.

Stage 3: Configuring the virtual machine and launching the container

Connecting to the virtual machine

1
Once the virtual machine is running, click Connect and select SSH using Azure CLI.
2
Wait for the validation checks to complete, then click Connect.
3
A Cloud Shell CLI will launch in your browser. Type Yes to accept the fingerprint and connect.

Installing Docker

1
Run the following commands to set up the Docker repository:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
2
Add the Docker repository to your sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
3
Install Docker:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
4
Verify the installation by running the hello-world image:
sudo docker run hello-world
If you see a success message, Docker is installed correctly.

Pulling and configuring the Draftable container

1
Pull the latest Draftable API Self Hosted image:
sudo docker pull draftable/apish:latest
2
Navigate to the root directory and create a folder for your Docker Compose file:
cd /
ls
sudo mkdir composefiles
ls
3
Navigate into the folder and create the docker-compose.yml file:
cd composefiles
sudo touch docker-compose.yml
sudo nano docker-compose.yml
4
In the nano editor, paste the following basic configuration. For additional parameters, refer to our API Self Hosted documentation.
version: '3.5'
services:
  apish:
    environment:
      DRAFTABLE_APISH_NGINX: |-
    image: draftable/apish
    ports:
       - 80:80/tcp
       - 443:443/tcp
    volumes:
      - draftable-apish:/srv/draftable
      - /sys/fs/cgroup:/sys/fs/cgroup
volumes:
  draftable-apish:
Save the file with Ctrl+O and exit with Ctrl+X.

Starting the container

1
Start the Docker service:
sudo systemctl start docker
2
Install the Docker Compose plugin:
sudo apt-get update
sudo apt-get install docker-compose-plugin
3
Launch the container with Docker Compose:
sudo docker compose up
The container will begin its boot sequence. Give it time to configure, and upon successful completion you should see a message saying Container startup complete.
4
Navigate back to the virtual machine in Azure to retrieve the public IP address. Copy it and enter it into your browser to connect to the instance.
You should see a screen similar to below, confirming the container is running correctly.

Next steps

You will now need to set up the administrator account. See Draftable Self-hosted instance first time configuration for details. If you have any issues or questions, please contact us at support@draftable.com.