1
|
|
|
module.exports = function (shipit) { |
2
|
|
|
shipit.blTask('initVirtualenv', function() { |
3
|
|
|
return shipit.remote( |
4
|
|
|
"cd " + shipit.releasePath + |
5
|
|
|
" && virtualenv venv -p /usr/bin/python3" + |
6
|
|
|
" && source venv/bin/activate" + |
7
|
|
|
" && pip install --upgrade pip" |
8
|
|
|
); |
9
|
|
|
}); |
10
|
|
|
|
11
|
|
|
shipit.blTask('installVendors', function() { |
12
|
|
|
return shipit.remote( |
13
|
|
|
"cd " + shipit.currentPath + |
14
|
|
|
" && source venv/bin/activate" + |
15
|
|
|
" && pip install --find-links=~/wheels -r requirements.txt --upgrade" |
16
|
|
|
); |
17
|
|
|
}); |
18
|
|
|
|
19
|
|
|
shipit.blTask('upgradeDatabase', function() { |
20
|
|
|
return shipit.remote( |
21
|
|
|
"cd " + shipit.currentPath + |
22
|
|
|
" && source venv/bin/activate" + |
23
|
|
|
" && set -a && source " + shipit.config.deployTo + "/password.conf" + |
24
|
|
|
" && export PYTHONPATH=src" + |
25
|
|
|
" && cd " + shipit.currentPath + |
26
|
|
|
" && python3 src/manage.py db upgrade" |
27
|
|
|
); |
28
|
|
|
}); |
29
|
|
|
|
30
|
|
|
shipit.blTask('install', function() { |
31
|
|
|
var tasks |
32
|
|
|
if(shipit.config.hasDatabase){ |
33
|
|
|
tasks = ['installVendors', 'upgradeDatabase', 'restartServer'] |
34
|
|
|
} else { |
35
|
|
|
tasks = ['installVendors', 'restartServer'] |
36
|
|
|
} |
37
|
|
|
shipit.start(tasks, function(err) { |
38
|
|
|
if(!err){ |
39
|
|
|
shipit.log('Install done!'); |
40
|
|
|
} |
41
|
|
|
}) |
42
|
|
|
}); |
43
|
|
|
|
44
|
|
|
shipit.on('updated', function() { |
45
|
|
|
return shipit.start('initVirtualenv'); |
46
|
|
|
}); |
47
|
|
|
}; |
48
|
|
|
|