Closed lorisleiva closed 3 years ago
I have the same problem with shopware and Magento and just go with it 🤷 first deployment fails.
Although my dream is to setup all secrets, credentials and hosts as gitlab/bitbucket/github action/pipeline secrets and have a task which creates the .env/whatever config is needed.
I hope this answer is at least a little helpful, even if pretty offtopic 🙈
I don't think it is valuable in a production environment and actually breaks the flow on your first deployment by not allowing you to deploy at all.
Yes, I agree. Let's now remove those tasks.
Will add a doc about missing .env file and how to create it.
Or maybe some general task for creating .env files? For example a task what will copy local .env.example and upload it to remote host?
Hmm maybe. I guess you'd be calling this "Copy local env" task after a first deploy anyway right? Otherwise, you wouldn't have the structure in place to paste it there.
Do you want me to make a PR tomorrow? If so, should I remove both the hooks and the tasks for the laravel
, magento
and shopware
recipes?
I already removed deploy:check_env from laravel recipe.
For creating .env
in the shared
folder we don't need anything.
BTW, Should 'artisan:migrate'
be included by default to Laravel deploy?
I just created a new Laravel + Jetstram app. Was able to configure VPS and deploy it in ~5min.
Nice! Yeah it 100% should. It's even in the deploy script of both Forge and Ploi so I think it's expected to be there by default.
Btw I saw you managed to provision your servers in a way that does need php fpm reloading. How is it working being the scenes? 🙂
How is it working being the scenes?
I’m going to write a doc about it later today 😀
And yes, dep provision
setups webserver correctly and no reloading is needed.
Just closing this for housekeeping since it's been fixed and deployed. Thank you! ❤️
v7.0.0-beta.39
Hi there 👋
I've just installed Deployer on a new project and I get the following error when deploying for the first time.
This is because, when deploying initially, there is no production
.env
file to use and therefore it's expected to fail.Prior to the latest version, we fixed this by using the
skipIfNoEnv
option on theartisan:migrate
task.https://github.com/deployphp/deployer/blob/20ca4718f2065c30b54a0b943112d50349141763/recipe/laravel.php#L112
This would allow us to create an empty
.env
and give us the chance to update it before runningdep deploy
one more time.However, I've noticed we've recently added a more automatic way to handle the missing
.env
file by copying it from.env.example
(using thedeploy:check_env
task). Whilst this is a good practice in a local machine, I don't think it is valuable in a production environment and actually breaks the flow on your first deployment by not allowing you to deploy at all.Moreover, I don't see any use case where developers would set up their production environment variables and secrets in a
.env.example
file and commit this to their repository as this would be a big no-no security-wise.In conclusion, I think it's okay to offer the new
deploy:check_env
task but I don't think it's a good idea to use it by default using abefore
hook.https://github.com/deployphp/deployer/blob/20ca4718f2065c30b54a0b943112d50349141763/recipe/laravel.php#L237
What do you think? I'm happy to submit a PR if you agree.