Installing Varnish 3 on CentOS 7

Oddly, there isn’t a lot of information on installing Varnish 3 on CentOS 7. There’s well-written instructions on the Varnish site for CentOS 5/6, but for 7, it seems like you’re stuck with Varnish 4 (from the epel-release repository), especially if you’ve searched around and found forum threads like this one.

I did some digging, though, and it turns out Varnish 3 actually does have packages for CentOS 7 – there just isn’t any documentation on how to install them. I played around a little and found something that worked, though. So far, I haven’t experienced any problems installing via the following:

yum install gcc
 rpm -i https://repo.varnish-cache.org/redhat/varnish-3.0/el7/x86_64/varnish/varnish-libs-3.0.6-1.el7.centos.x86_64.rpm
 rpm -i https://repo.varnish-cache.org/redhat/varnish-3.0/el7/x86_64/varnish/varnish-libs-devel-3.0.6-1.el7.centos.x86_64.rpm
 rpm -i https://repo.varnish-cache.org/redhat/varnish-3.0/el7/x86_64/varnish/varnish-3.0.6-1.el7.centos.x86_64.rpm

You do need to install the packages in this order, as Varnish depends on having gcc and the libraries in place.

You may need to adjust the Varnish config and point the pidfile to varnishd.pid instead of varnish.pid in /etc/rc.d/init.d/varnish. If you do, remember to run systemctl daemon-reload and kill all of the active varnish processes before starting the Varnish service again.

Excitement and anxiety

There’s been a lot of excitement in my life recently, especially when it comes to my upcoming wedding. Between favors, venue, food, music, the service itself, and everything else, it’s been a hectic few months of planning, but it’s been a lot of fun too. A lot of the prep’s done now, though, so getting a short bit of time to relax has been nice and hopefully will allow me to start working on some other projects that I’m looking forward to getting to grips with.

One other thing that I’m hoping to find some more time for is playing my violin again. I haven’t touched it in a while now, which I’m a little sad about – but there just hasn’t been time. At the very least, though, I have put together a nice list of things that I want to try when I can find the time – first on that list is the Mozart Concerto in A major, which I’ve listened to a lot recently. I’m really enamored of the third movement.

I know I don’t talk about music a lot on this blog, and I’m not honestly sure why I don’t – I absolutely love music in general, both listening to it and playing it. I think that might be something you see more here in the future, along with the tech stuff.

Anyway, the title of this post was “Excitement and anxiety”, and I swear there’s a good reason for that. I submitted Sarah’s I-129F back in September, and now that we’re coming up on November, I’ve watched the processing times at the relevant visa center (Texas) very closely to see when I’ll be receiving communication – and from the looks of it, it could be pretty soon. The reason this makes me a bit anxious is not because of the possibility of it being declined – something like 99.5% of applications get approved, so no worries there, really – but rather that there’s a lot of stuff that has to be done as soon as I get that notification. Letters to get written, documentation to get put together…yeah. Busy times. Definitely worth it at the end of the day, though.

Anyway, it’s going to be a very busy next couple of months. I’m looking forward to it, but at the same time I’m just going to have to make sure I’m not overwhelmed by all the stuff coming in. Either way, I’ll keep you all posted.

Zabbix web interface up on GitHub

Just a quick note that I’ve added the Zabbix frontend to a GitHub repository. There’s been a lot of interest in this frontend over the last week or so, and to that end I figured it’d be nice to have a place where we could all get together and work on improving it. Feel free to make pull requests and add issues, and we can have a way better Zabbix monitoring solution than what I originally released!

I’m really excited for a lot of the projects coming up for me in the near future. I’m currently starting to learn Laravel, and I’ll probably blog about that pretty soon. I haven’t forgotten about the other posts that I’ve promised, though!

Building a better Zabbix frontend

Recently, I ended up looking into Zabbix as a server monitoring solution. I was very impressed, but I felt that the reporting features left something to be desired; they were very robust, but it was hard to get all the information I wanted on one page.

 

Zabbix's bulky monitoring screens

Zabbix’s bulky monitoring screens

It was great for monitoring one server on a screen – giving me history of resource usage in pretty graphs and so on – but there really wasn’t a good way to get a view that would give me all of this information in a compact manner for all of the servers I wanted to monitor, at the same time. (Plus, some of the graphs are more than just a little misleading; look at that RAM usage graph! The bottom of the graph is 10 GB – what?!)

So, instead of struggling through Zabbix monitoring using a hilariously bulky system, I took a page out of Phyramid’s book. They used a Node.js server as their monitoring solution, with a prebuilt API client available on GitHub. I thought that was really freaking cool, but there were a few problems that prevented me from implementing an identical solution.

Challenges

The biggest issue, of course, was that I wasn’t running a Node server, meaning that I couldn’t pull in the zabbix.js library. That meant I had to figure out how to talk to the Zabbix server myself. This was interesting for me, because it meant I had to learn a few different things. First, I had to figure out the Zabbix API itself, which was interesting – the documentation is extensive, but not exactly easy to understand, and the examples are fairly limited. Second, I had to put together something in JavaScript to talk to the API – something of a challenge, because I had no idea where to start with writing my own jQuery plugin. Other problems would arise as the project moved forward, of course, but these were the biggest things that came up immediately.

Learning the API turned out to be a lot easier than I expected. Basically, the only call I needed to actually make to the server was the host.get call. What this one did, when properly filtered, was give me all of the information I needed for every server that I had set up monitoring for, including a full inventory with current usage statistics as well as any errors or alerts associated with the server.

Getting the call to go to the server was a problem, though. My initial implementation of a Zabbix API client was basically just a modification of the Node.js library to make it work in a traditional environment. In fact, it was mostly just plain old JavaScript with a touch of jQuery to do an AJAX call. Was it good? No. But it worked.

My API call returned a bunch of data – quite a bit to sort through, to be honest. It was formatted kind of strangely, too. There were some properties on the top level of the JSON object that it returned, and others that I needed were in an ‘items’ array. Some of these required cycling through multiple entries to get results – like figuring out disk usage when there were multiple hard drives on the system.

The full response that I received from the Zabbix server

The full response that I received from the Zabbix server. So much data to parse through!

I wrote more JavaScript to handle that, naturally. By this time, I’d written more JavaScript than I had for anything I’d ever written before. The page itself was 95% JavaScript (mostly jQuery, to be honest) – the other 5% being the empty div tags that I put the data in! I was able to eventually get everything put together, though, and get it parsed into something usable. All that was left was to get it displaying nicely on the screen.

Displaying the Data

Now that I had all of my Zabbix data, I faced the challenge of actually making it look nice. I settled on a Bootstrap grid layout with meters showing the CPU and RAM usage, with separate text for disk capacities and network stats. Kottenator’s jquery-circle-progress plugin worked really well for the meters – my only frustration was no radial gradients, but at the end of the day that’s really more of a CSS limitation than anything else. It certainly wouldn’t stop me from recommending this plugin.

I wanted to use the meters for disk usage, too, but that just wasn’t an option – some of our servers only had one drive, while others had as many as four. Doing meters wouldn’t have fit nearly as nicely into the grid layout I had planned.

I finished off the first take on the layout with an alert system – whenever something went wrong, like the web service or the server being unreachable, that server’s grid area would flash red, a tornado siren sound would go off, and the screen would display whatever error message that Zabbix threw for that server instead of displaying the meters.

The original frontend design.

The original frontend design.

The first iteration of the display worked fairly well. The data displayed, at least. Unfortunately, it just took up too much real estate per server. I was trying to display the data on a TV hooked up to a Raspberry Pi, and could only fit 8 servers on the screen. It just wasn’t good enough. I had to improve the layout and make it more of an “at-a-glance” display, so I decided to make four major visual changes.

Refinements

First, I condensed the “Disks” display into a Bootstrap collapsible accordion, meaning that I could just have a button instead of a long list. I went one step further, though – since disk usage is still pretty critical information, I decided it would be best to make sure that critically low disk space would still be visually represented. I used the panel-warning and panel-danger classes to change the color of the button whenever disk usage hit 75% or 90% respectively, and suddenly it became easy to spot potential issues from across the room.

Second, I condensed the text that was displayed for the operating system. Instead of displaying the raw string, I filtered the OS info that Zabbix gave me and output a human-readable string like “CentOS 6.5″ or “Win Server 2008 R2″. I also moved it right next to the name of the server, so everything would appear on one line.

I also swapped the Bootstrap theme to a sleeker, higher-contrast theme, which helped as well; it made it easier to see the board from across the room by providing a bigger difference between the white text and the black background.

Finally, I modified the jquery-circle-progress plugin so that all of the meters were no longer circles – instead, I made them semicircles. This was a bit of a challenge for me, but it both saved space and made the meters more intuitive.

The new Zabbix frontend with all of the changes.

The new Zabbix frontend with all of the changes.

Once I put all of these changes together, it turned out to be a very workable system. We’re now able to display up to 16 servers on the same screen, and it looks pretty beautiful to boot.

We’re currently in the process of getting this display put up on a large screen here in the office so that we can see immediately when a server or web service goes down. So far, it’s been working really well, and I’m excited to put it into production.

Interested in trying it out for yourself? I’ve made a version available for download; please credit me if you use it. If you’re sickened by the awful Zabbix library, check out jqZabbix on GitHub; it’s a much more solid Zabbix API client.

I’ve been doing a lot of cool tech stuff recently, so you’ll probably see more blogs in the same vein as this one soon; I’ve already got one planned for MyLeaf, a “what should I read next” application I built for a friend a month or two ago, as well as a preview of my next big project.

Quick update on installing Apache 2.4 and PHP 5.4 on CentOS 6.5

It seems like this has been a very popular post recently on my blog, looking at the site traffic. That’s really cool, but I want to point out that PHP 5.4 with FPM and Apache 2.4 are currently available on CentOS 7, which can be downloaded from the CentOS website.

Here are the directions for installing Apache 2.4 and PHP 5.4 with FPM on CentOS 7:

yum install httpd php php-fpm

…and that’s it.

If you need some sample virtual host or pool configs, you can still use the samples provided in my previous post.

Announcing: Politics!

Hey everybody! Just a short note here to announce the launch of a new blog. I’ve been thinking about this for a while, and finally decided to bite the bullet and go ahead with politics.andrewletson.com. It’s a sociopolitical blog with the goal of allowing me to write some thought-out posts with a lot of research – and I’m also looking for other writers! In the spirit of promoting an open dialogue on the site, I’ve put out a call for other interested parties to email me and start writing their own content. If I can get that part of it to take off, I’m planning to move it off of politics.andrewletson.com and onto a cooler domain.

Anyway, that’s all for now. More news about life – including peach pies, wedding plans, and shifts in after-work habits – soon!

Dota 2 #TI4 Final Bracket – Power Rank

As some of you may know, I’ve been following The International, Valve Software’s $10 million Dota 2 tournament, fairly closely this year. The final bracket will be played out at KeyArena in Seattle, Washington this coming weekend. There are 8 teams remaining in the tournament, and I’ve decided to take some time and put together a power ranking along with some justification for my picks.

#8 – Cloud9 HyperX

Cloud9 logo

Cloud9 logo

Cloud 9 is a relatively new organization to Dota 2, but they have a lot of scene veterans on their roster. Their ocean-spanning team went through various name changes – playing as Kaipi, RattleSnake.int, and Speed Gaming – before they were picked up by this North American organization. Since then, they’ve competed in many events, but haven’t won a major tournament since their win (as Speed Gaming) over DK at MLG Columbus in November 2013. They’ve already secured their largest prize pool to date by qualifying for the bracket, but they’re sure to be looking for more here. Unfortunately, they’ve got a monster bracket ahead of them. They’ll start in the lower bracket, where one loss means elimination, playing against Na’Vi EU, who stomped them in the group stages, and it only gets tougher from there. In addition, their games in the bubble bracket last week looked really shaky; they escaped LGD by a score of 2-1, only to be stopped cold by DK. It’s especially educational to look at the last game of the day, when DK forced a GG within 20 minutes – it’s a testament to how the team can suffer from tilt as well as an example of how C9’s drafting, while often unique, can sometimes make little to no sense whatsoever. They’ll need to make some serious adjustments to be successful this weekend, especially in these best-of-3’s where they’ve already looked vulnerable.

It’s not all bad news for C9, though. There are definitely some big positives for them – for starters, their players have very high individual skill. bone7 is one of the premier offlaners in the scene today, perhaps most notable for his unbelievably solid Batrider play, while SingSing routinely excels at heroes like Mirana (shoot arrow, hit arrow) and, in the group stages, Meepo (?!). EternalEnvy is, of course, a top-tier carry in the scene as well; I expect to see him performing well and finding farm regardless of how the games go.

#7 – LGD Gaming

LGDAh, the first of the five Chinese teams in the final bracket this year. Dota 2 has historically been dominated by Chinese teams; in 2011 and 2012, they looked untouchable. As foreign teams have come to China to compete and Chinese teams have started traveling abroad more, though, the rest of the world has caught up in the last couple of years, perhaps most notably at last year’s International, where two European teams finished on top of the bracket.

Of course, you wouldn’t have guessed that looking at the TI4 bracket, where no less than five of the eight competing teams hail from China. However, that’s not to say they’re going to sweep first through fifth place; LGD, in particular, has looked quite shaky so far this tournament. They haven’t really been putting up the kind of results that we’ve seen from the other Chinese teams in recent tournaments, and their group stage, where they lost to every other Final Bracket team except for C9, reflects that. They were able to scrape by into the bracket by beating Team Liquid in the bubble bracket, but they then promptly dropped a series to C9, making them the first team in the lower bracket this year.

LGD’s definitely a talented team, but they’ve really struggled in not just this tournament, but other recent Chinese tournaments. They’ve definitely had flashes of brilliance, including their win in the D2L Season 4 at the beginning of this year, but they really haven’t had that breakthrough moment yet. With the field at this year’s International as strong as it’s looking right now, they’ll probably have to keep waiting.

#6 – Natus Vincere EU

Na'Vi logo

Na’Vi logo

Na’Vi’s been a favorite in the Dota 2 scene since they captured the hearts of fans everywhere in June 2011, taking home the $1 million prize in the first iteration of The International over what was then a very dominant Chinese scene. Since then, they’ve been a team of offs and ons, sometimes demolishing their competition and making impressive tournament runs (they placed second at The International in both 2012 and 2013). While it seems like Na’Vi always seems to find their stride in the year’s premier tournaments, they’re going up against a very solid lineup of teams this year. In addition, they had a fairly weak group stage compared to other teams, finishing with a record of 8-7 in Group Stage 2 and then getting swept by Newbee in Group Stage 3. This loss means they will end up starting from the lower bracket, where one series loss will knock them out of the tournament.

However, not only does Na’Vi have a history of making deep runs in the top tournaments despite earlier results, we’ve seen them in situations just like this one before.  In 2012, they barely scraped into the main event bracket, finishing at the bottom of qualifying teams for their group. Despite the shaky group stage, they would go on to take second in the tournament. Their raw stats this year would seem to put them near the bottom of the list for taking the tournament, but the intangibles, as well as past performance on the big stage, give them a boost here.

5. Newbee

Newbee logo

Newbee logo

I had a really hard time with this pick, to be honest. Newbee’s been one of the big powerhouses of Chinese Dota 2 along with IG and DK in the recent months. Their all-star lineup, including former member of LGD and Newbee captain xiao8, 3 former players from TongFu’s 4th place team at The International 2013 (they were the highest-placing Chinese team last year), and former IG carry Hao, has been solid, most notably going undefeated in the Chinese MarsTV Dota 2 League, where they stomped every other Chinese team handily. Keep in mind, too, that those results are less than a month old.

On the other hand, Newbee has looked really inconsistent at The International 4. In Group Stage 2, they dropped games to really strange opponents (Fnatic, Titan, and Empire among them), and looked shaky in some of their wins. They did pick up a win against IG and LGD, but lost to the rest of the teams who qualified for the main event. However, during the bubble bracket, they looked absolutely invincible – they made Na’Vi look silly, and took a very convincing 2-1 series win from IG to qualify for the winners’ bracket. Even so, they’ve got a long road ahead of them; their first opponent is top-ranked Vici Gaming, and that will be a challenge, especially since Vici will be scrimming with DK to prepare for the main event. I wanted to rank Newbee higher, especially after seeing their performance earlier this week, but I just can’t after some more careful analysis.

#4 – Invictus Gaming

Invictus Gaming logo

Invictus Gaming logo

Oh, iG. As we get closer to the top of the list, I find myself having to write more and more about Chinese teams – and with good reason. They’ve shown themselves to be Dota 2 powerhouses both in and out of China in recent months. Invictus Gaming is no exception to this rule, having wrecked their way through ESL One less than a month ago, defeating Evil Geniuses in the finals there. They also won WPC 2014, a mostly-Chinese tournament, demolishing DK 4-1 in the finals.

This is also a good moment for me to talk a little bit about the shift in the Chinese metagame over the course of the last year. When most Dota 2 fans think “Chinese Dota”, they think a farm-heavy, lategame-oriented lineup that can overcome early disadvantages to be unstoppable in long games. To be fair to those fans, this does have some basis in fact – that style of low-risk Dota was how iG won The International 2012. However, interestingly, that perception has become increasingly inaccurate as time goes on, and iG is certainly part of that metagame shift. ChuaN has been an absolute terror in some games as a roaming Mirana, and iG hasn’t been afraid to draft push strats either (although if you want to talk about Chinese push strats, look no further than Newbee, who have had some of the fastest games on record at this International). Couple this aggressive play with Ferrari_430, one of the best (if not THE best) solo mid players in the world, and iG has found themselves in a prime spot to compete for the championship this year.

That’s not all, though. If you look back, Invictus Gaming has been a championship organization for years. In 2012, they took home the Aegis of the Immortal at The International 2, and since then they’ve had a remarkably stable roster with only one player change. They have quite a history of domination that can’t be denied, and that might just serve them well here.

So, given all of this praise, why don’t I rank them higher? To find the answer, we have to look to the bracket. After their (perhaps surprising) 2-1 loss to Newbee in the bubble bracket, they’ve found themselves in the lower bracket heading into KeyArena and will be facing off against LGD. While I don’t expect that to be much of a challenge for them given past results (they’re 13-4 against LGD in 2014), it’s the road they have to travel that worries me. While any given upper bracket team only has to play two best-of-3 series to make the grand finals, iG has to play four, and if they lose once they will be eliminated. With this year’s field as stacked as it is, iG has a lot to overcome if they want to take home the championship.

#3 – DK

DK logo

DK logo

The top three were perhaps the most difficult picks for me. All three teams remaining have really performed well in the group stage, which made it really tough to take a guess where they might end up. I ended up putting DK in rank 3, though.

DK’s been a formidable foe especially in the last month or so, taking three big Chinese tournament wins over Newbee in the finals. They didn’t look unbeatable in those tournaments, but they did look extraordinarily solid. They haven’t just dominated in China, though; in April, they came to Russia and won StarLadder Season 9. They then followed up by taking second to EG in the hard-fought finals of The Summit. Needless to say, they will definitely be a team to watch at KeyArena.

That said, though, they haven’t had the best tournament so far at TI4. In the group stages, they did place quite highly, but they had a very shaky Day 1. They were able to pull it together and claim a top seed for the bubble brackets, and they did end up looking absolutely unstoppable in their 2-0 win over Cloud 9, but that first day still has me wondering.

Speaking of that win over Cloud 9, I wanted to talk about that a little bit. By winning that series, DK did guarantee themselves a spot in the upper bracket, yes. However, once they won the first game, Cloud 9 picked what may have been the clowniest draft yet this tournament. It makes me wonder how those games would have gone had C9 stuck with something a little more normal. I don’t mean to take away from Game 1, because that game showed just how scary DK  can be in the lategame. Burning is perhaps the single best farmer in all of Dota 2, and his tactical mastery of the game is truly amazing.

Even with their rough Day 1, I might still have ranked them #1, if it weren’t for two really key points. First, VG didn’t just beat DK in the group stages – they stomped. The final score of that game was 10-1, and the GG came out within 20 minutes. To go past this tournament, though, DK also lost The Summit finals 3-2 to EG. It was a great series, very close, but they did lose, and that has to speak for something.

#2 – Evil Geniuses

EG logo

EG logo

Going into the final bracket at KeyArena, Evil Geniuses has to be feeling a lot of pressure. They’re the last North American team left in the tournament (unless you count the two Canadians on C9), which means that most of the fans at KeyArena will likely be cheering them on. That’s a lot of hope to put on one team – will the boys in blue be able to buckle down and carry the load?

Honestly, my best guess right now is yes, they certainly will. EG’s solid play and high level of individual skill (including Arteezy’s brilliant mid play and ppd’s unparalleled support on characters like Bane and Wraith King) have really shown through in this tournament so far, and they wound up with a direct seed into the upper bracket. EG has looked near-unstoppable so far, and I don’t see them slowing down. One thing that may hurt them a little bit is the practice with other teams before the main event; I really think DK has a stronger lategame than almost any other Chinese team left in the tournament, so EG needs to be cognizant of that and adjust from practice to the bracket when it comes time to do so.

One thing that really stands out for me is the emphasis that they put on Arteezy. Both North American teams did this to a certain extent: they turned their mid player into a 1 position carry, and using their hard carry as a supplemental carry. It’s worked well for them, too; Arteezy’s had some great games, and mason’s looked amazing, especially in his games as Faceless Void and Brewmaster so far this tournament.

In addition to their results so far at The International, EG’s been playing standout Dota at other tournaments as well. They beat both DK and VG at The Summit, and have also had other good Western results including a win at the D2L Western Challenge and a second-place finish at ESL One Frankfurt. Evil Geniuses is definitely one of the favorites to take home the championship this year.

#1 – Vici Gaming

Vici Gaming logo

Vici Gaming logo

Vici Gaming, like EG, has looked nearly flawless so far this tournament. This actually came as a bit of a surprise to me, as I had pegged DK, iG, and Newbee as the current Chinese powerhouses. Despite that, they stomped through the group stage, posting results like a 20 minute, 10-1 beatdown of DK on their way to the best record across all 16 teams. Their aggressive strategies and great team coordination throughout the entire group stage put them at the top of my list.

However, these results don’t necessarily mean the rest of the tournament will be sunshine and rainbows. VG has posted a lackluster 20-24 combined record against the rest of the upper bracket teams since the beginning of the year. This has been reflected in their recent tournament results – their last major tournament victory was back in December 2013, and since then they’ve been placing 3rd or lower. They’re going to have to maintain their focus and keep playing as well as they did in the group stages to close this one out.

Wrapping Up

There’s a really strong field at The International this year. Any of these eight teams definitely have a shot at taking home the close-to-$5 million first prize, but only one will actually pull it off. Regardless of who wins, though, we’ll be seeing a lot of great Dota 2 at KeyArena this weekend.