Problem
The allocator service constructs its own URL from config file fields, but the infrastructure (Terraform) separately calculates the full URL/FQDN based on environment, DNS settings, and other factors. This mismatch causes client VMs to receive an incorrect allocator URL and fail to connect.
Expected Behavior
The allocator should use the same URL that was calculated by the infrastructure deployment and configured in Caddy/DNS.
Actual Behavior
Infrastructure calculates (in Terraform):
ci-test.lablink.lablink-template-testing.com
Allocator uses:
lablink-template-testing.com
Allocator logs show:
2025-10-15 22:28:35 - lablink_allocator_service.main - INFO - Using allocator URL: http://lablink-template-testing.com (protocol: http)
Root Cause
The allocator service reads the config file and constructs a URL from individual fields (e.g., dns.domain), but doesn't have access to:
- The environment name
- DNS pattern/subdomain logic
- The final FQDN that Terraform calculated
This creates two sources of truth for the allocator URL:
- Infrastructure (Terraform) - calculates FQDN based on environment + DNS config
- Allocator service - constructs URL from config fields alone
Impact
- Client VMs cannot connect to allocator (connectivity failure)
- Multi-environment deployments to same domain don't work
- Deployment configuration doesn't match runtime behavior
Reproduction
- Deploy allocator with any DNS configuration involving subdomains or environment-specific URLs
- Check allocator logs to see what URL it's using
- Compare to the FQDN that Terraform calculated (available in Terraform outputs)
- Create client VM and observe connection failure
Proposed Solution
Pass the computed FQDN as an environment variable to the allocator container:
In the infrastructure template's user_data.sh:
docker run -d -p 127.0.0.1:5000:5000 \
-e ALLOCATOR_FQDN=${DOMAIN_NAME} \ # NEW: Pass FQDN from Terraform
-e ALLOCATOR_PUBLIC_IP=${ALLOCATOR_PUBLIC_IP} \
-e ENVIRONMENT=${RESOURCE_SUFFIX} \
...
$IMAGE
Then update the allocator service to:
- Check for
ALLOCATOR_FQDN environment variable first
- Fall back to constructing URL from config only if env var not set (backwards compatibility)
This ensures the allocator uses the same URL that the infrastructure configured, eliminating the dual source-of-truth problem.
Context
This issue was discovered during testing of the lablink-template repository's DNS configuration.
Template repository:
Note: The lablink-template is planning to simplify DNS/SSL configuration in future PRs (see DNS-SSL-SIMPLIFICATION-PLAN.md), but regardless of the final schema, the allocator should receive the computed FQDN rather than reconstructing it.
Related Discussion
This issue affects all deployment scenarios where the allocator URL differs from just the base domain field in config, including:
- Multi-environment deployments (dev/test/prod subdomains)
- Custom subdomain configurations
- Future DNS configuration simplifications
Problem
The allocator service constructs its own URL from config file fields, but the infrastructure (Terraform) separately calculates the full URL/FQDN based on environment, DNS settings, and other factors. This mismatch causes client VMs to receive an incorrect allocator URL and fail to connect.
Expected Behavior
The allocator should use the same URL that was calculated by the infrastructure deployment and configured in Caddy/DNS.
Actual Behavior
Infrastructure calculates (in Terraform):
Allocator uses:
Allocator logs show:
Root Cause
The allocator service reads the config file and constructs a URL from individual fields (e.g.,
dns.domain), but doesn't have access to:This creates two sources of truth for the allocator URL:
Impact
Reproduction
Proposed Solution
Pass the computed FQDN as an environment variable to the allocator container:
In the infrastructure template's
user_data.sh:Then update the allocator service to:
ALLOCATOR_FQDNenvironment variable firstThis ensures the allocator uses the same URL that the infrastructure configured, eliminating the dual source-of-truth problem.
Context
This issue was discovered during testing of the lablink-template repository's DNS configuration.
Template repository:
Note: The lablink-template is planning to simplify DNS/SSL configuration in future PRs (see DNS-SSL-SIMPLIFICATION-PLAN.md), but regardless of the final schema, the allocator should receive the computed FQDN rather than reconstructing it.
Related Discussion
This issue affects all deployment scenarios where the allocator URL differs from just the base domain field in config, including: