Jump to content

Working with PW located on remote server; git, etc.


John W.
 Share

Recommended Posts

This is really a general question about managing processwire projects located on a remote development server and syncing changes with git.

So, I have a project in my templates folder on my mac. I run Ubuntu on a VM that monitors the shared mac folder with grunt, as I save changes in Sublime on the mac, it kicks off grunt (grunt, npm, nodejs etc, is installed on the Ubuntu VM) to compile my SASS, etc in the templates folder on the mac. Hope I didn't lose you there.

Now, I want to be able to edit my code on my desktop, laptop from any location. So, I figure I would set up an Ubuntu install on development server, something like Digital Ocean, install npm, nodejs, grunt, etc (just like I did with the VM).

I guess what it comes down to, if I edit my code on my mac, it would push the save files out to Digital Ocean, where grunt is running, and grunt would kick off my SASS compiler, etc. Then if I jump onto my laptop from a remote location it would sync back a copy of my templates folder to the laptop. So, if I edit code on my mac or laptop, they will push the changes to the remote Ubuntu server where grunt runs to compile my sass or compress But, it also syncs back changes to both the laptop and mac.

I'm not really sure if this is the best approach. If you have any input on using something like git to sync your templates folder between a server that watches and compiles changes and for instance a desktop computer and laptop, I'd really like to hear it. Please don't tell me to learn emacs, lol.

Thanks for your time and input.

john w.

 

Link to comment
Share on other sites

I normally develop in a remote server and connect with my text editor through SSH. (using emacs, ironically haha)

Normally on the dev server, I install the things needed to compile frontend stuff (if needed) and just run the tasks either on a background process or run them everytime I'm developing in a terminal window. If I need sync with live, I use git and manually push (have yet to look into fancy hooks integration)

On this thread you can take a look at some comments that talk about a very nice VSCode extension that mounts remote file systems through SSH:
 

 

  • Like 2
Link to comment
Share on other sites

I'm far from an expert on all this npm, node, grunt things (actually I use none of them, just a php less parser to compile less to css on the fly) but I don't get why you want to do all the compiling on both machines? Why not do all the compiling just on your local dev machine and then git push/pull the static files to your live server?

Only problem with that workflow is that db changes are not synched automatically but usually you don't have a lot and if you have, they are quite easy to solve. You have at least three options:

  1. Move a DB backup from your local dev to remote live and restore it there. You can do this only, of course, if there where no changes/updates on the live system during your development.
  2. Use PW's import/export tools. You have pages import/export and template/fields import/export. For small updates those tools work well and fast.
  3. Use code to do that automatically, eg via the migrations module or wireshell.
  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...