Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Docker Installation: Development module, cannot install dependencies #3058

Closed
2 tasks done
JonasArnold opened this issue Sep 26, 2024 · 6 comments
Closed
2 tasks done
Labels
BUG Something isn't working
Milestone

Comments

@JonasArnold
Copy link

Is this a bug in companion itself or a module?

  • I believe this to be a bug in companion

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I am trying to use a customised module in my Docker installation.
But the Docker installation of Companion can no longer start because the installation of the dependencies for my module fails on startup with the following error:

Installing dependencies for all local dev modules...
Installing dependencies for module companion-module-allenheath-ahm
Unknown Syntax Error: Unsupported option name (‘--prod’).
$ yarn install [--json] [--immutable] [--immutable-cache] [--refresh-lockfile] [--check-cache] [--check-resolutions] [--inline-builds] [--mode #0]

The module I want to use is the following:
https://github.com/JonasArnold/companion-module-allenheath-ahm

Apparently the installed yarn does not seem to recognise the ‘--prod’ option.

Steps To Reproduce

  1. Installation of Companion using official Docker Image
  2. Mounting volume for data (path inside container /companion)
  3. Mounting separate volume for development modules (path inside container: /app/module-local-dev)
  4. In folder of volume for development modules:
    git clone https://github.com/JonasArnold/companion-module-allenheath-ahm.git
    => Creates a folder named companion-module-allenheath-ahm with the content of the main branch.
  5. Start Companion container
  6. View Logs

Expected Behavior

Installs dependencies of customised module according to package.json

Environment (please complete the following information)

- OS: Windows 10
- Browser: Brave
- Companion Version: v3.4.1 (stable)

Additional context

No response

@JonasArnold JonasArnold added the BUG Something isn't working label Sep 26, 2024
@tintinhamans
Copy link

I am also running in to this exact issue. @JonasArnold have you been able to figure out a workaround yet?

@Julusian
Copy link
Member

Julusian commented Oct 2, 2024

I have a fix for this, which kinda works and should for your module, but doesn't for every module.
I'm not going to worry about that for now, hopefully in 3.5 the ability to load modules in will be improved and this folder can be removed entirely and avoid this complexity.

@Julusian Julusian moved this to In Progress in Companion Plan Oct 2, 2024
@Julusian Julusian added this to the v3.4 milestone Oct 2, 2024
@Julusian Julusian moved this from In Progress to Done in Companion Plan Oct 2, 2024
@JonasArnold
Copy link
Author

Thanks a lot @Julusian.
I tried with the latest version 3.5.0-7435-main-80a9c16e but now I get the following message:

Installing dependencies for all local dev modules...
Installing dependencies for module companion-module-allenheath-ahm
/docker-entrypoint.sh: line 17: yarn: command not found

It seems like yarn is not installed in the image...
I accessed the container via /bin/bash and also there it seems yarn is not installed:

yarn --help
bash: yarn: command not found

Am I missing something crucial? Development modules with dependencies should work in the docker image right?

@Julusian
Copy link
Member

Julusian commented Oct 3, 2024

I'm not able to reproduce that, running docker run --rm -v $PWD:/app/module-local-dev -it ghcr.io/bitfocus/companion/companion:3.5.0-7435-main-80a9c16e is able to find yarn

@JonasArnold
Copy link
Author

I'm not able to reproduce that, running docker run --rm -v $PWD:/app/module-local-dev -it ghcr.io/bitfocus/companion/companion:3.5.0-7435-main-80a9c16e is able to find yarn

After creating a new container, yarn is now found.. probably some issue with environment variables.

At first I got the following problem with yarn having no permission to create folders inside the volume.

Installing dependencies for all local dev modules...
Installing dependencies for module companion-module-allenheath-ahm
➤ YN0000: · Yarn 4.4.0
➤ YN0000: ┌ Resolution step
➤ �]8;;https://yarnpkg.com/advanced/error-codes#yn0085---updated_resolution_record�YN0085�]8;;�: │ + @companion-module/base@npm:1.10.0, ajv@npm:8.17.1, colord@npm:2.9.3, ejson@npm:2.2.3, eventemitter3@npm:4.0.7, fast-deep-equal@npm:3.1.3, and 10 more.
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ �]8;;https://yarnpkg.com/advanced/error-codes#yn0001---exception�YN0001�]8;;�: │ Error: While persisting /home/companion/.yarn/berry/cache/ajv-npm-8.17.1-12ade7edc6-10c0.zip/node_modules/ajv/ -> /app/module-local-dev/companion-module-allenheath-ahm/node_modules/ajv EACCES: permission denied, mkdir '/app/module-local-dev/companion-module-allenheath-ahm/node_modules'
➤ YN0000: └ Completed
➤ YN0000: · Failed with errors in 0s 118ms

Nevertheless I was able to fix this with the following very ugly way :)
Giving 0777 permission to the folder of the development module volume:
sudo chmod 0777 /var/lib/docker/volumes/<dev modules volume name>/_data/<module folder>/

If there is a cleaner way to solve this, I am very happy for everyones recommendations. Otherwise this issue is fixed for me and I am hoping for a better way to integrate modules in future releases.
Thanks a lot @Julusian for your support!! Much appreciated!

@Julusian
Copy link
Member

Julusian commented Oct 4, 2024

Giving 0777 permission to the folder of the development module volume:

Yeah, I'm not surprised. The install is being run as the companion user, id is probably 1000, so you would have to make sure it had write permissions to that directory.
A chown would probably do it too, but a chmod while less elegant also works

Once #1002 is done (hopefully by #3062), then this flow won't be so relevant anymore and will probably be removed or stripped back to not do the install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG Something isn't working
Projects
Status: Done
Development

No branches or pull requests

3 participants