News for hackers. Stuff that matters.

Ask HN: Deploying my project on multiple servers?

Currently I have 5 Linux servers setup, my code is based on Python and celery. Every time I make a revision, I have to manually upload the code. What would be the best solution to automatically deploy? I was thinking of setting up an NFS share, but I'm curious if there's a better way?
( 7 comments | 3 points | on HN )
Re:Ask HN: Deploying my project on multiple servers? by jack335 on Friday July 28, 2023 @07:28AM (#36905371)
What is your project about? I'd setup an automated pipeline which deploys your code automatically on each git push. You can check out buddy for example for that
Re:Ask HN: Deploying my project on multiple servers? by ilaksh on Friday July 28, 2023 @07:50AM (#36905535)
NFS or SSHFS or maybe rsync or maybe a simple script that makes a tar gzip, runs scp to transfer and then runs ssh to execute a script on each server to uncompress and restart the program.

Or could have a simple agent that polls your server for updates and then downloads and deploys.

Re:Ask HN: Deploying my project on multiple servers? by ssss11 on Friday July 28, 2023 @08:42AM (#36905987)
Look up CI/CD tools
Re:Ask HN: Deploying my project on multiple servers? by ac2u on Friday July 28, 2023 @10:26AM (#36907265)
If you don't want to go down the NFS share route then Capistrano is a useful tool if you're willing to write a little bit of ruby. It comes with some built in goodies like rollbacks. It's an oldie (pre-dockerize everything), but still useful.

https://github.com/capistrano/capistrano

You can start by deploying from your machine to simultaneously get it deploying across all your servers, then I'd consider having a CI/CD pipeline take over and run Capistrano for you.

Re:Ask HN: Deploying my project on multiple servers? by plevexier on Friday July 28, 2023 @06:09PM (#36914028)
You can use ansible to deploy to multiple servers with a single command.
Re:Ask HN: Deploying my project on multiple servers? by gnz11 on Saturday July 29, 2023 @07:46AM (#36919275)
If you are using GitHub, you can use GitHub Actions or just a basic web hook. If you don’t want any of that and want something Python based, you can use Fabric [1] to run remote shell commands.

[1] https://www.fabfile.org/

Re:Ask HN: Deploying my project on multiple servers? by speedgoose on Saturday July 29, 2023 @04:23PM (#36924176)
One popular and complicated way is kubernetes.

I enjoy using k3s with argocd. The containers are built using GitHub actions but you can probably use many other tools.