2
我在嘗試讓Capifony工作時部署我的Symfony2開發的應用程序時出現以下問題。我將它部署到一個共享的網絡託管服務器...希望有人能提供一些線索:Capifony + Symfony2:FileLoaderLoadException,無法從config.yml導入資源parameters.ini
這是調用帽部署時,日誌:
/Applications/MAMP/htdocs/mtg
My-Mac:mtg $ cap deploy
* executing `deploy'
* executing `deploy:update'
** transaction: start
* executing `deploy:update_code'
executing locally: "svn info http://path.to/svn/my-app/ -rHEAD"
command finished in 3362ms
* getting (via checkout) revision 67 to /var/folders/kv/htk616w153q26vlhlp5g7xqw0000gn/T/20120211124452
executing locally: svn checkout -q -r67 http://path.to/svn/my-app/ /var/folders/kv/htk616w153q26vlhlp5g7xqw0000gn/T/20120211124452
command finished in 6517ms
compressing /var/folders/kv/htk616w153q26vlhlp5g7xqw0000gn/T/20120211124452 to /var/folders/kv/htk616w153q26vlhlp5g7xqw0000gn/T/20120211124452.tar.gz
executing locally: tar chzf 20120211124452.tar.gz 20120211124452
command finished in 190ms
servers: ["server.com"]
Password:
** sftp upload /var/folders/kv/htk616w153q26vlhlp5g7xqw0000gn/T/20120211124452.tar.gz -> /tmp/20120211124452.tar.gz
[server.com] /tmp/20120211124452.tar.gz
[server.com] done
* sftp upload complete
* executing "cd /var/chroot/home/content/62/8680462/html/capifony/releases && tar xzf /tmp/20120211124452.tar.gz && rm /tmp/20120211124452.tar.gz"
servers: ["server.com"]
[server.com] executing command
command finished in 9561ms
* executing `deploy:finalize_update'
* executing "chmod -R g+w /var/chroot/home/content/62/8680462/html/capifony/releases/20120211124452"
servers: ["server.com"]
[server.com] executing command
command finished in 12790ms
* executing "if [ -d /var/chroot/home/content/62/8680462/html/capifony/releases/20120211124452/app/cache ] ; then rm -rf /var/chroot/home/content/62/8680462/html/capifony/releases/20120211124452/app/cache; fi"
servers: ["server.com"]
[server.com] executing command
command finished in 271ms
* executing "mkdir -p /var/chroot/home/content/62/8680462/html/capifony/releases/20120211124452/app/cache && chmod -R 0777 /var/chroot/home/content/62/8680462/html/capifony/releases/20120211124452/app/cache"
servers: ["server.com"]
[server.com] executing command
command finished in 264ms
* executing "chmod -R g+w /var/chroot/home/content/62/8680462/html/capifony/releases/20120211124452/app/cache"
servers: ["server.com"]
[server.com] executing command
command finished in 122ms
* executing `deploy:share_childs'
* executing "mkdir -p /var/chroot/home/content/62/8680462/html/capifony/shared/app/logs"
servers: ["server.com"]
[server.com] executing command
command finished in 131ms
* executing "if [ -d /var/chroot/home/content/62/8680462/html/capifony/releases/20120211124452/app/logs ] ; then rm -rf /var/chroot/home/content/62/8680462/html/capifony/releases/20120211124452/app/logs; fi"
servers: ["server.com"]
[server.com] executing command
command finished in 241ms
* executing "ln -nfs /var/chroot/home/content/62/8680462/html/capifony/shared/app/logs /var/chroot/home/content/62/8680462/html/capifony/releases/20120211124452/app/logs"
servers: ["server.com"]
[server.com] executing command
command finished in 115ms
* executing "mkdir -p /var/chroot/home/content/62/8680462/html/capifony/shared/web/uploads"
servers: ["server.com"]
[server.com] executing command
command finished in 148ms
* executing "if [ -d /var/chroot/home/content/62/8680462/html/capifony/releases/20120211124452/web/uploads ] ; then rm -rf /var/chroot/home/content/62/8680462/html/capifony/releases/20120211124452/web/uploads; fi"
servers: ["server.com"]
[server.com] executing command
command finished in 106ms
* executing "ln -nfs /var/chroot/home/content/62/8680462/html/capifony/shared/web/uploads /var/chroot/home/content/62/8680462/html/capifony/releases/20120211124452/web/uploads"
servers: ["server.com"]
[server.com] executing command
command finished in 131ms
* executing "mkdir -p /var/chroot/home/content/62/8680462/html/capifony/shared/vendor"
servers: ["server.com"]
[server.com] executing command
command finished in 100ms
* executing "if [ -d /var/chroot/home/content/62/8680462/html/capifony/releases/20120211124452/vendor ] ; then rm -rf /var/chroot/home/content/62/8680462/html/capifony/releases/20120211124452/vendor; fi"
servers: ["server.com"]
[server.com] executing command
command finished in 154ms
* executing "ln -nfs /var/chroot/home/content/62/8680462/html/capifony/shared/vendor /var/chroot/home/content/62/8680462/html/capifony/releases/20120211124452/vendor"
servers: ["server.com"]
[server.com] executing command
command finished in 301ms
* executing "mkdir -p /var/chroot/home/content/62/8680462/html/capifony/shared/app/config"
servers: ["server.com"]
[server.com] executing command
command finished in 243ms
* executing "touch /var/chroot/home/content/62/8680462/html/capifony/shared/app/config/parameters.ini"
servers: ["server.com"]
[server.com] executing command
command finished in 180ms
* executing "ln -nfs /var/chroot/home/content/62/8680462/html/capifony/shared/app/config/parameters.ini /var/chroot/home/content/62/8680462/html/capifony/releases/20120211124452/app/config/parameters.ini"
servers: ["server.com"]
[server.com] executing command
command finished in 210ms
* executing "if [ -d web/css ] ; then mkdir -p web/css; fi"
servers: ["server.com"]
[server.com] executing command
command finished in 100ms
* executing "if [ -d web/images ] ; then mkdir -p web/images; fi"
servers: ["server.com"]
[server.com] executing command
command finished in 98ms
* executing "if [ -d web/js ] ; then mkdir -p web/js; fi"
servers: ["server.com"]
[server.com] executing command
command finished in 104ms
* executing "find /var/chroot/home/content/62/8680462/html/capifony/releases/20120211124452/web/css /var/chroot/home/content/62/8680462/html/capifony/releases/20120211124452/web/images /var/chroot/home/content/62/8680462/html/capifony/releases/20120211124452/web/js -exec touch -t 201202111245.31 {} ';'; true"
servers: ["server.com"]
[server.com] executing command
command finished in 2351ms
triggering after callbacks for `deploy:finalize_update'
* executing `symfony:assets:install'
* executing "cd /var/chroot/home/content/62/8680462/html/capifony/releases/20120211124452 && /usr/local/php5_3/bin/php app/console assets:install web --env=prod"
servers: ["server.com"]
[server.com] executing command
*** [err :: server.com] PHP Deprecated: Comments starting with '#' are deprecated in /web/conf/php5.ini on line 1256 in Unknown on line 0
*** [err :: server.com] PHP Deprecated: Comments starting with '#' are deprecated in /web/conf/php5.ini on line 1257 in Unknown on line 0
*** [err :: server.com]
*** [err :: server.com] Deprecated: Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in Unknown on line 0
** [out :: server.com]
** [out :: server.com]
** [out :: server.com]
** [out :: server.com] [Symfony\Component\Config\Exception\FileLoaderLoadException]
** [out :: server.com] Cannot import resource "/home/content/62/8680462/html/capifony/releases/20120211124452/app/config/parameters.ini" from "/home/content/62/8680462/html/capifony/releases/20120211124452/app/config/config.yml".
** [out :: server.com]
** [out :: server.com]
** [out :: server.com]
** [out :: server.com]
** [out :: server.com]
** [out :: server.com]
** [out :: server.com] [InvalidArgumentException]
** [out :: server.com] The "/home/content/62/8680462/html/capifony/releases/20120211124452/app/config/parameters.ini" file is not valid.
** [out :: server.com]
** [out :: server.com]
** [out :: server.com]
command finished in 3582ms
*** [deploy:update_code] rolling back
* executing "rm -rf /var/chroot/home/content/62/8680462/html/capifony/releases/20120211124452; true"
servers: ["server.com"]
[server.com] executing command
command finished in 13568ms
failed: "sh -c 'cd /var/chroot/home/content/62/8680462/html/capifony/releases/20120211124452 && /usr/local/php5_3/bin/php app/console assets:install web --env=prod'" on server.com
這是我deploy.rb:
set :application, "My App"
set :domain, "server.com"
set :deploy_to, "/var/chroot/home/content/62/8680462/html/capifony"
set :app_path, "app"
set :repository, "http://path.to/svn/"
set :scm, :subversion
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `subversion`, `mercurial`, `perforce`, `subversion` or `none`
#set :deploy_via, :rsync_with_remote_cache
set :deploy_via, :copy
set :model_manager, "doctrine"
# Or: `propel`
role :web, "server.com" # Your HTTP server, Apache/etc
role :app, "server.com" # This may be the same as your `Web` server
role :db, "server.com", :primary => true # This is where Rails migrations will run
set :keep_releases, 3
set :shared_files, ["app/config/parameters.ini"]
set :shared_children, [ app_path + "/logs", "web/uploads", "vendor"]
set :update_vendors, false
set :user, "root"
set :use_sudo, false
# set :dump_assetic_assets, false
set :php_bin, "/usr/local/php5_3/bin/php"
#set :symfony_lib, "/var/chroot/home/content/62/8680462/html/vendor/symfony"
請注意,我已將update_vendors設置爲false,因爲Git不在服務器上工作,所以我手動將其tarred並將文件上載到共享文件夾。 我在本地和遠程機器上運行PHP 5.3.6。
感謝
Id確實運行了cap deploy:setup ...什麼是cap deploy:cold for?它看起來就像做帽子部署一樣。還有,是的,我似乎有parameters.ini ...這裏是:$ pwd /var/chroot/home/content/62/8680462/html/capifony/shared/app/config $ ls - lart -rw-r - r-- 1 mygroup inetuser 0 Feb 11 05:45 parameters.ini – Prem 2012-02-12 17:29:36
'deploy:cold' - 部署並啓動一個'cold'應用程序。如果您之前尚未部署您的應用程序,或者您的應用程序(由於某些其他原因)當前未運行,此功能非常有用。我記得它是symfony1項目的有用命令,但我並沒有將它用於symfony2項目。當'parameters.ini'文件不是有效的ini文件時,拋出'InvalidArgumentException'異常。確保它的格式正確。 – 2012-02-13 09:59:48