Skip to content

Bundle docs_ai_backend #727

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

Merged
merged 1 commit into from
Apr 2, 2025
Merged

Bundle docs_ai_backend #727

merged 1 commit into from
Apr 2, 2025

Conversation

knazarov
Copy link
Collaborator

@knazarov knazarov commented Apr 1, 2025

Short Summary

It looks like it's not very difficult to bundle all necessary npm dependencies together with the docs_ai_backend. What is needed is just to specify output: standalone in the next.js config.

I've tried to start the server with node from the resulting build and it worked. However, I can't do any in-depth testing and will wait for Shukhrat to do that part.

Related Issue

Part of #728

Breaking Changes (if any)

It is possible that I didn't ship everything that is needed in the resulting distribution, so help is needed.

Checklist

Please mark each item with an x inside the brackets (e.g., [x]) once completed.

  • I have read and followed the Contributing Guide
  • I have tested the changes locally
  • I have added relevant tests (if applicable)
  • I have updated documentation/comments (if applicable)

@ukorvl
Copy link
Member

ukorvl commented Apr 1, 2025

Let's change "start" script to "node ./path to server.js"?

@ukorvl
Copy link
Member

ukorvl commented Apr 1, 2025

I see that standalone dir still contains some node_modules, that use symlinks. The problem is described in #714
If we copy this to deb it is not going to work since there are symlinks in the node_modules.

Copy link
Collaborator

@khannanov-nil khannanov-nil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two main issues that need to be investigated here. Both of them arise if the suggestion by @ukorvl is applied (i.e., the app is started via next ./node .next/standalone/docs_ai_backend/server.js.

  1. The app starts on port 3000 by default but the production machine will expect it at port 8092. Probably the port can be specified when the app is launched directly in the command.

  2. Requests to /api/services/db do not work and they are needed to renew the DB. Specific error is:

[TypeError: fetch failed] {
  [cause]: [Error: getaddrinfo EAI_AGAIN undefined] {
    errno: -3001,
    code: 'EAI_AGAIN',
    syscall: 'getaddrinfo',
    hostname: 'undefined'
  }
}

If the app is launched via npm run start, the request works normally.

It looks like it's not very difficult to bundle all necessary npm
dependencies together with the docs_ai_backend. What is needed is just
to specify `output: standalone` in the next.js config.

I've tried to start the server with `node` from the resulting build
and it worked. However, I can't do any in-depth testing and will wait
for Shukhrat to do that part.

testong

fixed the DNS error and made the app launch using the correct port

fixes
@knazarov knazarov added this pull request to the merge queue Apr 2, 2025
Merged via the queue into main with commit 2897ce0 Apr 2, 2025
15 checks passed
@knazarov knazarov deleted the docs_ai_backend_bundle branch April 2, 2025 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants