Monday, July 20, 2015

Yaws - Install and Configure route

I have been looking to build a wiki based on things in my head. I then figured it would be fun to write some Erlang, and I'm a fan of Yaws - Yet Another Web Server - so I decided to install yaws, designate a subdomain to it, and have apache proxy requests to port 8080, where Yaws is listening.

Step One - Install Yaws

sudo apt-get install yaws

well that was easy.

Then you can check the status of the yaws service

To view the default yaws page, navigate to the url: (localhost:8080 if on the same machine - I'm installing on a raspberry pi over ssh, so I'm useing the static IP) as seen in the status, you can also navigate to https://<URL>:8443 and get the same

Step Two - Access Yaws by Domain Name

I'm running this on a chromebook and haven't yet found a way to change how chrome resolves hostnames. To get around this, I use dnsmasq on the pi to allow computers on my network to access the local site. I put 

in /etc/hosts and reload with sudo service dnsmasq force-reload to put the new domain into effect. This allows me to access the page through (or 8443 if using https). Before going any further, I've added the apache configurations from this post to a github repository

Step Three - Eliminate the Port

In order to eliminate the need for the port, I'd like to use apache to proxy and send any traffic destined for over port 80 (the default http port) to port 8080. I do this by setting up a virtual host in my apache configuration.

I found this article very helpful when configuring virtual hosts on my server. It explains that apache looks for and reads the configuration in conf.d/virtual.conf, as well as explaining how apache treats the sites-available and sites-enabled directories. It is clear enough from their names, but I like to know why programs do certain things. Instead of being explicitly configured in a file, anything in these directories is loaded on startup by apache.

The configurations for each <VirtualHost> is saved in sites-available, and a link is placed in sites-enabled using the a2ensite command (a2dissite will clean up the link).

And the debugging begins... 

At first, I had NameVirtualHost * defined in my virtual.conf file. This caused apache to complain about mixing http and https ports. I got around this by adding a second line, and changing the * in the two lines to *:80 and *:443.

I fumbled around for a while trying to reload via: service apache2 and contstantly getting the message:
[FAILED] Reloading web server config: apache2 failed! 

This stack exchange post addressed the issue, or rather pointed me to the command: `apachectl configtest` which told me that I had a syntax error in line 5 of my virtual host configuration - ProxyPass needed a source path, and I reloaded after inserting a '/ ' between ProxyPass and my forwarded URL. This enabled me to reload apache without issue.

One more test showed displaying the main apache page, but with one last command:
a2dissite default 

disabled the default virtual host, leaving my custom virtualhost for the yaws app to handle the request.

Thursday, July 16, 2015

Toshiba Chromebook2 Pros and Cons

My previous laptop, a 5 year old dinosaur from college, finally started to go up. The wifi has been unstable for a while - randomly failing to come online after closing and reopening the lid - and then there was the heat and battery life, or lack thereof.

I would have stuck with linux if I could have beaten the $300 price point. I won't do another windows laptop; I'm stuck with windows for work, and while I have a great laptop - or 2 - I have a new gripe about the OS almost daily. For the price, and my basic needs of web access and connecting to my other computers, 

What I like:

  • easy setup for alternate keyboards
    I'm 'that guy' who decides it's a good idea to forgo qwerty for dvorak. No one understands it, and it confuses everyone who borrows my computer which can be amusing, especially if they aren't expecting it. Fortunately, there is an input selector in the system tray, with the least default options I've seen on a system: US, US International, US Extended, US Dvorak, and US Colemak.
  • new laptop for $300
  • Different keyboard
    The lack of a caps lock button was a nice surprise. I've never really thought about 
  • SSH is available - although through a chrome extension rather than crosh

What I'm not enjoying:

  • Small screen causes small text9
  • Screen is different (retina?) and contrast isn't high enough
  • Developer mode not as I hoped
  • ssh removed from crosh
  • keypad is garbage
    It would have been nice if Google would have tried some cool tricks with the keypad to keep up with Apple. The 3-finger swipe down (backwards from the 'up swipe' mentioned in the help) is a far cry from 3-finger drag/resize on my wife's macbook
  • Not a tablet, not a full OS
    Chromebook feels like a strange cross between android and a real OS


At the end of the day, I think I will like this thing called chromebook. After finding a suitable cloud replacement for my coding plus ssh and remote desktop for everything else, I won't be wanting anything more from a laptop than a browser with long battery life and an actual keyboard.

And as an effort to generate some content that makes it past the draft stage, here goes the post. I will do my best to come back to fill in the rest of my thoughts on these points, as well as include anything else I find after more than a couple hours on the device.