Skip to content

Hotfix/docker local fixes - #5

Merged
synalysis merged 3 commits into
synalysis:mainfrom
absynce:hotfix/docker-local-fixes
Aug 9, 2026
Merged

Hotfix/docker local fixes#5
synalysis merged 3 commits into
synalysis:mainfrom
absynce:hotfix/docker-local-fixes

Conversation

@synalysis

Copy link
Copy Markdown
Owner

No description provided.

absynce and others added 3 commits August 8, 2026 18:18
- docker-compose.yml: pin the service to linux/amd64 since the Pebble SDK
  toolchain (qemu-pebble, ARM cross-compiler) is x86_64-only.
- Dockerfile: set ERL_FLAGS="+JPperf true" during the Elixir build stage.
  Erlang's JIT uses dual-mapped RWX memory that QEMU's user-mode emulation
  mishandles, crashing mid-compile with confusing errors like
  "undefined function erlang:nif_error/1" in zlib:open_nif/0. Forcing
  single-mapped JIT memory avoids it (see erlang/otp#6340).
- docker/pebble_sdk.sh, docker/entrypoint.sh: ensure the pebble-tool
  persist dir (~/.pebble-sdk) exists before any pebble command runs.
  pebble-tool only uses that legacy path if it already exists, otherwise
  it silently falls back to ~/.local/share/pebble-sdk -- but every
  hardcoded SDK/QEMU path in this image assumes the legacy location, so
  the app could never find an SDK installed via the XDG fallback. Also
  migrates any SDK data that already landed in the wrong location.

Co-authored-by: Claude <noreply@anthropic.com>
…_-baked config paths

- internal_packages.ex, project_templates.ex: watch-target elm.json files
  never included the internal elm/json source directory (unlike elm/time
  and elm/random), causing "Module Main imports Json.Decode, but it was
  not found in loaded sources" errors for any watch app that uses
  Json.Decode/Encode.

- wasm_emulator.ex: Ide.WasmEmulator.asset_root/0 defaulted to
  Path.expand("../../priv/wasm_emulator", __DIR__). __DIR__ is a
  compile-time macro, so this baked in the build stage's /app/... path,
  which doesn't exist in the runner (/opt/ide) -- crashing
  Ide.Release.setup() with a permission error on every boot. Switched to
  Application.app_dir/2, which resolves correctly at actual runtime.

- config/runtime.exs: config.exs sets Ide.Settings.settings_path,
  Ide.Screenshots.storage_root, and Ide.PublishManifest.output_root via
  the same __DIR__ pattern, which breaks the same way in a release
  (surfaced as `Prepare release failed: %MatchError{term: {:error,
  :eacces}}`). Added prod-time overrides: settings_path now correctly
  falls back to the existing SETTINGS_FILE/data_root resolution,
  Screenshots.storage_root resolves via Application.app_dir/2 (must stay
  under the app's own priv/static since Plug.Static serves the public
  screenshot URLs from there), and PublishManifest.output_root moves to
  the persistent data root.

Co-authored-by: Claude <noreply@anthropic.com>
Same class of bug as the previous commit: __DIR__ is a compile-time
macro, so any path built from it gets frozen to the build stage's
absolute path (/app/...) and silently breaks once the compiled release
runs from a different location (/opt/ide). These didn't crash, but
silently degraded features in production:

- pypkjs.ex: the embedded_pypkjs.py wrapper script was never found, so
  the embedded emulator always fell back to the bare pypkjs binary
  without it.
- cmd_call/core.ex: reading Companion/Types.elm for companion-protocol
  schema introspection in the debugger always failed with :enoent.
- project_template_previews.ex: screenshot_available?/1 always returned
  false, so the create-project picker never showed template preview
  thumbnails despite them shipping correctly in priv/static.

All three now use Ide.Paths.priv_path/1 or Application.app_dir/2, which
resolve correctly at actual runtime regardless of where the release is
installed. Verified against the running container: all three paths now
resolve and the referenced files are found.

Co-authored-by: Claude <noreply@anthropic.com>
@synalysis
synalysis merged commit b8c5b7c into synalysis:main Aug 9, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants