DEV Community

Lucas Schiavini
Lucas Schiavini

Posted on • Originally published at lucas-schiavini.com on

This Blog Finally Has a SearchBar and other Ramblings

This Blog Finally Has a SearchBar and other Ramblings

Damn it took Ghost long enough to provide this functionality, but this tale is more about filesystems, permissions than it is about Ghost.

I'm thankful to Ghost because of this new search thingy, it just took me a lot of time to actually run ghost update.

So let's go.

First things first. I decided on going the self deploy route.

So I created a neat little Droplet on Digital Ocean(about $6/month), added an email sender called Mailgun, and also decided on setting up my own Comment's system with Disqus.

So how was it?

Droplet

Getting a droplet to work on Digital Ocean took me a bit of trouble, specially navigating all the ins and outs of the other steps.

Everytime I'd make a change on the droplet, it would crash the site because I was very inexperienced using all the technologies required to actually run a website.

So I had trouble installing ghost using my url without https, so that took a couple of days before I figured out I had to run nginx with the correct url, since I was using SSL.

Mailgun

Then there was the email service with Mailgun. A headsup for you newbies out there. Digital Ocean blocks the default SMTP (Simple Mail Transfer Protocol) port to avoid people creating droplets and sending spam.

So I had to learn to navigate using Mailgun and set out on my nginx conf files another port.

There was also an issue with regards to the safety protocol, you should keep both your config.production.json file using the same security as your Mailgun account. It is recommended to keep the configuration using the most secure option.

If for some reason you still get 500 when trying to subscribe to your own website, check if the security on Mailgun matches your config.production.json file. To run a quick test, you can replace the following line "secure" : true with "secure": false and see if you get a return from the server.

"mail": {  
  "transport": "SMTP",  
  "options": {  
    "service": "Mailgun",  
    "host": "smtp.eu.mailgun.org",  
    "port": "587",  
    "secure": true,
    "auth": {  
      "user": "postmaster@your_domain.com",  
      "pass": "your_password"  
    }  
  }  
}

Enter fullscreen mode Exit fullscreen mode

If the test returns positive, then you should review your Mailgun config on their platform to get the "secure": true working again.

If you need more details to solve your particular Ghost + Mailgun problem I highly recommend this post here.

Comment System

The commenting system is pretty straightforward, it only took me a couple of tries before getting it right. So a word of advice, just follow Ghost's goddamn tutorials.

SearchBar

Searchbar took me long enough, but thanks to the amazing Ghost team the latest upgrade from Ghost has a built in search bar, and it works wonderfully (at least for people with under 10K posts).

Before anything, make sure you followed this tutorial by ghost on creating a user and directory for your website.

What took me the most amount of time on this was having the correct file and folder permissions for the ghost folder on my remote machine. Because I didn't follow the above tutorial 😁.

Here's how my folder permissions looks at the moment. To see yours hit ls -al on your terminal.


    -rw-rw-r-- 1 myUser 799 Jun 20 12:56 config.production.json
    drwxrwxr-x 11 ghost ghost 4096 Jun 20 03:15 content 
    lrwxrwxrwx 1 myUser 29 Jun 20 03:19 current -> /[redacted]/versions/5.2.3 
    drwxr-xr-x 3 myUser root 4096 Jun 20 03:20 system 
    drwxrwxr-x 3 myUser myUser 4096 Jun 20 03:15 versions

Enter fullscreen mode Exit fullscreen mode

They don't really look like that, but you get the idea, replace myUser with yours and the versions with the one's you have.

After running ghost update I ended up breaking my system, so I actually had to run ghost setup again, and at the end ghost update --force.

If you have more issues with this latest update, you can check if this solves your problem.

What's Next?

So I'm pretty excited to be blogging under my own name and actually learning a lot of things about hosting a website, that gives me more comfidence to navigate better around terms like nginx, cloud access, ssh, file and folder permissions.

I'm sure I'll learn even more amazing things and I'll do my best to share them all the way. In detail, unlike this rambling post lol.

Here's some next steps I'm interested in taking with this blog:

  • Google Analytics to learn more about SEO so I can handle better distribution.
  • Learning to publish higher quality content on a weekly basis.
  • Future article: Why Am I switching from Medium to Ghost?

😗 Enjoy my writing?

Forward to a friend and let them know where they can subscribe (hint: it’s here).

Anything else? Just say hello in the comments :).

Join an Exclusive Tech Friendly Community! Connect with like-minded people who are interested in tech, design, startups, and growing online — apply here.

Top comments (0)