snipe / snipe-it

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

Stuck on Migrating Datbases when going from 4.x to 5.x #10204

Open cgreidjr4077 opened 2 years ago

cgreidjr4077 commented 2 years ago

Debug mode

Describe the bug

I'm attempting to do an upgrade (both git upgrade and manual) and no matter which method I use I get stuck at the migrating databases part. I let the git install sit for over an hour before giving up. I'm now running php artisan migrate and it's stopped at migrating the first table:


Migrating: 2016_06_01_000001_create_oauth_auth_codes_table

Any hints on what needs to be done?

The databases is remote, running on MySQL 8. PHP Version is 7.4.24.

Reproduction steps

cgreid@snipeit:/var/www/html/snipeit$ php upgrade.php

WELCOME TO THE SNIPE-IT UPGRADER!

This script will attempt to:


STEP 1: Checking PHP requirements:

Current PHP version: (7.4.24) is at least 7.2.5 - continuing... FYI: The php.ini used by this PHP is: /etc/php/7.4/cli/php.ini

Checking Required PHP extensions...

√ bcmath is installed! √ curl is installed! √ fileinfo is installed! √ gd is installed! √ json is installed! √ ldap is installed! √ mbstring is installed! √ mysqli is installed! √ openssl is installed! √ PDO is installed! √ tokenizer is installed! √ xml is installed! √ zip is installed!


STEP 2: Backing up database:

-- Starting backup... Backup failed because: mkdir(): Permission denied.


STEP 3: Putting application into maintenance mode:

-- Failed to enter maintenance mode. file_put_contents(/var/www/html/snipeit/storage/framework/down): failed to open stream: Permission denied


STEP 4: Pulling latest from Git (master branch):

Git is installed. error: cannot open .git/FETCH_HEAD: Permission denied fatal: Unable to create '/var/www/html/snipeit/.git/index.lock': Permission denied fatal: Unable to create '/var/www/html/snipeit/.git/index.lock': Permission denied Cannot save the current index state error: cannot open .git/FETCH_HEAD: Permission denied



Step 5: Cleaning up old cached files:

√ No bootstrap/cache/compiled.php, so nothing to delete. √ No bootsrap/cache/services.php, so nothing to delete. √ No bootstrap/cache/config.php, so nothing to delete.

-- Configuration cache cleared! -- Failed to clear cache. Make sure you have the appropriate permissions. -- Route cache cleared! -- Compiled views cleared!


Step 6: Updating composer dependencies: (This may take a moment.)

-- We couldn't find a local composer.phar. No worries, trying globally.

Illuminate\Foundation\ComposerScripts::postAutoloadDump Installing dependencies from lock file Verifying lock file contents can be installed on current platform. Nothing to install, update or remove Package doctrine/reflection is abandoned, you should avoid using it. Use roave/better-reflection instead. Package patchwork/utf8 is abandoned, you should avoid using it. Use symfony/polyfill-mbstring or symfony/string instead. Package fzaninotto/faker is abandoned, you should avoid using it. No replacement was suggested. Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested. Package sebastian/resource-operations is abandoned, you should avoid using it. No replacement was suggested. Generating optimized autoload files Illuminate\Foundation\ComposerScripts::postAutoloadDump 66 packages you are using are looking for funding. Use the composer fund command to find out more! Generating optimized autoload files Generated optimized autoload files containing 6017 classes


Step 7: Migrating database:

^C cgreid@snipeit:/var/www/html/snipeit$ php composer dump-autoload Could not open input file: composer cgreid@snipeit:/var/www/html/snipeit$ sudo !! sudo php composer dump-autoload [sudo] password for cgreid: Could not open input file: composer cgreid@snipeit:/var/www/html/snipeit$ ls ansible app.json bootstrap codeception.yml composer.json config CONTRIBUTING.md database docker-compose.yml Dockerfile.alpine heroku install.sh package.json phpmd.xml Procfile README.md routes SECURITY.md snipeit.sh tests Vagrantfile webpack.mix.js app artisan c3.php CODE_OF_CONDUCT.md composer.lock _config.yml crowdin.yml docker Dockerfile Dockerfile.fpm-alpine index.html LICENSE package-lock.json phpunit.xml public resources sample_csvs server.php storage upgrade.php vendor cgreid@snipeit:/var/www/html/snipeit$ sudo php artisan migrate


Migrating: 2016_06_01_000001_create_oauth_auth_codes_table

Expected behavior

Expected behavior is for the databases to migrate.

Screenshots

No response

Snipe-IT Version

4.8 I think

Operating System

Debian

Web Server

Apache

PHP Version

7.4.24

Operating System

No response

Browser

No response

Version

No response

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

No response

Additional context

No response

welcome[bot] commented 2 years ago

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

snipe commented 2 years ago

You definitely shouldn’t need to use sudo unless you installed composer and the vendors as root the first time (which we recommend against). I have not seen that be an issue with migrations though.

I am seeing a lot of permission denied errors in your output. Can you try chown-ing the entire snipe-it directory to something writable by the web server?