snipe-it
snipe-it copied to clipboard
Backup error with Docker install
Please confirm you have done the following before posting your bug report:
- [X] I have enabled debug mode
- [X] I have read checked the Common Issues page
Describe the bug
The php artisan snipeit:backup
command fails with error about port not being an integer
root@4acea6c41e59:/var/www/html# php artisan snipeit:backup
Starting backup...
In DbDumper.php line 117:
Type error: Argument 1 passed to Spatie\DbDumper\DbDumper::setPort() must be of the type integer, string given, called in /var/www/html/vendor/spatie/laravel-backup/src/Tasks/Backup/DbDumperFactory.php on line 36
Backup from the UI also fails with a less informative "something went wrong" error
To Reproduce
- Do docker install per documentation
- Exec into container and run
php artisan snipeit:backup
Expected behavior A backup to be created
Server (please complete the following information):
- Snipe-IT Version v4.9.4
- OS: [e.g. Ubuntu, CentOS] Gentoo
- Web Server: [e.g. Apache, IIS] Apache
- PHP Version PHP 7.1.33-17+ubuntu16.04.1+deb.sury.org+1
Error Messages
In DbDumper.php line 117:
Type error: Argument 1 passed to Spatie\DbDumper\DbDumper::setPort() must be of the type integer, string given, called in /var/www/html/vendor/spatie/laravel-backup/src/Tasks/Backup/DbDumperFactory.php on line 36
Additional context
- Is this a fresh install or an upgrade? fresh
- What OS and web server you're running Snipe-IT on. Gentoo
- What method you used to install Snipe-IT (install.sh, manual installation, docker, etc) Docker with mysql:5.6 db container
- Include what you've done so far in the installation, and if you got any error messages along the way.
- Indicate whether or not you've manually edited any data directly in the database
I tried explicitly setting port in env file MYSQL_PORT_3306_TCP_PORT=3306
but did not make a difference.
Ran into this on v4.9.4, and now on v5-beta5. Thus far I've been able to manually back things up via docker exec <container> bash
and mysqldump
, but this is really inconvenient.
If anyone that knows more about why this might not work form Docker can provide some clues, I'd be happy to look into opening a PR.
Take a look at #7571, setting DB_PORT=3306 fixed the issue for me.
Can confirm DB_PORT=3306
works for me too. Not sure why MYSQL_PORT_3306_TCP_PORT=3306
didn't for me like noted on that other issue.
Seems the docker documentation could use an update to note this.
Could it be related to this line?:
https://github.com/snipe/snipe-it/blob/83200d3cbd5917ea1c2b6dbc6f154491282eb43d/config/database.php#L73
The default value is of type string
, whereas public function setPort(int $port)
obviously expects an int
type. So either the default value should be of type int
too or it needs to be casted somewhere later.
Take a look at #7571, setting DB_PORT=3306 fixed the issue for me.
Thanks! Spend a day trying to figure this out. This was my issue as well.
Hit by the same issue with the latest v6.0.14
running in docker, fixed by setting DB_PORT=3306
in my env file
Hit by the same issue with the latest
v6.0.14
running in docker, fixed by settingDB_PORT=3306
in my env file
Just updated to 6.1.1 after trying to solve this issue with 6.0.14 and it is still the same issue. Unfortunately I was not able to solve it no matter what I entered into the env file.