AmazonEC2 ä¸ã«ãRedmine 2.6.5 ãæ§ç¯ããã¡ã¢
2017/6/15 : æµç³ã«é³è åããã®ã§ AMI ã¯æ¶ãã¾ããã
AMI 好ãã«ä½¿ã£ã¦
ä¸è¨ã§ä½ã£ã AMI ãå
±æãã¾ããã好ãã«ä½¿ã£ã¦ã
å½ããåã§ããããã¼ã¸ã§ã³ã¢ããã¨ãè²ã
ãã£ã¦ãä¿è¨¼ããªãã£ããã¼
ami-4001ac40
ã¡ã¼ã«ãµã¼ãã¯ç«ã¦ã¦ãªãã®ã§ããèªåã§ç«ã¦ã¦éç¨ãã¦ãã ããã
ããã¤ã¯ä½ãï¼
æ®éã«å ¥ãã¦ãçºçããããªã Redmine ã Amazon EC2 ä¸ã«æ§ç¯ããã¡ã¢ã æ師ã¯ãããã¼ã¸ã§ã³ã¯ãã㦠2.6.5 ãå ¥ããã ä½ã§ä»æ´ãããªå¤ãç©ãå ¥ããã®ãã£ã¦ã¼ã¨ãBackLogsã 2.3.1 ã¾ã§ãã対å¿ãã¦ããªãã®ã¨ã2.6.3 ã§åãããã¨ããè¨äºãè¦ã¤ããããã
BackLogs ã¯æå¿ã§ 3.0.x 対å¿ãã¦ãèãããå ¬å¼ã¯ã ãã¾ããã¦ãã®ã§ãã¨ããããç¾ç¶ã¯åããããã®ã§åãããã£ã¦è ¹ã
ãã¼ã¹ã¯ Amazon Linux AMI 2015.03 (HVM), SSD Volume Type ãé¸æãä¸çªåºç¤ã£ã½ãããã
sudo yum update
ç´å¾ããããªæãã
$ ruby --version ruby 2.0.0p645 (2015-04-13) [x86_64-linux] $ gem -v 2.0.14
å ¬å¼ ã«ã¯ãRedmine2.x 㯠Ruby 2.2âãæªãµãã¼ããªã®ã§ããã®ã¾ã¾ä½¿ãã
å¨è¾ºãµã¼ãçªã£è¾¼ããã
$ sudo yum install httpd ... ==================================================================================================================================================================================================================================== Package ã¢ã¼ããã¯ãã£ã¼ ãã¼ã¸ã§ã³ ãªãã¸ããªã¼ 容é ==================================================================================================================================================================================================================================== ã¤ã³ã¹ãã¼ã«ä¸: httpd x86_64 2.2.29-1.5.amzn1 amzn-main 1.2 M ä¾åæ§é¢é£ã§ã®ã¤ã³ã¹ãã¼ã«ããã¾ã: ... $ sudo yum install mysql-server mysql-devel ... ==================================================================================================================================================================================================================================== Package ã¢ã¼ããã¯ãã£ã¼ ãã¼ã¸ã§ã³ ãªãã¸ããªã¼ 容é ==================================================================================================================================================================================================================================== ã¤ã³ã¹ãã¼ã«ä¸: mysql-devel noarch 5.5-1.6.amzn1 amzn-main 2.7 k mysql-server noarch 5.5-1.6.amzn1 amzn-main 2.8 k ä¾åæ§é¢é£ã§ã®ã¤ã³ã¹ãã¼ã«ããã¾ã:
MySQL ã®è¨èªã¯ããã©ã§ã¯ä½¿ããªãã®ã§ã/etc/my.cnf
å¼ã£ã¦
[mysqld] # ç¥ character-set-server=utf8 [mysql] default-character-set=utf8
ã追å ã
ãããã sudo service mysqld start
ã§ãµã¼ãã¹éå§ãsudo chkconfig mysqld on
ã§èªåèµ·åãå
¥ãã¦ããã
Redmine ç¨ã®DBã¢ã«ã¦ã³ããå ¥ãã¦ããã
$ mysql -uroot mysql> create database db_redmine default character set utf8; mysql> grant all on db_redmine.* to user_redmine@localhost identified by 'PutYourPassword';
Redmine ã«ä½¿ããã¼ã«ãå ¥ãå§ããã
$ sudo yum groupinstall "Development Tools" $ sudo yum --enablerepo=epel install ruby-devel mysql-devel ImageMagick ImageMagick-devel ipa-gothic-fonts
ipa ãã©ã³ãã¨ãã¯ãpdf æä½ã§å¿ è¦ãªãã ãã©ãepel ã«ããç¡ãã®ã§ããããå ¥ããã
Redmine ã¤ã³ã¹ãã¼ã«éå§
$ wget http://www.redmine.org/releases/redmine-2.6.5.tar.gz $ tar xvf redmine-2.6.5.tar.gz $ sudo mv redmine-2.6.5 /var/lib/redmine
㧠redmine æ¬ä½ããããã¤ã
cd /var/lib/redmine $ bundle install --without development test /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- io/console (LoadError) from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require' from /home/ec2-user/.gem/ruby/2.0/gems/bundler-1.10.5/lib/bundler/vendor/thor/lib/thor/shell/basic.rb:2:in `<top (required)>' from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require' 以ä¸ç¥
ãããªãã ruby ããç¸å¤ãããææªãªã¨ã³ã·ã¹ãã ã ãªw ã¤ãã§ã« Rails 3.2.22 ãå ¥ãã(Remine 2.6.x 㯠rails 3.2 ä¾åã®ãã)ã
é£ããæãªã®ã ããbundler ã®ç®¡è½(Gemfile)ã®è¨è¿°ã§ãã¼ã¸ã§ã³åé¡èµ·ããã¨ãããããã¹ã¿ãã¯ãªãã§ã¨ã©ã¼ã表示ãããã
ãã®æ㯠Gemfile ãå¿
æ»ã«ä¿®æ£ããå¿
è¦ãããã®ã ããä»åã®æ§ã«ã¹ã¿ãã¯ãåºãå ´åããããã Gemfile ã«æ¸ãã¦ãªãã©ã¤ãã©ãªã®åé¡ã
ãã®å ´å㯠gem ã³ãã³ãã§å ¥ããã°ç´ãå ´åãå¤ã(ãã ããéçºè ã Gemfile è¨è¿°æ¼ãã¨ãã§å®ã¯ãã¼ã¸ã§ã³ä¾åã ã¨å°çãè¦ãäºããã)
gem install rails -v '3.2.22'
å°ãæ¤è¨¼ãã¦ç¡ãããrails4.x ãæ¢ã«å
¥ãã¦ãã¾ã£ãç°å¢ã®å ´åãgem uninstall railties -v '4.0.0'
ã§åé¤ããªãã¨ãrails4 ãããã©ã«ãã§åãã¦å°çãè¦ããããªã
$ gem install io-console $ bundle install --without development test Fetching: io-console-0.4.2.gem (100%) Building native extensions. This could take a while... Successfully installed io-console-0.4.2 ...以ä¸ç¥
ããå ¥ã£ãã
mv config/database.yml.example config/database.yml vi config/database.yml
production: adapter: mysql2 database: db_redmine host: localhost username: user_redmine password: "PutYourPassword" encoding: utf8
åæ§ã«è¨å®ã
mv config/configuration.yml.example config/configuration.yml vi config/configuration.yml
production: email_delivery: delivery_method: :smtp smtp_settings: address: "localhost" port: 25 domain: 'example.com' rmagick_font_path: /usr/share/fonts/ipa-pgothic/ipagp.ttf
ã¾ããã®ã¾ã¾ã ããã
$ bundle exec rake generate_secret_token Could not find gem 'mysql2 (~> 0.3.11) ruby' in any of the gem sources listed in your Gemfile or available on this machine. Run `bundle install` to install missing gems.
DB è¨å®ã«å¯¾å¿ãããã³ãã«ã足ããã¼ãã£ã¦è¨ãããâ¦
$ bundle install --without development test Installing mysql2 0.3.18 with native extensions ç¥ $ bundle exec rake generate_secret_token $
ããããã©ã¹ã
$ bundle exec rake db:migrate RAILS_ENV=production
æ£å¸¸çµäºãããOKã
失æããæã¯ãconf/database.xml
ã®è¨å®ã«ééããç¡ããè¦ç´ãã¨è¯ããã
(èªåã¯ããã§èºãã¦ãªãã®ã§ãä½ãåºãã¨ãã¦ããããã)
Passenger çªã£è¾¼ã
Rails ã¢ããªã Apache ã¨ãã®ãµã¼ãçµç±ã§åããããã®ããã«ã¦ã§ã¢ã¨æãã°ããã
$ gem install passenger --no-rdoc --no-ri $ passenger-install-apache2-module
å¾ã¯ç»é¢ã®æ示ã«å¾ãã°è¯ãããã
Installation instructions for required software * To install Curl development headers with SSL support: Please install it with yum install libcurl-devel * To install Apache 2 development headers: Please install it with yum install httpd-devel * To install Apache Portable Runtime (APR) development headers: Please install it with yum install apr-devel * To install Apache Portable Runtime Utility (APU) development headers: Please install it with yum install apr-util-devel If the aforementioned instructions didn't solve your problem, then please take a look at the Users Guide: /home/ec2-user/.gem/ruby/2.0/gems/passenger-5.0.13/doc/Users guide Apache.html https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html
ãããªé¢¨ã«è¨ãããã®ã§ãé ã«å®è¡ããã®ä¸ã§ãå度 passenger-install-apache2-module ãå®è¡ããã¨ã
Compiling Phusion Passenger works best when you have at least 1024 MB of virtual memory. However your system only has 996 MB of total virtual memory (996 MB RAM, 0 MB swap). It is recommended that you temporarily add more swap space before proceeding. You can do it as follows: sudo dd if=/dev/zero of=/swap bs=1M count=1024 sudo mkswap /swap sudo swapon /swap See also https://wiki.archlinux.org/index.php/Swap for more information about the swap file on Linux. If you cannot activate a swap file (e.g. because you're on OpenVZ, or if you don't have root privileges) then you should install Phusion Passenger through DEB/RPM packages. For more information, please refer to the manual, section "Installation": /home/ec2-user/.gem/ruby/2.0/gems/passenger-5.0.13/doc/Users guide Apache.html https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html
åããåã«ãã¶ãã¼ããã¹ã¯ããä½ã£ã¨ãã¨â¦
Ctrl + C
ã§ããã»ã¹ãä¸æ¦æ¢ãã¦ãä¸è¨ã³ãã³ãã§ã¹ã¯ãããä½ãããã®ä¸ã§åãã£ã¬ã³ã¸ã
ã¹ã¯ããä½ãéä¸ã§ã6G ããªã¹ã¹ã¡ã ãã¨ãè¨ããããç¡è¦â
Please edit your Apache configuration file, and add these lines: LoadModule passenger_module /home/ec2-user/.gem/ruby/2.0/gems/passenger-5.0.13/buildout/apache2/mod_passenger.so <IfModule mod_passenger.c> PassengerRoot /home/ec2-user/.gem/ruby/2.0/gems/passenger-5.0.13 PassengerDefaultRuby /usr/bin/ruby2.0 </IfModule> After you restart Apache, you are ready to deploy any number of web applications on Apache, with a minimum amount of configuration! Press ENTER when you are done editing. -------------------------------------------- Validating installation... * Checking whether this Passenger install is in PATH... â * Checking whether there are no other Passenger installations... â * Checking whether Apache is installed... â * Checking whether the Passenger module is correctly configured in Apache... (!) You did not specify 'LoadModule passenger_module' in any of your Apache configuration files. Please paste the configuration snippet that this installer printed earlier, into one of your Apache configuration files, such as /etc/httpd/conf/httpd.conf. Detected 0 error(s), 1 warning(s). Press ENTER to continue. -------------------------------------------- Deploying a web application: an example Suppose you have a web application in /somewhere. Add a virtual host to your Apache configuration file and set its DocumentRoot to /somewhere/public: <VirtualHost *:80> ServerName www.yourhost.com # !!! Be sure to point DocumentRoot to 'public'! DocumentRoot /somewhere/public <Directory /somewhere/public> # This relaxes Apache security settings. AllowOverride all # MultiViews must be turned off. Options -MultiViews # Uncomment this if you're on Apache >= 2.4: #Require all granted </Directory> </VirtualHost> And that's it! You may also want to check the Users Guide for security and optimization tips, troubleshooting and other useful information: /home/ec2-user/.gem/ruby/2.0/gems/passenger-5.0.13/doc/Users guide Apache.html https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-) https://www.phusionpassenger.com Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.
ã¨è¨ãäºã§ãä¸ããé ã«å¯¾å¿ã
/etc/httpd/conf.d/passenger.conf
ãä½æãã¦
LoadModule passenger_module /home/ec2-user/.gem/ruby/2.0/gems/passenger-5.0.13/buildout/apache2/mod_passenger.so <IfModule mod_passenger.c> PassengerRoot /home/ec2-user/.gem/ruby/2.0/gems/passenger-5.0.13 PassengerDefaultRuby /usr/bin/ruby2.0 </IfModule> Header always unset "X-Powered-By" Header always unset "X-Rack-Cache" Header always unset "X-Content-Digest" Header always unset "X-Runtime" PassengerMaxPoolSize 20 PassengerMaxInstancesPerApp 4 PassengerPoolIdleTime 3600 PassengerHighPerformance on PassengerStatThrottleRate 10 PassengerSpawnMethod smart RailsAppSpawnerIdleTime 86400 PassengerMaxPreloaderIdleTime 0
ããã§ãåé¡ãªããã°ã¢ã¸ã¥ã¼ã«ãèªã¿è¾¼ã¾ããçã
$ sudo service httpd start $ sudo chkconfig httpd on
Passenger ã apache ã«è¨å®
$ sudo chown -R apache:apache /var/lib/redmine
Passenger ã®ã¤ã³ã¹ãã¼ã«æã«ã¯ãVirtualHost ã®è¨å®ãæ¸ããã¦ãããããããªäºã¯ç¥ãã(Redmine å°ç¨ãµã¼ã)ãªã®ã§ã/etc/httpd.conf
ãç´ç·¨éã
sudo vi /etc/httpd/conf/httpd.conf
ã§ã
# DocumentRoot "/var/www/html" DocumentRoot "/var/lib/redmine/public"
ãããã
$ /etc/init.d/httpd configtest Syntax OK $ service httpd restart
ã§ã¨ããããåãããã¨ããããã ãã
We're sorry, but something went wrong. We've been notified about this issue and we'll take a look at it shortly.
ãã©ã¦ã¶ä¸è¡¨ç¤ºããããã§ãä½ãæªããè¦ããã¨ãã¦ãããããã Production åä½ã§ãããªãã®è¦ããã¼ãã¨ããããããè¨èã
ä»æ¹ãªãã®ã§ãconf/database.xml
ã® development ã«è¨è¿°ãå
¥ããä¸ã/etc/httpd/conf.d/passenger.conf
ã«ã RailsEnv development
ãçªã£è¾¼ãã
ããã¦ã§ã¦ããã¨ã©ã¼ã¡ãã»ã¼ã¸ã
cannot load such file -- bundler/setup
ã¯ãï¼ã£ã¦æãã ããã©ãã passenger ããè²ã ä¾åã解決ã§ããªããããã
$ sudo gem install bundler --no-rdoc --no-ri $ sudo gem install passenger --no-rdoc --no-ri $ export ORIG_PATH="$PATH" $ sudo -s -E $ export PATH="$ORIG_PATH" $ passenger-install-apache2-module
ãªã®ã§ãå種 sudo ã§æ¸ãåºãã¦ããã¹ã root ã¦ã¼ã¶ã«ã¾ã§å¼ãç¶ãã ä¸ã§ãã¢ã¸ã¥ã¼ã«ãã«ãã
ã§ãèµ·åããã¨
It looks like Bundler could not find a gem. Maybe you didn't install all the gems that this application needs. To install your gems, please run: bundle install
ã©ããèªã¿è¾¼ã¿ãã¹ãéããããã
ä¸è¨ã®ã¾ã¾ãã«ã¼ã権éããã°ã¢ã¦ããã(ã¤ã¾ããã¹ãå¼ãç¶ãã ã¾ã¾)ã«
$ gem install io-console $ bundle install --without development test $ service httpd restart
ããã§åããã
ç¸å¤ããããã¤ã¦ã® MS ã¨çãã dll å°çãããã㯠Java ã® Jar å°çãã²ãããã¯ã½ãã¿ã¬ãªç°å¢ã ããâ¦ã