部署带有capifony的symfony2时资产安装错误

时间:2013-01-11 09:38:47

标签: symfony deployment capifony

我正在尝试使用capifony部署symfony2项目。

我收到以下错误:

--> Updating code base with rsync_with_remote_cache strategy
--> Creating cache directory................................✔
--> Creating symlinks for shared directories................✔
--> Creating symlinks for shared files......................✔
--> Normalizing asset timestamps............................✔
--> Downloading Composer....................................✔
--> Updating Composer dependencies..........................✔
--> Building bootstrap file.................................✔
--> Updating Composer.......................................✔
--> Dumping an optimized autoloader.........................✔
--> Installing bundle's assets..............................✘
*** [err :: server.de] 
*** [err :: server.de] 
*** [err :: server.de] 
*** [err :: server.de] [Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException]
*** [err :: server.de] You have requested a non-existent parameter "secret".
*** [err :: server.de] 
*** [err :: server.de] 
*** [err :: server.de] 
*** [deploy:update_code] rolling back
failed: "sh -c 'sh -c '\\''cd /var/www/server.de/releases/20130111092102 && php app/console assets:install web --env=prod'\\'''" on server.de

我的deploy.rb

set :application, "Testproject"
set :domain,      "server.de"
set :deploy_to,   "/var/www/server.de/"
set :app_path,    "app"
set :user,        "username"
ssh_options[:forward_agent] = true

set :repository,  "file:///home/kai/webprojects/testproject/.git"
set :scm,         :git
set   :deploy_via,    :rsync_with_remote_cache
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `subversion`, `mercurial`, `perforce`, or `none`

set :model_manager, "doctrine"
# Or: `propel`

role :web,        domain                         # Your HTTP server, Apache/etc
role :app,        domain                         # This may be the same as your `Web` server
role :db,         domain, :primary => true       # This is where Symfony2 migrations will run

set :use_sudo,          false

set  :keep_releases,  3
set  :update_vendors, true
set  :shared_files,      ["app/config/parameters.yml"]
set  :shared_children,     [app_path + "/logs", web_path + "/uploads", "vendor"]
set  :use_composer, true

手动运行: php app / console assets:安装web --env = prod 工作没有错误

修改 由于秘密参数,PéCé的评论: 这是我的app / config / parameters.yml

parameters:
    database_driver:   pdo_mysql
    database_host:     127.0.0.1
    database_port:     ~
    database_name:     dbName
    database_user:     dbName
    database_password: secretPassword

    mailer_transport:  smtp
    mailer_host:       localhost
    mailer_user:       ~
    mailer_password:   ~

    locale:            de
    secret:            SomeSecret4465466

    beryllium_cache.client.servers: { "localhost": 11211 }

感谢您的想法

1 个答案:

答案 0 :(得分:1)

我找到了答案。它清楚地写在头号文件中:

最后一步是配置app / config / parameters.yml文件。最好的方法是手动在服务器上的共享文件夹中创建此文件:

ssh your_deploy_server
mkdir -p /var/www/my-app.com/shared/app/config
vim /var/www/my-app.com/shared/app/config/parameters.yml

正确配置parameters.yml文件后,您应该能够测试已部署的应用程序。在每次后续部署中,相同的app / config / parameters.yml文件将符号链接到您的应用程序中,这意味着您只需在初始部署后进行配置。

多数民众赞成:)