Migrating from a shared server to a VPS

Hi there,

I just wanted to check in to see if I did this correctly or if it was a bad idea that way I did it.

I was running v5 on a shared hosting server; all has been going well for sometime now. Very recently I stood up a VPS server which I deployed a php application to migrate my invoice to.

My migration went as follows:

  1. Downloaded the invoice folder directly via sftp from shared hosting server
  2. Exported the MySQL database used by the invoice app
  3. Uploaded the entire directly (step 1) onto my new VPS.
  1. Imported the exported dbs from step 2 onto my VPS host
  2. Visited the invoice url (same link) it prompted me with the installation wizard. I ensured the db username, name and password reflected the one from the exported/imported and or updated the .env file.

Once I was able to log in every was there, no issues that I can see. Of course there was more to it, new certs, domain host IP change etc.

Should I be worried that I did the migration this way going from a shared hosting to a VPS server? Was there a another way to do this to be able to restore client/expense/invoices data?

There is one thing I did notice, I use to be able to update the application leveraging the “Update App” within the gui but now when I do that it fails and claims “server error”. What is the best way to update to version 5.5.70 from v5.4.9?

Also I never got the cron jobs to work on the shared hosting, should I be worried about not having them?

Thank you

Hi,

We recommend using mysqldump to transfer the database between two self hosted installs.

If you’re having trouble updating you can try copying over the latest version of the app.

Crons are important, they’re used for recurring invoices, reminders, to check for updates, etc.

Thanks @hillel for the info. I was finally able to get the cron schedule to work on my self hosted server. Issue still applies where I can not update the application using the built in update. Would I just download the latest version and replace all files within my invoiceninja directory?
Thanks

That’s correct, you’d copy the latest files over the current ones

Thanks @hillel, man you reply fast (love it).

So I just did that and when I visit my invoice link now get this prompt: Composer detected issues in your platform: Your Composer dependencies require a PHP version “>= 8.1.0”.

So figured ok np, I will just update the php to at least 8.1, I did just that and now I get page HTTP ERROR 500. I tried reuploading the files and that didn’t fix it. I used the version on https://www.invoiceninja.org/

I now have since reverted the php back to 7.4 to at least get a prompt which is "Composer detected issues in your platform: Your Composer dependencies require a PHP version “>= 8.1.0”.

Any idea?

Cheers mate

*** Update ** I checked the logs and this is what the log is saying.


[Thu Feb 23 21:41:53.054013 2023] [proxy_fcgi:error] [pid 27646:tid 140710208419584] [client 202.69.45.130:0] AH01071: Got error ‘PHP message: PHP Fatal error: Uncaught ReflectionException: Class “view” does not exist in /home/941535.cloudwaysapps.com/bctzubhdux/public_html/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php:889\nStack trace:\n#0 /home/941535.cloudwaysapps.com/bctzubhdux/public_html/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(889): ReflectionClass->__construct()\n#1 /home/941535.cloudwaysapps.com/bctzubhdux/public_html/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(770): Illuminate\Container\Container->build()\n#2 /home/941535.cloudwaysapps.com/bctzubhdux/public_html/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(856): Illuminate\Container\Container->resolve()\n#3 /home/941535.cloudwaysapps.com/bctzubhdux/public_html/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(706): Illuminate\Foundation\Application->resolve()\n#4 /home/941535.cloudwaysapps.com/bctzubhdux/public…PHP message: PHP Fatal error: Uncaught ReflectionException: Class “view” does not exist in /home/941535.cloudwaysapps.com/bctzubhdux/public_html/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php:889\nStack trace:\n#0 /home/941535.cloudwaysapps.com/bctzubhdux/public_html/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(889): ReflectionClass->__construct()\n#1 /home/941535.cloudwaysapps.com/bctzubhdux/public_html/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(770): Illuminate\Container\Container->build()\n#2 /home/941535.cloudwaysapps.com/bctzubhdux/public_html/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(856): Illuminate\Container\Container->resolve()\n#3 /home/941535.cloudwaysapps.com/bctzubhdux/public_html/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(706): Illuminate\Foundation\Application->resolve()\n#4 /home/941535.cloudwaysapps.com/bctzubhdux/public…’


So this is clear there is an error at the application level. If I take the update to v5.5.75, the application than tells me “Composer detected issues in your platform: Your Composer dependencies require a PHP version “>= 8.1.0”.” and if I update php, than I fetal error (error listed above).

Thanks

Maybe this will help:

Hi @hillel,

Providing an update in hopes this will help others. Thanks for sharing the link, unfortunately that did not work. After many hours and days I was able to get it working. It seems like the the error is occurring if the Laravel database schema package is not installed or not loaded in your Laravel application. To resolve this issue, I had do the following:

composer require --dev --with-all-
dependencies --no-update –
prefer-dist beyondcode/laravel-
dump-server --no-suggest
php artisan cache:clear
composer install
php artisan key:generate
php artisan migrate --force

After it did its thing, everything was working again. This was caused when I replaced my working files with the latest version v5.5.74-C108 via FTP and update my PHP.

Thank you again

1 Like

Glad to hear it, thanks for sharing the solution!