是否可以设置部署脚本,以便供应商只有在自上次更新后deps文件发生更改时才会更新?
我最近将我的Symfony2应用程序升级到2.1并将其迁移到新服务器,因此我认为我将配置Capifony以使部署更简单.一切都变得很好,除了它现在没有使用APCLoader的事实,所以我不得不暂时评论它,直到它被排序.
以下是相关代码app.php:
$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
// Use APC for autoloading to improve performance.
// Change 'sf2' to a unique prefix in order to prevent cache key conflicts
// with other applications also using APC.
$loader = new ApcClassLoader('my_prefix', $loader);
$loader->register(true);
Run Code Online (Sandbox Code Playgroud)
问题是'my_prefix'每个版本不是唯一的,因此它最终会尝试查找属于以前版本的缓存文件,这些文件可能存在也可能不存在.这显然是一个非常大的问题!
什么是最好的解决方案?我应该以某种方式编写一个在部署之前运行capifony的任务,将前缀更改为唯一的东西,例如#{latest_release}变量?或者我应该在每次部署后以某种方式重置APC缓存的全部内容?
我不太确定做这些事情的最佳方法,所以如果你推荐其中一个可以请你指出正确的方向来实现它吗?或者有没有我想到的替代解决方案?
当cap deploy我的Symfony2项目,然后登录到我的服务器,我看到dev(app_dev.php)运行正常但prod版本(app.php)没有.
错误是
[Tue Jan 03 14:31:48 2012] [error] [client xxx.xxx.xxx.xxx] PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Failed to write cache file "/var/www/example/prod/releases/20120103202539/app/cache/prod/classes.php".' in /var/www/example/prod/releases/20120103202539/app/bootstrap.php.cache:1079\nStack trace:\n#0 /var/www/example/prod/releases/20120103202539/app/bootstrap.php.cache(1017): Symfony\\Component\\ClassLoader\\ClassCollectionLoader::writeCacheFile('/var/www/example/p...', '<?php ????name...')\n#1 /var/www/example/prod/releases/20120103202539/app/bootstrap.php.cache(682): Symfony\\Component\\ClassLoader\\ClassCollectionLoader::load(Array, '/var/www/example/p...', 'classes', false, false, '.php')\n#2 /var/www/example/prod/releases/20120103202539/web/app.php(10): Symfony\\Component\\HttpKernel\\Kernel->loadClassCache()\n#3 {main}\n thrown in /var/www/example/prod/releases/20120103202539/app/bootstrap.php.cache on line 1079
Run Code Online (Sandbox Code Playgroud)
查看最近部署的缓存目录,我看到:
drwxrwxrwx 4 root root 4096 Jan 3 14:28 .
drwxrwxr-x 5 root root 4096 Jan 3 14:28 ..
drwxr-xr-x 6 www-data www-data 4096 Jan 3 14:28 dev
drwxrwxr-x 7 …Run Code Online (Sandbox Code Playgroud) 我已经将DoctrineMigrationsBundle安装到我的Symfony2应用程序中,但是当我尝试部署到我的开发服务器时,我收到以下错误:
Do you really want to migrate dev's database? (y/N)
y
* executing "sh -c ' cd /var/www/vhosts/xyz.co.uk/releases/20130413181722 && php app/console doctrine:migrations:migrate --env=dev --no-interaction'"
servers: ["x.xx.xx.xxx"]
[x.xx.xx.xxx] executing command
** [out :: x.xx.xx.xxx]
** [out :: x.xx.xx.xxx] Application Migrations
** [out :: x.xx.xx.xxx]
** [out :: x.xx.xx.xxx]
** [out :: x.xx.xx.xxx] Migrating up to 0 from 0
** [out :: x.xx.xx.xxx]
** [out :: x.xx.xx.xxx]
** [out :: x.xx.xx.xxx]
** [out :: x.xx.xx.xxx] [Doctrine\DBAL\Migrations\MigrationException]
** [out :: x.xx.xx.xxx] Could not …Run Code Online (Sandbox Code Playgroud) 我一直收到这个错误 (OpenSSL::PKey::PKeyError: not a public key "/var/www/.ssh/id_rsa.pub")
提前致谢.
我的deploy.rb看起来像这样:
set :application, "goom"
set :domain, "goom@bloom.com"
set :deploy_to, "/var/www/goom"
#set :app_path, "app"
set :repository, "/var/www/goom/.git"
set :scm, :git
set :deploy_via, :copy
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `subversion`, `mercurial`, `perforce`, $
set :model_manager, "doctrine"
# Or: `propel`
role :web, domain # Your HTTP server, Apache/etc
role :app, domain # This may be the same as your$
role :db, domain, :primary => true # This is where Rails migratio$
Run Code Online (Sandbox Code Playgroud) $ cap deploy
Run Code Online (Sandbox Code Playgroud)
失败了,这是输出失败的片段
Run Code Online (Sandbox Code Playgroud)* executing "cd /var/www/site/prod/releases/20120831164520 && php app/console assetic:dump web --env=prod --no-debug" servers: ["site.me"] [site.me] executing command ** [out :: site.me] Dumping all prod assets. ** [out :: site.me] Debug mode is off. ...... ** [out :: site.me] [file+] web/js/compiled/c9751db.js *** [err :: site.me] [RuntimeException] *** [err :: site.me] The process timed out.
我在php app/console assetic:dump web --env=prod本地运行命令,没有问题.
我还检查了JSLint上相关的预编译JS文件,没有错误.
这是我如何将问题JS文件嵌入到我的模板中
{% javascripts
'@SoopDesignBundle/Resources/public/js/*.js'
filter='yui_js'
output='js/compiled/*.js'
%}
<script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
Run Code Online (Sandbox Code Playgroud)
我不知道如何解决问题所在.在过去,有一个缺失 …
我正在使用capyfony + symfony2.
上限部署
/var/lib/gems/1.9.1/gems/capistrano-2.13.4/lib/capistrano/configuration/loading.rb:183:in `find_file_in_load_path': no such file to load -- (LoadError)
from /var/lib/gems/1.9.1/gems/capistrano-2.13.4/lib/capistrano/configuration/loading.rb:171:in `load_from_file'
from /var/lib/gems/1.9.1/gems/capistrano-2.13.4/lib/capistrano/configuration/loading.rb:89:in `load'
from /var/lib/gems/1.9.1/gems/capistrano-2.13.4/lib/capistrano/configuration/loading.rb:86:in `block in load'
from /var/lib/gems/1.9.1/gems/capistrano-2.13.4/lib/capistrano/configuration/loading.rb:86:in `each'
from /var/lib/gems/1.9.1/gems/capistrano-2.13.4/lib/capistrano/configuration/loading.rb:86:in `load'
from Capfile:3:in `load'
from /var/lib/gems/1.9.1/gems/capistrano-2.13.4/lib/capistrano/configuration/loading.rb:93:in `instance_eval'
from /var/lib/gems/1.9.1/gems/capistrano-2.13.4/lib/capistrano/configuration/loading.rb:93:in `load'
from /var/lib/gems/1.9.1/gems/capistrano-2.13.4/lib/capistrano/configuration/loading.rb:172:in `load_from_file'
from /var/lib/gems/1.9.1/gems/capistrano-2.13.4/lib/capistrano/configuration/loading.rb:89:in `load'
from /var/lib/gems/1.9.1/gems/capistrano-2.13.4/lib/capistrano/configuration/loading.rb:86:in `block in load'
from /var/lib/gems/1.9.1/gems/capistrano-2.13.4/lib/capistrano/configuration/loading.rb:86:in `each'
from /var/lib/gems/1.9.1/gems/capistrano-2.13.4/lib/capistrano/configuration/loading.rb:86:in `load'
from /var/lib/gems/1.9.1/gems/capistrano-2.13.4/lib/capistrano/cli/execute.rb:65:in `block in load_recipes'
from /var/lib/gems/1.9.1/gems/capistrano-2.13.4/lib/capistrano/cli/execute.rb:65:in `each'
from /var/lib/gems/1.9.1/gems/capistrano-2.13.4/lib/capistrano/cli/execute.rb:65:in `load_recipes'
from /var/lib/gems/1.9.1/gems/capistrano-2.13.4/lib/capistrano/cli/execute.rb:31:in `execute!'
from /var/lib/gems/1.9.1/gems/capistrano-2.13.4/lib/capistrano/cli/execute.rb:14:in `execute'
from /var/lib/gems/1.9.1/gems/capistrano-2.13.4/bin/cap:4:in `<top (required)>'
from /usr/local/bin/cap:19:in `load' …Run Code Online (Sandbox Code Playgroud) 我正在尝试从Jenkins框中部署Symfony2应用程序.我正在为2个不同的环境使用capifony多级部署系统:dev和uat.
当我放
before "symfony:cache:warmup", "symfony:doctrine:migrations:migrate"
Run Code Online (Sandbox Code Playgroud)
在我的dev.rb文件中,我收到了capifony的错误
`symfony:doctrine:migrations:migrate' is only run for servers matching {:roles=>:app, :only=>{:primary=>true}, :except=>{:no_release=>true}}, but no servers matched
Run Code Online (Sandbox Code Playgroud)
我如何使用capifony自动部署和执行迁移?
我正在使用Capifony来部署我的Symfony2应用程序,但截至今天它无法下载composer - jenkins输出:
[32m--> Downloading Composer[0m
* executing "sh -c 'cd /data/www/testing/s00110/releases/20150426161117 && curl -s http://getcomposer.org/installer | php'"
servers: ["*domain*"]
[*domain*] executing command
** [out :: *domain*] <html>
** [out :: *domain*] <head><title>302 Found</title></head>
** [out :: *domain*] <body bgcolor="white">
** [out :: *domain*] <center><h1>302 Found</h1></center>
** [out :: *domain*] <hr><center>nginx</center>
** [out :: *domain*] </body>
** [out :: *domain*] </html>
command finished in 46ms
Run Code Online (Sandbox Code Playgroud)
似乎作曲家将他们的安装程序移动到https,而Capifony没有跟随重定向.有没有选择告诉capifony从哪里下载作曲家?
capifony ×9
symfony ×7
capistrano ×5
deployment ×3
apc ×1
composer-php ×1
doctrine ×1
doctrine-orm ×1
javascript ×1
php ×1
ssh-keys ×1
yui ×1