Posts Tagged the blog

    New link widget on the blog

    I spend a lot of time on the Internet. It is where I get all my entertainment and all my news. For a long time now I’ve had a “Reddit liked” widget out to the right-hand side of the blog here.

    Since Reddit has deteriorated much in quality I have stopped visiting Reddit so much. The list in the widget was automatically generated from my upvotes.

    I’ve been looking for a solution and I actually came up with a use-case for link-collection sites; namely collect links for display via RSS feeds. I chose to use Gnolia since I already had an account there.

    What this means is that whenever I find something cool on the internet, I will quickly add it with my gnolia bookmarklet, write up a little title and a description and the link will automagically appear in my little sidebar here on the blog for the rest of you to find and enjoy.

    The title is usually just the title of the linked page, but I try to write my own thoughts in the description of the link, so if you hold your mouse over the links you will see my comments about them.

    I hope you like it!

    Bytt design

    Kände för att göra något lite roligare.

    Heroku to the rescue

    Jag lade ut två applikationer (mina rails apps) till Heroku. Det är inte kritiskt att de ligger på min server, DHG applikationen får jag nog köra från min server under eventet. Men det är inga problem, den behöver ju inte ligga och ta plats där just nu bara.

    Server uppgradering

    Anledningen till att jag uppgraderade mjukvaran var att den var utdaterad och drog mycket minne. Jag ville lägga upp en site till och hoppades på att den nya mjukvaran skulle dra tillräckligt lite minne för att jag skulle kunna hosta en site till. Men tyvärr inte, swap usage var högt som fan och den var tvungen att skyffla runt cache minne som fan i swapen för att hålla takten uppe.

    Vad jag har gjort nu är att jag har uppgraderat min slice på slicehost.com till en 512mb slice. Nu har jag ~450mb minne used i snitt, varav 400mb är cache. Men det innebär att alla sidorna bör flyta riktigt fint nu. Så långt jag har lyckats testa fungerar det skitbra. Tyvärr kostar det 18 dollar extra i månaden, och jag är inte säker på att det är värt det, så får eventuellt ta ner någon site (någon okritisk site, bloggen och wikin kommer alltid ligga uppe) eller så får jag hitta en annan hosting lösning.

    Upgrade of server

    So it was time to upgrade my server software. I was using lighttpd with mongrel_clusters and php5. But with all the hype of passenger and how (actually) great it is, I decided to destroy my wonderful uptime in favor of easier deployment and less memory usage. I put up one more site so the server is kind of overloaded, i have virtually no free memory, if everything becomes to slow here i will probably shut one site down. So heres what i did (the whole thing took around 6 hours):

    I backed up my databases by exporting from phpmyadmin. I then tarballed my repos and my website root directory and backed them up. And i was off, reformating my wonderful uptime of:

    20:08:35 up 245 days, 3:37, 2 users, load average: 0.29, 0.35, 0.20

    Then began the commands:

    sudo apt-get update
    sudo apt-get install build-essential
    sudo apt-get install mysql-server
    sudo apt-get install php5-mysql
    sudo apt-get install apache2

    sudo apt-get install php5
    sudo apt-get install php5-gd
    sudo apt-get install libapache2-mod-php5
    sudo apt-get install tetex-base tetex-bin dvipng

    wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
    tar -xf rubygems-1.3.1.tgz
    cd rubygems-1.3.1
    sudo ruby setup.rb
    sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

    sudo gem install rails
    sudo gem install rails -v=2.1.1
    sudo gem install clickatell
    sudo gem install capistrano
    sudo gem install haml
    sudo apt-get install sqlite3
    sudo gem install passenger

    Now i ran into some trouble, first time. Apparently installing ruby wasnt enough. I got this:

    require': no such file to load -- mkmf

    I got the solution thanks to this guy

    So i had to install this too:

    sudo apt-get install ruby1.8-dev

    Trying this command again and it worked:

    sudo gem install passenger
    sudo gem install mysql

    Now this failed. With these error messages:

    Building native extensions. This could take a while...
    ERROR: Error installing mysql:
    ERROR: Failed to build gem native extension.

    /usr/bin/ruby1.8 extconf.rb install mysql
    checking for mysql_query() in -lmysqlclient… no
    checking for main() in -lm… yes
    checking for mysql_query() in -lmysqlclient… no
    checking for main() in -lz… no
    checking for mysql_query() in -lmysqlclient… no
    checking for main() in -lsocket… no
    checking for mysql_query() in -lmysqlclient… no
    checking for main() in -lnsl… yes
    checking for mysql_query() in -lmysqlclient… no
    *** extconf.rb failed ***

    So i had to run this, after some extensive googling and trying random things:

    sudo apt-get install libmysqlclient15-dev

    What i got from the internet originally was this: (and it was wrong, that package doesnt exist anymore, so i had to figure out to use 15 instead)

    sudo apt-get install libmysqlclient5-dev

    Then began the passenger installing

    sudo passenger-install-apache2-module
    sudo apt-get install apache2-prefork-dev

    And ruby enterprise for less memory usage:

    wget http://rubyforge.org/frs/download.php/48623/ruby-enterprise-1.8.6-20081215.tar.gz
    tar -xf ruby-enterprise-1.8.6-20081215.tar.gz
    cd ruby-enterprise-1.8.6-20081215
    sudo ./installer

    (following instructions and reinstalling everything)

    passenger-make-enterprisey

    Some excessive configuring of Apache with Vhosts and stuff, and this:

    LoadModule passenger_module /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/passenger-2.0.6/ext/apache2/mod_passenger.so
    PassengerRoot /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/passenger-2.0.6
    PassengerRuby /opt/ruby-enterprise-1.8.6-20081215/bin/rubysudo apt-get install git

    Then finally:

    sudo apt-get install subversion
    sudo apt-get install irb
    sudo apt-get install postfix
    sudo apt-get install screen irssi

    Yeah i know i could have bundled this up into one big install command but i wanted to see what failed along the way. Next time i have this so i can i can do the whole command in once.