felddy/foundryvtt-docker

Wrong build download on non-existing build

bushvin opened this issue · 1 comments

Bug description

When speciying an invalid version and build number of FoundryVTT when spinning up a container, the latest version of Foundry VTT is downloaded and installed

This has been happening to me, for a while now, but I only noticed today. Every time I updated to the latest version, I mistakenly used version 11, but it would download version 12.
According to the FoundryVTT Releases page 11.328, 11.330 and 11.331 do not exist.

The sha512sum has confirms the archives are identical

sha512sum foundryvtt-11.328.zip foundryvtt-12.328.zip foundryvtt-11.330.zip foundryvtt-12.330.zip foundryvtt-11.331.zip foundryvtt-12.331.zip
4345ae7308992d9fe6db7cbf84bd81ae9bce14adf02dca4b2ba2088ba73c3355f7d371c600afcac0ade6ac27ee0ccfd113ef96bbadec7d65ac743dc6176cef4b  foundryvtt-11.328.zip
4345ae7308992d9fe6db7cbf84bd81ae9bce14adf02dca4b2ba2088ba73c3355f7d371c600afcac0ade6ac27ee0ccfd113ef96bbadec7d65ac743dc6176cef4b  foundryvtt-12.328.zip
1602ad88e8b4808ea3202c265283f2738898dad75227741ccbd0274aa761b1e3a966e37d2468c30a8f35c9d4017f91338031c48ed1c0afc0ec8d71b19c22242b  foundryvtt-11.330.zip
1602ad88e8b4808ea3202c265283f2738898dad75227741ccbd0274aa761b1e3a966e37d2468c30a8f35c9d4017f91338031c48ed1c0afc0ec8d71b19c22242b  foundryvtt-12.330.zip
e5b306732379d5471437356c5692d125d07891a579292528c661b34d485cc844b04a774779a130997ed83629b96e124d9d017784d2cf8b2ce12b80bfe5e0a2c3  foundryvtt-11.331.zip
e5b306732379d5471437356c5692d125d07891a579292528c661b34d485cc844b04a774779a130997ed83629b96e124d9d017784d2cf8b2ce12b80bfe5e0a2c3  foundryvtt-12.331.zip

Steps to reproduce

  • Specify invalid FOUNDRY_VERSION environment variable, eg FOUNDRY_VERSION='11.331'
  • Start container

Expected behavior

I expect the process to complain about a non-existing foundry version and come to a grinding halt

Container metadata

podman inspect --format='{{range $k, $v := .Config.Labels}}
    {{- printf "%s = \"%s\"\n" $k $v -}} {{end}}' \
    felddy/foundryvtt:release
com.foundryvtt.version = "12.331"
org.opencontainers.image.authors = "markf+github@geekpad.com"
org.opencontainers.image.created = "2024-08-16T01:48:32.610Z"
org.opencontainers.image.description = "An easy-to-deploy Dockerized Foundry Virtual Tabletop server."
org.opencontainers.image.licenses = "MIT"
org.opencontainers.image.revision = "61a1ac11d7bd298b93fa6cebb102158ddb1d020e"
org.opencontainers.image.source = "https://github.com/felddy/foundryvtt-docker"
org.opencontainers.image.title = "foundryvtt-docker"
org.opencontainers.image.url = "https://github.com/felddy/foundryvtt-docker"
org.opencontainers.image.vendor = "Geekpad"
org.opencontainers.image.version = "12.331.0"

Relevant log output

Entrypoint | 2024-08-27 10:48:14 | [info] Starting felddy/foundryvtt container v12.331.0
Entrypoint | 2024-08-27 10:48:14 | [warn] FOUNDRY_VERSION has been manually set and does not match the container's version.
Entrypoint | 2024-08-27 10:48:14 | [warn] Expected 12.331 but found 11.331
Entrypoint | 2024-08-27 10:48:14 | [warn] The container may not function properly with this version mismatch.
Entrypoint | 2024-08-27 10:48:14 | [info] Reading configured secrets from: /run/secrets/config.json
Entrypoint | 2024-08-27 10:48:14 | [info] No Foundry Virtual Tabletop installation detected.
Entrypoint | 2024-08-27 10:48:14 | [info] Using FOUNDRY_USERNAME and FOUNDRY_PASSWORD to authenticate.
Authenticate | 2024-08-27 10:48:14 | [info] Requesting CSRF tokens from https://foundryvtt.com
Authenticate | 2024-08-27 10:48:15 | [info] Logging in as: [redacted]
Authenticate | 2024-08-27 10:48:17 | [info] Successfully logged in as: [redacted]
Entrypoint | 2024-08-27 10:48:17 | [info] Using authenticated credentials to download release.
ReleaseURL | 2024-08-27 10:48:17 | [info] Fetching presigned release URL for build 331...
Entrypoint | 2024-08-27 10:48:18 | [info] Using CONTAINER_CACHE: /data/container_cache
Entrypoint | 2024-08-27 10:48:18 | [info] Downloading Foundry Virtual Tabletop release.
Warning: Failed to get filetime: No such file or directory
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  4  221M    4 10.2M    0     0  12.8M      0  0:00:17 --:--:--  0:00:17 12.8M
 13  221M   13 30.3M    0     0  16.8M      0  0:00:13  0:00:01  0:00:12 16.8M
 23  221M   23 52.2M    0     0  18.6M      0  0:00:11  0:00:02  0:00:09 18.6M
 33  221M   33 74.1M    0     0  19.5M      0  0:00:11  0:00:03  0:00:08 19.5M
 43  221M   43 96.1M    0     0  20.0M      0  0:00:11  0:00:04  0:00:07 20.0M
 53  221M   53  118M    0     0  20.4M      0  0:00:10  0:00:05  0:00:05 21.7M
 62  221M   62  138M    0     0  20.4M      0  0:00:10  0:00:06  0:00:04 21.7M
 72  221M   72  160M    0     0  20.6M      0  0:00:10  0:00:07  0:00:03 21.6M
 82  221M   82  183M    0     0  20.8M      0  0:00:10  0:00:08  0:00:02 21.8M
 92  221M   92  204M    0     0  20.8M      0  0:00:10  0:00:09  0:00:01 21.6M
100  221M  100  221M    0     0  21.0M      0  0:00:10  0:00:10 --:--:-- 21.6M
Entrypoint | 2024-08-27 10:48:28 | [info] Installing Foundry Virtual Tabletop 11.331
Entrypoint | 2024-08-27 10:48:31 | [info] Preserving release archive file in cache.
Entrypoint | 2024-08-27 10:48:31 | [info] Not modifying existing installation license key.
Entrypoint | 2024-08-27 10:48:31 | [info] Setting data directory permissions.
Entrypoint | 2024-08-27 10:48:31 | [info] Starting launcher with uid:gid as foundry:foundry.
Launcher | 2024-08-27 10:48:31 | [info] Generating options.json file.
Launcher | 2024-08-27 10:48:31 | [info] Setting 'Admin Access Key'.
Launcher | 2024-08-27 10:48:31 | [info] Starting Foundry Virtual Tabletop.
FoundryVTT | 2024-08-27 10:48:32 | [info] Running on Node.js - Version 18.20.3
FoundryVTT | 2024-08-27 10:48:32 | [info] Foundry Virtual Tabletop - Version 12 Build 331
FoundryVTT | 2024-08-27 10:48:32 | [info] User Data Directory - "/data"
FoundryVTT | 2024-08-27 10:48:33 | [info] Application Options:
{
  "awsConfig": null,
  "compressSocket": false,
  "compressStatic": false,
  "cssTheme": "foundry",
  "fullscreen": false,
  "hostname": null,
  "hotReload": false,
  "language": "en.core",
  "localHostname": null,
  "passwordSalt": null,
  "port": 30000,
  "protocol": null,
  "proxyPort": 443,
  "proxySSL": false,
  "routePrefix": null,
  "sslCert": null,
  "sslKey": null,
  "telemetry": false,
  "updateChannel": "stable",
  "upnp": false,
  "upnpLeaseDuration": null,
  "world": null,
  "adminPassword": "••••••••••••••••",
  "deleteNEDB": false,
  "noBackups": false,
  "serviceConfig": null
}
FoundryVTT | 2024-08-27 10:48:33 | [info] Software license verification succeeded
FoundryVTT | 2024-08-27 10:48:33 | [info] Server started and listening on port 30000
FoundryVTT | 2024-08-27 10:48:46 | [info] Created client session 2d733ee95a96471749199b59

Code of Conduct

  • I agree to follow this project's Code of Conduct

Wow. This is a great bug! Thanks for the extra diagnostics on the hashes.

I know exactly why this is happening. FoundryVTT made the decision to not use semver a couple of years ago. The releases are only identified by a release and build. e.g., 12.331 or 11.315.

But in reality, when downloading the distribution archives from CDN the, release component isn't even used in their URLs, only the build. You can see this in your logs:

ReleaseURL | 2024-08-27 10:48:17 | [info] Fetching presigned release URL for build 331...

Which is generated by this code:

logger.info(`Fetching presigned release URL for build ${build}...`);
const release_url: string = `${BASE_URL}/releases/download?build=${build}&platform=linux`;

Which leads exactly to the behavior you are seeing. I'll have to think of a way to validate the release / build tuple to avoid this problem. Stay tuned...

See: