Odonno / surrealdb-migrations

An awesome SurrealDB migration tool, with a user-friendly CLI and a versatile Rust library that enables seamless integration into any project.
https://crates.io/crates/surrealdb-migrations
MIT License
231 stars 20 forks source link

Docker builds? #89

Open senpro-ingwersenk opened 2 months ago

senpro-ingwersenk commented 2 months ago

Is your feature request related to a problem? Please describe. Not relevant to a problem directly.

Basically I am mainly working with Kubernetes and it would be really helpful to run surrealdb-migrations as an initcontainer during the pod bootstrap - or during development to keep the components containerized and closer to how they will end up being deployed. For instance, I use Docker Compose during development, but rewrite the compose file into a Deployment down the line.

Describe the solution you'd like Since Github has useful and predefined actions, I would love to see one that produces Docker container builds that simply expose surrealdb-migrations. That way, we could do docker run -it --rm .../surrealdb-migrations -v .:/src <command here> or combine it with other systems like Docker-Compose and/or Kubernetes deployments.

Describe alternatives you've considered Publish the app to a well known package repository (Alpine, Pacman/Arch, Debian, ...) so it could be very quickly installed on-demand.

Additional context I have a long background with MySQL and I am doing my first SurrealDB app - it's a basic SPA CRUD kinda thing - nothing fancy or complicated, but I wanted to use SurrealDB here in order to help with simplifying the frontend.

Kind regards!

Odonno commented 2 months ago

Hi @senpro-ingwersenk

This is an excellent idea. I published the current release and the preview releases (for alpha & beta versions of surrealdb) of surrealdb-migrations as Docker images on Docker Hub. Can you try and tell me if that's what you expected?

Here is the link: https://hub.docker.com/r/dbottiau/surrealdb-migrations

senpro-ingwersenk commented 2 months ago

I took a look and it's awesome!

A recommendation I would give:

Set WORKDIR to a subfolder into which one may want to mount their schemas etc. This effectively turns -v ./schemas:/schemas -v ./events:/events into just -v .:/opt (or whichever folder you see fit). It just simplifies things :) Currently, CWD is /.

That said, in something like Compose or Kubernetes this is hardly an issue - but, it makes life just a little bit easier. :)

Additionally, whilst I have no real experience with those, I did see that there are dozen Github actions that allow cross-compiling and -building of container images for different architectures (aarch64/arm64, riscv64, ...). Maybe that can be implemented? My cluster at work runs on a bunch of Intel CPUs in Hyper-V - but at home, I use RockChip RK3588s, which are ARM :)

That said, I can totally work with that image for the time being, thank you!

akkie commented 2 weeks ago

ARM support would be awesome.

akkie commented 2 weeks ago

I added a proof of concept PR #94.