Skip to main content
Version: 0.5.5

Discourse on Aruba Cloud

Deploy Discourse — the leading open-source community forum platform — on Aruba Cloud using Terraform and cloud-init. Discourse is installed via the official discourse_docker launcher, which bundles PostgreSQL, Redis, and NGINX inside a single managed container.

Provider version: arubacloud/arubacloud ~> 0.5 | Terraform: ≥ 1.9


Introduction​

Discourse is a modern, mobile-friendly discussion platform used by thousands of open-source projects and communities. This example uses the official Docker-based installation — the only method supported by the Discourse team for production — which provisions:

  • discourse_docker launcher cloned from the official GitHub repository
  • PostgreSQL, Redis, NGINX, and Sidekiq bundled inside the Discourse container
  • SMTP configuration for outbound email (required for user registration)
  • Ports 80 and 443 open to the internet
  • Optional domain with SSL via Let's Encrypt (automatic inside the container when hostname is a real domain)

Bootstrap time: The launcher builds a Docker image from source the first time. Expect 20–30 minutes before the forum is accessible.

Email is required. Discourse uses email for account confirmation. Configure SMTP before deploying — registrations without working email will fail.


Architecture Overview​


Infrastructure Created​

ResourceName patternDescription
arubacloud_projectdiscourse-prodProject container
arubacloud_vpcdiscourse-prod-vpcVirtual Private Cloud
arubacloud_subnetdiscourse-prod-subnetBasic subnet
arubacloud_securitygroupdiscourse-prod-vm-sgSecurity group
arubacloud_securityrulediscourse-prod-vm-sshSSH ingress
arubacloud_securityrulediscourse-prod-vm-httpHTTP ingress TCP 80
arubacloud_securityrulediscourse-prod-vm-httpsHTTPS ingress TCP 443
arubacloud_elasticipdiscourse-prod-vm-eipVM public IP
arubacloud_blockstoragediscourse-prod-boot100 GB boot disk (Performance)
arubacloud_keypairdiscourse-prod-keypairSSH public key
arubacloud_cloudserverdiscourse-prod-vmCloudServer VM

Estimated Monthly Cost​

ResourceSpecEst. cost/mo
CloudServer VMCSO4A8 — 4 vCPU / 8 GB~€35
Boot disk100 GB Performance~€15
Elastic IP—~€3
Total~€53/mo

Requirements​

  • Terraform ≥ 1.9
  • ArubaCloud Terraform Provider ~> 0.5
  • An ArubaCloud account with OAuth2 API credentials
  • An SSH key pair
  • An SMTP server for outbound email (Gmail App Password, Mailgun, etc.)
  • (Recommended) A domain name with an A record pointing to the VM's Elastic IP

Variables​

Required​

VariableDescription
arubacloud_client_idArubaCloud OAuth2 client ID
arubacloud_client_secretArubaCloud OAuth2 client secret
ssh_public_keySSH public key content
admin_emailEmail for the initial Discourse admin account
smtp_hostSMTP server hostname
smtp_userSMTP login username
smtp_passwordSMTP login password

Optional​

VariableDefaultDescription
app_name"forum"Short name used in all resource names
environment"prod"Environment label
location"ITBG-Bergamo"ArubaCloud region
zone"ITBG-1"Availability zone
billing_period"Hour""Hour" or "Month"
vm_flavor"CSO4A8"CloudServer flavor
vm_image"LU22-001"Boot disk image (Ubuntu 22.04 LTS)
vm_disk_size_gb100Boot disk size in GB (min 40 GB)
ssh_cidr"0.0.0.0/0"CIDR for SSH
web_cidr"0.0.0.0/0"CIDR for HTTP/HTTPS
hostnameautoDomain name (defaults to VM Elastic IP)
smtp_port587SMTP port
dev_smtpfalseDeploy Mailpit instead of a real SMTP server (see Testing without a mail server)

Outputs​

OutputDescription
site_urlDiscourse site URL
vm_public_ipPublic IP address of the VM
ssh_commandSSH command to connect to the VM

Deployment Instructions​

1. Clone and navigate​

git clone https://github.com/arubacloud/terraform-arubacloud-examples.git
cd terraform-arubacloud-examples/discourse

2. Configure variables​

cp terraform.tfvars.example terraform.tfvars

Set credentials, admin email, SMTP settings, and optionally a domain:

admin_email = "admin@example.com"
hostname = "forum.example.com" # omit to use the Elastic IP
smtp_host = "smtp.gmail.com"
smtp_port = 587
smtp_user = "you@gmail.com"
smtp_password = "your-app-password"

For Gmail, create an App Password (not your account password) at https://myaccount.google.com/apppasswords.

3. Deploy​

terraform init
terraform plan
terraform apply

terraform apply returns quickly (VM provisioned in ~2 min). The Discourse bootstrap continues in the background for 20–30 minutes. Monitor progress:

ssh ubuntu@$(terraform output -raw vm_public_ip)
sudo tail -f /var/log/discourse-bootstrap.log

4. Create the admin account​

terraform output site_url

Visit the URL and register with the same email address set in admin_email. Discourse automatically grants admin rights to the first user who registers with that email.


Testing without a mail server​

Set dev_smtp = true in terraform.tfvars. This deploys Mailpit — a lightweight fake SMTP server — on the VM. Discourse is wired to it automatically; no smtp_host, smtp_user, or smtp_password are needed.

# terraform.tfvars
dev_smtp = true
admin_email = "you@example.com"

After bootstrap, open the Mailpit web UI to read captured emails (including the admin registration confirmation):

http://<vm_public_ip>:8025

Never use dev_smtp = true in production. Emails are only visible in the Mailpit UI — nothing is delivered to real inboxes.


Enabling HTTPS (Let's Encrypt)​

When hostname is set to a real domain:

  1. Create a DNS A record: forum.example.com → <vm_public_ip>
  2. Set hostname = "forum.example.com" in terraform.tfvars
  3. Re-apply — Discourse auto-obtains a Let's Encrypt certificate on bootstrap

No additional configuration is needed; the discourse_docker launcher handles ACME automatically.


Upgrading Discourse​

Discourse ships frequent updates. To upgrade:

ssh ubuntu@$(terraform output -raw vm_public_ip)
cd /var/discourse
git pull
./launcher rebuild app

The rebuild command pulls the latest image and restarts the container with zero downtime for the database.


Troubleshooting​

Forum not loading after 30 minutes​

ssh ubuntu@$(terraform output -raw vm_public_ip)
sudo tail -50 /var/log/discourse-bootstrap.log
cd /var/discourse && ./launcher logs app

Emails not being sent​

Check SMTP connectivity from the VM:

nc -zv smtp.gmail.com 587

Then from the Discourse admin panel: Admin → Email → Test Email.


References​