Grunt Ftpress
Grunt enhanced file transfer with speed in mind.
Installation
apt-get install lftp
npm install grunt-ftpress
Usage
Load the task:
grunt.loadNpmTasks('grunt-ftpress');
Config the task:
grunt.initConfig(
{
ftpress:
{
name:
{
src:
[
'build'
],
dest: '.',
options:
{
url: null,
username: null,
password: null,
protocol: 'ftp',
host: null,
port: 21,
commandArray:
[
'mirror {SOURCE} {TARGET} --reverse --delete-first --parallel=10 --use-pget-n=10',
'exit'
],
debug: false,
verbose: false,
haltOnError: false,
errorArray:
[
'Connection refused',
'Not connected',
'Permission denied'
]
}
}
}
});
Zero downtime pattern:
command:
[
'mirror {SOURCE} {TARGET}-new-{TIMESTAMP} --reverse --delete-first',
'mv {TARGET} {TARGET}-old-{TIMESTAMP}',
'mv {TARGET}-new-{TIMESTAMP} {TARGET}',
'rm -rf {TARGET}-old-{TIMESTAMP}',
'exit'
]
Run the task:
grunt ftpress