Reputation: 865
I've been trying to get multiple instances of my Apostrophe site running for a while, and have been running into an issue. I've tried two instances on the same server (in the same location, using the same forever method that is used in the Stagecoach start script) as well as with two instances on different servers, with a shared public folder between them. Both of those seem to partially work, but when I try to start the second forever process, it seems to remove the generated/minified stylesheets and scripts files that were created for the first instance of the process.
Unfortunately, I'm currently stuck using a Windows server as the host, otherwise I would try the same thing with Stagecoach. I'm guessing I didn't configure something correctly. Is there a setting I need to change to either have Apostrophe stop deleting/recreating the stylesheets/scripts for each run, or is there a way to have both instances use the same files?
Thanks!
Upvotes: 0
Views: 123
Reputation: 7572
Take a look at the scripts in deployment/. These are what stagecoach runs. A great reference even if you can't run them directly.
Basically on any new deployment you want to:
Run node app apostrophe-migrations:migrate --safe
. This carries out any database migrations that don't require that the processes all be stopped. This is the right way to minimize downtime.
Run node app apostrophe:generation
. This is the main one you are missing. This creates a new data/generation
file with an asset generation id, and builds the relevant asset files. When startups of the site see this file they will know to NOT build redundant asset files or change the asset ID. Note that the old instances are still up and running all this time, which is a good thing.
forever stop
the existing processes.
Run node app apostrophe-migrations:migrate
to take care of any migrations not marked as safe
to be done while the processes are up (usually there are none).
Start the new processes with forever
.
Also, you should definitely set minify: true
in data/local.js
on the server:
module.exports = {
modules: {
'apostrophe-assets': { minify: true }
}
};
Otherwise you'll have lots of separate .js and .css files loading.
Upvotes: 1