Recommendation on scripting Redmine site configuration
Added by Miodrag Milic almost 13 years ago
I made a script that installs Redmine, number of plugins, web servers and all prerequisites on blank OS installation.
However I still have to go to Administrative page to configure Redmine and some plugins.
Is there any preferred way to do so ?
Two solutions came to my mind:
1. To use rails runner and find all those setting in code. It looks like lot of work.
2. Browser automation. Lynx could be used and I could record keystrokes. Can be done in less then hour.
I appreciate any opinion.
Thanks.
Replies (2)
RE: Recommendation on scripting Redmine site configuration
-
Added by Jan Niggemann (redmine.org team member) almost 13 years ago
Is it for Linux or Windows? Can you share the installer with us? This is something interesting...
I don't have a recommendation for your problem though :-/
RE: Recommendation on scripting Redmine site configuration
-
Added by Miodrag Milic almost 13 years ago
Its for Ubuntu.
It should be easy to do for any linux admin which I am even not. I can't share it because it contains private data.
The very short version of the script (lots of parts omited) looks like this
redmine_url='http://rubyforge.org/frs/download.php/76578/redmine-2.1.3.tar.gz'
redmine_dir='/var/www/redmine'
redmine_mysql_user=redmine
redmine_mysql_pass=redmine
redmine_mysql_db=redmine
Prereqs() {
apt-get update > /dev/null
apt-get --assume-yes install ruby1.9.3
apt-get --assume-yes install nginx
export DEBIAN_FRONTEND=noninteractive
apt-get --assume-yes install mysql-server
}
ConfigureMySql() {
mysqladmin -uroot password ****
MYSQL=`which mysql`
Q1="create database $redmine_mysql_db character set utf8;"
Q2="create user '$redmine_mysql_user'@'localhost' identified by '$redmine_mysql_pass';"
Q3="grant all privileges on $redmine_mysql_db.* to '$redmine_mysql_user'@'localhost';"
Q4="FLUSH PRIVILEGES;"
SQL="${Q1}${Q2}${Q3}${Q4}"
$MYSQL -uroot -p***** -e "$SQL"
}
GetRedmine() {
wget $redmine_url
tar -xzf redmine*.tar.gz
rm redmine-*.gz
redmine_temp_dir=`find redmine-* -maxdepth 0 -type d`
cp -r redmine_custom/* $redmine_temp_dir
}
InstalirajRedmine() {
InstallPluginPrerequsites
mkdir -p $redmine_dir
redmine_temp_dir=`find redmine-* -maxdepth 0 -type d`
mv -fT $redmine_temp_dir $redmine_dir
cd $redmine_dir
#Step 2 - Dependencies installation
gem install bundler
bundle install --without development test postgresql sqlite
#Step 5 - Session store secret generation
rake generate_secret_token
#Step 6 - Database schema objects creation
RAILS_ENV=production rake db:migrate
#Step 7 - Database default data set
RAILS_ENV=production REDMINE_LANG=sr-YU rake redmine:load_default_data
#Step 8 - File system permissions (given to 'redmine' user of the system)
useradd --user-group --system redmine
chown -R redmine:redmine files log tmp public/plugin_assets
chmod -R 755 files log tmp public/plugin_assets
rake redmine:plugins:migrate RAILS_ENV=production
}
KonfigureWebServere() {
cp -r $start_dir/redmine_web_servers/nginx/* /etc/nginx
ln -s /etc/nginx/sites-available/redmine_443 /etc/nginx/sites-enabled
rm /etc/nginx/sites-enabled/default
thin install
/usr/sbin/update-rc.d -f thin defaults
cp $start_dir/redmine_web_servers/thin/* /etc/thin
}
Other parts install plugin prereqs, copy various configs around, change yml files, change some translations to better suit my needs etc... It runs on empty or used OS half an hour and then you can access it via browser normally. It becomes easy to deploy on any number of test systems.
I think its easy to set up config using rails runner, using Setting.find( param ) and updating it normaly the Rails way. Lynx automation works too, although its not fail safe for the future versions. You only need to scan database for the settings table and see setting names.