Updates, Hosting, and Downtime
I haven’t updated the site in quite a while. The uploader has gotten some love, the API has been refactored, but the site was getting a little stale. So about a month ago I started looking into what I could spruce up. One of the big things users have mentioned is SSL support, since you can log into the site with username/password. Sadly that wasn’t an option on the free tier of Openshift, who’s hosted the API and site since Nodejitsu got bought (still salty). So I started looking around for alternatives.
Searching for a Host
It’s not too hard to find hosting for Node apps (Digital Ocean, Linode, AWS, Google Cloud, Modulus.io, Heroku, Rackspace, etc…), but finding a free host that offers SSL for custom domains is not easy. So even with the awesome free certs from Let’s Encrypt, I was out of luck. So then I looked into exactly what I was doing on the backend. I’ll give you a hint: virtually nothing.
That is all the server was doing (minus some boilerplate and error handling). Return index.html, and redirect some routes for Angular to handle. Looking at that, I started wondering if I could do without a backend at all, and just serve some static files. This led me to Github Pages, which is beautifully simple, but wasn’t able to handle redirects. Lame. So I kept looking, and stumbled onto Firebase hosting. I’d heard of Firebase when they were just a super-hipster real-time app platform, but didn’t realize Google had pushed them into the hosting realm. And I’m so glad they did.
Firebase Is Awesome
Once I’d taken out the server code and moved a couple directories around, I was ready to switch. I grabbed their CLI via npm install -g firebase-tools, hooked up to my freshly made account, and away I went. It was way easier than I expected, but I guess it is a service from Google for single-page apps, so it better work pretty well, right? From there there wasn’t much else to do, so I made a few quick updates and pointed next.modwat.ch to my new firebase site.
I’ll be writing a separate post to describe all the new features on the site, but I’ll go over them quickly here. I totally revamped search on both the site and API. I don’t even want to talk about how I was doing it before, because it’s horrifying. Let’s just say it was… inefficient. Anyway, now it limits the result sets, queries are more efficient on the back, and the searches are now part of the userlist page, so there isn’t a clunky modal UI to deal with anymore. I also reworked the menu to be a little less awful, and fixed the header size on mobile. Finally I threw in a service worker to cache everything but the API calls, so the site is nice and speedy.
Cue Downtime
Once I got the UI changes nailed down and stable, I went to point modwat.ch to the new site. And then my domain threw up. I’d renewed it a few days earlier, but it went ahead and gave me a “This domain needs to be renewed” page anyway. So I went and cried to hover.com about it, and they let me know that .ch domains are renewed in some weird way that meant my domain wouldn’t work for 3 days. That was nice. So I posted the ugly Openshift URL to reddit and nexusmods and hoped it would just work again.
Cue Duct Tape
Finally the domain came back up, so I pointed modwat.ch to my firebase site. No dice. At this point I just wanted something to work, so I switched to A records instead of CNAME, and pressed the button. After a few minutes I was back up, and modwat.ch was pointing to a brand new fancy site. Not the best deployment, just several days of downtime and a very botched eventual deployment, but for a side project by a junior dev, I guess it’s not the worst thing that’s ever happened, right?
So that should cover it. Like I said I’ll be putting up a separate, less rambly-technical post about the new features and how to use them. Until then check out modwat.ch and click things until it breaks!