LeastAuthority / winden

Winden is a free web application for secure, fast, and easy file transfers between devices in real-time
MIT License
55 stars 4 forks source link

Deployment workflow fails with Permission denied error #171

Closed btlogy closed 10 months ago

btlogy commented 11 months ago

Likely since May 22nd 2023, the deployment workflow fails on the deploy step:

Run docker-compose run client npm run deploy
  docker-compose run client npm run deploy
  shell: /usr/bin/bash -e {0}
  env:
    TEST_ENV: foobar
    MAILBOX_URL: wss://mailbox.stage.winden.app/v1
    RELAY_URL: wss://relay.stage.winden.app/
Container winden-dummy-smtp-server-1  Running
Container winden-mailbox-1  Recreate
Container winden-feedback-api-1  Running
Container winden-relay-1  Recreate
Container winden-mailbox-1  Recreated
Container winden-relay-1  Recreated
Container winden-mailbox-1  Starting
Container winden-relay-1  Starting
Container winden-mailbox-1  Started
Container winden-relay-1  Started

> winden@0.5.4-beta deploy
> ts-node ./scripts/build.ts --deploy

sh: ts-node: Permission denied
Error: Process completed with exit code 127.

Apparently, it was still succeeding on March 7th 2023 (no more logs).

btlogy commented 10 months ago

I think I've found the root cause of this issue in #159:

  1. gulp deploy has been removed and replaced by a npm run deploy which requires the node_modules to be installed.
  2. while the image is build with those required node_modules in the /usr/src/app/client folder.
  3. the container is then started with the client folder mounted as a volume under /usr/src/app/client which then hides the node_modules directory populated at the previous step.

REM: npm run ... would have still work on a local development assuming npm install would have been called at least once outside the container. But this is not the case on the GitHub runner: the node_modules is just not existing.

This was a rather big change related to the deployment workflow, and I do not find any traces of a deployment after that PR was merged by @JustusFT on 23rd of May 2023. The last one was made on 23rd of Jan 2023 by @donpui.

I'm unsure how to fix this yet...

btlogy commented 10 months ago

I've a few ideas about how to fix this, but I'm going to merge a few changes in the documentation first: #172

After what, I'm going to submit a few changes:

... unless I have to do both in one PR.

btlogy commented 10 months ago

After a quick chat with @piegames, I've decided to merge the fix and :tada:: the deployment is now fixed! The FAQs have been updated on staging and production.

I've also noticed the deployment workflow builds and runs a bunch of containers while only one is required for the job (working on a PR to simplify those)!