# Can't complete build on Lightsail

**URL:** https://meta.discourse.org/t/cant-complete-build-on-lightsail/348410
**Category:** Self-hosting
**Created:** [January 22, 2025, 4:11pm UTC](https://meta.discourse.org/t/cant-complete-build-on-lightsail/348410 "2025-01-22T16:11:49Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![martim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martim/32/482990_2.png) [@martim](https://meta.discourse.org/u/martim)
#### Post date: [January 22, 2025, 4:11pm UTC](https://meta.discourse.org/t/cant-complete-build-on-lightsail/348410/1 "2025-01-22T16:11:49Z")

</div>

Hi, it seems like I’m having the same problem as [Rebuild app has stuck](https://meta.discourse.org/t/rebuild-app-has-stuck/67300) and [Background saving terminated with success](https://meta.discourse.org/t/background-saving-terminated-with-success/289649), except that I retried the build process many times, with and without rebooting.

I have a Lightsail instance with 2vCPU, 1GB RAM running Ubuntu 20.04. Manually edited `db_shared_memory` to 256MB and Unicorns to 4 based on other discussions here. I tried `discourse-setup`, `discourse-doctor` and `launcher rebuild app`, all of them seem to have the same behaviour.

I see  
`WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.` in my log but trying the configs in [MKJ's Opinionated Discourse Deployment Configuration](https://meta.discourse.org/t/mkjs-opinionated-discourse-deployment-configuration/193355#p-947673-kernel-configuration-6) didn’t seem to help.

My build process hangs at

```plaintext
...[Babel: select-kit > applyPatches]
...[@embroider/compat/app]
...[@embroider/webpack]
...[@embroider/webpack]
107:M 22 Jan 2025 14:37:30.565 * 1 changes in 3600 seconds. Saving...
107:M 22 Jan 2025 14:37:31.648 * Background saving started by pid 854
854:C 22 Jan 2025 14:37:34.940 * DB saved on disk
854:C 22 Jan 2025 14:37:35.092 * Fork CoW for RDB: current 0 MB, peak 0 MB, average 0 MB
107:M 22 Jan 2025 14:37:35.341 * Background saving terminated with success

```

Any suggestions of what I can do to solve this? Thanks

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [January 22, 2025, 4:52pm UTC](https://meta.discourse.org/t/cant-complete-build-on-lightsail/348410/2 "2025-01-22T16:52:08Z")

</div>

How much swap do you have? You might increase it to 3 or 4GB.

How long have you left it hanging at that prompt?

1GB isn’t much; is anything else running on that VM?

It’s not the problem, but why 20.04? Its EOL is in 4 months.

---

<div class="post-metadata">

### Author: ![martim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martim/32/482990_2.png) [@martim](https://meta.discourse.org/u/martim)
#### Post date: [January 22, 2025, 5:19pm UTC](https://meta.discourse.org/t/cant-complete-build-on-lightsail/348410/3 "2025-01-22T17:19:20Z")

</div>

Sorry, 22.04. Nothing else running on it. I left it hanging for more than an hour for sure. Am trying to increase the swap now, thanks for the suggestion.

On a side note, I’m in that scenario where my VM has marginally under 1GB RAM and I had to comment out the memory check. Is this why `discourse-setup` outputs this?

```plaintext
Found 0GB of memory and 4 physical CPU cores
setting db_shared_buffers = 0MB
setting UNICORN_WORKERS = 0
containers/app.yml memory parameters updated.

```

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [January 22, 2025, 5:21pm UTC](https://meta.discourse.org/t/cant-complete-build-on-lightsail/348410/4 "2025-01-22T17:21:27Z")

</div>

> [@martim](#):
>
> Is this why `discourse-setup` outputs this?

It could be that the converting of the memory to GB and the way that it counts CPU cores is wrong for some reason.

1GB is really tight these days. I’d really recommend 2GB.

---

<div class="post-metadata">

### Author: ![martim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martim/32/482990_2.png) [@martim](https://meta.discourse.org/u/martim)
#### Post date: [January 22, 2025, 5:26pm UTC](https://meta.discourse.org/t/cant-complete-build-on-lightsail/348410/5 "2025-01-22T17:26:42Z")

</div>

It is a very small community for the time being and funding comes from academia, so I’m trying my best to keep it under $10/month. If it proves impossible I’ll scale it up, thanks!

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [January 22, 2025, 5:28pm UTC](https://meta.discourse.org/t/cant-complete-build-on-lightsail/348410/6 "2025-01-22T17:28:22Z")

</div>

There are plenty under 10 USD

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [January 22, 2025, 5:29pm UTC](https://meta.discourse.org/t/cant-complete-build-on-lightsail/348410/7 "2025-01-22T17:29:48Z")

</div>

I’m not familiar with Lightsail, but with Hetzner you have 2 vCPU, 4 GB RAM and 40 GB NVMe for 5€/month. They have servers in US too.

---

<div class="post-metadata">

### Author: ![martim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martim/32/482990_2.png) [@martim](https://meta.discourse.org/u/martim)
#### Post date: [January 22, 2025, 5:34pm UTC](https://meta.discourse.org/t/cant-complete-build-on-lightsail/348410/8 "2025-01-22T17:34:51Z")

</div>

Thanks for the suggestions. I’m somewhat tied to AWS since everything else for this project is hosted/managed there, but will definitely consider moving somewhere else should it come to it.

---

<div class="post-metadata">

### Author: ![martim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martim/32/482990_2.png) [@martim](https://meta.discourse.org/u/martim)
#### Post date: [January 22, 2025, 9:40pm UTC](https://meta.discourse.org/t/cant-complete-build-on-lightsail/348410/9 "2025-01-22T21:40:17Z")

</div>

So increasing the swap got me farther than ever, but my ssh connection timed out before the build finished (after a couple hours running).

The last identifiable output between a thousand `Babel: discourse-plugins > applyPatches` was `[WARN] (broccoli-terser-sourcemap) Minifying "assets/browser-detect.js" took: 43325ms (more than 20,000ms)`. Giving it more swap would help here or should I just look into more RAM?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [January 22, 2025, 10:37pm UTC](https://meta.discourse.org/t/cant-complete-build-on-lightsail/348410/10 "2025-01-22T22:37:51Z")

</div>

> [@martim](#):
>
> So increasing the swap got me farther than ever, but my ssh connection timed out before the build finished (after a couple hours running).

You can try using `tmux` or `screen` so that you can re-connect to the session.

> [@martim](#):
>
> Giving it more swap would help here or should I just look into more RAM?

My guess is that you ran out of RAM/memory and adding more swap might get you farther, but I’d recommend again that you just get more RAM. It might be possible to resize it, leave the disk size the same, rebuild with the more ram, and then resize the VM to the smaller one once it’s running.

I don’t know if that’s possible or easy with Lightsail

How much swap do you have?

---

<div class="post-metadata">

### Author: ![martim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martim/32/482990_2.png) [@martim](https://meta.discourse.org/u/martim)
#### Post date: [January 23, 2025, 3:55pm UTC](https://meta.discourse.org/t/cant-complete-build-on-lightsail/348410/11 "2025-01-23T15:55:34Z")

</div>

Hi, I had 2GB swap. I ended up getting a chunkier VM in Lightsail and it built without a problem. I don’t think resizing up/down is possible with this service. Thanks again for the help!

P.S: I still got the memory overcommit warning but did nothing about it. Should I enable it nevertheless?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [January 23, 2025, 3:58pm UTC](https://meta.discourse.org/t/cant-complete-build-on-lightsail/348410/12 "2025-01-23T15:58:56Z")

</div>

> [@martim](#):
>
> I had 2GB swap.

If you’d gone to 4GB it might have worked.

> [@martim](#):
>
> I still got the memory overcommit warning but did nothing about it. Should I enable it nevertheless?

I haven’t paid attention to that lately. I’m pretty sure that my tooling enables it and the error message doesn’t go away. It’s a very good bet that most people don’t see or ignore that message completely. Your mileage may vary.

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [January 23, 2025, 4:11pm UTC](https://meta.discourse.org/t/cant-complete-build-on-lightsail/348410/13 "2025-01-23T16:11:24Z")

</div>

> [@pfaffman](#):
>
> It’s a very good bet that most people don’t see or ignore that message completely.

I see it regularly, but since my installs work, I just ignore it 😄

---

<div class="post-metadata">

### Author: ![martim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martim/32/482990_2.png) [@martim](https://meta.discourse.org/u/martim)
#### Post date: [January 23, 2025, 6:01pm UTC](https://meta.discourse.org/t/cant-complete-build-on-lightsail/348410/14 "2025-01-23T18:01:48Z")

</div>

> [@pfaffman](#):
>
> If you’d gone to 4GB it might have worked.

I suppose so, but I saw

> [@Create a swapfile for your Linux server](https://meta.discourse.org/t/create-a-swapfile-for-your-linux-server/13880/1):
>
> We recommend a 2GB swap file for Discourse, unless your server has 4GB or more of memory.

and figured that even if it worked it would still mean crazy long build times and $5 was worth the ease of mind. Hopefully our community grows to justify the leap too 🙂

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [January 23, 2025, 6:08pm UTC](https://meta.discourse.org/t/cant-complete-build-on-lightsail/348410/15 "2025-01-23T18:08:51Z")

</div>

2GB is the party line, but builds are taking increasing amounts of ram, so with only 1GB I’ll often create bigger swap.

> [@martim](#):
>
> $5 was worth the ease of mind

That’s what I’ve been trying to tell you, but in some parts of the world $5 is lots more than it is in other parts! 😉

---

<div class="post-metadata">

### Author: ![martim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martim/32/482990_2.png) [@martim](https://meta.discourse.org/u/martim)
#### Post date: [January 23, 2025, 6:11pm UTC](https://meta.discourse.org/t/cant-complete-build-on-lightsail/348410/16 "2025-01-23T18:11:21Z")

</div>

> [@pfaffman](#):
>
> That’s what I’ve been trying to tell you

I took the hints!

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [January 23, 2025, 6:54pm UTC](https://meta.discourse.org/t/cant-complete-build-on-lightsail/348410/17 "2025-01-23T18:54:59Z")

</div>

> [@pfaffman](#):
>
> That’s what I’ve been trying to tell you, but in some parts of the world $5 is lots more than it is in other parts! 😉

I still can’t wrap my head around the fact that I’ll look for every cent I can save when renting a server, whereas I’ll gladly pay 20$ for a game I won’t play on Steam, or buy a 15$ pizza knowing it won’t even be that good. :lolsob:

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [February 22, 2025, 7:15pm UTC](https://meta.discourse.org/t/cant-complete-build-on-lightsail/348410/19 "2025-02-22T19:15:53Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
