medusa
medusa copied to clipboard
General deploy guidance/Interest in implementing a docker image
I am afraid I have to ask another question also but I hope this one is easy, thanks again for the awesome project. I have seen the documentation about deploying a medusa app in various server environments(Heroku,Digital Ocean,Qovery) and I have also noticed the conversations on the issues #485 , #481 , #453 . I would like to ask if there is a minimal way to run a medusa production build(with PostgreSQL,Redis and any optimization available) on a typical general purpose Linux server (so just a terminal). A docker image seems a very good solution for me and I would even assign to myself to implement a docker image for your project and also to provide documentation for it. But firstly I would like some documentation about how could I manage to do this build natively on a Linux PC (I don't care about a specific distribution everything is fine). So I would expect something like :
- Download PostgreSQL and Redis with your package manager
- Open a PostgreSQL socket at local host random port
- Open a Redis socket at local host random port
- Write this configurations on
medusa-config
to connect with this two sockets
Hi @SpyrosMourelatos, have you made any progress on this yet? I'm currently evaluating medusa and since I'm pretty well-versed in Docker I figured I might contribute an app Dockerfile + a Docker-Compose file for easy setup.
https://github.com/medusajs/docker-medusa - seems like there's an official implementation on it's way. For prod I think it's mostly about modifying the configs (e.g. postgres max connections, nginx conf) and providing security (e.g. for your small single-server setup you may want to run ufw in front of the containers). However I'd use a very different setup for prod (e.g.: build artifacts for storefront/admin & deploy to CDN instead of serving directly, use managed DBs in the cloud…) to reap some of the "more headless" benefits compared to solutions like Magento which are more monolithic in nature.
I am also evaluating medusa as an e-commerce solution. And I am stuck at the same place as @SpyrosMourelatos. It seems doing anything non-standard with medusa is going to be difficult. For example, I have not been able to setup a local environment that mirrors a production environment - using postgres, redis, not committing the node_modules directory. I need to have a lock file that let's me clone a repo then run npm ci
and have a functional medusa server. This doesn't look possible now.
for your small single-server setup you may want to run ufw in front of the containers
Be aware that docker inserts its own iptables rules that completely bypass any ufw rules you have set. You can learn more about this here.
@chill117 By now I'm running my store inside Kubernetes for staging and theoretically I could run the images I build for that very easily with docker-compose and postgres locally.
Building a single image with all the requirements isn't something I'm looking to do right now since it will not mirror my production environment in any way, shape or form. But it's also something I assume wouldn't take you long to build.
Also thanks for the reminder pertaining to ufw, also leaving this repo here for anyone passing by (it's a great tool!) https://github.com/chaifeng/ufw-docker
if anyone runs it in Docker Please Share Docker image