Giter VIP home page Giter VIP logo

Comments (8)

tippexs avatar tippexs commented on July 26, 2024

Good morning!

Do you have an example application so we can reproduce the issue?

from unit.

rommanio avatar rommanio commented on July 26, 2024

Yes, we can provide it.
https://github.com/rommanio/sample-nuxt-unit-app
You can build and run it by docker compose -f docker/docker-compose.yml build && docker compose -f docker/docker-compose.yml up.

from unit.

tippexs avatar tippexs commented on July 26, 2024

@javorszky please give it a try to check whats the issue. Feel free to invite other to join the research.

from unit.

javorszky avatar javorszky commented on July 26, 2024

I've been debugging for the past hour and a bit. I have an idea where / why it hangs, but haven't found the concrete issue yet. I'll keep everyone updated once I either get stuck and need more answers or found a resolution :)

from unit.

javorszky avatar javorszky commented on July 26, 2024

@rommanio we found a possible cause for this. Testing whether that's causing it and trying to fix it.

from unit.

rommanio avatar rommanio commented on July 26, 2024

@rommanio we found a possible cause for this. Testing whether that's causing it and trying to fix it.

Good news. Thank you! :)

from unit.

javorszky avatar javorszky commented on July 26, 2024

@rommanio I've opened a PR to fix this issue that I tested locally: #1020

Here's how you can test the same changesets on your end:

  1. copy unit-http into your sample repository's docker folder. I had that local copy as ./docker/unit-http. This is so the local files can be copied into the dockerfile
  2. modify the dockerfile so it looks like this:
    FROM unit:1.31.1-node20
    
    #COPY --chown=unit . /var/www/
    
    RUN mkdir -p /builder
    COPY . /builder
    COPY docker/unit-http /lib/unit-http
    WORKDIR /builder
    RUN npm i --progress=false
    RUN npm run build
    RUN mkdir -p build && cp -r .output/server build/
    RUN npm run generate
    RUN cp -r .output/public build/
    RUN cp -r build /var/www/
    RUN chown -R unit:unit /var/www
    
    RUN chmod +x /var/www/server/index.mjs
    
    WORKDIR /var/www/server
    notable changes:
    • removed all the npm links
    • copied the local copy of unit-http from the host into /lib/ folder inside the dockerfile
    • removed copying the unit.json file
  3. change the unit.json file's arguments part to this:
            "arguments": [
                "node",
                "--loader",
                "/lib/unit-http/loader.mjs",
                "--require",
                "/lib/unit-http/loader",
                "index.mjs"
            ],
    notable changes:
    • replaced the require and loader paths from specifying only the package name to its path on the disk: /lib/...
  4. change the docker-compose.yml to add a volume mount on it:
        volumes:
          - ./unit.json:/docker-entrypoint.d/config.json
    this way the image doesn't need to be rebuilt if we're only making configuration changes
  5. lastly change the local copy of the ./docker/unit-http/loader.js and ./docker/unit-http/loader.mjs files so they add the new lines that are in the pull request.

That fixed the issue for me.

from unit.

andrey-zelenkov avatar andrey-zelenkov commented on July 26, 2024

Could you please also include short description in docs/changes.xml (for release purposes), since this change is visible for users.

Something like:

diff --git a/docs/changes.xml b/docs/changes.xml
--- a/docs/changes.xml
+++ b/docs/changes.xml
@@ -40,6 +40,13 @@ with Next.js.
 </para>
 </change>
 
+<change type="bugfix">
+<para>
+Node.js module name rules, notable for Node.js Nuxt applications.
+</para>
+</change>
+
+
 </changes>
 
 

from unit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.