Capifony + Symfony2:FileLoaderLoadException,无法从config.yml导入资源parameters.ini

时间:2012-02-11 13:32:36

标签: symfony capifony

我试图让Capifony部署使用Symfony2开发的应用程序时遇到以下问题。我正在将它部署到共享的网络托管服务器......希望有人可以解释一下:

这是调用cap deploy时的日志:

    /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无法在服务器上运行,因此我手动编译并将文件上载到共享文件夹。 我在本地和远程计算机上运行PHP 5.3.6。

由于

1 个答案:

答案 0 :(得分:1)

您似乎在共享位置(parameters.ini)没有/var/chroot/home/content/62/8680462/html/capifony/shared/app/config/parameters.ini

您是否在cap deploy:setup之前运行了cap deploy:coldcap deploy?如果需要,可以在运行cap deploy之前手动创建它。