NightlyArt Revival

gonna revive the Net, single-handedly

Tag: Ghost

third time from scratch. worth it

My fingers were drenched in sweat (and blood.. typing commands and codes is no joke). I continued Ghost deployment today to fix several maddening issues (thank god Ghost didn’t haunt my sleep last night). This time, rather than using Amazon Linux AMI, I switched to Ubuntu and I felt better working on OS that I know ins and outs.

Moving on. Last night I wrote that I couldn’t get Forever and Ghost running properly, and today I uncovered why. A pesky permission issue with sqlite. Linux and permission issue can’t part. Forever mingling. I didn’t notice this permission issue because I didn’t bother looking at Forever‘s log. So, how did I catch that?

PM2. I was looking for Forever‘s alternative, and bumped into a much elegant script kickstarter, that is PM2. I fell in love with its interface (but I hated it right the seconds after PM2 failed too). This is the interface of the simpleton Forever.

the simpleton forever

Wanna something saliva dripping? Look at this PM2.

pm2 elegant

Better? Yes, much better. By taking a deep ponder into this status check, it came to me that PM2 developer(s) might have thought that each script that runs under PM2’s influence prone to error, so that’s why path to err logs included right after you summon PM2. Legit argument? I think so.

On the first attempt waking up Ghost by using PM2, it resulted in vain. Checked the log, found the culprit.

readonly write attempt

For the next attempt, I gave another try with Forever by running sudo forever start index.js, and sorcery happened. Ghost was up and running. Stopped Forever, cleared PM2 logs and re-ran it again with sudo pm2 start index.js and.. no luck. Checked the log and tadaa, a recurring issue among PM2 users. I lodged a report already on GitHub.

pm 2 error report

Theming on Ghost

Installed a new theme on Ghost, but core didn’t register the theme pack. Restarting Ghost is the only option (seems like that, for now). I hope that the next version of Ghost could add watcher inside the theme folder. When the watcher awares of changes, something will run a check on it and register the changes to core if a new theme is spotted.

Closing Word

Done with installation issues, moving to roll my Ghost by attaching NightlyArt subdomain on it. FYI, I’m working on Amazon EC2 Asia Pacific Region, running on Ubuntu 12.04 LTS Precise Pangolin.

– Aizan Fahri, Malaysia.

Advertisements

first 7 hours with Ghost

For those who were stalking my Twitter, you must have realized that today I’ve been tweeting quite a lot technical jargons. Here’s why: I subscribed Amazon EC2 Free Tier to launch the Ghost. I spent first 1 hour and half installing and configuring both NodeJS and Ghost but I failed, and I blame my carelessness. It has been quite a long time I haven’t used Linux. Realizing that I executed few commands with noticeable slip-ups, then I took a 2-hour break (DotA 2 included) before working on it again.

I deleted the first instance (or you can say a VM, tho not really an accurate term), then got a new one running. I used the Amazon Linux AMI (I should have used Ubuntu AMI, because I still don’t know what is the base distro of Amazon Linux AMI. CentOS, probably). Launched the second instance, still on Amazon Linux AMI but this time with extra care with what I typed.

ghost installation

First, according to the guide, is to run the update.  That’s the common task when working with any Linux distribution (we don’t bother any Windows update, do we?). Then, grab the NodeJS and install it by compiling it yourself (should be easy, with make and make install command). Then, fetch the latest version of Ghost, edit the config file (use command cp config.example.js config.js, then use command nano config.js). I used the default Development configuration (the first section). Don’t bother editing the rest sections in the config file, otherwise you know what you are doing.

ghost configuration file

Yerp, I prefer nano over vim, because I’m not that pro.

I got everything pretty right for the second attempt, then I start the npm inside the Ghost folder by using sudo /usr/local/bin/npm start command. Caught no error.

ghost running environment on ec2

Just leave the terminal open. Don’t close it. Once you close it, Ghost will stop running.. I think. So, let’s go to the Ghost’s web interface. Dealing with the CLI was quite nauseating, so I was hoping the GUI would give a pleasant smell of satisfaction. It did, btw.

create user screen

I was greeted with this registration page (with few warning messages below the browser’s navbar, about mail app and… something I couldn’t remember.. haha). As for now with Ghost 0.3.2, only 1 user can be created on a single Ghost installation. Maybe next time we can have multiple users on a Ghost, and maybe multiple Ghost from a single user (like the WordPress Multisite feature).

Once the registration was done, I logged out and tried logging in. Purrfect!

sexy login screen

No need to verify email address (maybe the developers might wanna add email verification feature next time).

If we talk about improvements?

Sure we want improvements. Here are few ideas.

1) Friendlier installation process. I won’t compare it with WordPress or any other PHP-based CMS, because Ghost isn’t built to run on PHP/Apache stack. It is built on NodeJS, and this NodeJS isn’t widely adapted yet. However, I think I can see quite a bright future with NodeJS.

2) Still on installation process, I sincerely hope that installation of Ghost in aspect of editing config.js file would be more easier in the coming future. Not that editing the config.js is troublesome (it wasn’t troublesome at all), but at least make it inviting. I can’t complaint anything other than that, given the fact that to run Ghost, command line is required to run the npm. Hands down.

3) Ghost’s Markdown editor is great, seriously. I would like to emphasis on how fast the reaction time of the preview pane. Unlike any other online Markdown editors I have used before, there was no noticeable lag when I was using Ghost’s editor. But, here’s something I think I want to tweak, if I know how. The font size is ridiculously big. Is there any standard says Markdown must use big fonts? The same case on iA Writer (OS X). I hate big fonts.

4) Err, can you please fix the code to display page header properly? Thanks!

fix this namepage

Few misconception. My misconception, at least.

Just learnt about the existence of NodeJS few days ago. I’m quite adept with the basics of Apache stack (and Nginx stack, too). Just the basic configuration stuffs only. The concept of deployment on NodeJS is quite different. Here’s why:

Once Apache stack is installed, it listens to any incoming request (in this example, we assume a connection comes from port 80). Once a request hit Apache, even tho the web folder (/var/www) is empty, it returns a page on browser like Error 404, or anything similar. But on NodeJS stack (in my case, on Amazon Linux AMI), NodeJS is running all the time (is it? I think it is), but NodeJS doesn’t listen to any incoming request. Only application listens to incoming request.

I was dumbfounded when I set up NodeJS but when I navigated to the browser, I got “Firefox can’t establish a connection to the server at bla bla bla”. I thought I skipped a part or two, but when I rechecked, I did nothing wrong.

When I ran the command sudo /usr/local/bin/npm start inside the Ghost installation directory, then I was served correctly. Lesson learned; NodeJS just runs the app, it doesn’t listen to any request.

Can’t keep running forever. For now.

Having trouble with Forever (npm module) and Cron. I tried these 2 methods to keep my Ghost alive, but I failed without knowing what was wrong. Also I tried running it as service but this time I was sure I did it wrongly (again, I don’t know what Amazon Linux AMI really is, I should’ve used Ubuntu AMI instead). But as long as my second attempt of running a usable Ghost came to fruition, I can sleep soundly tonight although the site went down the moment I logged out from the server.

Verdicts?

Rating comes later, testing first. I wanna be enlisted in the developers’ team (a beta tester, maybe.. or working with Wiki. Sounds great).

Good night, sleep tight.

– Aizan Fahri, Malaysia.

p/s: Oh yea. I encountered permission error with npm install -g forever, and when I used sudo npm install -g forever, I was greeted with a freaking annoying npm: command not found. All you need is to fix permission error. No need to use sudo npm.