I created a NuxtJS static blog with Cockpit CMS backend. Currently I need to npm run generate
locally after I created a new blog post and upload the files from the dist folder to my server.
How to automate this process?
(What I would like to archive: Create new blog entry -} trigger generate static sites -} update files on server)
Update: I have SSH access and installed NodeJS on my server.
As your computer is not always up, may not keep the same IP address and won't have a reverse proxy to handle multiple hooks, it's considered good practice not to do that on your own machine.
If you were using Netlify or Vercel or any other SAAS serverless hosting, they give access to endpoints that you can send a request to, that would trigger a new build of your website: it's called "build hooks" or "deploy hooks".
What you should do on your server is to upload the sources of your Nuxt project and provide it everything it needs to generate (node+npm, network access...) to the place it is then exposed online. You'll then need to develop your own build hook: a script to regenerate your website and an endpoint to trigger it.
On Cockpit's side, they give you access to Webhooks to send a HTTP request whenever somethings happens on your account.
If it is an option, you should really consider migrating to Netlify/Vercel/... that would simplify all that a lot :). They will georeplicate your site for it to load very quickly, won't break your site if the build fails and make sure it's always up with a proper SSL certificate.