Giter Club home page Giter Club logo

Comments (12)

jaydrogers avatar jaydrogers commented on May 24, 2024 1

For sure, I totally agree with this.

My proposal is I think I can eliminate this line all together:

if [ "$APP_ENV_SETTING" != "local" ] && [ ! -z $APP_ENV_SETTING ] && [ ${CI_ENV:="false"} != "true" ]; then

I don't think we need to check for any of this anymore. Thoughts?

from docker-php.

jaydrogers avatar jaydrogers commented on May 24, 2024 1

I think --force flag is not a good idea for production

If we don't add --force, won't it prompt for a confirmation? Since there is no TTY, I think we need to leave it this way, correct?

Also, the user is choosing to enable this migration too... so it's not it's enabled by default.

Looking forward to hearing your thoughts!

from docker-php.

jaydrogers avatar jaydrogers commented on May 24, 2024 1

I totally agree.

The migration script is great for small apps, but for large apps we recommend running all migrations manually. 👍

from docker-php.

dakira avatar dakira commented on May 24, 2024 1

@jaydrogers @shinsenter Hey. Sorry for not being part of the discussion, was busy with my family. Thanks for fixing this! :-)

from docker-php.

jaydrogers avatar jaydrogers commented on May 24, 2024

I think the true discussion is down to this line:

if [ "$APP_ENV_SETTING" != "local" ] && [ ! -z $APP_ENV_SETTING ] && [ ${CI_ENV:="false"} != "true" ]; then

This line was added when things were more automated.

Proposed change

  • Maybe I just remove condition all together? I don't see a need for it now since we can explicitly enable migrations now with AUTORUN_LARAVEL_MIGRATION. Meaning if you have AUTORUN_LARAVEL_MIGRATION set to true, it should attempt to run the migrations without checking what APP_ENV you are in.

Opening up for comment

Does this sound good @dakira? @danpastori: What are your thoughts?

from docker-php.

shinsenter avatar shinsenter commented on May 24, 2024

@jaydrogers
According to the information from the official Laravel documentation, Laravel determines if either the APP_ENV environment variable has been externally provided.

Before loading your application's environment variables, Laravel determines if either the APP_ENV environment variable has been externally provided or if the --env CLI argument has been specified. If so, Laravel will attempt to load an .env.[APP_ENV] file if it exists. If it does not exist, the default .env file will be loaded.

I think it's better for letting user change the value of APP_ENV either from docker-compose.yml file or via the docker command. The default value should be set as APP_ENV_SETTING=${APP_ENV:-production}.

from docker-php.

shinsenter avatar shinsenter commented on May 24, 2024

@jaydrogers
Yes, I think you can remove that condition.

By the way, in the AUTORUN_LARAVEL_REFRESH_CACHE block, it should be only these two commands:

su - webuser -c "php $WEBUSER_HOME/artisan optimize:clear"
su - webuser -c "php $WEBUSER_HOME/artisan optimize"

Ref:

from docker-php.

jaydrogers avatar jaydrogers commented on May 24, 2024

Example of new automation script

Here's the example that I am thinking of updating it to, what does everyone think? https://github.com/serversideup/docker-php/blob/fix/adjust-automation-logic/templates/fpm/etc/cont-init.d/50-laravel-automations

AUTORUN_LARAVEL_REFRESH_CACHE

We had issues with this in the past, that's why I commented it out. I might want to circle back with @danpastori to see if it is safe to renable it. That might be done on another PR/issue though.

Let me know your thoughts on the script! 😃👍

from docker-php.

shinsenter avatar shinsenter commented on May 24, 2024

@jaydrogers
Since some migration operations are destructive, which means they may cause us to lose data.
Honestly, I think --force flag is not a good idea for production.

su - webuser -c "php $WEBUSER_HOME/artisan migrate --force"

from docker-php.

shinsenter avatar shinsenter commented on May 24, 2024

I think ${AUTORUN_LARAVEL_MIGRATION:="false"} may be a good choice for now, and it should be set to false for production.

I tried to imagine the case that I needed to run multiple instances behind a LB for production, it would be a big deal.

from docker-php.

shinsenter avatar shinsenter commented on May 24, 2024

So, the PR is LGTM

from docker-php.

jaydrogers avatar jaydrogers commented on May 24, 2024

Just merged this fix 🎉🚀

from docker-php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.