Self-hosting Fluxer: findings, bugs, and patches from a real deployment

(#1037) Feature Shipped self-hosting

Thread

Comment by @mgabor3141
RexSystem 1 vote originally by @mgabor3141 on GitHub OP

1: Dockerfile build fixes

The Dockerfile on refactor needs several fixes to produce a working build: Missing workspace package.json COPYs — 16 packages are missing from the deps stage, causing pnpm install to fail:
for pkg in date_utils elasticsearch_search geo_utils geoip i18n kv_client limits \
  list_utils locale markdown_parser media_proxy_utils meilisearch_search \
  mime_utils nats number_utils openapi time; do
  # Add before the fluxer_app COPY line:
  # COPY packages/${pkg}/package.json ./packages/${pkg}/
done
.dockerignore excludes build-time files:
  • **/build excludes fluxer_app/scripts/build/ (rspack config). Fix: add !fluxer_app/scripts/build
  • /fluxer_app/src/data/emojis.json is explicitly ignored but needed at build time. Fix: remove that line
No wasm32 target: The apt-installed rustc doesn't include wasm32-unknown-unknown, so wasm-pack fails. Fix: install via rustup instead:
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
    --default-toolchain stable --profile minimal \
    && rustup target add wasm32-unknown-unknown \
    && cargo install wasm-pack
Wrong ENTRYPOINT: ENTRYPOINT ["pnpm", "start"] targets the root workspace which has no start script. Fix:
ENTRYPOINT ["pnpm", "--filter", "fluxer_server", "start"]
Missing admin CSS build step: Add after the marketing CSS build:
RUN pnpm --filter admin build:css
tsgo --noEmit fails at build time because lingui locale .mjs files don't exist yet. Fix: remove tsgo --noEmit && from fluxer_app/package.json build script. FLUXER_CONFIG not available in app-build stage: rspack reads config.json to derive endpoint URLs. Inject a minimal build-time config via build arg:
FROM deps AS app-build
ARG FLUXER_BUILD_CONFIG="{}"
RUN echo "$FLUXER_BUILD_CONFIG" > /tmp/fluxer-build-config.json
ENV FLUXER_CONFIG=/tmp/fluxer-build-config.json
Then pass it in compose:
build:
  args:
    FLUXER_BUILD_CONFIG: |
      { "domain": { "base_domain": "your.domain", "static_cdn_domain": "fluxerstatic.com", "public_scheme": "https", "public_port": 443 } }