Skip to content

Commit

Permalink
fix(worker): copy ffmpeg into worker
Browse files Browse the repository at this point in the history
  • Loading branch information
Floffah committed Feb 8, 2025
1 parent 7e6d5cb commit ac50236
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ The AtCast lexicons and backend support up to 20MB of audio data per episode. Th

The 20MB is modeled after 60 minutes of 30kbps 48khz audio compressed in OPUS format. If necessary, this may be increased in the future.

AtCast does not expect the `audio` field of [`live.atcast.show.episode`](./lexicons/live/atcast/show/episode.json) to ever be changed. It will not be set when the record is created, as uploading and encoding is done in the background. These constraints are because AtCast will generate HLS streams from the audio data and store them in the UploadThing repository after the initial upload. If the audio data is changed in the PDS, the HLS streams will be out of sync. AtCast will be upgraded in the future to handle changes and re-generate the HLS streams.
AtCast does **not** expect the `audio` property of records following the `live.atcast.show.episode` lexicon unless edited by AtCast itself. This will be changed in the future.

Note that HLS generation is currently not implemented, but in progress. This will require a separate cluster of workers to handle the encoding of the audio data.
Currently, AtCast has two services: the website and the worker service. The worker service currently is only responsible for compressing and re-encoding the audio files to OPUS format. In the future, this worker will also generate HLS streams for the audio files.

### Podcast model

Expand All @@ -31,6 +31,7 @@ NEXT_PUBLIC_BASE_URL="http://localhost:3000"
NEXT_PUBLIC_REACT_SCAN_API_KEY="key"
# Required
UPLOADTHING_TOKEN="token"
UPLOADTHING_HOST="id.ufs.sh"
```

This file should be placed at the path `apps/web/.env`. You may also need to copy this file to `packages/models/.env` so that the database migrations apply properly.
This file should be placed at the paths `apps/web/.env` and `apps/worker/.env`. You may also need to copy this file to `packages/models/.env` so that the database migrations apply properly.
12 changes: 7 additions & 5 deletions apps/worker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
FROM oven/bun
FROM jrottenberg/ffmpeg:6.0-scratch as ffmpeg
FROM oven/bun:latest

WORKDIR /usr/src/app

ENV LD_LIBRARY_PATH=/usr/local/lib

COPY --from=node:22 /usr/local/bin/node /usr/local/bin/node
COPY --from=ffmpeg /usr/local /usr/local
COPY --from=ffmpeg /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu

COPY . .

RUN bun install
RUN bun run build --filter=@atcast/worker

RUN rm -rf ./node_modules

RUN bun install --production

WORKDIR /usr/src/app/apps/worker

CMD [ "bun", "start" ]

0 comments on commit ac50236

Please sign in to comment.