# Free Hosted Ghost



## raindog308 (Feb 11, 2014)

My employer sent me to the hinterlands of Wisconsin for a week - it's -17F (-27C) here, so I've had plenty of time to work on take-over-the-world schemes in my hotel room.

Following on to the recreating Gatsby.im thread, I read up a bit on Ghost.  What would it take to do something similar to Gatsby/wordpress.org but for Ghost?

Well...the problem I see with it is that Ghost requires a separate node.js instance per blog.  Ghost is a node.js application and doesn't sit unused like a php app.  You could put a million php apps on a server and not consume and cpu/memory.  But each node.js app requires an instance of node.js running.

So each Ghost instance runs on its own port, which isn't the problem - you can put nginx in front of it to proxy and map domains/subdomains.

But fundamentally, I think each Ghost blog would require a separate running process, 24x7.  If someone sets up a blog and never uses it, you essentially will have a process idling for that user forever.  You could say "you must login once every X weeks" or something but the fundamental problem remains.

I fired up Ghost on a CentOS box:



$ ps p 29334 o pid,rss,vsz,comm
  PID   RSS    VSZ COMMAND
29334 69624 987716 node

Figuring out how much memory a process uses is surprisingly tricky in Linux, but that suggests ~60-70MB per Ghost instance.  And that's just sitting there idling.

Let's say it's _half_ that - 30MB.  If you had 1000 blogs on a box, you'd need nearly 32GB just so they could sit there idling, waiting for visitors who may never come.  20 more people sign up and you need another 600MB.

Plus some memory for MySQL, if you use that (by default, Ghost uses sqlite).  And CPU for nginx and all those Ghost instances.

I'm going to think some more...maybe there's a way to have the Ghost instance "hibernate" so that it shuts down if not accessed with X hours, and then is autostarted when a visitor comes.  If you blog was hibernated, the first page load would take a little longer.

Not sure how nginx might do that - it's going to sit waiting on a port, so you'd probably have to have some kind of layer between nginx and Ghost, keeping state.  If a blog is not hibernated, just let them nginx get data from Ghost.  If the blog is hibernated, start it and then connect nginx to it.  Meh...


----------



## peterw (Feb 11, 2014)

Node.js is not supporting more than one app and ghost is not supporting more than one blog. Node.js use a lot of ram per connection. You found the reason why nobody is offering ghost hosting.


----------



## tuguhost (Feb 11, 2014)

i tried to install 10 ghost in one our server that use litespeed, there are cpanel,csf firefawall, csf expolorer, clamav and softaculous.

i fill one this ghost with 50 post, and perform visitor simulation. I use 50 opera tab from 5 pc and each tab auto refresh each 5 second.

i check memory consuption and it ate almost 1 GB RAM


----------



## splitice (Feb 11, 2014)

node.js should always be behind a reverse proxy such as nginx / lighttpd etc. Think of it like mod_php in terms of memory wastage.

You would most likely need to make a fork of Ghost in order to scale reasonably with it. Think of starting with a modification that changes the source file path based on the domain given and work from there.


----------



## tchen (Feb 11, 2014)

Sounds like you want to basically build your own ghost specific PaaS.  





raindog308 said:


> I'm going to think some more...maybe there's a way to have the Ghost instance "hibernate" so that it shuts down if not accessed with X hours, and then is autostarted when a visitor comes.  If you blog was hibernated, the first page load would take a little longer.
> 
> 
> 
> Not sure how nginx might do that - it's going to sit waiting on a port, so you'd probably have to have some kind of layer between nginx and Ghost, keeping state.  If a blog is not hibernated, just let them nginx get data from Ghost.  If the blog is hibernated, start it and then connect nginx to it.  Meh...



I'd suggest build your own performant proxy (eg. https://github.com/nodejitsu/node-http-proxy) and have it do the state and request queue management.  That'll give you the power to block on that initial wakeup request.  Bind it to redis or something fast.  You can still stick nginx/haproxy in front if it makes you feel more comfortable.

edit: added actual suggestion.


----------



## Dylan (Feb 11, 2014)

raindog308 said:


> Figuring out how much memory a process uses is surprisingly tricky in Linux


smem


----------



## raindog308 (Feb 11, 2014)

splitice said:


> You would most likely need to make a fork of Ghost in order to scale reasonably with it. Think of starting with a modification that changes the source file path based on the domain given and work from there.


I think this would likely be the only way - to scale within one node.js instance.

Of course, this means keeping modifications in sync with upstream (or convincing them to adopt...my sense is that they want to get to 1.0 without another new idea).  Also plugin compatibility.

It also changes this from a sysadmin/script sort of project to a pretty hardcore javascript coding project  :blink:


----------



## eva2000 (Feb 11, 2014)

yup consumes a bit of memory indeed

my Ghost blog at http://ghost.centminmod.com

smem


smem -ktp | egrep 'pm2|node'
27667 root egrep pm2|node 0 184.0K 205.0K 616.0K 
6346 root pm2: Satan Daemonizer 9.1M 2.4M 3.0M 4.2M 
11840 root node /home/nginx/domains/gh 6.3M 63.3M 63.9M 65.1M 

memory stats = 36 days uptime and 65MB via pm2 https://github.com/Unitech/pm2


pm2 list
PM2 Process listing
┌──────────┬────┬──────┬───────┬────────┬───────────┬────────┬───────────┬────────────────────────────────┐
│ App Name │ id │ mode │ PID │ status │ Restarted │ Uptime │ memory │ err logs │
├──────────┼────┼──────┼───────┼────────┼───────────┼────────┼───────────┼────────────────────────────────┤
│ ghost1 │ 0 │ fork │ 11840 │ online │ 0 │ 36d │ 65.160 MB │ /root/.pm2/logs/ghost1-err.log │
└──────────┴────┴──────┴───────┴────────┴───────────┴────────┴───────────┴────────────────────────────────┘
PM2 PM2 log file path : /root/.pm2/pm2.log (type pm2 logs to see log streaming)


Definitely, want Nginx in front + proxy_cache


----------



## raindog308 (Feb 11, 2014)

Such a strange project, Ghost is...

"We want to be just blogging...because blogs are important".  But they're building on a platform that requires dedicated, unsharable resources which means it'll be limited to (a) technophiles who run their own VPSes, or (b) richer people who can afford managed VPS hosting.  (Or I suppose © will pay ghost.org to host it for them, which sounds more like a commercial enterprise/startup than a crowdfunded world-improver).  

Meanwhile, the platform they say has gotten away from its roots and is no longer focused on blogging can be run anywhere much more cheaply, appealing to...well, bloggers.


----------



## WelltodoInformalCattle (Feb 11, 2014)

This piques my interest, are you still looking at implementing your idea or are you getting second thoughts?


----------



## tortau (Feb 11, 2014)

I was one of their KS backers and eventually, I also stopped using it. I don't use nodeJS all that much and find the whole separate process per application quite a pain. Had it running but it kept breaking (between updates) and occasionally, it would just take like 30 seconds to load and respond with content. I think it was my setup - no idea why because I was just using the guides. I'll even admit that I'm not terribly familiar with supporting nodeJS appliacation so eventually I abandoned the platform.

Honestly, the platform has failed to impress me so far, which is kinda sad because I really don't like WP as a blogging platform.


----------



## bauhaus (Feb 11, 2014)

Yeah, I unplugged that thing after like a 2 hour of testing. I consider myself a half decent linux user, but it is quite cumbersome to install and resource hungry. Ghost as a simple blogging platform can be nice but it needs to be rethinked at the back end. Right now is more popular just because people is tired of the old blog alternatives.

EDIT: Just because.


----------



## raindog308 (Feb 11, 2014)

WelltodoInformalCattle said:


> This piques my interest, are you still looking at implementing your idea or are you getting second thoughts?


 Probably more second thoughts at this point.

Free Hosted Jekyll?

Free Hosted GetSimple?


----------



## juan (Feb 11, 2014)

AnchorCMS might be a good alternative too for lightweight blogging.


----------



## wlanboy (Feb 12, 2014)

raindog308 said:


> Probably more second thoughts at this point.
> 
> Free Hosted Jekyll?


*sniff* you are suggesting a Ruby based project?

If you want to run a JekyII based service I would have (want) to write a WEB frontend for it.

Jekyll is a well written software (stack) and is using markdown.

But it is based on rake (terminal commands) and does not have a frontend.

But it is secure because it is generating plain js/css/html.

It might work to build a small Ruby/Phyton/Php web frontend to create markdown files and the templates.

The call of JekyII is simple and does not need any parameters.

So it can be done by a cron or by an action called by a button.


----------



## WelltodoInformalCattle (Feb 12, 2014)

raindog308 said:


> Probably more second thoughts at this point.
> 
> Free Hosted Jekyll?
> 
> Free Hosted GetSimple?


This makes me sad, to think I was excited coming across this thread


----------



## howardsl2 (Feb 12, 2014)

Buster is a static site generator for Ghost. You will find it by searching on GitHub. Once generated as static files it can be served directly via Nginx.


----------



## sv01 (Feb 12, 2014)

free hosted html/js/css (manage using git). so anyone can create website using their favorite web generator.


----------



## splitice (Feb 12, 2014)

Static generation would definitely be an interesting solution. Either that or just heavy caching (its less heavy than Wordpress  )


----------



## tortau (Feb 12, 2014)

Maybe I should plug for sculpin.io since people seem to be throwing out recommendations 

It's a PHP-based static site generator.


----------



## sv01 (Feb 12, 2014)

tortau said:


> Maybe I should plug for sculpin.io since people seem to be throwing out recommendations
> 
> It's a PHP-based static site generator.


I've testing sculpin for a week  <3 because they built using PHP


----------



## raindog308 (Feb 13, 2014)

sv01 said:


> free hosted html/js/css (manage using git). so anyone can create website using their favorite web generator.


I've actually thought of doing free panel-less hosting. Kind of a "smart guys' hosting". Maybe a small custom panel for dns & mysql db create, but otherwise just ftp/jailed ssh.


But there are so many free hosts out there already...


Speaking of smart guy hosting : NoSupportLinuxHosting.com is an interesting take.


----------



## howardsl2 (Feb 27, 2014)

Based on information from various sites, I created a Nginx configuration for Ghost which includes caching, gzip compression as well as direct static files serving by Nginx. These should help to improve performance and reduce resource usage.

You can find the configuration at my Ghost 0.4.1 install tutorial.


----------

