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.
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. ...
Jump to solution
6 Replies
Obala
Obala11mo ago
I don't know if it's the best method to solve this but normally I use GitHub action for this, when I am at work, I push everything I did at the end of the day (MUST) to GitHub then at home would just pull from the repo and continue off, while the action syncs the code with the one in the shared host, which in this case can be done without
MilenKo
MilenKo11mo ago
It worth trying, thank you @codprez for the idea. I thought of GH as the backup plan but since the project is already hosted in cPanel and it is not allowing the full access to ssh commands, I sall pull the project everywhere I go, comit my changes, then move to the new spot, pull again etc. That is why I though maybe adding some web IDE might help or have a way to work on files locally and only comit my changes to the hosting once I am done working or issue the comit...
Obala
Obala11mo ago
Yep and in this way u will be able to easily track changes and collaborate easily with colleagues
tuto1902
tuto190211mo ago
I’ll just be over here soaking in all the great knowledge
Solution
MilenKo
MilenKo11mo ago
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.
Want results from more Discord servers?
Add your server
More Posts