Working on a Laravel Filament project using remote Shared Hosting
Hello guys.
As part of my "training punishment" I decided to try to install a fresh Laravel + Filament project on my shared cPanel hosting and edit the files locally with a remote sync. Why am I trying this - simple, I switch PCs often as part of my IT work related day so having a centralized project space would allow me to edit from wherever whenever.
So far, I've discovered a package provided from Micro$oft named RemoteSSH which allows you to connect to a shared host, lists all your files in the editor and you update directly. The issue with this approach is that when you need to transfer some files to the host, you can't copy/paste the folder or multiple files at once in VSCode (or at least it did not work with me to transfer 20Mb of assets). Besides that, the connection is reset quite often and it is almost impossible to reconnect without restarting the PC or else.
Another issue with RemoteSSH is that I am unable to execute any of the composer/artisan/filament commands. It just sends the command, no messages of an error but no actions either so when you want to create a full resource with this tool, you should manually create a model, controller, migration etc. etc.
Later on, I've discovered another way of achieving my needs, which seems to be more elegant (not flawless again but workable) - using SSHFS-Win application (available for free in GitHub etc.). So what this app does is mapping a remote host to a specific drive letter of choice (or a folder under Linux) so that any IDE would access it as a local project allowing copy/paste etc. This method seems a bit more reliable, stable etc. however I started noticing an issue with the File Format on SAVE with VSC as it tries several times to save and I guess it starts to loop. Since this method is opening the project as a local, it allows me to open a local console so I am lead to believe I can use it to issue all Laravel commands.
As part of my "training punishment" I decided to try to install a fresh Laravel + Filament project on my shared cPanel hosting and edit the files locally with a remote sync. Why am I trying this - simple, I switch PCs often as part of my IT work related day so having a centralized project space would allow me to edit from wherever whenever.
So far, I've discovered a package provided from Micro$oft named RemoteSSH which allows you to connect to a shared host, lists all your files in the editor and you update directly. The issue with this approach is that when you need to transfer some files to the host, you can't copy/paste the folder or multiple files at once in VSCode (or at least it did not work with me to transfer 20Mb of assets). Besides that, the connection is reset quite often and it is almost impossible to reconnect without restarting the PC or else.
Another issue with RemoteSSH is that I am unable to execute any of the composer/artisan/filament commands. It just sends the command, no messages of an error but no actions either so when you want to create a full resource with this tool, you should manually create a model, controller, migration etc. etc.
Later on, I've discovered another way of achieving my needs, which seems to be more elegant (not flawless again but workable) - using SSHFS-Win application (available for free in GitHub etc.). So what this app does is mapping a remote host to a specific drive letter of choice (or a folder under Linux) so that any IDE would access it as a local project allowing copy/paste etc. This method seems a bit more reliable, stable etc. however I started noticing an issue with the File Format on SAVE with VSC as it tries several times to save and I guess it starts to loop. Since this method is opening the project as a local, it allows me to open a local console so I am lead to believe I can use it to issue all Laravel commands.
Solution
Hmm, adding up to the need, when a dev works on a project and need to demonstrate/prove the progress to a client, eventually you would:
1. Want to have your website with the latest functionality UP-2-DATE
2. Not want to re-import DB, files etc. every time when a client need it.
To add a bit to the story, option 2 seems to work pretty well, my issue with Laravel Filament/artisan command was resolved and boy it was silly me (I've completely forgot to check the host PHP version so eventually I ended up with PHP 5.2 instead of 8.1 and this was the bottleneck why I was not seeing any errors while executing the commands but no actions either. So I must admit that for now I will test the development of SSHFS-Win as it maps a local drive to your online project and even though it is a bit slower in terms of refresh etc. as it pass through an SSH tunnel for security, it still makes sure your website is up-to-date out of the box and also allows me the easy local GIT comits as a backup.
Will see which one works best in terms of stability, usability and easiness to setup and be done and report back. The suggestion of Obala I totally embrace, if it is a single developer working from multiple machines and not depending on demos to project managers/clients.
1. Want to have your website with the latest functionality UP-2-DATE
2. Not want to re-import DB, files etc. every time when a client need it.
To add a bit to the story, option 2 seems to work pretty well, my issue with Laravel Filament/artisan command was resolved and boy it was silly me (I've completely forgot to check the host PHP version so eventually I ended up with PHP 5.2 instead of 8.1 and this was the bottleneck why I was not seeing any errors while executing the commands but no actions either. So I must admit that for now I will test the development of SSHFS-Win as it maps a local drive to your online project and even though it is a bit slower in terms of refresh etc. as it pass through an SSH tunnel for security, it still makes sure your website is up-to-date out of the box and also allows me the easy local GIT comits as a backup.
Will see which one works best in terms of stability, usability and easiness to setup and be done and report back. The suggestion of Obala I totally embrace, if it is a single developer working from multiple machines and not depending on demos to project managers/clients.
