Redmine 을 다른 호스트로 옮길 때는 세 가지를 가져간다 — 데이터베이스, 체부 파일(files), 플러그인. 버전이 다르면 옮긴 뒤 db:migrate 를 돌린다. 옮기기 전에 원본 Redmine 은 멈춰 둔다.
<REDMINE_HOME>/config/database.yml 을 열어 DB 이름 · 계정을 본다. 아래는 Bitnami 패키지로 깔렸던 환경의 예다.
---
# Default setup is given for MySQL with ruby1.9.
# Examples for PostgreSQL, SQLite3 and SQL Server can be found at the end.
# Line indentation must be 2 spaces (no tabs).
production:
adapter: mysql2
database: bitnami_redmine # database
host: localhost #
username: bitnami # 계정
password: ${REDACTED}
encoding: utf8
socket: /home/redmine/mysql/tmp/mysql.sock
development:
adapter: mysql2
database: redmine_development
host: localhost
username: root
password: ""
encoding: utf8
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: mysql2
database: redmine_test
host: localhost
username: root
password: ""
encoding: utf8
# PostgreSQL configuration example
#production:
# adapter: postgresql
# database: redmine
# host: localhost
# username: postgres
# password: "${REDACTED}"
# SQLite3 configuration example
#production:
# adapter: sqlite3
# database: db/redmine.sqlite3
# SQL Server configuration example
#production:
# adapter: sqlserver
# database: redmine
# host: localhost
# username: jenkins
# password: ${REDACTED}
# MySQL · MariaDB
mysqldump -h 127.0.0.1 -P 3307 -u bitnami -p bitnami_redmine > redmine.dump
# PostgreSQL
pg_dump -h 127.0.0.1 -U redmine -Fc redmine > redmine.dump
mysql -h 192.168.0.1 -u bitnami -p cfda88dc59 bitnami_redmine < redmine.dump
체부 파일과 플러그인을 옮긴다. public 은 테마 · 사용자 자원을 고쳤을 때만 옮기면 된다.
rsync -av <원본>/files/ <대상>/files/
rsync -av <원본>/plugins/ <대상>/plugins/
rsync -av <원본>/public/ <대상>/public/
옮긴 뒤 소유자를 애플리케이션 계정으로 맞춘다.
chown -R apache:apache <대상>/files <대상>/plugins
cd <대상 REDMINE_HOME>
bundle install
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake redmine:plugins:migrate
플러그인이 새 Redmine 버전을 지원하는지 먼저 확인한다. 맞지 않는 플러그인은 마이그레이션을 중간에 세우고 깨진다.
캐시와 정적 자원을 다시 만든다.
RAILS_ENV=production bin/rails assets:precompile
RAILS_ENV=production bundle exec rake tmp:cache:clear