テスト環境構築手順

仕様書
2013/08/24

商用環境ソースコピー

[root@web1 sync]# pwd
/www/aff/sync
[root@web1 sync]# ./content_rsync_test_20130824.sh

テスト環境、商用環境のソース差分

[root@web1 www]# pwd
/www

  • ソース内差分

[root@web1 www]# grep -R 'aff_test' aff_test | grep -v '\.log'
aff_test/admin/www/login.php:require_once( "/www/aff_test/set/server.inc" );
aff_test/admin/www/.htaccess:AuthUserFile /www/aff_test/admin/.htpasswd
aff_test/admin/const.inc:require_once( "/www/aff_test/set/server.inc" );
aff_test/sync/content_rsync_test.sh:rsync -avz -e ssh /www/aff_test/test.txt :/www/aff_test/
aff_test/sync/log_rsync.sh:rsync -avz -e ssh /www/aff_test/log/ :/www/aff_test/log/web2
aff_test/sync/content_rsync.sh:rsync -avz -e ssh --exclude-from /www/aff_test/sync/exclude_pattern.txt /www/aff_test :/www
aff_test/sync/content_rsync_init.sh:rsync -avz -e ssh /www/aff_test :/www
aff_test/sync/exclude_pattern.txt:aff_test/log
aff_test/sync/exclude_pattern.txt:aff_test/stat/log
aff_test/set/server.inc:$SERVER_PATH = "/www/aff_test";
aff_test/set/server.inc:$AD_SERVER_PATH = "/www/aff_test/ad";
aff_test/set/server.inc:$DOCUMENT_ROOT_PATH = "/www/aff_test/user/www";
aff_test/set/server.inc:$AD_DOCUMENT_ROOT_PATH = "/www/aff_test/ad/www";
aff_test/set/server.inc.old:$SERVER_PATH = "/www/aff_test";
aff_test/set/server.inc.old:$AD_SERVER_PATH = "/www/aff_test/ad";
aff_test/set/server.inc.old:$DOCUMENT_ROOT_PATH = "/www/aff_test/user/www";
aff_test/set/server.inc.old:$AD_DOCUMENT_ROOT_PATH = "/www/aff_test/ad/www";
aff_test/stat/stat_am_listing.php:require("/www/aff_test/ad/const.inc");
aff_test/stat/stat_rs.php:require("/www/aff_test/ad/const.inc");
aff_test/stat/stat_rs_listing.php:require("/www/aff_test/ad/const.inc");
aff_test/stat/stat_am.php:require("/www/aff_test/ad/const.inc");
aff_test/stat/stat.php:require("/www/aff_test/ad/const.inc");
aff_test/stat/stat_am_asp.php:require("/www/aff_test/ad/const.inc");
aff_test/stat/stat_rs_asp.php:require("/www/aff_test/ad/const.inc");
aff_test/stat/stat_listing.php:require("/www/aff_test/ad/const.inc");
aff_test/stat/stat_asp.php:require("/www/aff_test/ad/const.inc");
aff_test/user/www/admin/login.php:require_once( "/www/aff_test/set/server.inc" );
aff_test/user/www/admin/.htaccess:AuthUserFile /www/aff_test/admin/.htpasswd
aff_test/user/const.inc:require_once("/www/aff_test/set/server.inc");
aff_test/ad/const.inc:require_once("/www/aff_test/set/server.inc");

  • ポート番号

[root@web1 www]# grep -R ':8000' aff_test | grep -v '\.log'
aff_test/set/server.inc:$WW_PORT = ":8000";
aff_test/set/server.inc:$AD_PORT = ":8000";
aff_test/set/server.inc:$IM_PORT = ":8000";
aff_test/set/server.inc:$ADMIN_PORT = ":8000";
aff_test/set/server.inc.old:$WW_PORT = ":8000";
aff_test/set/server.inc.old:$AD_PORT = ":8000";
aff_test/set/server.inc.old:$IM_PORT = ":8000";
aff_test/set/server.inc.old:$ADMIN_PORT = ":8000";
aff_test/user/www/action/conversion.js: var host = "i-generation.jp:8000";
aff_test/user/www/action/retarget.js: var host = "i-generation.jp:8000";
aff_test/ad/www/ac/retarget.js: var host = "i-generation.jp:8000";
aff_test/ad/www/ac/action.js: var host = "i-generation.jp:8000";

  • シンボリックリンク

[root@web1 sync]# ll -R /www/aff_test/user/ | grep ^l
lrwxrwxrwx 1 root root 23 Oct 27 2011 admin -> /www/aff_test/admin/www
lrwxrwxrwx 1 root root 27 Oct 27 2011 banner -> /www/aff_test/ad/www/banner
lrwxrwxrwx 1 root root 33 Oct 27 2011 click.php -> /www/aff_test/ad/www/cl/click.php
lrwxrwxrwx 1 root root 37 Sep 20 2012 click_app.php -> /www/aff_test/ad/www/cl/click_app.php
lrwxrwxrwx 1 root root 37 Oct 27 2011 click_asp.php -> /www/aff_test/ad/www/cl/click_asp.php
lrwxrwxrwx 1 root root 41 Oct 29 2011 click_listing.php -> /www/aff_test/ad/www/cl/click_listing.php
lrwxrwxrwx 1 root root 33 Oct 31 2011 conversion.js -> /www/aff_test/ad/www/ac/action.js
lrwxrwxrwx 1 root root 34 Oct 31 2011 conversion.php -> /www/aff_test/ad/www/ac/action.php
lrwxrwxrwx 1 root root 34 Oct 27 2011 resign.php -> /www/aff_test/ad/www/ac/resign.php
lrwxrwxrwx 1 root root 35 Mar 23 2012 retarget.js -> /www/aff_test/ad/www/ac/retarget.js
lrwxrwxrwx 1 root root 36 Mar 23 2012 retarget.php -> /www/aff_test/ad/www/ac/retarget.php
lrwxrwxrwx 1 root root 36 Dec 7 2011 reverse.html -> /www/aff_test/ad/www/cl/reverse.html
lrwxrwxrwx 1 root root 41 Dec 7 2011 reverseAction.php -> /www/aff_test/ad/www/cl/reverseAction.php

gitインストール

[root@web1 git-1.8.4]# cd /usr/local/src/
[root@web1 git-1.8.4]# wget http://git-core.googlecode.com/files/git-1.8.4.tar.gz
[root@web1 git-1.8.4]# tar zxvf git-1.8.4.tar.gz
[root@web1 git-1.8.4]# cd git-1.8.4
[root@web1 git-1.8.4]# ./configure
[root@web1 git-1.8.4]# make
GIT_VERSION = 1.8.4
  • new build flags
    CC credential-store.o
    In file included from credential-store.c:1:
    cache.h:19:18: warning: zlib.h: No such file or directory
    In file included from credential-store.c:1:
    cache.h:21: error: expected specifier-qualifier-list before 'z_stream'
    make: *** [credential-store.o] Error 1

エラーが出たのでzlibインストール

[root@web1 git-1.8.4]# yum install zlib-devel
[root@web1 git-1.8.4]# make
[root@web1 git-1.8.4]# make install
[root@web1 git-1.8.4]# git --version
git version 1.8.4

git設定
[root@web1]$ git config --global user.name "i-generation.jp"
[root@web1]$ git config --global user.email
[root@web1]$ git config --global core.quotepath false

git設定確認
[root@web1]$ git config --list

gitoliteユーザー登録

SSH公開鍵作成

[admin@web1]$ cd ~
[admin@web1]$ ssh-keygen
key: i-generation
[admin@web1]$ mv i-generation i-generation.pub .ssh/

gitサーバ設定
[admin@web1]$ vi .ssh/config
HOST gitserver.vps
HOSTNAME 219.94.235.108
USER gituser
PORT 22
IDENTITYFILE ~/.ssh/i-generation

[admin@web1]$ chmod 600 ~/.ssh/config

公開鍵を管理者端末へ
[admin@web1]$ scp .ssh/i-generation.pub :/home/admin/
[admin@local]$ cd /User/haltyt/Sites/gitolite/gitolite-admin/keydir/
[admin@local]$ scp :/home/admin/i-generation.pub .

リポジトリへ反映
[admin@local]$ git add i-generation.pub
[admin@local]$ git commit -m "新規ユーザー登録"
[admin@local]$ git push

リモートリポジトリを取得できるか確認
[admin@web1]$ git clone ssh://gitserver.vps/testing

gitoliteにリモートリポジトリ登録

[admin@local]$ cd /User/haltyt/Sites/gitolite/gitolite-admin/
vi config/gitolite.conf
@developer = gitolite i-generation yamamoto

repo gitolite-admin
RW+ = gitolite

repo testing
RW+ = @all

repo new-repo
R = @all
RW = yamamoto

repo i-generation
RW+ = @all

repo aff
RW+ = @developer

リポジトリへ反映
[admin@local]$ git add .
[admin@local]$ git commit -m "新規リポジトリ登録"
[admin@local]$ git push

i-generationをgitへ登録

[admin@web1]$ cd /www/aff_test_new/
[admin@web1]$ git init
[admin@web1]$ git add .
[admin@web1]$ git commit
[admin@web1]$ git remote add origin gitserver.vps:aff.git
[admin@web1]$ git remote -v
origin gitserver.vps:aff.git (fetch)
origin gitserver.vps:aff.git (push)
[admin@web1]$ git push origin master

gitoliteをredmineで参照できるようにhook設定

[root@vps]$ cd
/var/lib/git

ミラーリポジトリ作成
[root@vps]$ git clone --mirror /home/gituser/repositories/aff.git
Initialized empty Git repository in /var/lib/git/aff.git/

ブラウザから閲覧できるようにパーミッション変更
[root@vps]$ chown -R gituser:gituser aff.git

[root@vps]# su - gituser
[gituser@vps]$ cd
[gituser@vps ~]$ vi repositories/aff.git/hooks/post-receive
#!/bin/sh
/usr/bin/git push --mirror /var/lib/git/aff.git

[gituser@vps ~]$ chmod 700 repositories/aff.git/hooks/post-receive

ファイル