2016-11-01 3 views
0

Ich habe eine Instanz von Apostrophe-CMS, die ich zur Zeit in der Produktion bereitstellen möchte. Running sudo npm start funktioniert gut und die Anwendung startet. Aber wenn ich versuche, das PM2-Daemon, um es ausführen ich einen Symlink Fehler bekommen:Probleme beim Starten einer Knoten-App mit PM2 in der Produktion

Error: EEXIST: file already exists, symlink '/var/sites/hackday-2016-microsite/node_modules/apostrophe/lib/modules/apostrophe-assets/public' -> '/var/sites/hackday-2016-microsite/public/modules/apostrophe-assets' hackday2016-28 at Error (native) hackday2016-28 at Object.fs.symlinkSync (fs.js:1048:18) hackday2016-28 at Object.self.linkAssetFolderOnUnix (/var/sites/hackday-2016-microsite/node_modules/apostrophe/lib/modules/apostrophe-assets/index.js:447:10) hackday2016-28 at Object.self.linkAssetFolder (/var/sites/hackday-2016-microsite/node_modules/apostrophe/lib/modules/apostrophe-assets/index.js:424:14) hackday2016-28 at /var/sites/hackday-2016-microsite/node_modules/apostrophe/lib/modules/apostrophe-assets/index.js:402:14 hackday2016-28 at /var/sites/hackday-2016-microsite/node_modules/lodash/index.js:3073:15 hackday2016-28 at baseForOwn (/var/sites/hackday-2016-microsite/node_modules/lodash/index.js:2046:14) hackday2016-28 at /var/sites/hackday-2016-microsite/node_modules/lodash/index.js:3043:18 hackday2016-28 at Function.<anonymous> (/var/sites/hackday-2016-microsite/node_modules/lodash/index.js:3346:13) hackday2016-28 at self.symlinkModules (/var/sites/hackday-2016-microsite/node_modules/apostrophe/lib/modules/apostrophe-assets/index.js:398:9) hackday2016-28 at /var/sites/hackday-2016-microsite/node_modules/async/lib/async.js:718:13 hackday2016-28 at iterate (/var/sites/hackday-2016-microsite/node_modules/async/lib/async.js:262:13) hackday2016-28 at async.forEachOfSeries.async.eachOfSeries (/var/sites/hackday-2016-microsite/node_modules/async/lib/async.js:281:9) hackday2016-28 at _parallel (/var/sites/hackday-2016-microsite/node_modules/async/lib/async.js:717:9) hackday2016-28 at Object.async.series (/var/sites/hackday-2016-microsite/node_modules/async/lib/async.js:739:9) hackday2016-28 at Object.self.afterInit (/var/sites/hackday-2016-microsite/node_modules/apostrophe/lib/modules/apostrophe-assets/index.js:349:20)

+0

Hmm, eine klärende Frage? Verwenden Sie pm2, um mehrere Instanzen gleichzeitig zu starten und einen Lastenausgleich durchzuführen? Das ist nicht schlecht, aber es ist relevant für das, was ich als nächstes vorschlagen würde. –

+0

PM2 verwaltet mehrere Knotenanwendungen auf diesem einzelnen Server, aber nur eine Instanz der Apostroph-Anwendung. – jerikojones

+0

Dies könnte ein Berechtigungsproblem sein, wenn der Benutzer, der Apostroph ausführt, keine Berechtigungen hat, die er in public/modules ausführen kann. Es könnte auch sein, dass PM2 so konfiguriert ist, dass es mehr als einen Prozess für den Lastausgleich ausführt, was ich zuvor gefragt habe. Empfehlen Sie "node app apostrophe: generation" nach der Bereitstellung und vor dem Starten von Serverprozessen. Dies vermeidet eine Wettlaufsituation. –

Antwort

0

Ich bin ziemlich neu in ApostropheCMS zu und haben für einige Zeit um gespielt. Es sieht so aus, als ob Sie einen Symlink erstellt haben, um den Apostroph-Assets-Ordner mit einem öffentlichen Ordner zu verknüpfen. Ich verstehe nicht die Notwendigkeit, das zu tun. AposCMS nimmt automatisch bis alle Vermögenswerte in den

node_modules/Apostroph/lib/modules/Apostroph-Assets/public und

/var/sites/HackDay-2016-Microsite/public/modules/Apostroph-Assets Ordner .

Alles, was Sie tun müssen, ist sicher, dass Sie das Vermögen deklarieren, die Sie für Ihr Projekt hinzufügen unter /var/sites/hackday-2016-microsite/lib/modules/apostrophe-pages/index.js

hier ist der Code, den ich unter meiner Datei

module.exports = { 
     park: [{ 
      slug: '/search', 
      type: 'apostrophe-search', 
      label: 'Search', 
      published: true 
     }], 
     types: [{ 
       name: 'default', 
       label: 'Default' 
      }, 
      { 
       name: 'home', 
       label: 'Home' 
      }, 
      { 
       name: 'apostrophe-blog-page', 
       label: 'Blog' 
      } 
     ], 

    //construct is one of the nunjucks functions that gets called when app.js starts 
    construct: function(self, options) { 

     //push assets to for use in front end - e.g. lib/modules/apostrophe-pages/public/js/site.js 

     self.pushAsset('script', 'site', { scene: 'always' }); 
     self.pushAsset('script', 'jquery.easing', { scene: 'always' }); 
     self.pushAsset('script', 'jquery.scrollTo', { scene: 'always' }); 
     self.pushAsset('script', 'bootstrap', { scene: 'always' }); 
     self.pushAsset('script', 'jquery.easing', { scene: 'always' }); 
     self.pushAsset('script', 'jquery.matchHeight', { scene: 'always' }); 
     self.pushAsset('script', 'jquery.easy-autocomplete', { scene: 'always' }); 
    } 
}; 

Und für das Hinzufügen der CSS-Dateien haben, können Sie das unter

/var/sites/HackDay-2016-Microsite/public/Module tun /apostrophe-assets/public/css/site.less Mein Code in der Datei ist:

@import 'utilities/_index.less'; 
@import 'typography/_index.less'; 
@import 'layout/_index.less'; 
@import 'templates/_index.less'; 
@import 'components/_index.less'; 
@import 'global/_index.less'; 
@import 'components/easy-autocomplete.less'; 
@import 'components/easy-autocomplete.themes.less'; 
// this is the place were we are adding the css syles so that they get automatically compiled 
// and are minified and send out as one file 
@import 'custom/bootstrap.less'; 
@import 'custom/font-awesome.less'; 
@import 'custom/jquery.autocomplete.less'; 
@import 'custom/simple-sidebar.less'; 
@import 'custom/style.less'; 

.apos-slideshow-item 
{ 
    h4 
    { 
    display: none; 
    } 
} 
Verwandte Themen