-
Notifications
You must be signed in to change notification settings - Fork 0
/
flightplan.sample.js
43 lines (35 loc) · 1.18 KB
/
flightplan.sample.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
var plan = require('flightplan');
var username = 'USERNAME';
var host = 'HOSTNAME';
plan.target('production', [
{
host: host,
username: username,
privateKey: 'LINK TO YOUR SSH KEY',
agent: process.env.SSH_AUTH_SOCK
}
]);
plan.remote(['build', 'deploy'], function(remote) {
remote.exec('apt-get update');
remote.exec('mkdir -p /usr/src/app');
});
plan.local('build', function(local) {
local.log('Building containers');
local.exec('cd ..');
local.exec('docker-compose build --pull --force-rm');
local.exec('docker-compose push');
});
plan.local(['build', 'deploy'], function(local) {
local.log('Move docker-compose file');
local.exec('scp ' + __dirname + '/docker-compose.yml ' + username + '@' + host + ':/usr/src/app');
});
plan.remote(['build', 'deploy'], function(remote) {
var username = remote.prompt('Enter your Docker username:');
var password = remote.prompt('Enter your Docker password:', { hidden: true });
remote.exec('docker login -u ' + username + ' -p ' + password);
remote.with('cd /usr/src/app', function() {
remote.exec('docker-compose down');
remote.exec('docker-compose pull');
remote.exec('docker-compose up -d');
});
});