VM Deployment Guide
Step-by-step guide for deploying plexd on cloud virtual machines using Cloud-Init.
Prerequisites
- Cloud account with VM provisioning access (AWS, GCP, Azure, OpenStack, or similar)
- VM image with cloud-init support (e.g., Ubuntu 22.04, Debian 12, Amazon Linux 2023)
- Network connectivity from the VM to the Plexsphere control plane API
- Bootstrap token from the control plane for node enrollment
Quick start
Use the minimal cloud-init template to deploy a VM with plexd:
#cloud-config
runcmd:
- |
set -eu
curl -fsSL https://get.plexsphere.com/install.sh | sh -s -- \
--token <YOUR_BOOTSTRAP_TOKEN> \
--api-url https://api.plexsphere.comPaste this as the user-data when launching a VM in your cloud provider.
Using the cloud-init templates
Full template
The full template writes a configuration file with metadata service support enabled, pre-provisions the bootstrap token, and runs the install script.
- Copy
deploy/cloud-init/user-data.yaml - Replace the template variables:
| Variable | Description |
|---|---|
PLEXD_API_URL | Control plane API URL |
PLEXD_BOOTSTRAP_TOKEN | Bootstrap token |
PLEXD_VERSION | Version to install (latest) |
PLEXD_HOSTNAME | Hostname override (optional) |
PLEXD_LOG_LEVEL | Log level (info) |
- Pass the rendered template as VM user-data
Minimal template
The minimal template only runs the install script with token and API URL. plexd uses defaults for all other settings.
- Copy
deploy/cloud-init/user-data-minimal.yaml - Replace
PLEXD_API_URLandPLEXD_BOOTSTRAP_TOKEN - Pass as VM user-data
Deploying with Terraform
AWS EC2
- Copy the example from
deploy/cloud-init/examples/terraform-aws.tf - Provide the required variables:
plexd_api_url = "https://api.plexsphere.com"
plexd_bootstrap_token = "your-token-here"
ami_id = "ami-0abcdef1234567890" # Ubuntu 22.04
subnet_id = "subnet-0123456789abcdef0"- Apply:
terraform init
terraform applyThe instance enforces IMDSv2 (http_tokens = "required") for security.
OpenStack
- Copy the example from
deploy/cloud-init/examples/terraform-openstack.tf - Provide the required variables:
plexd_api_url = "https://api.plexsphere.com"
plexd_bootstrap_token = "your-token-here"
image_name = "Ubuntu 22.04"
network_name = "internal-network"- Apply:
terraform init
terraform applyUsing IMDS for token delivery
Instead of embedding the bootstrap token in user-data, you can deliver it through the cloud instance metadata service (IMDS). This avoids storing the token in cloud-init logs.
1. Set the metadata key
Set the key /plexd/bootstrap-token in your cloud provider's instance metadata with the bootstrap token value. The method varies by provider:
- AWS: Use instance tags or SSM Parameter Store with a startup script
- OpenStack: Set via
openstack server set --property plexd/bootstrap-token=<TOKEN> - Custom: Any HTTP endpoint that serves the token at the configured path
2. Configure plexd
In the cloud-init user-data, set use_metadata: true in the config:
write_files:
- path: /etc/plexd/config.yaml
permissions: "0600"
content: |
api:
base_url: "https://api.plexsphere.com"
data_dir: /var/lib/plexd
registration:
use_metadata: true
metadata_token_path: /plexd/bootstrap-token
metadata_timeout: 2splexd will query the IMDS at {base_url}/plexd/bootstrap-token during registration.
Token resolution order
plexd checks these sources in priority order and uses the first non-empty result:
- Direct value (
token_valuein config) - Token file (
/etc/plexd/bootstrap-token) - Environment variable (
PLEXD_BOOTSTRAP_TOKEN) - Metadata service (IMDS)
Verification
Check cloud-init status
cloud-init status --waitExpected output: status: done
Check plexd service
sudo systemctl status plexdView cloud-init logs
# Cloud-init output log
sudo cat /var/log/cloud-init-output.log
# Cloud-init detailed log
sudo cat /var/log/cloud-init.log | grep plexdView plexd logs
journalctl -u plexd -fVerify registration
plexd statusTroubleshooting
Cloud-init did not run
Check that your VM image has cloud-init installed and the datasource is configured:
cloud-init query datasourceplexd install failed
Check the cloud-init output log for errors:
sudo cat /var/log/cloud-init-output.log | tail -50Common issues:
- Network unreachable: The VM cannot reach the artifact server or control plane API. Check security groups and network ACLs.
- Invalid token: The bootstrap token is expired or malformed. Generate a new token from the control plane.
- curl not found: The minimal template assumes
curlis installed. Use the full template (which installscurlviapackages) or ensurecurlis in the base image.
IMDS token not found
If using metadata-based token delivery and plexd reports "no bootstrap token found":
- Verify the metadata key is set:
curl -s http://169.254.169.254/plexd/bootstrap-token - Check that
use_metadata: trueis in the config - Check that the metadata timeout hasn't been set too low for your provider
See also
- Cloud-Init Deployment Reference — Full reference for IMDSProvider, config fields, and templates
- Bare-Metal Installation Guide — Bare-metal server installation
- Registration Reference — Registration package documentation