I've managed to deploy my Payload app to AWS EBS using docker. I'm using the example
Dockerfile
with the exception of the run command; instead of using node, I'm using pm2 (
CMD ["pm2-runtime","dist/server.js"]
)
Once it's deployed, the first load of the admin is SO SO Slow! API responses are ok, I imagine is something to do with webpack? But I'm not sure how to debug this. Any idea?
How slow are we talking? 3 seconds? 10 seconds? More?
Do you see the same slowness when building the dockerfile then running it locally?
About a minute to first load
whaaaaat
do you have
NODE_ENV=production
?
you should be running in production mode, which should completely bypass Webpack and serve static, prebuilt admin files
make sure you have that set and then you should be golden
Any update on this topic? I deployed to EC2 with DocumentDB using docker. I have NODE_ENV=production on my Dockerfile. It takes about 1-3 minutes on first load.
What EC2 and database specs? Is provisioning of the resource included in your timings?
I'm using t2.small and running it along with a next.js application. Apparently, after debugging in the developer console on the browser i noticed that the main.js file is way too large about
30 mb. Which keeps the page loading depending on the internet speed.
Sounds like an issue with how you're building your image. Can you provide more info?
I'm simply running it with docker compose. Found the Docker build file in the docs.
See that the selected resource is way too large.
I have the same issue, payload cms with next app with prod build running on good sized cloud server with mongo db atlas, it takes about a min after login and all other pages also slow about 20 seconds .
Star
Discord
online
Get dedicated engineering support directly from the Payload team.