Just a quick troubleshooting post for anyone using Hexo at the moment. If you go into your Hexo directory and do any Hexo command but recieve something similar to this:
As a relatively new user to Hexo I thought it only right to put my contrbution into the mix with a new plugin. I was inspired by Ivanov Yordan's Spotify tag plugin here.
I'm planning to add support for the Deezer HTML5 widget at a later date. The current version uses the iframe plugin and if you're interested in what the full widgets are cacapble of without using short tag plugins like this then checkout the Deezer widget page.
However, the advantages with this:
Integration with Hexo.
Easy to put a track in your post.
Less HTML cruft to deal with. Just a nice tidy tag.
Monit is a comparitively lightweight server monitor. I'd say its biggest sellig point is th ease ans sped of setup compared to the more enterprise-grade monnitoring services like Nagios, Icinga, Munnin, Zabbix, etc. Those are likely overkill unless in an enterprise situation.
Although I say comparitively lightweight you'll find as you dig into Monit it has a great depth of features. I came to use it recently because a problem I've recently run into with PHP-FPM dying for no apparent reason leaving me with a bad gateway timeout for nginx.
Monit to the rescue which will detect the dead service, restart it, log it and continue monitoring.
There's a few key things you'll want to change in here and a few that are optional but the config file is great with loads of explanation on each variabe you can change.
/etc/monit/monitrc
1 2 3 4 5 6 7 8 9 10
# Checks pocesses every 2 minutes (120 secs) for up state set daemon 120
# Use the localhost as the mailserver for sending alerts (change as appropriate) set mailserver localhost
# The email address to send alerts of services being dwn and restarted set alert your@email.com
Service monitoring is just one of the many core facets of Monit but its the one I'm focussing on in this blog. Even within basic service monitoring there's a lot extra options you can use but I'm keeping it simple for now. If you want to go into more detail such as file checking, space, network monitoring, etc check out the full manual at monit HQ.
Heres a very basic example for checking 3 services on yoru box:
/etc/monit/monitrc
1 2 3 4 5 6 7 8 9 10 11 12 13
############################################################################### ## Services ############################################################################### check process php5-fpm with pidfile /var/run/php5-fpm.pid start program = "/etc/init.d/php5-fpm start" stop program = "/etc/init.d/php5-fpm stop" check process nginx with pidfile /var/run/nginx.pid start program = "/etc/init.d/nginx start" stop program = "/etc/init.d/nginx stop" check process mysql with pidfile /var/run/mysqld/mysqld.pid start program = "/etc/init.d/mysql start" stop program = "/etc/init.d/mysql stop"
Afer doing any changes to the monitrc file you must run:
If receiving notifications and allowing Mnit to do its thing isn't enough then you can satisfy your inner voyeur by setting up the Monit httpd service. In the monitc file find the commented out section below:
/etc/monit/monitrc
1 2 3 4 5 6 7 8
# set httpd port 2812and # use address localhost # only accept connectionfrom localhost # allow localhost # allow localhost toconnectto the serverand # allow admin:monit # require user'admin'withpassword'monit' # allow @monit # allow users ofgroup'monit'toconnect (rw) # allow @users readonly # allow users ofgroup'users'toconnect readonly
The comments make it pretty self explanatory but to give you an idea I've included a simple example here:
/etc/monit/monitrc
1 2 3 4 5 6
set httpd port 2500 and # The port to allow access from use address 101.102.103.104 # Your servers IP address to bind to allow 89.90.91.92 # Your IP address allow username:password allow @monit allow @users readonly
With those settings you can visit http://101.102.103.104:2500 and after putting in the username and password above you will be presented with something like this:
This really only scractes the surface of what Monit can do as you may have noticed with the huge number of examples and sub-rules to checks in the monitrc file. I'd strongly recommend reading through the config file and checking out the manual too for some of Monits more powerful features.
If you find your MySQL server doesn't have a pid file (one of my servers didn't) then its as simple as adding it to your config file (in MySQL's case: /etc/mysql/my.cnf) like so:
1
pid-file = /var/run/mysqld/mysqld.pid
Then set the location of that pid file in your server monitoring configs as above.
This is pretty common especially if you're using the localhost. Its most likely they are going to spam or your server is simply picking them up due to a misconfigured Postfix install. Check your spam folder and try a different alert email on a different domain to narrow down the issue.
If like me you have had annoying 404's pop up during apt-get update and no amount of fiddling with the /etc/apt/source.list then it means your Ubuntu has reached End of Life. AKA: it's an OAP.
It needs a bus pass.
So to help it out simply change all instances of archive.ubuntu.com and security.ubuntu.com to old-releases . Like so:
/etc/apt/source.list
1 2 3 4 5 6 7 8 9 10 11 12 13
# From this: #deb http://archive.ubuntu.com/ubuntu quantal main #deb http://archive.ubuntu.com/ubuntu quantal-updates main #deb http://security.ubuntu.com/ubuntu quantal-security main #deb http://archive.ubuntu.com/ubuntu quantal universe #deb http://archive.ubuntu.com/ubuntu quantal-updates universe
# To this: deb http://old-releases.ubuntu.com/ubuntu quantal main deb http://old-releases.ubuntu.com/ubuntu quantal-updates main deb http://old-releases.ubuntu.com/ubuntu quantal-security main deb http://old-releases.ubuntu.com/ubuntu quantal universe deb http://old-releases.ubuntu.com/ubuntu quantal-updates universe
Then run sudo apt-get update to get the 'fresh' list of packages you're used to But its highly recommended you upgrade your distro to a more up-to-date version by following the steps at Ubuntu's community EOL page.
I had the idea for this post after accidentally stumbling across KrakenJS and realising its a Paypal open source project.
OK so its pretty obvious companies like Google, RedHat, Oracle, etc all contribute to the open source community and even stand on its shoulders to a great extent. But after finding Paypal's contributions I did some digging to find some lesser known coroporate open source contributors. And some cool projects popped up.
There was a time when I'd do a lot of coding using Google API's and open source libraries but over the years I'd become dissillusioned with them and as a result subconciously steered clear of any future corporately sponsored projects.
First it was a major banking organisation. Now we've the darling of media streaming services to the public and paraiah to US ISPs.
The Netflix open source contribution is no less impressive than PayPals - maybe even more so which is why its criminal its not more widely known. So here's a heads up on their:
What? That stuffy old wood and leather palace with its yays and nays? Yep - ineed they have such a prolific open source collection on Github (19 pages of repos!) It was hard to dig out the gems. Its worth checking them all and there's some that are criminally under-appreciated. Here's a few:
Magna Charter - Accessible, useful, beautiful barcharts from HTML tables.
Gov.UK Styleguides - Good to see the government have style guides in place.
Router - Just, erm. Wow. Check the readme - maybe you'll make more sense of it than me. Seems built on Go and handles routing for the main Gov.uk site.
One thing I have noticed is the UK Government does seem to like it's Ruby, esp. Ruby on Rails.
Check out the full 19 page monster list at AlphaGov.
The UK newspaper currently has a list of repos to rival the Government's but the potential for cool finds does seem a bit higher. Here's a few I managed to dig out:
Prout - Looks after your pull requests, tells you when they're live.