Fork me on GitHub

Install REDMINE 3.4 with PgSQL and Apache2 on debian 9

Resources

  • http://www.redmine.org/projects/redmine/wiki/howto_install_redmine_on_ubuntu_step_by_step
  • http://www.redmine.org/projects/redmine/wiki/redmineinstall

Tested version

pg_config --version
PostgreSQL 11.2 (Debian 11.2-1.pgdg90+1)

ruby -v
ruby 2.3.3p222 (2016-11-21) [x86_64-linux-gnu]

Server packages

Debian packages

sudo apt-get install apache2 libapache2-mod-passenger ruby ruby-dev
sudo apt install postgresql-server-dev-all

Ruby GEMs

sudo -E gem install bundler -v 1.17.3

Database

CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'redmine' NOINHERIT VALID UNTIL 'infinity';
CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;

App

tar -xzf redmine-3.4.10.tar.gz
cd redmine-3.4.10/
mv config/database.yml.example  config/database.yml
cd ..
mv redmine-3.4.10/ /var/www/redmine

Edit config/database.yml.example :

# PostgreSQL configuration example
production:
  adapter: postgresql
  database: redmine
  host: localhost
  username: redmine
  password: "redmine"

And rename it:

mv config/database.yml.example  config/database.yml

Dependencies

bundle install --without development test

Setup

bundle exec rake generate_secret_token
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production REDMINE_LANG=fr bundle exec rake redmine:load_default_data


mkdir -p tmp tmp/pdf public/plugin_assets
sudo chown -R www-data: files log tmp public/plugin_assets
sudo chmod -R 755 files log tmp public/plugin_assets

Apache2

Permissions & ownership

sudo chown -R www-data: /var/www/
sudo chmod -R 755 /var/www/

 Configuration of passenger.conf

Add the following line to /etc/apache2/mods-available/passenger.conf:

PassengerDefaultUser www-data

Virtual Host

Edit /etc/apache2/sites-enabled/000-default.conf:

<VirtualHost *:80>
    #ServerName www.example.com
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/redmine/public/
        #MaxRequestLen 20971520

        <Directory "/var/www/redmine/public">
                Options Indexes ExecCGI FollowSymLinks
                Order allow,deny
                Allow from all
                AllowOverride all
        </Directory>

    ErrorLog ${APACHE_LOG_DIR}/redmine.error.log
    CustomLog ${APACHE_LOG_DIR}/redmine.access.log combined
</VirtualHost>

Test

REDMINE should be running, login with admin/admin.

GIT rebase

The aim of this post is to understand and get confortable with the git rebase command.

Definition:

Rebasing is the process of moving or combining a sequence of commits to a new base commit. Rebasing is most useful and easily visualized in the context of a feature branching workflow.

Create a git repo

mkdir rebase-test && cd rebase-test
git init

output:

Initialized empty Git repository in /home/bmn/rebase-test/.git/

Create one commit on master branch

echo "first content from master" >> README.md
git add README.md 
git commit -m "first commit"

output:

[master (root-commit) dc5f8d2] first commit
1 file changed, 1 insertion(+)
create mode 100644 README.md

Create a feature branch from that commit

git checkout -b feature
Switched to a new branch 'feature'

Create one commit on the feature branch

echo "introducing a new feature" >> README.md

Check file:

cat README.md

output:

first content from master
introducing a new feature


git commit -am "add feature line"

output:

[feature 2212653] add feature line
1 file changed, 1 insertion(+)

Check repo graph

nohup gitg &

screenshot

Create a new commit on master branch

git checkout master 
Switched to branch 'master'

Check file:

cat README.md 
first content from master

vim README.md # add a title line for example
cat README.md

output:

# Master title
first content from master

Commit that:

git commit -am "add master title"

output:

[master ec82793] add master title
 1 file changed, 1 insertion(+)

Let's say that master branch has a new commit because work on master has been delivered. Let's rebase the feature branch to this new commit, to get the new content from master and play the commit from feature branch.

Let's rebase the feature branch on the master branch

Let's move on our feature branch:

git checkout feature 

output:

Switched to branch 'feature'

And now the rebase operation itself:

git rebase -i master 

screenshot

output:

Successfully rebased and updated refs/heads/feature.

Our feature branch starts now from master head commit and now git is replaying all the commit from our feature branch from this point.

The result is the following:

The file README.ms now contains the commits from master + the commit from feature.

Let's check feature branch content

cat README.md 

output:

# Master title
first content from master
introducing a new feature

Let's check master branch content

git checkout master 

output:

Switched to branch 'master'


cat README.md

output:

# Master title
first content from master

Check repo graph

nohup gitg &

screenshot

Usage: getting changes from origin/branch on branch

Retrieve changes from origin:

git fetch

apply commit from that:

git checkout master
git rebase origin/master

PHPSTORM search & replace with regexp

Context

I have a list of 10K of #ID,and need to add a , at the end of each line to process them in a SQL query.

data input

1
2
3
4
5
6
7
8
9
10
...

the trick

Hit ctrl+R to launch the search & replace action.

Search the following pattern:

(.*)$

And replace it with:

$1,

screenshot

data output

1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
...,