We often run into the error, `An unexpected error occurred:
"https://registry.yarnpkg.com/date-fns/-/date-fns-2.29.1.tgz:
ESOCKETTIMEDOUT".` This seems to be a common problem with the
date-fns package, as well as other large packages installed with
older versions of Yarn. See for example the following GitHub
issues:
https://github.com/date-fns/date-fns/issues/1004https://github.com/yarnpkg/yarn/issues/8242
The problem seems to be related to slow hard-disk access on the
client server/VPS - so it's actually the storage connection and
not the Internet connection, that's timing out.
A common workaround for this is to increase the network timeout
for Yarn long enough for the build will complete, which is what
we're doing in this case since it's likely to affect a lot of the
slower setups (including, as it seems, the YunoHost CI!). For
everyone else, the worst case is that they'll have to wait 10
minutes before they realise there's actually something wrong with
the network.
Instead of checking for the existence of a file, we were checking
if config.production.json was a directory! Obviously, this would
end up failing (unless you've done something very strange with
your Ghost setup).
Ghost has significantly changed their file structure, which means
the scripts had to be changed around quite a bit as well. We are
also using the readymade `yarn setup` tool to set up the Ghost
installation instead of manually running each command. Significant
changes are:
- Config and content now lives under ./ghost/core instead of
being directly in the project root. While updating, for
backward compatibility, we're checking for the existence
of the old folder as well
- The admin interface is bundled along with the main Ghost
package, so there is no need to download it separately
(Casper is still being downloaded separately though)
- We are using `yarn start` instead of knex, grunt, etc.
(`yarn start` automatically calls those commands for us
behind the scenes)
- Similarly, we are now running `yarn start` to execute the
Ghost process in the systemd config, instead of manually
running `index.js` as we were doing earlier.
Fresh installs work well on this commit, though upgrades are yet
to be tested!