Search This Blog

Thursday, May 3, 2018

Redmine 3.45 install Debian 9 stretch with SystemD

Please notice this is a quick and slim example only for non-multi user environment.

It fits my need very well.

Can hold up to 50 Clients at same time.

I am using SQLite as database because I love it.

apt-get install curl dirmngr
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL https://get.rvm.io | bash -s stable

source /etc/profile.d/rvm.sh
rvm requirements

rvm install 2.4

rvm use 2.4 --default
ruby -v

echo "gem: --no-ri --no-rdoc" >> ~/.gemrc

gem install bundler --no-ri --no-rdoc
gem install sqlite3 --no-ri --no-rdoc


cd /var/www/redmine/
cp config/database.yml.example config/database.yml

My config/database.yml:
production:
  adapter: sqlite3
  database: db/redmine.sqlite3

Start install:
bundle install --without development test rmagick
bundle exec rake generate_secret_token
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake redmine:load_default_data

Testing it out:
bundle exec rails server webrick -e production -b 192.168.1.33 -p 80

Run as systemd service: add file

/etc/systemd/system/redmine.service
[Unit]
Description=Redmine server
After=syslog.target
After=network.target

[Service]
Type=simple
User=root
Group=root
ExecStart=/bin/bash -c 'source /etc/profile.d/rvm.sh && cd /var/www/redmine && bundle exec rails server webrick -e production -b 192.168.1.33 -p 80'

# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300

[Install]
WantedBy=multi-user.target

To start it:
systemctl enable redmine.service
systemctl start redmine.service

What to improve:

  1. I run it as [root] user it may not super safe, but this is just for internal use.

  2. Redmine Log rotation, please reference my old post: Redmine Log rotation

No comments:

Post a Comment