snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
11.08k stars 3.18k forks source link

Installation process should monitor database deployment #10863

Closed adagioajanes closed 2 years ago

adagioajanes commented 2 years ago

Snipe-IT Version

v6-RC?

Operating System

Windows

Web Server

Azure App Service/IIS

PHP Version

7.4

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

When installing Snipe IT on Azure App Service, the database deployment step times out and returns an error to the web browser. The process did not actually fail. But, the Azure App Service decided 240 seconds was long enough to wait, and gave up. The migrations don't stop. They eventually finish. But, for an admin, this looks like a failed install.

As a temporary workaround, I simply let the process time out, and give it another 10 minutes to be sure it finished setting up the database. Then, I manually navigate to the Create User page to complete the installation process.

This problem can present itself in any web server that limits HTTP request timeouts. But, Azure App Service specifically has this value hard coded. So I cannot increase the time out length to work around the issue.

Describe the solution you'd like A clear and concise description of what you want to happen.

I would like the database migration process to navigate to a page with a log textbox. I would like the log to show the output of the database migrations, so that I can see exactly where in the process it is currently. By doing it this way, the time out period on Azure App Service would be bypassed, as the page would successfully load. This would be the ideal solution in my mind. Not only would it solve the timeout problem, but it would provide an easy to access log of the migration process that admins can utilize to troubleshoot a failing installation.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

In terms of other ways to change the application, I know there are ways (although I am unsure if it is possible in PHP/Laravel) to have a web application begin to respond with a blank character, and then pull that response back. Supposedly that tricks Azure App Service into not timing out. But that would be a hacky workaround for one platform. So, not recommended.

In terms of what I can do as an admin, I could just, not rely on the install process and manually do that step myself. But, I think that would go against how it is recommended to install Snipe IT.

Additional context Add any other context or screenshots about the feature request here.

This is not an urgent issue, as I am definitely able to work around it. But, for the sake of being compatible with as many hosting platforms as possible, I recommend making the database migration log output to the browser window to prevent a timeout.

snipe commented 2 years ago

I would like the log to show the output of the database migrations, so that I can see exactly where in the process it is currently.

That's currently what the QuickStart does - it shows you the output of the migrations command. (It's the one screenshot that's not in this guide, of course.) https://snipe-it.readme.io/docs/pre-flight-setup

This isn't a PHP limitation AFAIK - you can increase the max_execution_time and memory limits to prevent PHP from timing out, but I cannot speak to what magic you'd need from Azure. This is the first time this has been mentioned, so I don't think it's a very common problem?

Snipe-IT Documentation
Pre-Flight & Setup
Snipe-IT comes with a pre-flight check and setup to help make sure your environment is set up correctly, create the database tables and add your first admin user. If you've been able to get through the first few steps (Downloading, Configuration, and Installing Dependencies) successfully, you should...
adagioajanes commented 2 years ago

@snipe This is not a common problem. You are correct. Most systems should be able to work around it. I happen to be using one that cannot.

However, IMHO, it is a best practice to not have a http request hanging that long waiting for a response. Having a monitor for the migration output is a great way to see where the system is in the process.

Additionally, in terms of user experience, they may think that the request hanging is the system failing to respond. When, in reality, it is just going through a long process that takes time.

adagioajanes commented 2 years ago

I think we can close this. I have found an even easier workaround for those who run into this issue. When your preflight screen looks good, don't click the button to proceed to database setup. Instead, launch your console and run a php artisan migrate yourself. Once complete, go back to the pre-flight screen, and proceed with database setup. It is safe to do this, because Laravel has already tracked your previous migration, and will simply proceed to the next page. :)