« 05.30 MIB3 | ココ | 06.02 DotCloudをGit serverにしてみる(2) »

2012年6月 1日

DotCloudをGit serverにしてみる   このエントリーを含むはてなブックマーク 

なんとかして、DotCloudをgitサーバーにしてプライベートなレポジトリにできないかなーと思って考えてるんやけど。これどうや、という方法が見つかったので試してみた。

1つは完全にDotCloudをストレージとして使う方法やけども…これはサーバーがもう1つ必要になるので実のところあんまりやりたくない。そしてもう1つはたまたま見つけたDotCloudでカスタムのNginXを動かすという方法。

DotCloudではもともとNginXが動いてるわけやけど、HTTPベースでgitでアクセスするのにこいつでは設定が不完全になって動かせない、というのがある。http_dav_moduleだと、PROPFINDメソッドに対応してないから動かないという…。しかし、これを克服するのにカスタムのNginXをインストールすることが可能というのを知ってしまい。

nginx-on-dotcloudというのがそれで、そしてさらにnginx-dav-ext-moduleを使えばPROPFINDメソッドにも対応できるようにhttp_dav_moduleを拡張できるという。これは!ということでやってみることに。


$ mkdir nginx-dav-ext-module
$ cd nginx-dav-ext-module/
$ git clone git://github.com/arut/nginx-dav-ext-module.git .

$ mkdir testgit
$ cd testgit/
$ git clone git://github.com/dotcloud/nginx-on-dotcloud.git .

$ vi dotcloud.yml
$ vi nginx/builder
$ vi nginx/nginx.conf.in
$ cp -R $DIR_OF_nginx-dav-ext-module .

これで、必要なモジュールとデプロイ用のファイルの編集を終了。ファイルの内容については、github(gist)で公開中

$ dotcloud push --all testgit
# upload /home/user/dcprojects/testgit ssh://dotcloud@uploader.dotcloud.com:443/testgit
# rsync
Pseudo-terminal will not be allocated because stdin is not a terminal.
building file list ... done
./
.gitignore
README.rst
dotcloud.yml
postinstall
nginx-dav-ext-module/
nginx-dav-ext-module/README
nginx-dav-ext-module/config
nginx-dav-ext-module/ngx_http_dav_ext_module.c
nginx/
nginx/builder
nginx/nginx.conf.in
static/
static/404.html
static/500.html
static/502.html
static/503.html
static/504.html
static/index.html
static/robots.txt

sent 10.29K bytes received 328 bytes 1.42K bytes/sec
total size is 27.87K speedup is 2.63
08:34:04 ---> Deploy of "testgit" scheduled for revision rsync-1338539643465 at 2012-06-01 08:34:04
08:34:04 ---> Building the application...
08:34:04 [nginx] Build started for revision rsync-1338539643465 (clean build)
08:34:07 [nginx] I am snapshotsworker_01/bob-1, and I will be your builder today.
08:34:10 [nginx] stdin: is not a tty
08:34:10 [nginx] Get:1 http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com lucid Release.gpg [189B]
08:34:10 [nginx] Ign http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com/ubuntu/ lucid/main Translation-en_US
08:34:10 [nginx] Ign http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com/ubuntu/ lucid/universe Translation-en_US
08:34:10 [nginx] Ign http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com/ubuntu/ lucid/multiverse Translation-en_US
08:34:11 [nginx] Get:2 http://archive.canonical.com lucid Release.gpg [198B]
08:34:11 [nginx] Ign http://archive.canonical.com/ lucid/partner Translation-en_US
08:34:11 [nginx] Get:3 http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com lucid-updates Release.gpg [198B]
08:34:11 [nginx] Ign http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com/ubuntu/ lucid-updates/main Translation-en_US
08:34:11 [nginx] Ign http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com/ubuntu/ lucid-updates/universe Translation-en_US
08:34:11 [nginx] Ign http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com/ubuntu/ lucid-updates/multiverse Translation-en_US
08:34:11 [nginx] Get:4 http://archive.canonical.com lucid Release [8,215B]
08:34:11 [nginx] Get:5 http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com lucid-security Release.gpg [198B]
08:34:11 [nginx] Ign http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com/ubuntu/ lucid-security/main Translation-en_US
08:34:11 [nginx] Get:6 http://archive.canonical.com lucid/partner Packages [12.9kB]
08:34:11 [nginx] Ign http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com/ubuntu/ lucid-security/universe Translation-en_US
08:34:11 [nginx] Ign http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com/ubuntu/ lucid-security/multiverse Translation-en_US
08:34:11 [nginx] Get:7 http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com lucid Release [57.2kB]
08:34:11 [nginx] Get:8 http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com lucid-updates Release [57.3kB]
08:34:11 [nginx] Get:9 http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com lucid-security Release [57.3kB]
08:34:11 [nginx] Get:10 http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com lucid/main Packages [1,383kB]
08:34:11 [nginx] Get:11 http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com lucid/universe Packages [5,430kB]
08:34:11 [nginx] Get:12 http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com lucid/multiverse Packages [176kB]
08:34:12 [nginx] Get:13 http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com lucid-updates/main Packages [614kB]
08:34:12 [nginx] Get:14 http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com lucid-updates/universe Packages [287kB]
08:34:12 [nginx] Get:15 http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com lucid-updates/multiverse Packages [11.3kB]
08:34:12 [nginx] Get:16 http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com lucid-security/main Packages [419kB]
08:34:12 [nginx] Get:17 http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com lucid-security/universe Packages [146kB]
08:34:12 [nginx] Get:18 http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com lucid-security/multiverse Packages [5,345B]
08:34:18 [nginx] Fetched 8,665kB in 7s (1,186kB/s)
08:34:19 [nginx] Reading package lists...
08:34:21 [nginx] stdin: is not a tty
08:34:21 [nginx] Reading package lists...
08:34:21 [nginx] Building dependency tree...
08:34:21 [nginx] Reading state information...
08:34:21 [nginx] Note, selecting libexpat1-dev instead of libexpat-dev
08:34:21 [nginx] libexpat1-dev is already the newest version.
08:34:21 [nginx] The following extra packages will be installed:
08:34:21 [nginx] libpcrecpp0
08:34:21 [nginx] The following NEW packages will be installed:
08:34:21 [nginx] libpcre3-dev libpcrecpp0
08:34:21 [nginx] 0 upgraded, 2 newly installed, 0 to remove and 78 not upgraded.
08:34:21 [nginx] Need to get 362kB of archives.
08:34:21 [nginx] After this operation, 905kB of additional disk space will be used.
08:34:21 [nginx] Get:1 http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com/ubuntu/ lucid/main libpcrecpp0 7.8-3build1 [98.2kB]
08:34:21 [nginx] Get:2 http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com/ubuntu/ lucid/main libpcre3-dev 7.8-3build1 [264kB]
08:34:21 [nginx] Fetched 362kB in 0s (2,981kB/s)
08:34:21 [nginx] Selecting previously deselected package libpcrecpp0.
(Reading database ... 34544 files and directories currently installed.)
08:34:22 [nginx] Unpacking libpcrecpp0 (from .../libpcrecpp0_7.8-3build1_amd64.deb) ...
08:34:29 [nginx] Selecting previously deselected package libpcre3-dev.
08:34:29 [nginx] Unpacking libpcre3-dev (from .../libpcre3-dev_7.8-3build1_amd64.deb) ...
08:34:30 [nginx] Processing triggers for man-db ...
08:35:39 [nginx] Setting up libpcrecpp0 (7.8-3build1) ...
08:35:39 [nginx]
08:35:39 [nginx] Setting up libpcre3-dev (7.8-3build1) ...
08:35:39 [nginx] Processing triggers for libc-bin ...
08:35:39 [nginx] ldconfig deferred processing now taking place
08:35:40 [nginx] --> ./nginx/builder: Step 0: getting ready for build::
08:35:40 [nginx] --> ./nginx/builder: Step 1: install nginx::
08:35:40 [nginx] --> ./nginx/builder: installing Nginx into: /home/dotcloud/nginx
08:35:40 [nginx] --> ./nginx/builder: making directory: /home/dotcloud/nginx
08:35:40 [nginx] --> ./nginx/builder: making directory: /tmp/code/tmp/stage
08:35:40 [nginx] --> ./nginx/builder: downloading nginx from (http://nginx.org/download/nginx-1.0.14.tar.gz) and untaring into (/tmp/code/tmp/stage)
(省略)
08:35:52 [nginx] checking for sysconf(_SC_NPROCESSORS_ONLN) ... found
08:35:52 [nginx] configuring additional modules
08:35:52 [nginx] adding module in ./nginx-dav-ext-module
08:35:52 [nginx] ./configure: error: no ./nginx-dav-ext-module/config was found
08:35:52 [nginx] --> ./nginx/builder: Nginx install failed
08:35:53 [nginx] -- Build failed: "SERVICE_POSTINSTALL='' SERVICE_APPROOT=. SERVICE_SYSTEMPACKAGES="['libpcre3-dev', 'libexpat-dev']" SERVICE_REQUIREMENTS='[]' SERVICE_PROCESSES_NGINX=nginx SERVICE_BUILDSCRIPT=nginx/builder SERVICE_TYPE=custom SERVICE_PORTS_WWW=http ./nginx/builder" failed with return code 1
08:35:53 ---> Aborting due to some build failure

Deployment finished. Your application is available at the following URLs
error: No URL found.

あれ。どうやらnginx-dav-ext-moduleのディレクトリが間違っていたらしい。nginx/builderファイルを修正して再挑戦。

(省略)
09:51:03 [nginx] --> ./nginx/builder: move into /tmp/code/tmp/stage
09:51:03 [nginx] --> ./nginx/builder: trying to compile nginx, and then install it
09:51:03 [nginx] checking for OS
09:51:03 [nginx] + Linux 2.6.38.2-grsec-dotcloud-ec2 x86_64
09:51:03 [nginx] checking for C compiler ... found
09:51:03 [nginx] + using GNU C compiler
09:51:03 [nginx] checking for gcc builtin atomic operations ... found
09:51:03 [nginx] checking for C99 variadic macros ... found
09:51:04 [nginx] checking for gcc variadic macros ... found
09:51:04 [nginx] checking for unistd.h ... found
09:51:04 [nginx] checking for inttypes.h ... found
09:51:04 [nginx] checking for limits.h ... found
09:51:04 [nginx] checking for sys/filio.h ... not found
09:51:04 [nginx] checking for sys/param.h ... found
09:51:04 [nginx] checking for sys/mount.h ... found
09:51:04 [nginx] checking for sys/statvfs.h ... found
09:51:04 [nginx] checking for crypt.h ... found
09:51:04 [nginx] checking for Linux specific features
09:51:04 [nginx] checking for epoll ... found
09:51:04 [nginx] checking for sendfile() ... found
09:51:04 [nginx] checking for sendfile64() ... found
09:51:04 [nginx] checking for sys/prctl.h ... found
09:51:05 [nginx] checking for prctl(PR_SET_DUMPABLE) ... found
09:51:05 [nginx] checking for sched_setaffinity() ... found
09:51:05 [nginx] checking for crypt_r() ... found
09:51:05 [nginx] checking for sys/vfs.h ... found
09:51:05 [nginx] checking for nobody group ... not found
09:51:05 [nginx] checking for nogroup group ... found
09:51:05 [nginx] checking for poll() ... found
09:51:05 [nginx] checking for /dev/poll ... not found
09:51:05 [nginx] checking for kqueue ... not found
09:51:05 [nginx] checking for crypt() ... not found
09:51:05 [nginx] checking for crypt() in libcrypt ... found
09:51:05 [nginx] checking for F_READAHEAD ... not found
09:51:05 [nginx] checking for posix_fadvise() ... found
09:51:05 [nginx] checking for O_DIRECT ... found
09:51:05 [nginx] checking for F_NOCACHE ... not found
09:51:05 [nginx] checking for directio() ... not found
09:51:06 [nginx] checking for statfs() ... found
09:51:06 [nginx] checking for statvfs() ... found
09:51:06 [nginx] checking for dlopen() ... not found
09:51:06 [nginx] checking for dlopen() in libdl ... found
09:51:06 [nginx] checking for sched_yield() ... found
09:51:06 [nginx] checking for SO_SETFIB ... not found
09:51:06 [nginx] checking for SO_ACCEPTFILTER ... not found
09:51:06 [nginx] checking for TCP_DEFER_ACCEPT ... found
09:51:06 [nginx] checking for accept4() ... found
09:51:06 [nginx] checking for int size ... 4 bytes
09:51:06 [nginx] checking for long size ... 8 bytes
09:51:06 [nginx] checking for long long size ... 8 bytes
09:51:06 [nginx] checking for void * size ... 8 bytes
09:51:07 [nginx] checking for uint64_t ... found
09:51:07 [nginx] checking for sig_atomic_t ... found
09:51:07 [nginx] checking for sig_atomic_t size ... 4 bytes
09:51:07 [nginx] checking for socklen_t ... found
09:51:07 [nginx] checking for in_addr_t ... found
09:51:07 [nginx] checking for in_port_t ... found
09:51:07 [nginx] checking for rlim_t ... found
09:51:07 [nginx] checking for uintptr_t ... uintptr_t found
09:51:07 [nginx] checking for system endianess ... little endianess
09:51:07 [nginx] checking for size_t size ... 8 bytes
09:51:07 [nginx] checking for off_t size ... 8 bytes
09:51:07 [nginx] checking for time_t size ... 8 bytes
09:51:07 [nginx] checking for setproctitle() ... not found
09:51:07 [nginx] checking for pread() ... found
09:51:07 [nginx] checking for pwrite() ... found
09:51:08 [nginx] checking for sys_nerr ... found
09:51:08 [nginx] checking for localtime_r() ... found
09:51:08 [nginx] checking for posix_memalign() ... found
09:51:08 [nginx] checking for memalign() ... found
09:51:08 [nginx] checking for mmap(MAP_ANON|MAP_SHARED) ... found
09:51:08 [nginx] checking for mmap("/dev/zero", MAP_SHARED) ... found
09:51:08 [nginx] checking for System V shared memory ... found
09:51:08 [nginx] checking for POSIX semaphores ... not found
09:51:08 [nginx] checking for POSIX semaphores in libpthread ... found
09:51:08 [nginx] checking for struct msghdr.msg_control ... found
09:51:08 [nginx] checking for ioctl(FIONBIO) ... found
09:51:08 [nginx] checking for struct tm.tm_gmtoff ... found
09:51:08 [nginx] checking for struct dirent.d_namlen ... not found
09:51:08 [nginx] checking for struct dirent.d_type ... found
09:51:09 [nginx] checking for sysconf(_SC_NPROCESSORS_ONLN) ... found
09:51:09 [nginx] configuring additional modules
09:51:09 [nginx] adding module in /tmp/code/nginx-dav-ext-module
09:51:09 [nginx] + ngx_http_dav_ext_module was configured
09:51:09 [nginx] checking for PCRE library ... found
09:51:09 [nginx] checking for OpenSSL library ... found
09:51:09 [nginx] checking for zlib library ... found
09:51:09 [nginx] checking for libxslt ... found
09:51:09 [nginx] checking for libexslt ... found
09:51:09 [nginx] checking for GeoIP library ... found
09:51:09 [nginx] creating objs/Makefile
09:51:11 [nginx]
09:51:11 [nginx] Configuration summary
09:51:11 [nginx] + using system PCRE library
09:51:11 [nginx] + using system OpenSSL library
09:51:11 [nginx] + md5: using OpenSSL library
09:51:11 [nginx] + sha1: using OpenSSL library
09:51:11 [nginx] + using system zlib library
09:51:11 [nginx]
09:51:11 [nginx] nginx path prefix: "/home/dotcloud/nginx"
09:51:11 [nginx] nginx binary file: "/home/dotcloud/nginx/sbin/nginx"
09:51:11 [nginx] nginx configuration prefix: "/home/dotcloud/nginx/conf"
09:51:11 [nginx] nginx configuration file: "/home/dotcloud/nginx/conf/nginx.conf"
09:51:11 [nginx] nginx pid file: "/home/dotcloud/nginx/logs/nginx.pid"
09:51:11 [nginx] nginx error log file: "/home/dotcloud/nginx/logs/error.log"
09:51:11 [nginx] nginx http access log file: "/home/dotcloud/nginx/logs/access.log"
09:51:11 [nginx] nginx http client request body temporary files: "client_body_temp"
09:51:11 [nginx] nginx http proxy temporary files: "proxy_temp"
09:51:11 [nginx] nginx http fastcgi temporary files: "fastcgi_temp"
09:51:11 [nginx] nginx http uwsgi temporary files: "uwsgi_temp"
09:51:11 [nginx] nginx http scgi temporary files: "scgi_temp"
09:51:11 [nginx] make -f objs/Makefile
09:51:11 [nginx] make[1]: Entering directory `/tmp/rsync-1338544207217/tmp/stage'
09:51:11 [nginx] gcc -c -O3 -pipe -I src/core -I src/event -I src/event/modules -I src/os/unix -I /usr/include/libxml2 -I objs \
(省略)
09:51:43 [nginx] make[1]: Leaving directory `/tmp/rsync-1338544207217/tmp/stage'
09:51:43 [nginx] --> ./nginx/builder: Successfully compiled and installed nginx
09:51:43 [nginx] --> ./nginx/builder: remove some of the default config files from the nginx config directory that aren't needed
09:51:43 [nginx] --> ./nginx/builder: cleaning up (/tmp/code/tmp) since it is no longer needed.
09:51:43 [nginx] --> ./nginx/builder: change directories back to /tmp/code
09:51:43 [nginx] --> ./nginx/builder: finished installing nginx.
09:51:43 [nginx] --> ./nginx/builder: Step 2: build profile::
09:51:43 [nginx] --> ./nginx/builder: Step 3: install application::
09:51:43 [nginx] --> ./nginx/builder: change directories to /tmp/code
09:51:43 [nginx] --> ./nginx/builder: moving /tmp/code/profile to ~/
09:51:43 [nginx] --> ./nginx/builder: installing application to ~/current/ from /tmp/code
09:51:43 [nginx] sending incremental file list
09:51:43 [nginx] created directory /home/dotcloud/current
09:51:43 [nginx] dotcloud.yml
09:51:43 [nginx] postinstall
09:51:43 [nginx] nginx-dav-ext-module/
09:51:43 [nginx] nginx-dav-ext-module/README
09:51:43 [nginx] nginx-dav-ext-module/config
09:51:43 [nginx] nginx-dav-ext-module/ngx_http_dav_ext_module.c
09:51:43 [nginx] nginx/
09:51:43 [nginx] nginx/builder
09:51:43 [nginx] nginx/nginx.conf.in
09:51:43 [nginx] static/
09:51:43 [nginx] static/404.html
09:51:43 [nginx] static/500.html
09:51:43 [nginx] static/502.html
09:51:43 [nginx] static/503.html
09:51:43 [nginx] static/504.html
09:51:43 [nginx] static/index.html
09:51:43 [nginx] static/robots.txt
09:51:43 [nginx]
09:51:43 [nginx] sent 27538 bytes received 290 bytes 55656.00 bytes/sec
09:51:43 [nginx] total size is 26538 speedup is 0.95
09:51:43 [nginx] --> ./nginx/builder: All done...
09:51:50 [nginx] Build completed successfully. Compiled image size is 26MB
09:51:50 ---> Application build is done
09:51:50 ---> Initializing new services... (This may take a few minutes)
09:51:50 ---> Using default scaling for service nginx (1 instance(s)).
09:51:51 [nginx.0] Initializing...
09:52:02 [nginx.0] Service initialized
09:52:05 ---> All services have been initialized. Deploying code...
09:52:05 [nginx.0] Deploying build revision rsync-1338544207217...
09:52:14 [nginx.0] Running postinstall script...
09:52:18 [nginx.0] Launching...
09:52:20 [nginx.0] Waiting for the instance to become responsive...
09:52:23 [nginx.0] Re-routing traffic to the new build...
09:52:23 [nginx.0] Successfully deployed build revision rsync-1338544207217
09:52:23 ---> Deploy finished
09:52:23 ---> Application fully deployed

Deployment finished. Your application is available at the following URLs
nginx: http://testgit-67yk2h4g.dotcloud.com/

おお、いったっぽい!! 続きは次のエントリーで。

By ただ at 23:11 カテゴリー ; プログラミングとか

« 05.30 MIB3 | 06月の記事 | 06.02 DotCloudをGit serverにしてみる(2) »




トラックバック

このエントリーのトラックバックURL:
http://pinmarch.sakura.ne.jp/mt/mt-tb.cgi/1804

このリストは、次のエントリーを参照しています: DotCloudをGit serverにしてみる:

» アディダス スニーカー リボン from アディダス スニーカー リボン
Her commute grew by a couple miles, but his new doing work environment reflec...

トラックバック時刻: 2014年8月28日 06:48