- README entry about liveserver rsync+ssh sync

- fail to run if keys.py is missing
- try-catch for sync because it's optional
w
This commit is contained in:
Peter Molnar 2019-04-10 09:37:24 +01:00
parent 1f4a864d59
commit f196b26b79
3 changed files with 32 additions and 8 deletions

View file

@ -80,6 +80,22 @@ Install the pip dependency packages by using the Pipfile by running:
`pipenv install` `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 ### Prepare
Create a local base directory where your contents will be put into. Eg: Create a local base directory where your contents will be put into. Eg:

19
nasg.py
View file

@ -2342,15 +2342,18 @@ def make():
if not settings.args.get('nosync'): if not settings.args.get('nosync'):
# upload site # upload site
logger.info('starting syncing') try:
os.system( logger.info('starting syncing')
"rsync -avuhH --delete-after %s/ %s/" % ( os.system(
settings.paths.get('build'), "rsync -avuhH --delete-after %s/ %s/" % (
'%s/%s' % (settings.syncserver, settings.paths.get('build'),
settings.paths.get('remotewww')) '%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'): if not settings.args.get('nosync'):
logger.info('sending webmentions') logger.info('sending webmentions')

5
run
View file

@ -3,4 +3,9 @@
set -euo pipefail set -euo pipefail
IFS=$'\n\t' 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 "$@" python3 nasg.py "$@"