goatcorp / dalamud-docs

Dalamud developer documentation site
https://dalamud.dev/
MIT License
6 stars 21 forks source link

Reworked Docker configuration and minor fixes #12

Closed SayuShira closed 2 months ago

SayuShira commented 10 months ago

Since at the momentI can't build on windows (#11), I wanted to use Docker. As mentioned this ran slow on my system. I changed the Docker setup and saw major speed increases.

This PR seeks to implement them in the main repo if you are interested.


I can't pinpoint what made it run slow before. My best guess would be Docker Desktop for Windows and file IO between Windows and Docker on WSL2.

Comparison with my setup (Win + Docker WSL2):

There are differences in operation compared to before as well.

1) Build dependencies are baked into the image, thus the Image size change. This enables use of pnpm cache for rebuilds and (my guess) contributed to the faster execution times. To update dependencies just docker compose build with a new pnpm-lock.yaml.

2) Workaround for node_modules If we create a volume of the whole dalamud-docs directory node_modules will be deleted in the container as it does not exist on the host. To avoid this /app/node_modules is bound to named volume separate of the host filesystem. Bonus: You can have a node_modules directory on host without it spilling to the docker container and causing this: image

3) Despite some efforts to let docusaurus listen to FS events of the host, this still didn't work with the Windows/Docker setup. The default behavior now includes --poll 1000. Note: Some IDE, e.g. WebStorm, still don't trigger the FS events by default. For me changing this setting didn't hot reload either, that's why I'm defaulting to poll.


This also includes 2 minor fixes that were mentioned in #11 as well.


Furthermore for if anyone who runs into this error again. At some point randomly, no changes to the dockerfiles, this error happend on startup:

dalamud-docs-workspace-1  | Error: Processing of blog source file path=2023-05-26-removing-legacy-devplugins.md failed.
dalamud-docs-workspace-1  |     at doProcessBlogSourceFile (/app/node_modules/.pnpm/@docusaurus+plugin-content-blog@3.0.0-alpha.0_@swc+core@1.3.64_eslint@8.43.0_react-dom@18.0.0_cs3vfzh2nzoyfz3b5ir6dc2cu4/node_modules/@docusaurus/plugin-content-blog/lib/blogUtils.js:252:19)
dalamud-docs-workspace-1  |     at async Promise.all (index 1)
dalamud-docs-workspace-1  |     at async generateBlogPosts (/app/node_modules/.pnpm/@docusaurus+plugin-content-blog@3.0.0-alpha.0_@swc+core@1.3.64_eslint@8.43.0_react-dom@18.0.0_cs3vfzh2nzoyfz3b5ir6dc2cu4/node_modules/@docusaurus/plugin-content-blog/lib/blogUtils.js:255:24)
dalamud-docs-workspace-1  |     at async Object.loadContent (/app/node_modules/.pnpm/@docusaurus+plugin-content-blog@3.0.0-alpha.0_@swc+core@1.3.64_eslint@8.43.0_react-dom@18.0.0_cs3vfzh2nzoyfz3b5ir6dc2cu4/node_modules/@docusaurus/plugin-content-blog/lib/index.js:53:31)
dalamud-docs-workspace-1  |     at async /app/node_modules/.pnpm/@docusaurus+core@3.0.0-alpha.0_@docusaurus+types@3.0.0-alpha.0_@swc+core@1.3.64_eslint@8.43.0_k23iezacojfblnlv4eaj34r44q/node_modules/@docusaurus/core/lib/server/plugins/index.js:35:25
dalamud-docs-workspace-1  |     at async Promise.all (index 1)
dalamud-docs-workspace-1  |     at async loadPlugins (/app/node_modules/.pnpm/@docusaurus+core@3.0.0-alpha.0_@docusaurus+types@3.0.0-alpha.0_@swc+core@1.3.64_eslint@8.43.0_k23iezacojfblnlv4eaj34r44q/node_modules/@docusaurus/core/lib/server/plugins/index.js:34:27)
dalamud-docs-workspace-1  |     at async load (/app/node_modules/.pnpm/@docusaurus+core@3.0.0-alpha.0_@docusaurus+types@3.0.0-alpha.0_@swc+core@1.3.64_eslint@8.43.0_k23iezacojfblnlv4eaj34r44q/node_modules/@docusaurus/core/lib/server/index.js:76:58)
dalamud-docs-workspace-1  |     at async Command.start (/app/node_modules/.pnpm/@docusaurus+core@3.0.0-alpha.0_@docusaurus+types@3.0.0-alpha.0_@swc+core@1.3.64_eslint@8.43.0_k23iezacojfblnlv4eaj34r44q/node_modules/@docusaurus/core/lib/commands/start.js:44:19) {
dalamud-docs-workspace-1  |   [cause]: [Error: EIO: i/o error, open '/app/news/2023-05-26-removing-legacy-devplugins.md'] {
dalamud-docs-workspace-1  |     errno: -5,
dalamud-docs-workspace-1  |     code: 'EIO',
dalamud-docs-workspace-1  |     syscall: 'open',
dalamud-docs-workspace-1  |     path: '/app/news/2023-05-26-removing-legacy-devplugins.md'
dalamud-docs-workspace-1  |   }
dalamud-docs-workspace-1  | }
dalamud-docs-workspace-1  | [INFO] Docusaurus version: 3.0.0-alpha.0
dalamud-docs-workspace-1  | Node version: v18.18.0
dalamud-docs-workspace-1  |  ELIFECYCLE  Command failed with exit code 1.

Restarting the OS (in my case just WSL) did solve the issue again.

SayuShira commented 10 months ago

Removed the named volume due to a issue with updating node_modules. The volume would override the new dependencies from build. Removing the volume first would have worked, but looking that up every time dependencies are updated is annoying.

Instead of working around node_modules this now imports all needed directories and files individually and doesn't touch the rest. Note: This then mean that if e.g. #10 is merged the docker configuration would likely have to include a volume ./i18n:/app/i18n