Skip to content

Commit

Permalink
deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
jevets committed Aug 20, 2015
1 parent 2c47a89 commit 723b26d
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ Compiles the site to static files in `/www`

npm run build

### deploy-[target]

Deploy via rsync over ssh.

npm run deploy-dev

1. Copy `/secrets-sample.json` to `secrets.json` and fill in your server(s) details.
2. Update `/index.js` to match your server aliases.
3. Run `npm run deploy-[alias]` to rsync over ssh to the server

## Layouts

**A note on layouts:**
Expand Down
42 changes: 42 additions & 0 deletions deploy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
var yargs = require('yargs').argv;
var rsync = require('rsyncwrapper').rsync;

var secrets = require('./secrets.json');


try
{
var server = secrets.servers[yargs.server];

var rsyncDest = server.user+'@'+server.host+':'+server.path;

console.log("Deploying to " + server.host + "\n");

rsync({
ssh: true,
src: './www/',
dest: rsyncDest,
recursive: true,
syncDest: true,
args: ['--verbose'],
exclude: ['.git', '.DS_Store'],
onStdout: function(data) {
console.log(data.toString());
}
}, function(error, stdout, stderr, cmd) {
if (error) {
console.log(error.message);
} else {
console.log('Deployed to ' + rsyncDest);
process.exit();
return;
}
});
}
catch (e)
{
console.log('No server found');
process.exit();
}


0 comments on commit 723b26d

Please sign in to comment.