Skip to content
Back

[SOLVED] How to edit the source code after installing Appwrite locally using docker in Ubuntu?

  • 0
  • General
  • Tools
Binyamin
23 Aug, 2023, 13:52

What is the specs of that machine?

TL;DR
Title: [SOLVED] Editing source code after installing Appwrite locally on Ubuntu using Docker Solution: To edit the source code after installing Appwrite locally using Docker in Ubuntu, follow these steps: 1. Edit the Dockerfile by adding the following line before the `RUN npm ci` command: ```dockerfile ENV NODE_OPTIONS=--max_old_space_size=4096 ``` 2. Run the command `docker compose build` to build the Docker image. 3. Make the necessary changes to the source code. 4. Run `npm run build` to rebuild the project. Explanation: The default `NODE
manazo
23 Aug, 2023, 14:16

Ubuntu 22.04

Binyamin
23 Aug, 2023, 14:17

I mean ram & cpu wise

Binyamin
23 Aug, 2023, 14:17

Can you share screenshot

Binyamin
23 Aug, 2023, 14:17

of htop

manazo
23 Aug, 2023, 14:19

is it what you mean?

Binyamin
23 Aug, 2023, 14:19

Yes

Binyamin
23 Aug, 2023, 14:19

That's a pretty strong server

manazo
23 Aug, 2023, 14:20

means my specs aren't the problem?

Binyamin
23 Aug, 2023, 14:21

Open 2 terminals to the same server In one run

TypeScript
docker compose build

In the second have htop opened

Binyamin
23 Aug, 2023, 14:22

To see when & what uses the RAM

Binyamin
23 Aug, 2023, 14:23

Next you can edit the Dockerfile and add this before the RUN npm ci

TypeScript
ENV NODE_OPTIONS=--max_old_space_size=4096

RUN npm ci
RUN npm run build

Then run

TypeScript
docker compose build

Check more about it here

manazo
23 Aug, 2023, 14:27

is it anything helpful?

Binyamin
23 Aug, 2023, 14:29

Yes It seems like that it doen't use as much RAM as available Try to add the line from the last message and run it again

manazo
23 Aug, 2023, 14:33

seems it worked now. but what was this magic? can you help me understand it?

Binyamin
23 Aug, 2023, 14:33

Yes

Binyamin
23 Aug, 2023, 14:33

Let's hope it will work 😉

Binyamin
23 Aug, 2023, 14:37

When creating bundles with JS using <:vite:1007379819660595291> Vite or any other bundlers there's a huge amounts of files to process, and so many sub-process like tree-shaking etc. it's not too much to say that bundling JS file are one of the most resource consuming processes out there.

When the Dockerfile executing this command

TypeScript
RUN npm run build

It uses the default NODE_OPTIONS that have a smaller limit for RAM size. Because of that when JS uses all the available RAM it can't create any more variables in the heap and it crashes.

Adding the above command will force it to use 4096MB of RAM and this is more optimal for such a tasks.

Binyamin
23 Aug, 2023, 14:37

It this makes sense?

manazo
23 Aug, 2023, 14:41

makes so much sense. i wonder what's the default limit of RAM size you mentioned?

Binyamin
23 Aug, 2023, 14:52

It seems like it is been decided in runtime by Node V8's unless you force by adding the setting

manazo
23 Aug, 2023, 15:17

in this article, the auther says he got this number from a test. my current node version is 20.5.1. and in the command above, we again setting the limit to 4gb

Binyamin
23 Aug, 2023, 15:18

Yes I read this one, but only setting it as flag helped it From what I've seen it's more about the calculation node is doing compere to available RAM

manazo
23 Aug, 2023, 15:25

however. that might another whole topic to discuss about. but thanks for your help. really appreciate

manazo
23 Aug, 2023, 19:43

[SOLVED] How to edit the source code after installing Appwrite locally using docker in Ubuntu?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more