DPLOY is an FTP/SFTP deployment tool built in node.js
Uploads the latest changes by comparing the version on your server with your git repository.
Install DPLOY and it's dependancies globally by running:
npm install dploy -g
Will deploy the first environment that you have on your
Will install the
dploy.yaml file and set up a
post-commit script on your
.git/hooks folder so you can DPLOY from your commit message as well.
Anything else after the
dploy command will be used as an environment, like this:
dploy dev stage production
In this case DPLOY will expect to find dev, stage and production configs on your
If you only have one server, just name whatever you want and run
server_name: host: "ftp.myserver.com" user: "user" pass: "password" path: local: "deploy/" remote: "public_html/"
Deploying on the command line:
You can also set the environment that you want to upload:
DPLOY has two available schemes: ftp and sftp. You must provide this information, because we don't like to play guessing games.
21when ftp and
The port that your hosting server is using. Note that the default value is different depending on scheme that you are using.
If you don't set a password and if you are using SFTP, DPLOY will try look for the privateKey and publicKey.
But if we can't find any of those options, you will be prompted to type the password manually.
When using SFTP, you can set the path of your private key instead of the password. The default locations are usually:
privateKey: ~/.ssh/id_rsa privateKey: ~/.ssh/id_dsa
For an encrypted private key, this is the passphrase used to decrypt it.
It works in the same way of the privateKey. The default locations are usually:
publicKey: ~/.ssh/id_rsa.pub publicKey: ~/.ssh/id_dsa.pub
Set this parameter only if you are using FTPS. Set to
true for both control and data connection encryption,
control for control connection encryption only, or
implicit for implicitly encrypted control connection.
Additional options to be passed together with the
To check the different between your local files and what's on the server, we have to create a temporary file with the reference of the last commit you've uploaded. This parameter defines the name of this file.
To make the upload faster, you can create multiple connections to your server.
If you set this parameter to
true, you will be prompted to confirm the list of files before the actual action.
You can set a list of branches that are allowed to deploy to your server. This will also help you to avoid accidental uploads to different servers.
Note that you can also set a string (a single branch), rather than a list.
The local folder that you want to upload to the server. If you don't set anything, the entire folder of your project will be uploaded.
The remote folder where your files will be uploaded. If you don't set anything, your files will be uploaded to the root of your server. We highly recommend that you set this!
Exclude files that are tracked by git, but that you don't want on your server. You can target individual files or use glob to target multiple files and file types.
exclude: ["dploy.yaml", "package.json", "path/to/file.js"].
exclude: ["*.yaml", "*.json", "path/**/*.js", "**/*.md"].
The include parameter is similar to the exclude. But instead of an array, it expects an object.
The key of your object is what DPLOY is gonna search locally and the value of your object is the destination on the remote server (this path is relative to the path.remote!). Again you can also target individual files or multiple using glob on the key of your object.
include: "videos/kitty.mp4": "videos/" "videos/*.mp4": "another/folder/inside/remote/path/" "*.json": "data/"
If you are using the include parameter on your
dploy.yaml, you will note that those files will always be uploaded to the server, no matter if they were modified or not (because they aren't necessarily tracked by git).
In order to avoid re-uploading those files all the time, there's a tag called
--ignore-include that you can set when calling DPLOY.
dploy stage --ignore-include
Or using a shortcut:
dploy stage -i
If you already have your files on the server (from a previous manual upload or if you somehow deleted the revision file), setting this flag will upload only the revision file and nothing more. It can be used for multiple servers too.
dploy stage --catchup
Or using a shortcut:
dploy stage -c
Most of the times we have to work on different environments (dev, stage, production…).
With DPLOY is really easy to make multiple deploys using a single command. All you need to do is create different configurations on your
dploy.yaml file, like this:
dev: host: "dev.myserver.com" user: "dev_user" pass: "dev_password" path: local: "deploy/" remote: "public_html/" stage: host: "stage.myserver.com" user: "stage_user" pass: "stage_password" path: local: "deploy/" remote: "public_html/" production: host: "myserver.com" user: "production_user" pass: "production_password" path: local: "deploy/" remote: "public_html/"
Deploy to stage environment only:
Or if you want to upload to more than one environment:
dploy dev stage production
This example will upload your local
deploy folder to your remote
public_html folder and:
.mp4files inside your
videosfolder to a remote folder named
funnyon your server.
xmlfiles at your cwd folder to a remote folder named
jsfiles inside the folder
mdfiles from your
server_name: host: "ftp.myserver.com" user: "user" pass: "password" path: local: "deploy/" remote: "public_html/" exclude: ["deploy/*.yaml", "deploy/*.json", "deploy/path/**/*.js", "deploy/**/*.md"] include: "videos/*.mp4": "funny/" "*.json *.yaml *.xml": "data/"
Feel free to contribute to DPLOY in any way. If you have any issues, questions or suggestions, just create it at the issues page.
If you want to create your own fork, follow the instructions bellow to build DPLOY:
You need to install the dependencies from npm first and then just use grunt to compile the CoffeeScript:
You can watch the changes by running the watch task from grunt:
DPLOY was inspired by another great tool written in Ruby, called dandelion from Scott Nelson.
The MIT License
Copyright (c) 2013 Lean Mean Fighting Machine, Inc. http://lmfm.co.uk
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.