all repos — nasg @ f196b26b79ffd82e305641c8d41ec4e5fcf26c5c

- README entry about liveserver rsync+ssh sync
- fail to run if keys.py is missing
- try-catch for sync because it's optional
w
Peter Molnar hello@petermolnar.eu
Wed, 10 Apr 2019 09:37:24 +0100
commit

f196b26b79ffd82e305641c8d41ec4e5fcf26c5c

parent

1f4a864d594863cf16997c9e89d88db8062bd848

3 files changed, 32 insertions(+), 8 deletions(-)

jump to
M README.mdREADME.md

@@ -80,6 +80,22 @@ Install the pip dependency packages by using the Pipfile by running:

`pipenv install` +#### SSH (optional) + +Once the build is done, NASG will attempt to sync the output folder to a remote server. It needs an entry in the `~/.ssh/config` file: + +``` +Host liveserver + HostName your.ssh.host + User your.ssh.user + IdentityFile ~/.ssh/your.ssh.identity.file + IdentitiesOnly yes + ServerAliveInterval 30 + +``` + +Note: if you don't have this, there will be no auto upload, but the build will still succeed. + ### Prepare Create a local base directory where your contents will be put into. Eg:
M nasg.pynasg.py

@@ -2342,15 +2342,18 @@ logger.info('process took %d ms' % (end - start))

if not settings.args.get('nosync'): # upload site - logger.info('starting syncing') - os.system( - "rsync -avuhH --delete-after %s/ %s/" % ( - settings.paths.get('build'), - '%s/%s' % (settings.syncserver, - settings.paths.get('remotewww')) + try: + logger.info('starting syncing') + os.system( + "rsync -avuhH --delete-after %s/ %s/" % ( + settings.paths.get('build'), + '%s/%s' % (settings.syncserver, + settings.paths.get('remotewww')) + ) ) - ) - logger.info('syncing finished') + logger.info('syncing finished') + except Exception as e: + logger.error('syncing failed: %s', e) if not settings.args.get('nosync'): logger.info('sending webmentions')
M runrun

@@ -3,4 +3,9 @@

set -euo pipefail IFS=$'\n\t' +if [ ! -f 'keys.py' ]; then + echo "missing keys.py file; please copy keys.dist.py to keys.py and fill in the needed values inside" + exit 1 +fi + python3 nasg.py "$@"