serverpod / serverpod

Serverpod is a next-generation app and web server, explicitly built for the Flutter and Dart ecosystem.
BSD 3-Clause "New" or "Revised" License
2.37k stars 217 forks source link

Deployment on Vitual private server VPS #347

Open excellencemichel opened 1 year ago

excellencemichel commented 1 year ago

Add support to deploy on VPS server (Our own server) that will be good to let client/users independant of cloud services like AWS or GCP

vlidholt commented 1 year ago

Serverpod can already run anywhere you can run Dart and have access to Postgres. In which form would you like to see the deployment support?

excellencemichel commented 1 year ago

Okay I will explore more

excellencemichel commented 1 year ago

In the deploy docs the are only AWS terraform deploy documentation. When I say VPS, I mean if customer has his own server where he want to deploy on, or VPS from maybe Digital Ocean other VPS what we have access with SSH. Thank you to help us

vlidholt commented 1 year ago

There are some tips in here, but will flesh it out before the 1.0 release. https://docs.serverpod.dev/deployments/general

chanan commented 1 year ago

@vlidholt specific direction to run on fly.io would be awesome!

daniel-naegele commented 1 year ago

I guess there would be a few ways to implement this:

  1. Use docker compose and the possibility to connect to a remote docker daemon via SSH and deploy a docker-compose file with serverpod in it, though you would need to host your image somewhere (ghcr or something). You could also include a Postgres and Redis database, MinIO for S3 storage and even Traefik for cert management. This could be an easy way to get started fast with an opinionated way on a cheap VPS (no fear of unexpected costs as on AWS).
  2. Use systemd to do the same/something similar

You could also use the then finished deployment process and Terraform to deploy it quickly to [Hetzner Cloud](Hetzner Cloud), Digitial Ocean, ... for example.

If there is something I can help with, let me know.

excellencemichel commented 1 year ago

Do you have any idea to combine it with reverse proxy like nginx ?

mkoehne commented 1 year ago

@excellencemichel Maybe this can help you: https://medium.com/@markus_32812/host-serverpod-on-your-vps-with-ci-cd-6e1c56eaa027

dkbast commented 3 months ago

I guess there would be a few ways to implement this:

  1. Use docker compose and the possibility to connect to a remote docker daemon via SSH and deploy a docker-compose file with serverpod in it, though you would need to host your image somewhere (ghcr or something). You could also include a Postgres and Redis database, MinIO for S3 storage and even Traefik for cert management. This could be an easy way to get started fast with an opinionated way on a cheap VPS (no fear of unexpected costs as on AWS).
  2. Use systemd to do the same/something similar

You could also use the then finished deployment process and Terraform to deploy it quickly to [Hetzner Cloud](Hetzner Cloud), Digitial Ocean, ... for example.

If there is something I can help with, let me know.

I think what many devs are looking for is a "single machine" solution where you run server and database on the same vps (or raspberry pi). Bonus if there is also a backup mechanism :)

Would you @daniel-naegele & @mkoehne be interested in pairing to build something like this? @mkoehne has already written a pretty good article, but it's missing a few pieces to make this "painless" for people coming from the app / frontend world without "any" infrastructure experience.

mkoehne commented 3 months ago

@dkbast Yeah I would be very interested :)

daniel-naegele commented 3 months ago

@dkbast Same here too

dkbast commented 2 months ago

A quick update, just to avoid anybody else working on this as well - @inf0rmatix and I have been working on this and we do have a working (github) pipeline which builds a Dockerimage from the Dockerfile, publishes it to ghcr and deploys it to a VPS using docker compose and a github action. We need to do some cleanup on our end and would appreciate some guidance on how we can best contribute this upstream @vlidholt

dkbast commented 2 months ago

@daniel-naegele @mkoehne I opened a PR #2124 together with @inf0rmatix - since you are both already familiar with the whole setup it would be great if you could take a look and add your thoughts.