nick soph's picture

Im looking for some general guidance on how best to setup a simple dev machine.

I am working on a project that requires a simple web server (no backend processing just delivery of HTML/CSS/JS files) and want to live edit the files the server is dishing out. Im working on 2 machines around the house and using Brackets as the text editor on both. 

Brackets has various extensions that work with SFTP (and maybe SSH?) but these seem to require synching and what I want to do is write directly into the folder that is being served (this allows Brackets to work with Chrome to provide live updates as soon as I save (or as I type with CSS changes).

If the right process is to create a samba share and map a drive to it: What are the issues I need to be aware of re permissions? 

Is there a better way?

Thanks in advance.

 

Forum: 
Jeremy Davis's picture

FWIW TurnKey only provides vim-tiny so IMO the first thing I do is to install proper vim. OTOH I'm a Linux guy and find most IDEs sluggish and distracting. I much prefer to just use vim from the commandline for development. But YMMV...

So short answer is that Samba is a totally legitimate option. There are lots of other (better IMO) options too.

Despite Samba being a legitimate option, my inclination is to adjust your host OS to work nicely with TurnKey (and Linux in general), rather than adjusting TurnKey to work nicely with your host OS. My rational is that then your host OS will integrate with any TurnKey (and/or Linux) instance you launch OOTB. It makes VMs much more disposable which IMO is the way it should be...

IMO the way to go would be to install SSHFS and then mount the remote directory via SSHFS. For Mac and Linux that should be fairly straight forward. If you have Windows, then have a look here. TBH I haven't used it since Win7 some time ago, but it worked quite well (occasional crashes on waking from sleep). My suspicion is that it'd be even better now...

Alternatively, back when I used to use Windows lots, I used Notepad++ with the SFTP extension. IIRC there was a config option to auto sync when files are saved. So you still need to save, but then the file auto syncs. Perhaps the SFTP extensions for your IDE can be configured the same? If not, it's probably worth forwarding it as a feature request.

nick soph's picture

Thanks Jeremy, is there a Turnkey appliance with SSHFS and Apache already installed? 

Windows 10 64bit with HyperV - learning Javascript slowly

Jeremy Davis's picture

All TurnKey servers come with SSH enabled and ready to use, so if you install SSHFS on Windows, then you should be good to go! Here's the link to SSHFS for Windows again: https://github.com/Foreveryone-cz/win-sshfs

I have a vague recollection that by default SSHFS sessions cache content. But that may just be the default Linux client behaviour? If you have issues getting the "instant" result you are after, you may need to explicitly turn off the caching. Let's cross that bridge if we get to it though...

The LAMP appliance includes Apache, as well as MySQL and a number of languages starting with 'P'! :) (PHP, Python and Perl). The LAPP appliance is very similar except has PostgreSQL (instead of MySQL).

nick soph's picture

Thanks Jeremy,

This has been a really big help.

Think there should be a big flag - Dont install Samba till you have tried this...

All very straight forward - winssfhs has some issues with versions and seems to be be light on instructions and tutorials for set up but it doesnt need a lot to get working.

For info - Installed on 64bit Windows 10 using Win SSHFS 1.5.12.8 and Dokan 0.7.4. 

Needed to get the settings right before it behaved nicely (otherwise explorer became unresponsive) and had to delete settings (in c:\users\USERNAME\appdata\local\winSshFS) inbetween attempts. 

No longer thinking about samba (nice)

In the screenshot below - it works (ie mounted I: drive to/var/www)  but - mount folder seems not to do anything. (Not sure what/if it was meant to do) leaving it blank seems not to change anything.

Windows 10 64bit with HyperV - learning Javascript slowly

Jeremy Davis's picture

I discovered it and found it incredibly useful back when I was a Windows user (I only use Linux these days) and I'm glad it works for you too.

Like I said, the real advantage IMO is that you can now use that with any TurnKey appliance OOTB with no need to install extra stuff in Linux! :)

Also thanks for posting back with your feedback. Hopefully that will help guide others looking to do something similar!

nick soph's picture

Just installing again and came accross this 

https://igikorn.com/sshfs-windows-10/

Windows 10 64bit with HyperV - learning Javascript slowly

Jeremy Davis's picture

That looks pretty nice. Great find and thanks for posting.

Add new comment