As a SW/Ops/DB Engineer

riywo’s technology memo

Terraform Module for Mesos + Ceph Cluster and Packer Template


I’ve just tried to use Terraform and Packer to create a Mesos + Ceph cluster in AWS. Yes, I know Mesosphere applications supporting deployment of Mesos cluster in some IaaS (see Getting Started), but I’d like to understand what’s going on there. So, I did it by Terraform and Packer. I’m gonna explain a little bit more about this.

Through this work, I’ve learned a lot of things. I will write something below too.

Chown With User’s Default Group

You may have used chown command to change the ownership of files or directories like below.

$ ls -l file
-rw-r--r--  1 root root  675 2013-09-23 23:23 file
$ sudo chown foo file
$ ls -l file
-rw-r--r--  1 foo root  675 2013-09-23 23:23 file

But this is not good because group of file is still root. Most case, you want to set it the default(login) group of the user.

$ id foo
uid=1010(foo) gid=1009(foo) groups=1009(foo)

In this case, you want to set it foo. For that, I used a command below.

$ chown foo:foo file
$ ls -l file
-rw-r--r--  1 foo foo  675 2013-09-23 23:23 file

Not bad. But you have to know the default group of the user. It is not always same as the user name.

Mesos Tutorial 2

In the pervious post, I tried “cpu = 0.1” for Mesos tasks. But it didn’t work precisely. If you have only one cpu on each slave server, you can run only one task on each slave at the same time even if you specify “cpu = 0.1” for the tasks.

It only happens on the slave which has just one cpu. If a slave has more than one cpus, it can run tasks more than the number of cpus. I use m1.small and it has only one cpu, unfortunately…

So, I changed Mesosphere’s runner script a little to configure --resources flag of mesos-slave.

@@ -22,6 +22,7 @@
   [[ ! ${ULIMIT:-} ]] || ulimit $ULIMIT
   [[ ! ${MASTER:-} ]] || args+=( --master="$MASTER" )
   [[ ! ${LOGS:-} ]]   || args+=( --log_dir="$LOGS" )
+  [[ ! ${RESOURCES:-} ]] || args+=( --resources="$RESOURCES" )
   logged /usr/local/sbin/mesos-slave "${args[@]}"

And set more cpus.

$ cat /etc/default/mesos-slave
MASTER=`cat /etc/mesos/zk`

Now you can see 2 cpus in your Mesos cluster, then you can run more than 2 tasks on it at the same time.

Private PaaS


  • 基本コンセプト
    • Herokuライクなデプロイ
    • 壊れにくい
    • 開発が運用コスト管理
  • 技術トピック
    • 12factor
    • Docker
    • Mesos

My Github Trends 2013-09-05


Typed variable for ruby!

Sirupsen/posix-mqueue & Sirupsen/localjob

Local host message queue using POSIX mqueue and delayed job. You don’t have to run any daemon for queue store!


foreman written in Go! ddollar is an original author of foreman, so this is a real descendant of foreman.


We can manage go libraries source and version using a simple config file like Bundler.


We can write an desktop application using HTML5, CSS, JS and WebGL!


MongoDB management GUI application. Beautiful…

Today’s my best: node-webkit

Love github!

My Github Trends 2013-09-04

I love github. I introduce some github repositories from Today’s trends or my recent starred. I will continuously post Github Trends every day hopefully…

I read only README, so my impression must be useless, but I hope it will be a chance for readers to know awesome github repositories.

Omniauth-openid With Pow and Nginx SSL Termination

I tried to use omniauth-openid with my new rails application. It worked when I developed using HTTP. After I started to develop with HTTPS, it failed. Finally I got the coolest workaround: OmniAuth.config.full_host and X-Forwarded-Host/Port.