Deploy to DigitalOcean droplet?

default discord avatar
akacronos
5 months ago
9

Hi there! I'm new to Payload, I've been trying to deploy an instance in a DigitalOcean Droplet, but I'm failing miserably.



I followed the instructions for the Droplet preparation, and have it working, but I don't find any resources on what to do next.



I've been trying to clone the repo, but running 'npm run build/serve' isn't working. It's there some other documentation that I can follow?

  • discord user avatar
    Jarrod
    Payload Team
    4 months ago

    Hey @akacronos! What steps have you followed so far? Is your repo cloned on your droplet? Have you run

    npm i

    in the project folder after cloning?

  • default discord avatar
    akacronos
    4 months ago

    I don't know how but it works now! Well, kinda, I can build and serve the repo, but I don't know how to let it run. I know there's is a package called pm2 (already installed from the tutorials) but I don't know which file should I run it with to serve payload.



    (I'm a Product Designers that can do front-end, I'm don't know well back-end stuff, sorry 😅)



    again i think i found the solution:

    pm2 start server.js --env production

    it's running fine.

  • discord user avatar
    Jarrod
    Payload Team
    4 months ago

    you got it! pm2 is what I would suggest to manage your node processes, a script

    pm2 start npm --name stage -- run serve --time

    . This example starts an NPM script called

    serve

    and aliases it to name

    stage

    . You can then run commands like

    pm2 restart stage

    .



    So if you make changes to your repo and pull those into your server, you will want to run

    yarn build && pm2 restart stage

    for your changes to appear!



    re: not knowing server stuff - I get that, that used to be me. While it is a mind shift from the FE, with practice it makes sense. Understanding how to manage a server, even in a basic sense is invaluable 🚀

  • default discord avatar
    akacronos
    4 months ago

    I'm going to try this config, thanks!

  • default discord avatar
    Jonny Willis
    4 months ago

    I'm probably in a similar boat as @akacronos ... trying to deploy a droplet. But I'm getting 404's. Everything works fine locally.

  • default discord avatar
    akacronos
    4 months ago

    did you manage to deploy to digitalOcean? need help?

  • default discord avatar
    AngeloK
    last month

    Would be cool if there was a Payload 1 click droplet install template

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.