Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

target_ftp

Marcel Kloubert edited this page Oct 22, 2017 · 31 revisions

Home >> Targets >> ftp

FTP

Deploys to a FTP server.

Table of contents

  1. Settings
  2. Known issues
  3. Examples

Settings []

{
    "deploy": {
        "targets": [
            {
                "type": "ftp",
                "name": "My FTP folder",
                "description": "A FTP folder",

                "dir": "/my_package_files",
                "host": "ftp.example.com", "port": 21,
                "secure": false,
                "user": "mkloubert", "password": "P@assword123!"
            }
        ]
    }
}
Name Description Supported engine(s)
beforeUpload One or more command to execute on the server BEFORE a file is going to be uploaded. (all)
checkBeforeDeploy Check for newer files before a deployment starts or not. Default: (false) (all)
closing One or more command to execute on the server BEFORE a connection is going to be closed. (all)
connected One or more command to execute on the server AFTER a connection has been established. (all)
dir The remote directory on the server. Default: / (all)
connTimeout How long (in milliseconds) to wait for the control connection to be established. Default: 10000 ftp
engine Engine to use. Possible values are ftp or jsftp. Default: ftp (all)
host The host address of the server. Default: 127.0.0.1 (all)
keepalive How often (in milliseconds) to send a 'dummy' (NOOP) command to keep the connection alive. Default: 10000 ftp
password Password (all)
pasvTimeout How long (in milliseconds) to wait for a PASV data connection to be established. Default: 10000 ftp
port The TCP port of the server. Default: 21 or 990 (secure = (true)) (all)
promptForPassword Prompt for a password if not defined. Default: (true) (all)
rejectUnauthorized s. tls.connect(). Default: (false) ftp
secure Use secure connection or not. Default: (false) ftp
transformer* The path to the script that transforms data before it is send / after it has been downloaded. (all)
transformerOptions Optional data for the transformer script. (all)
uploaded One or more command to execute on the server AFTER a file has been uploaded. (all)
user Username. Default: anonymous (all)

* supports placeholders

Known issues []

  • In some cases, pulling files does not work with ftp module module (s. issue), that is used by default. This is why you should try to set engine property to jsftp.

Examples []

Azure []

For an Azure website like http://nameofyoursite.azurewebsites.net:

{
    "deploy": {
        "targets": [
            {
                "type": "ftp", "name": "FTP",
                "host": "waws-prod-sn1-053.ftp.azurewebsites.windows.net",
                "user": "nameofyoursite\\$nameofyoursite",
                "password": "sOmeCrYPTicL00kIngStr1nG",
                "dir": "/site/wwwroot"
            }
        ]
    }
}

You can find more information in this article.

Execute commands on server

This example shows how to execute FTP commands:

{
    "deploy": {
        "targets": [
            {
                "type": "ftp",

                "host": "myhost.examples.com",
                "dir": "/var/www/my_package_files",

                "user": "tester", "password": "P@ssword123!",

                "connected": [
                    "NOOP"
                ],

                "beforeUpload": [
                    "DELE ${remote_name}"
                ]
            }
        ]
    }
}

beforeUpload / uploaded

The following placeholder / variables are supported:

Name Description Example
atime The access time of the local file. 20170419125552
atime_full The access time of the local file with milliseconds. 20170419125552.356
atime_full_utc The UTC access time of the local file with milliseconds. 20170419125552.356
atime_utc The UTC access time of the local file. 20170419125552
birthtime The birth time of the local file. 20170419125552
birthtime_full The birth time of the local file with milliseconds. 20170419125552.356
birthtime_full_utc The UTC birth time of the local file with milliseconds. 20170419125552.356
birthtime_utc The UTC birth time of the local file. 20170419125552
ctime The change time of the local file. 20170419125552
ctime_full The change time of the local file with milliseconds. 20170419125552.356
ctime_full_utc The UTC change time of the local file with milliseconds. 20170419125552.356
ctime_utc The UTC change time of the local file. 20170419125552
mode The file mode (octal) of the local file. 666
mode_full The full file mode (octal) of the local file. 100666
mode_decimal The file mode (decimal) of the local file. 33206
mtime The modified time of the local file. 20170419125552
mtime_full The modified time of the local file with milliseconds. 20170419125552.356
mtime_full_utc The UTC modified time of the local file with milliseconds. 20170419125552.356
mtime_utc The UTC modified time of the local file. 20170419125552
remote_dir The path of the remote directory. /wwwroot/docs
remote_file The path of the remote file. /wwwroot/docs/test.html
remote_name The (base) name of the remote file. test.html
user The name of the user as defined in the settings. tester

closing / connected

The following placeholder / variables are supported:

Name Description Example
close_time1 The close time. 20170419125552
close_time_full1 The close time with milliseconds. 20170419125552.356
close_time_full_utc1 The UTC close time with milliseconds. 20170419125552
close_time_utc1 The UTC close time with milliseconds. 20170419125552.356
connection_time The connection time. 20170419125552
connection_time_full The connection time with milliseconds. 20170419125552.356
connection_time_full_utc The UTC connection time with milliseconds. 20170419125552
connection_time_utc The UTC connection time with milliseconds. 20170419125552.356
user The name of the user as defined in the settings. tester

1: only available for closing

Clone this wiki locally