-
Notifications
You must be signed in to change notification settings - Fork 14
Add command to restart node after the build #468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
The whole handle_mounts script can be updated to just a few way simpler lines in the hooks. Also you should add a separate mount for the next image cache, that is then linked into Would you be open for a PR restructuring it a bit? |
|
@apfelbox Is this a better way to restart than what is in #82 ? Regarding the Also, I don't think PSH follows these repos, so it may be better to just share our solutions here 😶 |
|
@achton, yes this case is much better than #82, because the other one has a race condition: Platform.sh starts up Next.js and then runs the We had this case very reliably in one of our applications. Using On your mounts question, we always have this setup, which is basically just the inlined calls. They are small enough: mounts:
'/.next':
source: local
source_path: 'next'
'/.next-image-cache':
source: local
source_path: 'next-image-cache'And then build: |
# ...
# Keep build files out of reach
mkdir -p .build/.next
mv .next/* .build/.next
deploy: |
set -x -e
# Move stored files back
rm -rf .next/*
cp -r .build/.next/* .next
# relink image cache dir
rm -f .next/cache/images
ln -s ../../.next-image-cache .next/cache/images
# restart node
systemctl --user restart appThe If you need to add more caches (like the fetch cache), you might need to adapt either the mount or add some more. In our case & architecture it's fine to start with a clean slate when deploying, but YMMV. |
|
@apfelbox Thanks for your input. we also did not use the We have also ditched the |
Hi,
right now the Next.js process starts with the outdated build and will fail in production (like not being able to load the assets).
That is why you need to restart Next.js at the end of the deployment once.