Deploying with SFTP only

Hi,

I am trying to find the best way to deploy a Grav site in a situation where I can only connect to the server by SFTP - I don’t have shell/SSH access or a control panel etc.

I have been experimenting with dploy - which purports to do exactly what I want (i.e. intelligently deploy changes from a git repo over SFTP from the command line), but I can’t get it to work reliably.

I’d like to end up with a system where the entire site is kept, versioned, on Bitbucket/GitHub and relatively non-technical authors/administrators can make changes to the content of the website, push their changes to the repo and then deploy them to the production website.

Any ideas?

I’ve not tried it but have you looked at https://ftploy.com/ ? Also there’s https://www.deployhq.com/ ?

I struggled with set-up, deployment and the idea of how to maintain as well. I blogged my recipe here: https://aptly.io/blog/grav-recipe. Maybe this might work for you as well?

Hi,

I also have the same problem that I solved with lftp, on Ubuntu.

This recipe, in a file called eg. COMMAND.SH, to make the idea

#!/bin/bash

lftp -u USERNAME,PASSWORD DOMAIN_OR_IP << EOF

cd FTP_PATH
put LOCAL_PATH/FILE.MD

bye
EOF

Then, at the command line, run ./COMMAND.SH

(As soon as possible I will show you the site (to add it in the Sample Sites Grav) that I am building with the amazing and powerful GRAV)

Good work

Those symbols in capitals in your script are shell variables that are set-up first?

Note that dandelion figures out what to sftp by looking into the change set of the git repository. I mean, the very first time that dandelion runs, it sftp the whole of Grav. But after committing a single new blog (and maybe a tweak in a twig template), dandelion figures the minimal number of file to transfer based on git differences. There’s no need for you to think in terms of cd …, put … Dandelion also creates the necessary directories.

If you guys are using SFTP only and have no access to shell to clear cache when needed, you probably should look at the cachebuster plugin. This lets you clear the cache via the browser which is a convenient thing.

You’re right EOF only have to leave it as it is, the capitalized words are to be replaced with your values, for example. if your FTP username is franchan if your PASSWORD is newyork, if your DOMAIN_OR_IP is franchan.com then you must write

lftp -u franchan,newyork franchan.com << EOF

You have to change again FTP_PATH, LOCAL_PATH and FILE.MD

I hope I have clarified

As a proof of concept, I set up my site to deploy as you imagined Ross. I sync only the relevant files from my local installation (using Bitnami) to Bitbucket (using SourceTree), and then deploy this with Deploybot (previously Dploy.io) over SFTP. Finally, Deploybot allows shell-commands so I can clear cache after the deployment.

This preserves privacy, in that the Bitbucket repo is private, security from all transactions being encrypted, and ease-of-use by all links in the chain having fairly understandable GUI’s.

For a future iteration I would like to achieve something similar on mobile devices: Writing content that is only synced and deployed when connected to the internet, and with a comfortable interface for phones. I haven’t yet found a stable way of doing this though, hopefully Grav’s webhooks will end up in the documentation soon so various integration’s can be explored.

beyond compare supports SFTP, that’s how i usually upload mine.