Closed Johannes-Werbrouck closed 1 year ago
This is for the fly launch
command, or something more abstract?
This is for the fly launch
command! It's the only place where we'll have a lot of user input combined with a lot of different steps to execute
I wonder how this would work with secret questions like database passwords and the like. Is it safe to keep these in an array until we use them?
Don't roast me for this(please), but, for additional services like setting up mysql or redis( any extra fly app really! ), I think it might be a good idea to consider separating them into a separate fly command right( like "fly service:database(which will ask whether user wants mysql postgres or litefs) or fly service:cache(which i think would only provide redis for now")?
Possible reasons:
Possible reasons not to:
Hmm, you do raise valid points. I'm thinking out loud here, but I guess the only issue I could see is fitting a laravel app and a mysql app (for example) together: The database name has to be set on both apps, for example. We could just ignore this and assume there's going to be a fly.toml file in the root directory and run it that way.
Yeah maybe you're right, let's do it that way!
Wew, I was not roasted. Thanks @Johannes-Werbrouck ! Yup That is one way to go about it, assume that the fly.toml file would be in the root dir, if no fly.toml is there, then sadly we dont get to edit a laravel fly app's fly.toml for the database details. But if it's there great!
I'd like to see all the questions directed at the user grouped before we do anything. This way, the user can just fill in everything needed to make the setup they want, and we can get going after all the questions are filled in. Here's my proposal: We put all the answers the user gives into an array, that has an array for every service the user wants to run. So the array could look like this:
We can set up our questions in 2 steps: first we'll ask everything laravel-related since that's definitely what the user wants. Then we can ask for extra laravel-processes like cron and queue workers, and then we can ask for extra services like MySQL or Redis. For each process or service we could create a function that just adds extra stuff into the userInput array. After that, we could have a function for every service that just executes the tasks needed to set it up.
So for each service we would have a
input
function that adds to theuserInput
array, and asetUp
function that executes the tasks needed. Every task would have its own function just like it is right now for the laravel app setup. When the user answered all the questions, we can just run over the keys in the$userInput
array and execute the tasks we need.I believe this would provide a good user experience since the user can just answer all the questions and let the command handle everything after that, and it would provide a great structure for us to build upon because every service follows the same pattern. If we want to add LiteFS later on for example, we just add it to the 'select services' prompt and add
inputLitefs()
andsetupLitefs()
methods.Let me know what you guys think of this!