Laravel Forge部署环境变量问题 [英] Laravel Forge Deployment environment variable issue
问题描述
我的应用程序缺少必需的环境变量,因此无法部署.
My App will not deploy because it is missing required environment variables.
当我在Forge中进行设置时,它们会出现.一旦我点击部署,它们全部消失,那么我的部署就会失败.
When I set these from within Forge, they appear. As soon as I hit deploy they all disappear, then my deploy fails.
我正在将Symfony2与Digital Ocean一起使用-但不应有所作为,问题是所有环境变量在部署之前都会被删除.那不对吗?
I am using Symfony2 with Digital Ocean - but shouldn't make a difference, the issue is all environment variables get deleted prior to a deploy. That can't be right?
这是来自Symfony的错误消息,但这是由于未设置环境变量(在伪造中,我可以看到它在部署之前就被删除了)
Here is the error message from Symfony, but it is due to the environment variable not being set (in forge I can see it get deleted right before a deploy)
- Installing tedivm/stash-bundle (v0.4.2)
Loading from cache
- Installing twig/extensions (v1.2.0)
Loading from cache
Generating autoload files
Creating the "app/config/parameters.yml" file
PHP Fatal error: Class 'Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle' not found in /home/forge/beta.dashboardhub.io/app/AppKernel.php on line 31
PHP Stack trace:
PHP 1. {main}() /home/forge/beta.dashboardhub.io/app/console:0
PHP 2. Symfony\Component\Console\Application->run() /home/forge/beta.dashboardhub.io/app/console:27
PHP 3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /home/forge/beta.dashboardhub.io/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:126
PHP 4. Symfony\Component\HttpKernel\Kernel->boot() /home/forge/beta.dashboardhub.io/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:70
PHP 5. Symfony\Component\HttpKernel\Kernel->initializeBundles() /home/forge/beta.dashboardhub.io/app/bootstrap.php.cache:2343
PHP 6. AppKernel->registerBundles() /home/forge/beta.dashboardhub.io/app/bootstrap.php.cache:2513
Fatal error: Class 'Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle' not found in /home/forge/beta.dashboardhub.io/app/AppKernel.php on line 31
Call Stack:
0.0002 225112 1. {main}() /home/forge/beta.dashboardhub.io/app/console:0
0.0253 3126784 2. Symfony\Component\Console\Application->run() /home/forge/beta.dashboardhub.io/app/console:27
0.0279 3329440 3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /home/forge/beta.dashboardhub.io/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:126
0.0279 3329664 4. Symfony\Component\HttpKernel\Kernel->boot() /home/forge/beta.dashboardhub.io/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:70
0.0279 3329960 5. Symfony\Component\HttpKernel\Kernel->initializeBundles() /home/forge/beta.dashboardhub.io/app/bootstrap.php.cache:2343
0.0279 3330560 6. AppKernel->registerBundles() /home/forge/beta.dashboardhub.io/app/bootstrap.php.cache:2513
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [--ignore-platform-reqs] [packages1] ... [packagesN]
推荐答案
这是Forge的问题/功能.确实会在部署之前重置环境变量.
This is an issue / feature of Forge. It does reset the environment variables before a deploy.
这是他们支持的回应...
Here is the response from their support...
是的,我今天要解决的是一个混乱的问题.基本上 最初的想法是,如果您要安装新项目,您将 需要新的环境变量,但是许多人设置了环境 安装前先输入变量.
Yeah that has been a point of confusion I will fix today. Basically the original thought was if you are installing a new project you will want new environment variables, but many people set the environment variables before installing.
泰勒·奥特威尔
因此,它将很快得到修复.
So it looks like it will be fixed soon.
我无法找到Forge票证,Twitter帐户或部署变更日志来跟踪此进度.
I have not been able to find a Forge Ticket, Twitter Account or Deployment changelog to follow this progress.
临时解决方案/解决方法
否当前没有部署更改日志.我会让你知道 准备好要走的时候.比听起来有些棘手……因为 现在,您可以安装项目,然后取消选中安装 Composer"步骤,然后添加您的环境变量,然后单击 部署"按钮,使它可以执行作曲家的安装步骤.
No there is not currently a deployment change log. I will let you know when it is ready to go. It’s a little trickier than it sounds… for now, you could install the project and just un-check the "Install Composer" step, then add your environment variables, then click the "Deploy" button so it picks up the composer install step.
泰勒·奥特威尔
这篇关于Laravel Forge部署环境变量问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!