Skip to content

Commit

Permalink
Merge pull request #40 from ayapapa/ubuntu1404-redmine2-issue39
Browse files Browse the repository at this point in the history
Ubuntu1404 redmine2 issue39
  • Loading branch information
ayapapa committed Dec 25, 2015
2 parents 949fdd1 + 59e7aac commit a31dce8
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 73 deletions.
14 changes: 7 additions & 7 deletions backup
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ then
exit 1
fi

export CURRENT_DIR=`pwd`
export FIRST_CHAR_BACKUP_DIR=`echo $1 | cut -c 1`
CURRENT_DIR=`pwd`
FIRST_CHAR_BACKUP_DIR=`echo $1 | cut -c 1`
if [ "$FIRST_CHAR_BACKUP_DIR" = '/' ]
then
export BACKUP_DIR=$1
BACKUP_DIR=$1
else
export BACKUP_DIR=$CURRENT_DIR/$1
BACKUP_DIR=$CURRENT_DIR/$1
fi

# 実行ユーザーチェック
Expand All @@ -44,7 +44,7 @@ read DO_CONTINUE
#データベースをバックアップ
if [ "$DBBACKUP_NAME" = "" ]
then
export DBBACKUP_NAME=$BACKUP_DIR/alminiumDB-`date +"%Y-%m-%d-%H-%M-%S"`.dump
DBBACKUP_NAME=$BACKUP_DIR/alminiumDB-`date +"%Y-%m-%d-%H-%M-%S"`.dump
fi
if [ -f $DBBACKUP_NAME ]
then
Expand All @@ -66,7 +66,7 @@ fi
##大きすぎて非効率な場合は、/opt/alminium/files以下を退避(移動)しておけば良い
if [ "$FILE_BACKUP" = "" ]
then
export FILE_BACKUP=$BACKUP_DIR/opt_alminium_files-`date +"%Y-%m-%d-%H-%M-%S"`.tar.gz
FILE_BACKUP=$BACKUP_DIR/opt_alminium_files-`date +"%Y-%m-%d-%H-%M-%S"`.tar.gz
fi
if [ -f $FILE_BACKUP ]
then
Expand All @@ -88,7 +88,7 @@ fi
##大きすぎて非効率な場合は、/var/opt/alminium/以下を退避(移動)しておけば良い
if [ "$REPOS_BACKUP" = "" ]
then
export REPOS_BACKUP=$BACKUP_DIR/var_opt_alminium-`date +"%Y-%m-%d-%H-%M-%S"`.tar.gz
REPOS_BACKUP=$BACKUP_DIR/var_opt_alminium-`date +"%Y-%m-%d-%H-%M-%S"`.tar.gz
fi
if [ -f $REPOS_BACKUP ]
then
Expand Down
2 changes: 1 addition & 1 deletion inst-script/debian/packages.lst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ make
fonts-ipafont-gothic
#libmysql-ruby
libapache2-mod-auth-mysql
#libapache2-mod-passenger
libapache2-mod-passenger
libapache2-svn
libapache2-mod-wsgi
libcurl4-openssl-dev
Expand Down
22 changes: 1 addition & 21 deletions inst-script/debian/post-install
Original file line number Diff line number Diff line change
@@ -1,30 +1,11 @@
#!/bin/bash

# set Redmine.pm
# modified for https://github.com/ayapapa/alminium/issues/16
# 上記問題は本家で解決されたためRedmine.pmは本家のものをそのまま利用するようにする
#if [ ! -f /etc/perl/Apache/Authn/Redmine.pm ]
#then
# mkdir -p /etc/perl/Apache/Authn
# cat $INSTALL_DIR/extra/svn/Redmine.pm |sed 's/Digest::SHA1/Digest::SHA/g' > /etc/perl/Apache/Authn/Redmine.pm
# cp $INSTALL_DIR/extra/svn/Redmine.pm /etc/perl/Apache/Authn/Redmine.pm
#fi
#if [ -f /etc/perl/Apache/Authn/Redmine.pm ]
#then
# #backup Redmine.pm
# mv /etc/perl/Apache/Authn/Redmine.pm /etc/perl/Apache/Authn/Redmine.pm-`date +"%Y-%m-%d-%H-%M-%S"`
#fi
mkdir -p /etc/perl/Apache/Authn
#remove error(unsubstantial) symbolic link
rm -f /etc/perl/Apache/Authn/Redmine.pm
#cat $INSTALL_DIR/extra/svn/Redmine.pm | \
#sed s/' \$r->set_handlers(PerlAuthenHandler => \[\\&OK\])'/' #modified for anonymous access(see https\:\/\/github.com\/ayapapa\/alminium\/issues\/16)\n #\$r->set_handlers(PerlAuthenHandler => \[\\\&OK])'/ |
#sed s/' if is_public_project(\$project_id, \$r) \&\& anonymous_role_allows_browse_repository(\$r);'/'# if is_public_project(\$project_id, \$r) \&\& anonymous_role_allows_browse_repository(\$r);\n if (is_public_project(\$project_id, \$r) \&\& anonymous_role_allows_browse_repository(\$r)) {\n \$r->set_handlers(PerlAuthenHandler => \[\\\&OK]);\n \$r->user(\"\");\n }'/ |
#sed s/' if is_public_project(\$project_id, \$r) \&\& anonymous_allowed_to_browse_repository(\$project_id, \$r);'/'# if is_public_project(\$project_id, \$r) \&\& anonymous_allowed_to_browse_repository(\$project_id, \$r);\n if (is_public_project(\$project_id, \$r) \&\& anonymous_allowed_to_browse_repository(\$project_id, \$r)) {\n \$r->set_handlers(PerlAuthenHandler => \[\\\&OK]);\n \$r->user(\"\");\n }'/ > $INSTALL_DIR/extra/svn/Redmine-patched.pm
#ln -s $INSTALL_DIR/extra/svn/Redmine-patched.pm /etc/perl/Apache/Authn/Redmine.pm
ln -s $INSTALL_DIR/extra/svn/Redmine.pm /etc/perl/Apache/Authn/Redmine.pm


# Apache configs
if [ "$SSL" = "y" ]; then REPLACE_SSL="#SSL# *"; fi
if [ "$ENABLE_JENKINS" = "y" ]; then REPLACE_JENKINS="#JENKINS# *"; fi
for FILE in $(ls etc/ | grep '.conf$')
Expand All @@ -36,7 +17,6 @@ do
"etc/$FILE" > "$ALM_ETC_DIR/$FILE"
done

ln -sf "$ALM_ETC_DIR/passenger.conf" "/etc/apache2/mods-available/passenger.load"
ln -sf "$ALM_ETC_DIR/alminium.conf" "/etc/apache2/sites-available/alminium.conf"

#log rotate
Expand Down
9 changes: 9 additions & 0 deletions inst-script/debian/pre-install
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
#!/bin/bash

# add passenger to APT repository
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7
apt-get install apt-transport-https ca-certificates
echo deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main > /etc/apt/sources.list.d/passenger.list
chown root: /etc/apt/sources.list.d/passenger.list
chmod 600 /etc/apt/sources.list.d/passenger.list

# install APT packages
apt-get -q2 update
apt-get -y install `grep -v "^#" inst-script/debian/packages.lst`
REALLY_GEM_UPDATE_SYSTEM=1 gem update --system
Expand Down
4 changes: 2 additions & 2 deletions redmine/Gemfile.local
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
gem 'rake-compiler'
gem 'passenger'
#gem 'rake-compiler'
#gem 'passenger'
11 changes: 3 additions & 8 deletions redmine/setup/redmine-plugins
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ do
esac
done


## setup plugin
pushd .

Expand All @@ -84,11 +83,7 @@ cd $INSTALL_DIR
mv plugins/redmine_hudson/Gemfile plugins/redmine_hudson/Gemfile.org

# redmineに必要なgemをインストール
bundle install --path vendor/bundle --without development test

# mod_passengerをインストール
bundle exec passenger-install-apache2-module --auto
bundle exec passenger-install-apache2-module --snippet > $ALM_ETC_DIR/passenger.conf
bundle install --path vendor/bundle --without development test xapian RAILS_ENV=production

# セッションストア秘密鍵を生成
bundle exec rake generate_secret_token
Expand All @@ -104,9 +99,9 @@ bundle exec rake redmine:load_default_data RAILS_ENV=production
bundle exec rake tmp:cache:clear
bundle exec rake tmp:sessions:clear

bundle exec rake redmine:plugins:process_version_change
bundle exec rake redmine:plugins:process_version_change RAILS_ENV=production
touch backlogs.dev
bundle exec rake redmine:backlogs:install task_tracker=サポート story_trackers=機能 labels=false
bundle exec rake redmine:backlogs:install task_tracker=サポート story_trackers=機能 labels=false RAILS_ENV=production

# FIXME: to avoid open_flash_chart assets aren't copied.
cp -fr plugins/open_flash_chart/assets public/plugin_assets/open_flash_chart
Expand Down
7 changes: 2 additions & 5 deletions redmine/setup/redmine-plugins.lst
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,14 @@
# アーカイブディレクトリ名はtgz/zipファイルを展開したときのディレクト名
redmine_wiki_extensions,redmine_wiki_extensions,https://bitbucket.org/haru_iida/redmine_wiki_extensions/downloads/redmine_wiki_extensions-0.6.5.zip
#redmine_issue_extensions,redmine_issue_extensions,http://redmineissueext.googlecode.com/files/redmine_issue_extensions1.0.7.1.zip
redmine_xls_export,0.2.1.t4,https://github.com/two-pack/redmine_xls_export.git
redmine_xls_export,ALMinium,https://github.com/ayapapa/redmine_xls_export.git
redmine_plugin_views_revisions,redmine_plugin_views_revisions,http://www.redmine.org/attachments/download/7705/redmine_plugin_views_revisions_v001.zip
redmine_importer,master,https://github.com/zh/redmine_importer.git
redmine_code_review,0.6.5,https://bitbucket.org/haru_iida/redmine_code_review
redmine_hudson,redmine2.x,https://bitbucket.org/okamototk/redmine_hudson
redmine_hudson,redmine_hudson,https://bitbucket.org/nobiinu_and/redmine_hudson/downloads/redmine_hudson-2.1.2.zip
##redmine_ms_projects,master,https://github.com/suer/redmine_ms_projects.git
redmine_backlogs,ubuntu1404-support,https://github.com/ayapapa/redmine_backlogs.git
redmine_spent_time_column,backlogs-support,https://github.com/mikoto20000/redmine_spent_time_column.git
#redmine_scm,HEAD,http://svn.s-andy.com/scm-creator/
#最新版を適用するように変更
#redmine_scm,master,https://github.com/alminium/redmine_scm.git
redmine_scm,0.5.0b-ALMinium-RM2,https://github.com/ayapapa/redmine_scm.git
#Redmine1.3.1のWikiのセクション編集ができなくなるのでredmine_restructuredtext_formatterを削除
#redmine_restructuredtext_formatter,japanese-localization,https://github.com/alminium/redmine_restructuredtext_formatter.git
Expand Down
22 changes: 11 additions & 11 deletions smelt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
# Smart installer for redmine/chiliproject.
############################################################

export ALM_SRC_DIR=$(cd $(dirname $0);pwd)
export ALM_ETC_DIR=/etc/opt/alminium
export ALM_VAR_DIR=/var/opt/alminium
export INSTALL_DIR=/opt/alminium
ALM_SRC_DIR=$(cd $(dirname $0);pwd)
ALM_ETC_DIR=/etc/opt/alminium
ALM_VAR_DIR=/var/opt/alminium
INSTALL_DIR=/opt/alminium

export RAILS_ENV=production
export SCRIPT_DIR=`pwd`
RAILS_ENV=production
SCRIPT_DIR=`pwd`
RM_VER=2.6.9
RM_ARC=http://www.redmine.org/releases/redmine-${RM_VER}.tar.gz
#RM_ARC=http://redmine.rubyforge.org/svn/tags
Expand Down Expand Up @@ -41,7 +41,7 @@ fi
if [ -f /etc/redhat-release ]
then
APACHE_USER=apache
export APACHE_CONF_DIR=/etc/httpd/conf.d
APACHE_CONF_DIR=/etc/httpd/conf.d
MYSQLD='/etc/init.d/mysqld'
MYSQL='mysql'
CHK=`egrep "CentOS release 5|Red Hat Enterprise Linux .* 5" /etc/redhat-release`
Expand All @@ -59,7 +59,7 @@ then
elif [ -f /etc/system-release ]
then
APACHE_USER=apache
export APACHE_CONF_DIR=/etc/httpd/conf.d
APACHE_CONF_DIR=/etc/httpd/conf.d
MYSQLD='/etc/init.d/mysqld'
MYSQL='mysql'
CHK=`egrep "Amazon Linux AMI" /etc/system-release`
Expand All @@ -72,7 +72,7 @@ elif [ -f /etc/debian_version ]
then
OS='debian'
APACHE_USER=www-data
export APACHE_CONF_DIR=/etc/apache2/conf.d
APACHE_CONF_DIR=/etc/apache2/conf.d
MYSQLD='/etc/init.d/mysql'
# TODO: -u -pを指定するとcreatedb.sqlの読み込みに失敗する
# MYSQL="$MYSQL -u root -p"
Expand All @@ -88,7 +88,7 @@ else
then
OS='mac'
APACHE_USER=www
export APACHE_CONF_DIR=/opt/local/apache2/conf
APACHE_CONF_DIR=/opt/local/apache2/conf
MYSQLD=/opt/local/share/mysql55/support-files/mysql.server
MYSQLD=mysql
CPCMD='cp -Rf'
Expand Down Expand Up @@ -210,7 +210,7 @@ then
touch gems.installed
fi

export RAKE=`which rake2.0`
RAKE=`which rake2.0`

if [ "$RAKE" = "" ]
then
Expand Down
7 changes: 3 additions & 4 deletions uninstall
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ read YN

if [ "$YN" = "y" ]
then
rm -fr /etc/httpd/conf.d/{alminium,passenger}.conf
rm -fr /etc/apache2/conf.d/{alminium,passenger}.conf
rm -fr /etc/httpd/conf.d/{alminium}.conf
rm -fr /etc/apache2/conf.d/{alminium}.conf
rm -fr /etc/apache2/sites-{available,enabled}/alminium.conf
rm -fr /etc/apache2/mods-{available,enabled}/passenger.load
rm -fr /opt/local/apache2/conf/{alminium,passenger}.conf
rm -fr /opt/local/apache2/conf/{alminium}.conf
rm -fr /etc/opt/alminium
fi

Expand Down
30 changes: 16 additions & 14 deletions upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
# upgrader for ALMinium.
############################################################

export CURRENT_DIR=`pwd`
export FIRST_CHAR_BACKUP_DIR=`echo $1 | cut -c 1`
CURRENT_DIR=`pwd`
FIRST_CHAR_BACKUP_DIR=`echo $1 | cut -c 1`
if [ "$FIRST_CHAR_BACKUP_DIR" = '/' ]
then
export BACKUP_DIR=$1
BACKUP_DIR=$1
else
export BACKUP_DIR=$CURRENT_DIR/$1
BACKUP_DIR=$CURRENT_DIR/$1
fi

export DBBACKUP_NAME=$BACKUP_DIR/alminiumDB-`date +"%Y-%m-%d-%H-%M-%S"`.dump
export FILE_BACKUP=$BACKUP_DIR/opt_alminium_files-`date +"%Y-%m-%d-%H-%M-%S"`.tar.gz
export REPOS_BACKUP=$BACKUP_DIR/var_opt_alminium-`date +"%Y-%m-%d-%H-%M-%S"`.tar.gz
DBBACKUP_NAME=$BACKUP_DIR/alminiumDB-`date +"%Y-%m-%d-%H-%M-%S"`.dump
FILE_BACKUP=$BACKUP_DIR/opt_alminium_files-`date +"%Y-%m-%d-%H-%M-%S"`.tar.gz
REPOS_BACKUP=$BACKUP_DIR/var_opt_alminium-`date +"%Y-%m-%d-%H-%M-%S"`.tar.gz

#バックアップを行う
./backup $1 "途中にエラーが発生した場合、復活できなくなる可能性があります。スナップショットをとるなど、後戻りできるようにしておくことをお勧めします。"
source ./backup $1 "途中にエラーが発生した場合、復活できなくなる可能性があります。スナップショットをとるなど、後戻りできるようにしておくことをお勧めします。"
if [ $? -gt 0 ]
then
exit 1
Expand All @@ -38,12 +38,12 @@ echo "処理を継続する場合は何らかのキーを押下してくださ
read DO_CONTINUE

cd $CURRENT_DIR
./uninstall
source ./uninstall

#install
echo "ALMiniumのインストールを開始します。"
cd $CURRENT_DIR
./smelt
source ./smelt
service apache2 stop

echo "バックアップデータを復元します。"
Expand All @@ -56,10 +56,12 @@ mysql -uroot alminium < $DBBACKUP_NAME

#データベースのマイグレーション
cd /opt/alminium
rake db:migrate RAILS_ENV="production"
rake redmine:plugins:migrate RAILS_ENV=production
rake tmp:cache:clear
rake tmp:sessions:clear
bundle exec rake db:migrate RAILS_ENV=production
bundle exec rake redmine:plugins:migrate RAILS_ENV=production
bundle exec rake tmp:cache:clear
bundle exec rake tmp:sessions:clear

service apache2 start

echo アップグレードが終了しました。もし、途中でエラーが発生していたなら、手動でアップグレードを行ってください。

0 comments on commit a31dce8

Please sign in to comment.