Chapters
24 Chapters
|
2:45:42
|
Login to bookmark this video
-
Course Code
Subscribe to download the code!Compatible PHP versions: >=5.5.9
Subscribe to download the code!Compatible PHP versions: >=5.5.9
-
This Video
Subscribe to download the video!
Subscribe to download the video!
-
Subtitles
Subscribe to download the subtitles!
Subscribe to download the subtitles!
-
Course Script
Subscribe to download the script!
Subscribe to download the script!
10.
Composer & Cache Permissions
Scroll down to the script below, click on any sentence (including terminal blocks) to jump to that spot in the video!
Subscribe to jump to this part in the video!
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
While the fundamentals of Ansistrano haven't changed, this tutorial is built using Symfony 3, which has significant differences versus Symfony 4 and later.
What PHP libraries does this tutorial use?
// composer.json
{
"require": {
"php": ">=5.5.9",
"doctrine/doctrine-bundle": "^1.6", // 1.6.8
"doctrine/orm": "^2.5", // v2.7.2
"incenteev/composer-parameter-handler": "^2.0", // v2.1.2
"sensio/distribution-bundle": "^5.0.19", // v5.0.20
"sensio/framework-extra-bundle": "^3.0.2", // v3.0.26
"symfony/monolog-bundle": "^3.1.0", // v3.1.0
"symfony/polyfill-apcu": "^1.0", // v1.4.0
"symfony/swiftmailer-bundle": "^2.3.10", // v2.6.3
"symfony/symfony": "3.3.*", // v3.3.5
"twig/twig": "^1.0||^2.0", // v1.34.4
"doctrine/doctrine-migrations-bundle": "^1.2", // v1.2.1
"predis/predis": "^1.1", // v1.1.1
"composer/package-versions-deprecated": "^1.11" // 1.11.99
},
"require-dev": {
"sensio/generator-bundle": "^3.0", // v3.1.6
"symfony/phpunit-bridge": "^3.0", // v3.3.5
"doctrine/data-fixtures": "^1.1", // 1.3.3
"hautelook/alice-bundle": "^1.3" // v1.4.1
}
}
What Ansible libraries does this tutorial use?
# ansible/requirements.yml
-
src: DavidWittman.redis
version: 1.2.4
-
src: ansistrano.deploy
version: 2.7.0
-
src: ansistrano.rollback
version: 2.0.1
6 Comments
Hello guys:
I just upgrade my Symfony app to 4.3 version from 3.4. Everything is working in local but I have problems deploying by Ansistrano.
The task Install Composer dependencies is exploting and appears the message "Executing script cache:clear [KO]", Environment variable not found: \"DATABASE_URL\". But, I put that variable in a file .env.prod.local that I put in the ansistrano_release_path.stdout using the synchronize module of Ansible. Please, can you tell me any suggestion about how to fix this?
Thanks.
Cesar
Hey Cesar
Have you tried to put that env var on
.envwith a dummy value and then override it on.env.localfile?Cheers!
In another project I currently use the ansistrano workflow (and I have tested this additionally with your finished downloaded version).
When I start to deploy I get this message:
An error occurred when executing the \"'cache:clear --no-warmup'\" command: \n PHP Fatal error: Uncaught Error: Class 'Liip\ImagineBundle\LiipImagineBundle' not found in /var/www/project/releases/20180123144814Z/app/AppKernel.php:23 Stack trace: #0 /var/www/project/releases/20180123144814Z/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(448): AppKernel->registerBundles()
In deploy.yml I set
In after-symlink-shared.yml:
In composer.json I add:
Can you please help me to get my deployment going? At this point after researching for hours I'm clueless what to do next.
Thank you very much :)
I manged it to install liip/imagine-bundle onto my ec2 server,
Installing jms/serializer-bundle (2.3.1): Loading from cache - Installing imagine/imagine (v0.7.1): Loading from cache - Installing liip/imagine-bundle (1.9.1): Loading from cache -
but now I get
[Symfony\\Component\\Config\\Exception\\FileLoaderLoadException] \n Class Doctrine\\Bundle\\FixturesBundle\\Fixture not found in /var/www/project/ \n releases/20180124103155Z/app/config/services.yml (which is being imported f \n rom \"/var/www/project/releases/20180124103155Z/app/config/config.yml\").
After digging into it, I used this approach: https://github.com/doctrine/DoctrineFixturesBundle/issues/225#issuecomment-352538507
If there is a better solution, please let me know.
Have a nice day,
Chris
Hey Chris!
I'm glad you figured out the first issue :). What was the fix? Your original code looked good to me, so I was also surprised that the bundle wasn't originally being installed on your server.
About your second issue, this is fascinating! I'm afraid that I caused this bug with the new DoctrineFixturesBundle system :). I've already added a comment on the issue you linked and created an issue on Symfony's main repository. Basically, I think we have a "bug", or a situation we hadn't thought of. But the solution is 100% fine. In fact, it's basically what the "fix" would do internally - so there's no downside to that fix, other than it's annoying that you need to write all that code :).
Cheers!
It's weird and to be honest I actually don't know what the problem was. It's pretty inconclusive for me how this problem could happen to me.
For the second problem it's nice to see that you are fixing this issue. Thanks for the fast reply. With it it's assured that this approach is valid and the error is not caused through a mistake of my own.
Many greetings and keep up the good work!
Chris
"Houston: no signs of life"
Start the conversation!