Few questions about trying to use Docker-Compose + npm link + grunt + ./nodebb dev



  • Hello all,
    I am running my board through docker and I have been fighting with Docker a bit trying to get things to work.

    Firstly, I added a line to the Dockerfile of:

    npm i grunt grunt-contrib-watch grunt-cli
    

    Then I also have this persistence setup within compose.

    volumes:
                - nodebb_dev_plugins:/usr/src/
    
    nodebb_dev_plugins:
       driver: local
       driver_opts:
         o: bind
         device: /home/myuser/devtools/nodebb/nodebb-dev/plugins/src
    

    This then puts my plugin just outside of the /usr/src/app folder, so then I can docker exec -it into the container and npm link my plugin into the /usr/src/app folder (which I think is the way I am supposed to do this?)

    I am wondering if anyone happens to know though, how I can execute grunt watch while also having the verbosity of ./nodebb dev as I am quite new to node and working with this board, so the more output I can get as to what I mess up the better, lol.

    As of now, all I was doing was starting up the container like this:

    nodebb-dev:
            build: nodebb-dev/NodeBB
            container_name: nodebb_dev
            command: bash -c "grunt" 
    

    I also don't seem to see my plugin in the forum's available plugins after I linked it. I went into my plugin folder, did 'sudo npm link', then I went into /usr/src/app and did 'sudo npm link nodebb-plugin-my-plugin', which did give me some output that didn't look erroneous, so I figured it must have been correct, but it still didn't show up, I tried to run a rebuild just to make sure to no avail. Looking back now, I do see the actual plugin within /usr/src/app/node_modules after linking.

    If anyone has any suggestions, or spots anything I might have done incorrectly, I would definitely appreciate the input.
    Thanks,
    -MH


  • Global Moderator

    Docker ... + grunt + ./nodebb dev

    So you're trying to develop within a docker container?

    Firstly, I added a line to the Dockerfile of:

    npm i grunt grunt-contrib-watch grunt-cli

    You want npm i -g grunt-cli if you want to use the grunt cli. Also you only need to install grunt-cli.

    Then I also have this persistence setup within compose.

    I don't know much about docker, what kind of directory structure do you expect this to generate?

    This then puts my plugin just outside of the /usr/src/app folder, so then I can docker exec -it into the container and npm link my plugin into the /usr/src/app folder (which I think is the way I am supposed to do this?)

    This is how you'd do it on a normal system:

    cd nodebb-plugin-yours # where the plugin's package.json lives
    npm link
    cd nodebb-source-directory # where NodeBB's config.json lives
    npm link nodebb-plugin-yours
    

    But you can instead use ln -s to link nodebb-plugin-yours into nodebb/node_modules/nodebb-plugin-yours.

    I am wondering if anyone happens to know though, how I can execute grunt watch while also having the verbosity of ./nodebb dev as I am quite new to node and working with this board, so the more output I can get as to what I mess up the better, lol.

    grunt --verbose
    

    I also don't seem to see my plugin in the forum's available plugins after I linked it. I went into my plugin folder, did sudo npm link, then I went into /usr/src/app and did sudo npm link nodebb-plugin-my-plugin, which did give me some output that didn't look erroneous, so I figured it must have been correct, but it still didn't show up, I tried to run a rebuild just to make sure to no avail. Looking back now, I do see the actual plugin within /usr/src/app/node_modules after linking.

    Have you tried it not in the docker container? It's a lot of variables all at once.

    Also you shouldn't need or use sudo to run any npm commands.



  • I appreciate the reply. It looks like after a bunch of tinkering, it seems to be working. I put the plugin into one of the persistent folders, then made a script that I execute via Docker-Compose just before I call grunt which handles the actual linking and then it showed up.


Log in to reply
 

Suggested Topics

  • 7
  • 1
  • 2
  • 3
  • 1
| |