================================================== RhodeCodeとJenkinsを利用したSphinxのWebサイト作成 ================================================== 概要 ================================================== * SphinxのプロジェクトをMercurial/RhodeCodeで管理する * JobサーバのJenkinsでリポジトリ更新を感知し、Webサイト更新を自動的にかける Mercurialの導入 ================================================== * 作業端末にMercurialを導入する * ローカルのSphinxプロジェクトをMercurialで管理する * TortoiseHG Jobサーバの構築 基本設定 ================================================== * OSのインストール * CentOS6.3 * ssh * ntp Jobサーバの構築 Pythonの導入 ================================================== * Pythonのパッケージ管理ツールをインストール Jobサーバの構築 Mercurialの導入 ================================================== * サーバでMercurialのインストール Jobサーバの構築 Sphinxの導入 ================================================== * Sphinxの導入 * Sphinxと各種プラグイン RhodeCodeの構築 ================================================== * RhodeCodeのインストール pip install rhodecode -U * RhodeCodeの設定 * 検証機見てconfig張る * ログの設計、設定 :: mkdir -p /var/rhodecode/ cd /var/rhodecode/ paster make-config RhodeCode production.ini ls production.ini paster setup-rhodecode production.ini Are you sure to destroy old database ? [y/n]y Enter a valid absolute path to store repositories. All repositories in that path will be added automatically: /var/rhodecode/repo Specify admin username:nesapo-admin Specify admin password (min 6 chars):netsupport Specify admin email:education@n-support.jp * 起動 paster serve production.ini * 起動スクリプト作成 * 別紙 * アカウント作成 * kyoshimi * goyamada * ituka * saeki * matsui * sanpei * nesapo-admin * リポジトリ作成 hg clone http://goyamada@172.30.18.5:8888/rhodecode/education/sitetop hg push http://goyamada@172.30.18.5:8880/rhodecode/test_repositry hg clone http://goyamada@172.30.18.5:8880/rhodecode/education/taiki-report Jobサーバの構築 Jenkinsのインストール ================================================== * yumでJenkinsインストール * Javaインストール:: wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key yum install jenkins yum -y install java-1.6.0-openjdk.i686 Jobサーバの構築 Jenkinsの設定 ================================================== * nesapo-admin セキュリティの有効 https://wiki.jenkins-ci.org/display/JA/Standard+Security+Setup .. vim /etc/sysconfig/jenkins 19 JENKINS_JAVA_CMD="" 29 JENKINS_USER="jenkins" 47 JENKINS_PORT="8080" 57 JENKINS_AJP_PORT="8009" 最終行 JENKINS_ARGS="--prefix=/jenkins" パーミッションを変更 chown -R "jenkins":"jenkins" /var/log/jenkins jenkinsユーザのシェル変更 jenkinsユーザーがパスワードなしでsudo出来るように設定 visudo ------ jenkins ALL=(ALL) NOPASSWD:ALL ------ 起動 sudo /etc/init.d/jenkins start sudo chkconfig jenkins on chkconfig --add paste-serve-rhodecode chkconfig --level 345 paste-serve-rhodecode on * ワークスペースの作成 * Mercurialのプラグインインストール jenkinsの管理 プラグインの管理 ワークスペース⇒設定⇒ビルド処理後の手順 成果物を保存 _build/html/** 成果物の確認方法 状態⇒ 最新成功ビルドの成果物 Jobサーバの構築 Webサーバの構築 ================================================== * Apacheインストール、設定 * リバースプロクシ * Jenkins basic認証有り * RhodeCode basic認証無し ※アカウント認証有り .. パスワードファイルの作成 htpasswd -c /etc/httpd/conf/rproxy_passwd nesapo-admin /etc/httpd/conf/rproxy_passwd :: ServerAdmin admin@example.com CustomLog /var/log/httpd/rproxy/rproxy_access_log combined ErrorLog /var/log/httpd/rproxy/rproxy_error_log AllowOverride FileInfo AuthConfig Limit Options MultiViews Indexes SymLinksIfOwnerMatch AuthType Basic AuthName "Password for Jenkins" AuthUserFile /etc/httpd/conf/rproxy_passwd Require valid-user # Reverse Proxy ProxyPass /jenkins http://localhost:8080/jenkins ProxyPassReverse /jenkins http://localhost:8080/jenkins * ServerAdmin admin@example.com DocumentRoot /data/example ServerName www.example.com # CustomLog logs/example_access_log combined ErrorLog logs/example_error_log AllowOverride FileInfo AuthConfig Limit Options MultiViews Indexes SymLinksIfOwnerMatch AuthType Basic AuthName "Password for Jenkins" AuthUserFile /etc/httpd/conf/jenkins_passwd Require valid-user # Reverse Proxy ProxyPass /jenkinsn http://localhost:9080/jenkins ProxyPassReverse /jenkinsn http://localhost:9080/jenkins * Jobサーバの構築 sshの設定 ================================================== * 鍵の作成 * アクセスを許可するユーザの作成 ※Mercurialリポジトリの利用について .. ssh-keygen -t rsa -N "" -f $HOME/.ssh/id_rsa.bitbucket 作業項目 ================================================== * RhodeCodeのインストール * Jenkinsインストール * Jenkins設定 ⇒ Webへのアップロード