Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

russellwwest's avatar

Deploying laravel on digital ocean droplet

Hey, I'm currently struggling with this. At the moment I am including the public folder assets in git and then just pulling git changes on the server. However, it's a shared repository and everytime I make a little change (for example a react component used on every page) it causes tracking of every js file that has that component in the public folder. Which means other Devs get loads of file changes to pull down etc.

I tried adding the public assets to gitignore and stop tracking them, however I now can't deploy the changes to the server because running mix's npm prod results in a JavaScript heap out of memory error.

What's the best practice for laravel front end assets in a shared git repo and deployment?

Thanks.

0 likes
4 replies
russellwwest's avatar

@jlrdw that was how it was all setup originally, I used forge for about 8 months, with the same issue.

drehimself's avatar

How much RAM is on your DigitalOcean droplet? More importantly, how much free RAM does your server have?

I have a few of the cheapest droplets with 1GB of ram, and they are able to run npm run prod or npm install fine on the server. I remember a few years ago when the cheapest droplets came with 512MB of ram, I had trouble doing npm install or npm run prod on the server.

You can SSH on the server and try running free -m or top or htop to get memory info. Alternatively, you can login to your DO account and look at your graph showing memory usage. If it's using most of the memory, you need to investigate and figure out what's taking up most of the RAM. For example, for my server, my memory usage is at about 40%.

Please or to participate in this conversation.