Below is a step‐by‐step guide to deploy Etherpad and Postgres setup on Azure so that Etherpad is accessible publicly. In this guide, we’ll use the Azure CLI to create a Linux VM, install Docker and Docker Compose, deploy your docker‑compose file, and then open the required network port. You can follow these steps:


1. Create an Azure Resource Group

Create a new resource group (replace “myResourceGroup” and “eastus” with your preferred names/region):

az group create --name myResourceGroup --location eastus

2. Create an Ubuntu Virtual Machine

Create a VM that will host your containers. This command creates an Ubuntu VM, generates SSH keys, and assigns a public IP:

az vm create \
  --resource-group myResourceGroup \
  --name myDockerVM \
  --image UbuntuLTS \
  --admin-username azureuser \
  --generate-ssh-keys

3. Open Port 9001 for Public Access

Since your docker‑compose maps Etherpad’s port to 9001, open that port on the VM so it is accessible from the Internet:

az vm open-port --resource-group myResourceGroup --name myDockerVM --port 9001

This updates the VM’s network security group to allow inbound traffic on port 9001.


4. SSH into the VM and Install Docker & Docker Compose

SSH into your VM using its public IP (replace <public-ip> with the actual IP provided by the previous command):

ssh azureuser@<public-ip>

Once logged in, update the package lists and install Docker and Docker Compose

sudo apt-get update
sudo apt-get install -y docker.io docker-compose
 
# Post installation
sudo groupadd docker
sudo usermod -aG docker $USER
 
# Either reboot the machine or run:
newgrp docker

Verify the installation:

docker --version
docker-compose --version

5. Transfer or Create Your docker‑compose.yml File on the VM

You have two options here:

  • Option A: Create the file directly on the VM Open an editor (e.g., nano or vim) and paste the contents:
    nvim docker-compose.yml
    Then paste your docker‑compose content:
    services:
      app:
        user: "0:0"
        image: etherpad/etherpad:latest
        tty: true
        stdin_open: true
        volumes:
          - plugins:/opt/etherpad-lite/src/plugin_packages
          - etherpad-var:/opt/etherpad-lite/var
        depends_on:
          - postgres
        environment:
          NODE_ENV: production
          ADMIN_PASSWORD: ${DOCKER_COMPOSE_APP_ADMIN_PASSWORD:-admin}
          DB_CHARSET: ${DOCKER_COMPOSE_APP_DB_CHARSET:-utf8mb4}
          DB_HOST: postgres
          DB_NAME: ${DOCKER_COMPOSE_POSTGRES_DATABASE:-etherpad}
          DB_PASS: ${DOCKER_COMPOSE_POSTGRES_PASSWORD:-admin}
          DB_PORT: ${DOCKER_COMPOSE_POSTGRES_PORT:-5432}
          DB_TYPE: "postgres"
          DB_USER: ${DOCKER_COMPOSE_POSTGRES_USER:-admin}
          DEFAULT_PAD_TEXT: ${DOCKER_COMPOSE_APP_DEFAULT_PAD_TEXT:- }
          DISABLE_IP_LOGGING: ${DOCKER_COMPOSE_APP_DISABLE_IP_LOGGING:-false}
          SOFFICE: ${DOCKER_COMPOSE_APP_SOFFICE:-null}
          TRUST_PROXY: ${DOCKER_COMPOSE_APP_TRUST_PROXY:-true}
        restart: always
        ports:
          - "${DOCKER_COMPOSE_APP_PORT_PUBLISHED:-9001}:${DOCKER_COMPOSE_APP_PORT_TARGET:-9001}"
     
      postgres:
        image: postgres:15-alpine
        environment:
          POSTGRES_DB: ${DOCKER_COMPOSE_POSTGRES_DATABASE:-etherpad}
          POSTGRES_PASSWORD: ${DOCKER_COMPOSE_POSTGRES_PASSWORD:-admin}
          POSTGRES_PORT: ${DOCKER_COMPOSE_POSTGRES_PORT:-5432}
          POSTGRES_USER: ${DOCKER_COMPOSE_POSTGRES_USER:-admin}
          PGDATA: /var/lib/postgresql/data/pgdata
        restart: always
        volumes:
          - postgres_data:/var/lib/postgresql/data/pgdata
     
    volumes:
      postgres_data:
      plugins:
      etherpad-var:
    Save and exit the editor.
  • Option B: Use SCP to copy the file from your local machine On the local machine, run:
    scp docker-compose.yml azureuser@<public-ip>:~/

6. Deploy the Containers Using Docker Compose

From the directory where your docker-compose.yml is located, run:

sudo docker-compose up -d

This command downloads the required images, creates the containers (including the persistent volumes), and starts the services in detached mode.


7. Verify Public Access to Etherpad

Open a browser and navigate to:

http://<public-ip>:9001

You should see the Etherpad interface. If you encounter issues, double-check that the VM’s firewall settings and NSG rules allow traffic on port 9001.


Additional Considerations

The application will not be able to access through XAMK network, likely due to the firewall. So in case you want to check the application out, please use your own Mobile network or personal WiFi.