[基本環境]
- Ubuntu 18.04
- Docker 19.03.12
[参考サイト]
[注意]
[Dockerコンテナの展開(ホストOS上で実行)]
- docker pull ubuntu:18.04
- docker run -itd --privileged -p 80:80/tcp --name redmine ubuntu:18.04
- docker exec -it redmine /bin/bash
[コンテナ(redmine)内での手続き]
- adduser ubuntu
- apt-get update
- apt-get upgrade
- apt-get install sudo
- usermod -G sudo ubuntu
- su - ubuntu
- sudo apt-get install locales
- sudo locale-gen ja_JP.UTF-8
- locale -a
- sudo apt-get install build-essential zlib1g-dev libssl-dev libreadline-dev
- sudo apt-get install libyaml-dev libcurl4-openssl-dev libffi-dev
- sudo apt-get install postgresql libpq-dev
- sudo apt-get install apache2 apache2-dev
- sudo apt-get install imagemagick fonts-takao-pgothic
- sudo apt-get install subversion git vim
- curl -O https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.5.tar.gz
- tar xvf ruby-2.6.5.tar.gz
- cd ruby-2.6.5
- ./configure --disable-install-doc
- make
- sudo make install
- cd
- ruby -v
- sudo service postgresql start
- sudo -u postgres createuser -P redmine
- sudo -u postgres createdb -E UTF-8 -l ja_JP.UTF-8 -O redmine -T template0 redmine
- sudo mkdir /var/lib/redmine
- sudo chown www-data /var/lib/redmine
- sudo -u www-data svn co https://svn.redmine.org/redmine/branches/4.1-stable /var/lib/redmine
- cd
- vi database-yml.sh
- chmod 755 database-yml.sh
- sudo ./database-yml.sh
- more /var/lib/redmine/config/database.yml
- ファイルの存在を確認
- password:にpostgresqlのユーザredmineのパスワードを書く
- vi configuration-yml.sh
- chmod 755 configuration-yml.sh
- sudo ./configuration-yml.sh
- more /var/lib/redmine/config/configuration.yml
- cd /var/lib/redmine/config/
- sudo chown www-data:www-data database.yml
- sudo chown www-data:www-data configuration.yml
- cd /var/lib/redmine/
- sudo -u www-data bundle install --without development test --path vendor/bundle
- sudo -u www-data bin/rake generate_secret_token
- sudo -u www-data RAILS_ENV=production bin/rake db:migrate
- sudo gem install passenger -N
- sudo passenger-install-apache2-module --auto --languages ruby
- cd
- vi redmine-conf.sh
- chmod 755 redmine-conf.sh
- sudo ./redmine-conf.sh
- more /etc/apache2/conf-available/redmine.conf
- ファイルの存在を確認
- 3行目(</Directory>)以降の内容がpassenger-install-apache2-module --snippetの出力結果であることを確認
- sudo a2enconf redmine
- apache2ctl configtest
- sudo service apache2 reload
- sudo vi /etc/apache2/sites-enabled/000-default.conf
- DocumentRootの値を /var/lib/redmine/public に変更
- apache2ctl configtest
- sudo service apache2 reload
- sudo service apache2 start
- sudo vi /etc/init.d/redmine-start.sh
- sudo chmod 755 /etc/init.d/redmine-start.sh
- sudo vi /etc/init.d/redmine-stop.sh
- sudo chmod 755 /etc/init.d/redmine-stop.sh
- sudo service postgresql stop
- sudo service apache2 stop
- exit
- exit
[Dockerイメージの生成(ホストOS上で実行)]
- docker stop redmine
- docker commit redmine ubuntu1804:redmine
[DockerイメージからRedmineを展開(ホストOS上で実行)]
- docker run -itd --privileged -p 8080:80 --name sample ubuntu1804:redmine
- docker exec sample /etc/init.d/redmine-start.sh
[Redmineコンテナの停止]
- docker exec sample /etc/init.d/redmine-stop.sh
- docker stop sample
[Redmineコンテナの起動]
- docker start sample
- docker exec sample /etc/init.d/redmine-start.sh
[Redmineの起動を確認]
- 手元PCのウェブブラウザで http://RedmineのIPアドレス:8080/ に接続する