Today we are going to setup the development and test environments for redmine . Generally when we install redmine , we install it in production environment . Sometimes it become necessary to have development env for tasks like debugging OR for development logs . So if you want to setup development and test env also you can follow these steps . (We are using redmine 4.2.1 , MySql 8 as a database and Apache2 web server also.)

STEP 1: CREATE DATABASES

First of all we need to create separate databases for developement and test environments. Enter following commands by replacing the names of DB if you want .

$ sudo -i
$mysql
>CREATE DATABASE redmine_dev CHARACTER SET utf8mb4;
>CREATE DATABASE redmine_test CHARACTER SET utf8mb4;

STEP 2: CREATE USERS

Inside the same mysql shell , we need to create users .

>CREATE USER 'redmine_dev'@'localhost' IDENTIFIED BY 'password' ;
>CREATE USER 'redmine_test'@'localhost' IDENTIFIED BY 'password' ;

STEP 3: GRANT PERMISSIONS

Now we need to Grant permission to database to respective users.

>GRANT ALL ON redmine_dev.* TO 'redmine_dev'@'localhost';
>GRANT ALL ON redmine_test.* TO 'redmine_test'@'localhost';

STEP 4: UPDATE database.yml

Now we need to add entry to redmine/config/database.yml file as follows:

development:
  adapter: mysql2
  database: redmine_dev
  host: localhost
  username: redmine_dev
  password: "password"

test:
  adapter: mysql2
  database: redmine_test
  host: localhost
  username: redmine_test
  password: "password"

STEP 5: CREATE A VIRTUAL HOST

If you are going to use redmine with apache , you need to setup multiple virtual hosts .

step 6: Migrate database

Now , we need to migrate data .Run this command from redmine directory.

$sudo RAILS_ENV=development bundle exec rake db:migrate
$sudo RAILS_ENV=test bundle exec rake db:migrate

STEP 7: LOAD redmine defaults

Now , database is migrated, we can load redmine defaults .

$sudo RAILS_ENV=development bundle exec rake redmine:load_default_data
$sudo RAILS_ENV=test bundle exec rake redmine:load_default_data

STEP 8: (optional)install erpmine plugin separately

This step is optional . If you have installed ERPmine plugin in your redmine installation, you need to install it separately for development OR test environment. run this command from redmine/plugins directory.

$sudo bundle exec rake redmine:plugins:migrate NAME=redmine_wktime RAILS_ENV=development
$sudo bundle exec rake redmine:plugins:migrate NAME=redmine_wktime RAILS_ENV=test

STEP 9: Migrate DB

After installing ERPmine , we have to again migrate db just to make sure that everything is properly migrated.

$sudo RAILS_ENV=development bundle exec rake db:migrate
$sudo RAILS_ENV=test bundle exec rake db:migrate

step 10 : Launch Webrick

Now , if you are running webrick web server, then stop the server and start in the environment which you just setup.

$sudo bundle exec rails server webrick -e development
$sudo bundle exec rails server webrick -e test

Step 11: Restart apache

If you are using apache + passenger mod then you need to restart the apache server.

$sudo service apache2 restart

And That’s it your development OR test environments is configured now .

Note:

One Response