RarestBlog

Install CoreOS on Hetzner

1) Boot into Rescue

2) If you have previously installed RAID, disable it:

mdadm -S /dev/md0
mdadm -S /dev/md1
mdadm -S /dev/md2

3) Clean up partition table:

dd if=/dev/zero of=/dev/sda bs=100M count=1

4) Install CoreOS

cd /tmp

cat >cloud-config.yaml << 'EOF'
#cloud-config

hostname: coreos1

ssh_authorized_keys:
  - ssh-rsa AAAAB3....
EOF

wget https://raw.githubusercontent.com/coreos/init/master/bin/coreos-install
chmod +x coreos-install
./coreos-install -d /dev/sda -C stable -c cloud-config.yaml

5) Reboot

6) You can now do ssh core@your-server.com

FollowUpThen

Wanted to recommend a great software that I use daily.

Create an email and send it to

tomorrow@fut.io

This e-mail will return to you tomorrow, at which point you would be able to defer it for any amount of time or be done with it.

The service is called FollowUpThen and it’s awesome!

Some things to try: tomorrow8am@fut.io, nextmonday@fut.io, every3days@fut.io, 5d@fut.io (in 5 days).

Try it! - http://www.followupthen.com/

Gerar PHP

Today I started experimenting with something - PHP-based configuration management (think Chef/Puppet).

Basically I though something like this should be possible:

Package::named("php5-cli mysql-server git imagemagick")
    ->shouldBeInstalled();

Service::named('apache2')
    ->shouldBeInstalled()
    ->shouldBeRunning()
    ->shouldBeRunningAtReboots();


File::named('/var/www/index.html')->write("Bender is great!");

Http::request('http://localhost/')
    ->onSuccess(function($request, $response) {
        Console::log('My new code is "' . $response->getBody() . '"');
    })
    ->run();

User::named('root')
    ->shouldHaveSshKey()
    ->mailPublicKeyOnce('user@super-server.com');

User::named('alex')
    ->shouldBePresent()
    ->haveSshKeyFrom('files/alex.ssh')
    ->shouldBeInGroup('sudo')
    ->shouldHaveNoPasswordSudoFor('/usr/sbin/service')
    ->shouldHaveSudoFor('/bin/vi');

I thought that since PHP has PHPStorm, which has a great auto-completion - it should be much easier to write PHP scripts than Puppet/Chef scripts. Also you have a complete language to help you refactor the code.

And that’s what I actually implemented. It’s still a work in progress, but check it out if you want to.

Git repository

Interesting eBook: Hype-free Principles for Software Developers by Jason Gorman

  1. Software Should Have Testable Goals
  2. Close Customer Involvement Is Key
  3. Software Development Is A Learning Process
  4. Do The Important Stuff First
  5. Communicating Is The Principal Activity
  6. Prevention Is (Usually) Cheaper Than Cure
  7. Software That Can’t Be Put To Use Has No Value
  8. Interfaces Are For Communicating
  9. Automate The Donkey Work 10.Grow Complex Software Using The Simplest Parts 11.To Learn, We Must Be Open To Change

Check it out

Simplest Way to Have Virtual Machines on Production: OpenVZ

Installing

Start with CentOS 6 as root:

wget -P /etc/yum.repos.d/ http://ftp.openvz.org/openvz.repo
rpm --import http://ftp.openvz.org/RPM-GPG-Key-OpenVZ
yum install vzkernel

echo "
# On Hardware Node we generally need
# packet forwarding enabled and proxy arp disabled
net.ipv4.ip_forward = 1
net.ipv6.conf.default.forwarding = 1
net.ipv6.conf.all.forwarding = 1
net.ipv4.conf.default.proxy_arp = 0

# Enables source route verification
net.ipv4.conf.all.rp_filter = 1

# Enables the magic-sysrq key
kernel.sysrq = 1

# We do not want all our interfaces to send redirects
net.ipv4.conf.default.send_redirects = 1
net.ipv4.conf.all.send_redirects = 0
" >> /etc/sysctl.conf

echo "SELINUX=disabled" > /etc/sysconfig/selinux

yum install vzctl vzquota ploop

reboot

Download template

cd /vz/template/cache/ && wget http://download.openvz.org/template/precreated/ubuntu-12.04-x86_64.tar.gz

Laravel Testing

Reading Laravel Testing Decoded.

Some interesting points:

  • “Don’t force yourself to test-first every controller, model, and view (my ratio is typically 20% test-first, 80% test-after). ” - David Heinemeier Hansson

  • There is a module called guard-phpunit. guard is this awesome thing will restart your tests once you change your code.

Open Sourcing Octopress Editor

I’ve been thinking lately about releasing my Octopress Editor into a wild open-source world. But I’m not really sure anybody needs it.

It’s not really polished and can only probably publish to local server. But, hey.. if you are using Octopress - you probably are ready to help me out with polishing the code?

Written in Rails.

Do you need it?

SMS Reminders to Look for Business Ideas

I’ve been thinking a lot about opening a side-business lately, but none of the ideas seem particularly interesting lately. So I decided that I need to create an SMS service to be on a constant lookout for new business opportunities with ideas like:

  • In last 10 minutes you were doing something. Can you take it and make into a business?
  • The thing I just saw is for consumers. Can I produce such a thing?

If only I had enough willpower to follow thorough with that.

Simple Upstart Template

vi /etc/init/something.conf

#!upstart

description "Something"

start on runlevel [2345]
stop on runlevel [!2345]

console output

env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

exec something
respawn