fix(install): resolve optional service secrets from install root (#319)
Heimdall Gitea / Detect CI scope (pull_request) Successful in 5s
Heimdall Gitea / Build and tests (pull_request) Successful in 24m53s
Heimdall Gitea / Build and scan agent image (pull_request) Skipped
Heimdall Gitea / Build and scan NVIDIA Agent image (pull_request) Skipped
Heimdall Gitea / Build and scan server image (pull_request) Successful in 9m34s
Heimdall Gitea / Publish versioned installer release (pull_request) Skipped
Heimdall Gitea / CI policy (pull_request) Successful in 3s
Heimdall Gitea / Detect CI scope (pull_request) Successful in 5s
Heimdall Gitea / Build and tests (pull_request) Successful in 24m53s
Heimdall Gitea / Build and scan agent image (pull_request) Skipped
Heimdall Gitea / Build and scan NVIDIA Agent image (pull_request) Skipped
Heimdall Gitea / Build and scan server image (pull_request) Successful in 9m34s
Heimdall Gitea / Publish versioned installer release (pull_request) Skipped
Heimdall Gitea / CI policy (pull_request) Successful in 3s
This commit is contained in:
1 parent
060239d10e
commit
682dcaad17
5 files changed
+28
-5
No files matched your search
@@ -379,7 +379,7 @@ foreach ($service in $selected) {
|
||||
}
|
||||
}
|
||||
if ($startCore -and (Read-YesNo "Démarrer le service optionnel $service ?" 'o')) {
|
||||
Invoke-DockerCompose @('--project-name', "heimdall-$service", '--env-file', $envPath,
|
||||
Invoke-DockerCompose @('--project-directory', $destination, '--project-name', "heimdall-$service", '--env-file', $envPath,
|
||||
'-f', (Join-Path $optionalDirectory "docker-compose.$service.yml"), 'up', '-d')
|
||||
} else {
|
||||
Write-Host "Service $service préparé dans $optionalDirectory."
|
||||
|
||||
@@ -318,7 +318,8 @@ for service in "${selected[@]}"; do
|
||||
;;
|
||||
esac
|
||||
if [[ "$start_core" == yes ]] && [[ "$(ask "Démarrer le service optionnel ${service} ?" 'o')" =~ ^([oO]|[oO][uU][iI]|[yY]|[yY][eE][sS])$ ]]; then
|
||||
docker compose --project-name "heimdall-${service}" --env-file "$destination/.env" \
|
||||
docker compose --project-directory "$destination" --project-name "heimdall-${service}" \
|
||||
--env-file "$destination/.env" \
|
||||
-f "$destination/optional/docker-compose.${service}.yml" up -d
|
||||
else
|
||||
say "Service ${service} préparé dans $destination/optional/."
|
||||
|
||||
@@ -73,6 +73,14 @@ class PublicationWorkflowTests(unittest.TestCase):
|
||||
self.assertNotIn('secrets.GITEA_TOKEN', workflow.split(' publish:\n', 1)[0])
|
||||
|
||||
class PowerShellInstallerTests(unittest.TestCase):
|
||||
def test_optional_compose_commands_resolve_paths_from_install_root(self):
|
||||
linux_installer = (REPO_ROOT/'install/install-server.sh').read_text()
|
||||
windows_installer = (REPO_ROOT/'install/install-server.ps1').read_text()
|
||||
self.assertIn('docker compose --project-directory "$destination" --project-name',
|
||||
linux_installer)
|
||||
self.assertIn("Invoke-DockerCompose @('--project-directory', $destination, '--project-name',",
|
||||
windows_installer)
|
||||
|
||||
@unittest.skipUnless(shutil.which('pwsh'), 'PowerShell is not installed')
|
||||
def test_server_installer_has_valid_powershell_syntax(self):
|
||||
parser = "$tokens=$null; $errors=$null; [void][System.Management.Automation.Language.Parser]::ParseFile((Resolve-Path 'install/install-server.ps1'), [ref]$tokens, [ref]$errors); if ($errors.Count) { $errors | ForEach-Object { Write-Error $_.Message }; exit 1 }"
|
||||
|
||||
@@ -5,13 +5,13 @@ description: Keep installer-managed RustFS and coturn Compose services aligned w
|
||||
|
||||
# Installer-managed optional services
|
||||
|
||||
The Linux and Windows server installers run optional Compose files with the installation root as the current directory. They save service secrets in `optional/secrets/` and pass the root `.env` for interpolation. Therefore, Compose secret `file:` entries must use `./optional/secrets/<name>`, not `./secrets/<name>` or paths relative to `optional/`.
|
||||
The Linux and Windows server installers save service secrets in `<install-root>/optional/secrets/` and pass the root `.env` for interpolation. Compose resolves relative file paths from the project directory, which otherwise defaults to the directory containing the first `-f` file. Because optional Compose files are stored under `optional/`, both installers must pass `--project-directory <install-root>` when starting them. Compose secret `file:` entries then use `./optional/secrets/<name>`, not `./secrets/<name>` or paths relative to `optional/`.
|
||||
|
||||
## RustFS
|
||||
|
||||
- Keep `rustfs_access_key` and `rustfs_secret_key` file paths aligned with the generated files from both installers.
|
||||
- Installers create these bind-mounted secret files as owner-only (`0600`), which the official RustFS process (`10001:10001`) cannot read directly. Keep a short root initializer, copy the files into the service's private tmpfs, `chown` the copies to UID/GID 10001, then drop to the `rustfs` account before executing the upstream entrypoint. Keep the root filesystem read-only and provide tmpfs only for runtime paths that RustFS writes (`/logs`, `/tmp`, and its secret copies).
|
||||
- Verify Compose config from the install-root working directory and ensure Docker secrets are sourced from those files.
|
||||
- Verify the actual optional-service invocation includes `--project-directory <install-root>` and Compose resolves each Docker secret file to the exact file created under `<install-root>/optional/secrets/`. A successful `config` without checking normalized source paths is insufficient because Compose can accept an unintended path that happens to exist.
|
||||
- Keep the named data volume and shared `heimdall-net` behavior intact.
|
||||
|
||||
## coturn
|
||||
@@ -26,4 +26,4 @@ The Linux and Windows server installers run optional Compose files with the inst
|
||||
|
||||
## Acceptance
|
||||
|
||||
Run `skills/optional-server-services/acceptance.sh`. It creates a uniquely named disposable Compose project, generated owner-only secrets, an isolated install root, unique listener and relay ports, then validates Compose using that root. It verifies RustFS `/health`, signs a real S3 bucket-creation request with the generated keys, and runs `turnutils_uclient` inside the Compose network with TURN REST credentials. This proves local container-network allocation only; it does not prove external firewall/NAT reachability. The trap tears down only that project and verifies its containers, volumes, and networks are absent. The recipe builds no local images and retains upstream images.
|
||||
Run `skills/optional-server-services/acceptance.sh`. It creates a uniquely named disposable Compose project, generated owner-only secrets, an isolated install root, unique listener and relay ports, then validates Compose using the same explicit `--project-directory <install-root>` used by the installers. It asserts the normalized RustFS and coturn secret source paths exactly match the generated files before starting containers. It verifies RustFS `/health`, signs a real S3 bucket-creation request with the generated keys, and runs `turnutils_uclient` inside the Compose network with TURN REST credentials. This proves local container-network allocation only; it does not prove external firewall/NAT reachability. The trap tears down only that project and verifies its containers, volumes, and networks are absent. The recipe builds no local images and retains upstream images.
|
||||
@@ -155,6 +155,20 @@ EOF
|
||||
|
||||
printf 'Disposable project: %s\nLocal images built: none\n' "$project"
|
||||
compose config --quiet
|
||||
compose config --format json | INSTALL_ROOT="$install_root" python3 -c '
|
||||
import json, os, sys
|
||||
config = json.load(sys.stdin)
|
||||
root = os.environ["INSTALL_ROOT"]
|
||||
expected = {
|
||||
"rustfs_access_key": os.path.join(root, "optional/secrets/rustfs_access_key"),
|
||||
"rustfs_secret_key": os.path.join(root, "optional/secrets/rustfs_secret_key"),
|
||||
"coturn_secret": os.path.join(root, "optional/secrets/coturn_secret"),
|
||||
}
|
||||
actual = {name: config["secrets"][name]["file"] for name in expected}
|
||||
if actual != expected:
|
||||
raise SystemExit("Compose secret bind mounts do not resolve under the installer root")
|
||||
print("Verified RustFS and coturn secret bind mounts resolve under the installer root.")
|
||||
'
|
||||
compose up -d rustfs coturn
|
||||
|
||||
base_url="http://127.0.0.1:$rustfs_api_port"
|
||||
|
||||
Reference in new issue
Block a user