matomo-org / plugin-Migration

Migrate a Matomo Measurable (website, app, roll-up, ...) from one Matomo instance to another Matomo
5 stars 11 forks source link

Add more details to SSH tunnel example #45

Closed gitressa closed 1 year ago

gitressa commented 1 year ago

The README has this part about SSH tunneling:

Both Matomo instances may be on different servers with proper firewall rules that restrict database access on target instance. In such case, the easiest way for source server to access target database is to create a ssh tunnel on new port (e.g. 3307) in another terminal. Then, execute to the above command with --target-db-port=3307 instead to access port 3306 on target host. Example:

ssh -NL 3307:localhost:3306 targetuser@targethost

It would be great with more details, like where is the command supposed to be run? Also, what is the value of targetuser@targethost supposed to be set to?

Thanks!!

gitressa commented 1 year ago

I ended up doing the import directly on the target server: https://forum.matomo.org/t/exporting-web-site-data-from-one-server-into-another-existing-matomo-instance/48212/2

gitressa commented 1 year ago

It's great that this Matomo Migration tool exists, so thanks for providing it.

A few observations:

SSH tunneling can be daunting for many, but with current server set ups, I believe this technique is required more often than not. Since it's so complicated, perhaps the option of using the less elegant, but workable solution I used (see link above) could be added in the README?

After my imports, I get an error message, though everything seems to work fine:

Processed ArchiveMigration at 2022-11-12 18:10:27
ERROR [2022-11-12 18:10:27] 19920 Uncaught exception: /var/www/html/website/public_html/tempmatomo/matomo/libs/Zend/Db/Adapter/Pdo/Abstract.php(314): There is no active transaction [Query: , CLI mode: 1]

[PDOException]
There is no active transaction

Is there a way to avoid this, or is it the expected final message?

Also, I wasn’t sure about importing a site with siteid 1, since it already existed. But the Migration plugin intelligently gave it a new siteid 5, the next available site ID, which is great.

Perhaps this could also be added in the README, to reassure future migrators that this will be taken care of?

snake14 commented 1 year ago

Hi @gitressa . Thank you for taking the time to create this issue. I'll see if I can get some of that information added to the readme. I'm not familiar with that error. Have you seen that PDOException before @AltamashShaikh ?

gitressa commented 1 year ago

Perfect @snake14. if you create a PR, I can have a look, if you want?

AltamashShaikh commented 1 year ago

@snake14 Not familiar with the message, but I checked the code and it was due to DB trying to perform a commit operation but had nothing to commit.

@gitressa Following is already present here "The migration tool will create a new website in the target Matomo and copy all the data from the source website to this newly created target website."

snake14 commented 1 year ago

@gitressa Thank you for all your feedback. I just merged the changes and they will be included as part of the next release of this plugin.

gitressa commented 1 year ago

Thanks for a great job @snake14, I really appreciate it. If I find time, I might at some point go through the steps, and see if I can make it work (I am after all the intended SSH noob audience for the instructions) and see if I can successfully transfer Matomo data from one fire-walled server to another. Have a nice day.