Symfony2 + Capifony — Сбой при развертывании

Я не знаю, что я делаю с этим. Я пытаюсь развернуть приложение Symfony 2 3 дня. Я также пытался использовать DeployBundle, но он не работал, из-за проблем с windows и rsync. Сейчас я снова пытаюсь использовать capifony. У Capifony есть трагическая документация …

Я перестал подключаться к хранилищу битбакетов, потому что у меня были проблемы с ключами SSH. Сейчас я использую локальный репозиторий, но сервер удаленный, и я подключен через openVPN. Если я буду использовать cap deploy или же cap deploy:cold (Я не знаю, в чем тут разница), поэтому капифония не сказала точно, в чем проблема. Я также обнаружил, что можно развернуть в локальной папке
Развертывание приложения на локальном хосте с использованием Capistrano.

Но капифония говорит the task local does not exist, Я не знаю, как разработчик смог использовать эту команду.

Мой журнал capifony (во время развертывания на сервере):

JoHn@JOHN-PC /d/Prace/Project/web/os-project/web (master)
$ git branch -D deploy
Deleted branch deploy (was 5f8a385).

JoHn@JOHN-PC /d/Prace/Project/web/os-project/web (master)
$ cap deploy:cold
DL is deprecated, please use Fiddle
* 2015-01-19 22:33:33 executing `deploy:cold'
* 2015-01-19 22:33:33 executing `deploy:update'
** transaction: start
* 2015-01-19 22:33:33 executing `deploy:update_code'
triggering before callbacks for `deploy:update_code'
--> Updating code base with copy strategy
executing locally: "git ls-remote d:\\Prace\\Project\\web\\os-project\\ ma
ster"command finished in 90ms
* getting (via checkout) revision 5f8a385ac83bf26188b3ab58ce985a3b45dfc96f to
C:/Users/JoHn/AppData/Local/Temp/20150119213334
executing locally: git clone -q -b master d:\Prace\Project\web\os-project\
C:/Users/JoHn/AppData/Local/Temp/20150119213334 && cd C:/Users/JoHn/AppData/Loc
al/Temp/20150119213334 && git checkout -q -b deploy 5f8a385ac83bf26188b3ab58ce98
5a3b45dfc96f
command finished in 2694ms
* Compressing C:/Users/JoHn/AppData/Local/Temp/20150119213334 to C:/Users/JoHn
/AppData/Local/Temp/20150119213334.tar.gz
executing locally: tar czf 20150119213334.tar.gz 20150119213334
command finished in 2761ms
servers: ["10.0.0.61"]
[email protected]'s password:
** sftp upload C:/Users/JoHn/AppData/Local/Temp/20150119213334.tar.gz -> /tmp/2
0150119213334.tar.gz
[10.0.0.61] /tmp/20150119213334.tar.gz
[10.0.0.61] done
* sftp upload complete
* executing "cd /var/www/html/project/releases && tar xzf /tmp/20150119213334
.tar.gz && rm /tmp/20150119213334.tar.gz"servers: ["10.0.0.61"]
[10.0.0.61] executing command
command finished in 491ms
* 2015-01-19 22:34:33 executing `deploy:finalize_update'
* executing "chmod -R g+w /var/www/html/project/releases/20150119213334"servers: ["10.0.0.61"]
[10.0.0.61] executing command
command finished in 264ms
--> Creating cache directory
* executing "sh -c 'if [ -d /var/www/html/project/releases/20150119213334/app
/cache ] ; then rm -rf /var/www/html/project/releases/20150119213334/app/cache;
fi'"servers: ["10.0.0.61"]
[10.0.0.61] executing command
command finished in 260ms
* executing "sh -c 'mkdir -p /var/www/html/project/releases/20150119213334/ap
p/cache && chmod -R 0777 /var/www/html/project/releases/20150119213334/app/cach
e'"servers: ["10.0.0.61"]
[10.0.0.61] executing command
command finished in 94ms
* executing "chmod -R g+w /var/www/html/project/releases/20150119213334/app/c
ache"servers: ["10.0.0.61"]
[10.0.0.61] executing command
command finished in 153ms
* 2015-01-19 22:34:34 executing `deploy:share_childs'
--> Creating symlinks for shared directories
* executing "mkdir -p /var/www/html/project/shared/app/logs"servers: ["10.0.0.61"]
[10.0.0.61] executing command
command finished in 292ms
* executing "sh -c 'if [ -d /var/www/html/project/releases/20150119213334/app
/logs ] ; then rm -rf /var/www/html/project/releases/20150119213334/app/logs; f
i'"servers: ["10.0.0.61"]
[10.0.0.61] executing command
command finished in 320ms
* executing "ln -nfs /var/www/html/project/shared/app/logs /var/www/html/anim
alco/releases/20150119213334/app/logs"servers: ["10.0.0.61"]
[10.0.0.61] executing command
command finished in 292ms
* executing "mkdir -p /var/www/html/project/shared/web/uploads"servers: ["10.0.0.61"]
[10.0.0.61] executing command
command finished in 160ms
* executing "sh -c 'if [ -d /var/www/html/project/releases/20150119213334/web
/uploads ] ; then rm -rf /var/www/html/project/releases/20150119213334/web/uplo
ads; fi'"servers: ["10.0.0.61"]
[10.0.0.61] executing command
command finished in 210ms
* executing "ln -nfs /var/www/html/project/shared/web/uploads /var/www/html/a
nimalco/releases/20150119213334/web/uploads"servers: ["10.0.0.61"]
[10.0.0.61] executing command
command finished in 310ms
--> Normalizing asset timestamps
* executing "find /var/www/html/project/releases/20150119213334/web/css /var/
www/html/project/releases/20150119213334/web/images /var/www/html/project/rele
ases/20150119213334/web/js -exec touch -t 201501192134.36 {} ';' &> /dev/null ||
true"servers: ["10.0.0.61"]
[10.0.0.61] executing command
command finished in 303ms
triggering after callbacks for `deploy:finalize_update'
* 2015-01-19 22:34:36 executing `symfony:composer:install'
triggering before callbacks for `symfony:composer:install'
* 2015-01-19 22:34:36 executing `symfony:composer:get'
* executing "if [ -e /var/www/html/project/releases/20150119213334/composer.p
har ]; then echo 'true'; fi"servers: ["10.0.0.61"]
[10.0.0.61] executing command
command finished in 290ms
--> Downloading Composer
* executing "sh -c 'cd /var/www/html/project/releases/20150119213334 && curl
-s http://getcomposer.org/installer | php'"servers: ["10.0.0.61"]
[10.0.0.61] executing command
** [out :: 10.0.0.61] #!/usr/bin/env php
** [out :: 10.0.0.61] All settings correct for using Composer
** [out :: 10.0.0.61] Downloading...
** [out :: 10.0.0.61]
** [out :: 10.0.0.61] Composer successfully installed to: /var/www/html/animalc
o/releases/20150119213334/composer.phar
** [out :: 10.0.0.61]
** [out :: 10.0.0.61] Use it: php composer.phar
command finished in 11613ms
--> Installing Composer dependencies
* executing "sh -c 'cd /var/www/html/project/releases/20150119213334 && SYMFO
NY_ENV=prod php composer.phar install --no-dev --verbose --prefer-dist --optimiz
e-autoloader --no-progress'"servers: ["10.0.0.61"]
[10.0.0.61] executing command
command finished in 314ms
*** [deploy:update_code] rolling back
* executing "rm -rf /var/www/html/project/releases/20150119213334; true"servers: ["10.0.0.61"]
[10.0.0.61] executing command
command finished in 320ms
failed: "sh -c 'sh -c '\\''cd /var/www/html/project/releases/20150119213334 &&
SYMFONY_ENV=prod php composer.phar install --no-dev --verbose --prefer-dist --op
timize-autoloader --no-progress'\\'''" on 10.0.0.61

Я нашел много команд и их комбинаций, поэтому в моем deploy.rb есть много комментариев о командах для будущего использования.

set :application, "project"set :domain,      "10.0.0.61"set :deploy_to,   "/var/www/html/project"set :app_path,    "app"set :user,        "kunesd"
#ssh_options[:forward_agent] = true
#ssh_options[:port] = "22"set :branch, "master"
# set :symfony_env_prod, "dev"
set   :scm,           :git
set   :repository,    "d:\\Prace\\Project\\web\\os-project\\"set   :deploy_via,    :copy
# 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, :primary => true       # This may be the same as your `Web` server

# Composer settings
# set :use_composer, true
#set :use_composer_tmp, true
# set :update_vendors, false
#set :vendors_mode, "install"
# General settings
#set :shared_files,    ["app/config/parameters.yml"]
#set :shared_children, [app_path + "/logs", web_path + "/uploads"]
set :keep_releases,  3
set :use_sudo, false
#set :writable_dirs,     [app_path + "/logs", app_path + "/cache", web_path + "/uploads"]
#set :webserver_user,    "www-data"#set :permission_method, :acl
#set :use_set_permissions, true

# Be more verbose by uncommenting the following line
logger.level = Logger::TRACE

Спасибо за ответ.

# 1 ОБНОВЛЕНИЕ

Ошибка была в моей структуре папок:

  • .мерзавец
  • Спецификация
  • изображений
  • web -> это SF проект, но Capifony требуется в set :repository .git папка в SF проекте.

Спасибо @Matteo, это сработало, но появилась новая ошибка:

  * Installing dependencies from lock file
* Your requirements could not be resolved to an installable set of packages.
* Problem 1
* - Installation request for sensiolabs/security-checker v2.0.0 -> satisfiable
by sensiolabs/security-checker[v2.0.0].
* - sensiolabs/security-checker v2.0.0 requires ext-curl * -> the requested PH
P extension curl is missing from your system.
* Problem 2
* - sensiolabs/security-checker v2.0.0 requires ext-curl * -> the requested PH
P extension curl is missing from your system.
* - sensio/distribution-bundle v3.0.8 requires sensiolabs/security-checker ~2.
0 -> satisfiable by sensiolabs/security-checker[v2.0.0].
* - Installation request for sensio/distribution-bundle v3.0.8 -> satisfiable
by sensio/distribution-bundle[v3.0.8].

# 2 ОБНОВЛЕНИЕ

мой composer.json:

{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": {
"": "src/",
"SymfonyStandard": "app/"}
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.5.*",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~3.0",
"sensio/framework-extra-bundle": "~3.0",
"incenteev/composer-parameter-handler": "~2.0",
"components/jquery": "1.9.*",
"oyejorge/less.php": "~1.5",
"components/font-awesome": "4.2.0",
"doctrine/doctrine-fixtures-bundle": "2.2.*",
"symfony/serializer": "v2.5.7",
"jms/serializer-bundle": "~0.13",
"twbs/bootstrap": "3.3.*"},
"require-dev": {
"sensio/generator-bundle": "~2.3"},
"scripts": {
"post-root-package-install": [
"SymfonyStandard\\Composer::hookRootPackageInstall"],
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles"],
"post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles"]
},
"config": {
"bin-dir": "bin"},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"incenteev-parameters": {
"file": "app/config/parameters.yml"},
"branch-alias": {
"dev-master": "2.5-dev"}
}
}

1

Решение

Отладьте развертывание вашей процедуры, запустив задачу cap как:

 cap -dv deploy

и выполните в командной строке сервера проблемную задачу (не делайте этого для capifony, выполняйте задачу в ожидании, иначе она выполнит откат выполнения без запроса ошибки)

Тогда вы можете понять реальную проблему.

Подробно, настоящая проблема связана с отсутствующим расширением php ext-curl на общем сервере. Установка его развертывания работает нормально.

Теперь проблема в настройке веб-сервера в правильной веб-папке

1

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]