Deploy to ECS (Docker) troubles - solved #4260
Replies: 4 comments
-
This is my complete Dockerfile which I have modified for my needs
|
Beta Was this translation helpful? Give feedback.
-
And running "blitz dev" on my local machine works without any issues |
Beta Was this translation helpful? Give feedback.
-
It seemed that I had two issues at once, which made this super hard to debug and fix.
After I fixed the issue on my local machine, I could successfully build and run a node:20 image. After deploying to ECS, also there everything was fine 🎉😀 |
Beta Was this translation helpful? Give feedback.
-
For anyone that is looking for a working Docker Image, here is mine
with |
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
I am trying to deploy my blitz app to ECS, so I need to create a Docker Image and push that to ECS. First, I could not find any complete documentation on how to do that with blitzjs, so I am going to summarize my experience for others to follow it. So far I am nearly done and even have got the blitzjs app running on ECS, there is just a "small" issue that I am going to describe further down, that I can not get my head around and I am beginning to go crazy!!!
But first things first, here is what I have done so far:
Step 1: Find the nextjs documentation on how to deploy to docker
I found and used this Dockerfile to get started.
One important change I had to make was in line 11, to change (I am using npm) "npm install" to "npm install --legacy-peer-deps" as I am getting "could not resolve dependency" issues that are impossible to resolve (e.g. blitz needs up to date version of react and node and the pretty old dependencies like @testing-library/react need older version, so there is not one version of react that would satisfy all peer dependencies).
Another change I had to make was to enable "standalone" mode by adding
to
next.config.js
See here
But apart from that, it was working quite well but it is missing some blitzjs stuff, which brings me to the next step.
Step 2: Make changes to support prisma
I had to make a couple of changes to include prisma into the Dockerfile as the nextjs template didn't care about that. First I added
blitz prisma generate
before I wouldRUN blitz build
. And then I had to make sure thatblitz prisma migrate deploy
is run before the blitz app is started.With these steps I had a working blitz app running in Docker. BUT it only seemed to work. As soon as I would try to sign up a new user, the app would crash with
This is what I can not figure out. I have googled as much as I can. I found an issue related to prisma and postgres (which I am using) but I don't think that is the issue with me. I tried switching to MySql as well as trying the suggested workarounds, no luck. I also found this issue but I also don't think this applies here (and I have also tried the fixes suggested).
So I am looking for anyone that has successfully dockerized a blitzjs app and can share their Dockerfile and step-by-step guide. I don't expect anyone having experienced my SIGSEGV issue but in the rare case, please help me 🙏🏼🙏🏼🙏🏼
Thank you very much,
Florian
Beta Was this translation helpful? Give feedback.
All reactions