Quick Ghost Installation with Express
You will most likely need to have a persistent database and its good to have the credentials ready beforehand. So, some standard commands to create a MySQL database:
create database `www.site.com`;
GRANT USAGE on `www.site.com`.* to `ghost`@`%` IDENTIFIED BY "mypassword";
GRANT ALL PRIVILEGES on `www.site.com`.* to `ghost`@`%`;
Test database connection:
mysql -h dbhost.com --port=3306 -u ghost --password=mypassword
Create Your Node Service
Create new repository and run the following:
npm init
npm install --save ghost express
Add NodeJS Server
Add something to it to invoke Ghost from server.js
file:
var ghost = require('ghost'),
express = require('express'),
parentApp = express();
var options = {
config: require( 'path' ).join(__dirname, 'config.js')
};
ghost( options ).then(function (ghostServer) {
parentApp.use(ghostServer.config.paths.subdir, ghostServer.rootApp);
ghostServer.start(parentApp);
});
parentApp.on('mount', function() {
console.log( 'mounted' );
})
Run Server
Ghost will install DB on first run. To start server add something to package.json
like this:
PORT=8080 NODE_ENV=production node server.js
And then run npm start
.
Adding A Theme
Still figuring this one out..