저의 개발환경 구성을 이렇게 하고 있다.(사정이 있어 기존 구성된 환경을 유지하려다 보니 복잡해 보인다)
[개발서버(소스)] => 개발VM(nfs) => web-dev 외부작업환경1) 윈도우 네트워크 드라이브 -> vm (smb) 외부작업환경2) (remote) -> sftp -> smb_mount -> vm (smb)
그에 맞게 작업환경을 꾸미다보니 sftp 로 직접 붙이려니 애매한 부분이 있었다. 그래서 중간에 smb mount 해서 사용하기로 했다.
1. samba 관련 설정. /etc/samba/smb.conf (설치 부분은 생략)
[httpd] comment = working dev httpd path = /work/httpd browseable = yes hosts allow = 127.0.0.1 force user = www-data force group = www-data public = yes guest ok = yes writable = yes printable = no create mask = 0765 directory mask = 0755
윈도우 운영체제만을 사용하다가 리눅스(유닉스)/맥OS 를 사용하려는 분들이 제일 어려워 하는 부분이
파일(폴더)권한 permission 에 관한 것일 듯 하다. 그러나 개념을 한번 익혀놓으면 그리 어렵지는 않다.
윈도우만 쓰는 분들도 쇼핑몰,블로그 등을 운영하다 보면 호스팅을 사용하는 경우가 생긴다. 그러면 대부분 리눅스 운영체제의 호스팅을 사용하게 된다.
물론 호스팅을 사용하더라도 퍼미션에 관한 사항을 체크할일은 거의 없지만, PG 결제모듈을 연결하거나 할때 필요한 경우가 생긴다.
다음은 kcp 모듈의 실행권한이 필요한 파일예시이다. (console 을 주로 쓰긴 하지만, 익히기 쉽게 Filezilla 의 파일권한 메뉴를 통해서 본 화면이다)
크게 소유자권한 / 그룹권한 / 공개권한 이라는 것이 있는데, 주로 소유자/공개 부분을 유념해두면 된다.(그냥 동일하게 설정하거나...)
읽기 권한 : 해당 파일을 볼 수 있는 권한을 말한다. 텍스트 파일이면 편집기등을 통해 파일의 내용을 볼 수 있게 된다. 쓰기 권한 : 파일을 열어 내용을 수정할 수 있는 권한이다. 삭제도 포함된다. 실행 권한 : 파일을 실행할 수 있는 권한이다. 이 부분이 중요한데, 결제 모듈같은 경우 결제/결과보기 등을 해당 모듈(파일)을 실행해야 하는 경우가 있다.
위 그림에서 실행 권한을 체크해줘야 한다.
콘솔상의 명령은
chmod 655 pp_cli
정도가 되겠다. 보통은 chmod 777 pp_cli / chmod 707 pp_cli 를 많이 사용한다.(보안등의 문제는 이 글에서는 생략한다)
그리고 폴더(디렉토리)의 권한은 파일과 비교해 동작이 약간 다른 부분이 있다.
읽기 권한 : 폴더내의 파일리스트를 볼 수 있는 권한이다. 쓰기 권한 : 폴더내에 파일을 생성할 수 있는 권한이다. 실행 권한 : 폴더로 이동(?)할 수 있는 권한이다.
결제 모듈등에서 또 중요한 부분이 있는데, 결제를 한 후 결과를 파일등에 로그를 남기는 경우가 있다. kcp 같은 경우 log 폴더에 201406 등의 월별로 폴더를 생성하고 일별로 파일을 생성해 로그를 남긴다. (다른 모듈 이니시스 / LGU+ 등도 비슷하다)
그래서 log 폴더는 쓰기/실행 권한을 주는게 좋다.
chmod 707 log
의 명령으로 해준다.
Filezilla 를 사용한다면
위 처럼 777 전체로 줘도 되고, 그룹권한은 뺴고 줘도 된다.(보통의 웹호스팅 환경에는 비슷하다)
rake aborted! This installation of RMagick was configured with ImageMagick 6.7.5 but ImageMagick 6.7.7-10 is in use.
위 메시지는 imagemagick 를 설치하지 않으면 통과한다.
그러나 다른 문제가.
http://www.jenkins.or.kr/boards/4/topics/225?r=274 에서 언급된 문제.
plugins/redmine_ckeditor# bundle install --without development test
Fetching gem metadata from https://rubygems.org/............ Fetching gem metadata from https://rubygems.org/.. Resolving dependencies................................... Bundler could not find compatible versions for gem "mime-types": In Gemfile: rich (= 1.4.6) ruby depends on mime-types (~> 1.16) ruby
rich (= 1.4.6) ruby depends on mime-types (2.2)
Bundler could not find compatible versions for gem "activesupport": In Gemfile: rich (= 1.4.6) ruby depends on activesupport (= 4.0.0) ruby
paperclip (~> 3.5.4) ruby depends on activesupport (3.0.0)
checking for Ruby version >= 1.8.5... yes checking for gcc... yes checking for Magick-config... no Can't
install RMagick 2.13.2. Can't find Magick-config in
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
*** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.
Gem files will remain installed in /var/lib/gems/1.9.1/gems/rmagick-2.13.2 for inspection. Results logged to /var/lib/gems/1.9.1/gems/rmagick-2.13.2/ext/RMagick/gem_make.out
An error occurred while installing rmagick (2.13.2), and Bundler cannot continue. Make sure that `gem install rmagick -v '2.13.2'` succeeds before bundling.
App 31726 stdout: App 31726 stdout: [
2014-06-11 03:30:47.1599 31473/7f601e1ef700
Pool2/Implementation.cpp:883 ]: Could not spawn process for group
/opt/redmine-2.5.1-0/apps/redmine/htdocs#default: An error occured while
starting up the preloader. in 'void
Passenger::ApplicationPool2::SmartSpawner::handleErrorResponse(Passenger::ApplicationPool2::SmartSpawner::StartupDetails&)'
(SmartSpawner.h:455) in 'std::string
Passenger::ApplicationPool2::SmartSpawner::negotiatePreloaderStartup(Passenger::ApplicationPool2::SmartSpawner::StartupDetails&)'
(SmartSpawner.h:566) in 'void Passenger::ApplicationPool2::SmartSpawner::startPreloader()' (SmartSpawner.h:206)
in 'virtual Passenger::ApplicationPool2::ProcessPtr
Passenger::ApplicationPool2::SmartSpawner::spawn(const
Passenger::ApplicationPool2::Options&)' (SmartSpawner.h:752)
in 'void Passenger::ApplicationPool2::Group::spawnThreadRealMain(const
Passenger::ApplicationPool2::SpawnerPtr&, const
Passenger::ApplicationPool2::Options&, unsigned int)'
(Implementation.cpp:804)
[ 2014-06-11 03:30:47.1603 31473/7f6017fff700 agents/HelperAgent/RequestHandler.h:2210 ]: [Client 23] Cannot checkout session. Error page: <p>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:</p>
<pre class="commands">bundle install</pre>
<p>If
that didn't work, then the problem is probably caused by your
application being run under a different environment than it's supposed
to. Please check the following:</p>
<ol> <li>Is this app supposed to be run as the <code>daemon</code> user?</li> <li>Is this app being run on the correct Ruby interpreter? Below you will see which Ruby interpreter Phusion Passenger attempted to use.</li> </ol>
<p>-------- The exception is as follows: -------</p> Could not find rake-10.1.1 in any of the sources (Bundler::GemNotFound) <pre>
/opt/redmine-2.5.1-0/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/spec_set.rb:92:in
`block in materialize' /opt/redmine-2.5.1-0/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/spec_set.rb:85:in `map!' /opt/redmine-2.5.1-0/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/spec_set.rb:85:in `materialize' /opt/redmine-2.5.1-0/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/definition.rb:133:in `specs' /opt/redmine-2.5.1-0/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/definition.rb:178:in `specs_for' /opt/redmine-2.5.1-0/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/definition.rb:167:in `requested_specs' /opt/redmine-2.5.1-0/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/environment.rb:18:in `requested_specs' /opt/redmine-2.5.1-0/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/runtime.rb:13:in `setup' /opt/redmine-2.5.1-0/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler.rb:119:in `setup' /opt/redmine-2.5.1-0/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/setup.rb:17:in `<top (required)>' /opt/redmine-2.5.1-0/ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require' /opt/redmine-2.5.1-0/ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require' /opt/redmine-2.5.1-0/ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
/opt/redmine-2.5.1-0/ruby/lib/ruby/gems/1.9.1/gems/passenger-4.0.40/lib/phusion_passenger/loader_shared_helpers.rb:245:in
`block in run_load_path_setup_code'
/opt/redmine-2.5.1-0/ruby/lib/ruby/gems/1.9.1/gems/passenger-4.0.40/lib/phusion_passenger/loader_shared_helpers.rb:348:in
`running_bundler'
/opt/redmine-2.5.1-0/ruby/lib/ruby/gems/1.9.1/gems/passenger-4.0.40/lib/phusion_passenger/loader_shared_helpers.rb:243:in
`run_load_path_setup_code' /opt/redmine-2.5.1-0/ruby/lib/ruby/gems/1.9.1/gems/passenger-4.0.40/helper-scripts/rack-preloader.rb:100:in `preload_app'
/opt/redmine-2.5.1-0/ruby/lib/ruby/gems/1.9.1/gems/passenger-4.0.40/helper-scripts/rack-preloader.rb:158:in
`<module:App>'
/opt/redmine-2.5.1-0/ruby/lib/ruby/gems/1.9.1/gems/passenger-4.0.40/helper-scripts/rack-preloader.rb:29:in
`<module:PhusionPassenger>'
/opt/redmine-2.5.1-0/ruby/lib/ruby/gems/1.9.1/gems/passenger-4.0.40/helper-scripts/rack-preloader.rb:28:in
`<main>'</pre>
뭔가 되는 듯 싶더니, Passenger 가 정상 로드되지 못하는 듯 하다.
bitnami 의 실행스크립트 ./ctlscript.sh restart 로 재시작 해준다.