cli icon indicating copy to clipboard operation
cli copied to clipboard

Generator in docker crash

Open polyn0m opened this issue 2 years ago • 5 comments
trafficstars

Describe the bug

I use docs command for generating docs

docker run --rm -it \
   -v ${PWD}/docks.yaml:/app/asyncapi.yml \
   -v ${PWD}/output:/app/output \
   asyncapi/cli generate fromTemplate -o /app/output /app/asyncapi.yml @asyncapi/html-template --force-write

And getting output:

Generation in progress. Keep calm and wait a bit... done

Generator Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@asyncapi/cli/node_modules/@asyncapi/generator/node_modules/node-fetch/node_modules'

Docs not generated!

How to Reproduce

  • Run a command
Env:
  • macOS 13.4.1

  • Docker info
     Client:
      Context:    default
      Debug Mode: false
      Plugins:
       buildx: Docker Buildx (Docker Inc., v0.10.3)
       compose: Docker Compose (Docker Inc., v2.15.1)
       dev: Docker Dev Environments (Docker Inc., v0.1.0)
       extension: Manages Docker extensions (Docker Inc., v0.2.18)
       sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
       scan: Docker Scan (Docker Inc., v0.25.0)
       scout: Command line tool for Docker Scout (Docker Inc., v0.6.0)
     Server:
      Containers: 11
       Running: 4
       Paused: 0
       Stopped: 7
      Images: 35
      Server Version: 20.10.23
      Storage Driver: overlay2
       Backing Filesystem: extfs
       Supports d_type: true
       Native Overlay Diff: true
       userxattr: false
      Logging Driver: json-file
      Cgroup Driver: cgroupfs
      Cgroup Version: 2
      Plugins:
       Volume: local
       Network: bridge host ipvlan macvlan null overlay
       Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
      Swarm: inactive
      Runtimes: io.containerd.runtime.v1.linux runc io.containerd.runc.v2
      Default Runtime: runc
      Init Binary: docker-init
      containerd version: 2456e983eb9e37e47538f59ea18f2043c9a73640
      runc version: v1.1.4-0-g5fd4c4d
      init version: de40ad0
      Security Options:
       seccomp
        Profile: default
       cgroupns
      Kernel Version: 5.15.49-linuxkit
      Operating System: Docker Desktop
      OSType: linux
      Architecture: x86_64
      CPUs: 4
      Total Memory: 3.841GiB
      Name: docker-desktop
      ID: ZRRM:VY6O:OMPU:L2Q5:W3QB:VVON:PI2O:Z4US:TEKF:A2OA:TORO:YIOR
      Docker Root Dir: /var/lib/docker
      Debug Mode: false
      HTTP Proxy: http.docker.internal:3128
      HTTPS Proxy: http.docker.internal:3128
      No Proxy: hubproxy.docker.internal
      Registry: https://index.docker.io/v1/
      Labels:
      Experimental: false
      Insecure Registries:
       hubproxy.docker.internal:5000
       127.0.0.0/8
      Live Restore Enabled: false
    

Expected behavior

Docs generated in output folder!

polyn0m avatar Oct 15 '23 19:10 polyn0m

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

github-actions[bot] avatar Oct 15 '23 19:10 github-actions[bot]

You need to run it with argument --user=root - I didn't search in source code, but I think, that the problem is, that the container downloads and installs template (in your case @asyncapi/html-template) after startup.

hofin34 avatar Oct 20 '23 09:10 hofin34

It doesn't work despite the --user=root flag being provided.

ldynia avatar Nov 28 '23 14:11 ldynia

@polyn0m sorry for not an addressing the problem earlier but we were focused on AsyncAPI v3 release. @ldynia can you please clarify if after using --user=root the error is still related to permissions an nothing else

to share also more context, I believe permission issues are related to the same reason I described in https://github.com/asyncapi/html-template/issues/454#issuecomment-1860868519

derberg avatar Dec 18 '23 16:12 derberg

@hofin34 @derberg yep, adding --user=root problem is gone.

polyn0m avatar Dec 18 '23 20:12 polyn0m

This issue has been automatically marked as stale because it has not had recent activity :sleeping:

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience :heart:

github-actions[bot] avatar Apr 17 '24 00:04 github-actions[bot]

still relevant

Amzani avatar Apr 29 '24 11:04 Amzani

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

Closing issues just because nobody is writing comments about it every day is a terrible practice, specially when the only workaround is running the docker command as root (which is a HUGE security risk)

Altair-Bueno avatar Jun 06 '24 07:06 Altair-Bueno

@Altair-Bueno Thanks for your feedback, As a maintainer, it helps to check non-active issues and prioritize them again, so in practice, valid issues are never closed if maintainers are active.

Amzani avatar Jun 10 '24 10:06 Amzani

:tada: This issue has been resolved in version 2.0.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

asyncapi-bot avatar Jun 11 '24 09:06 asyncapi-bot