OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 import sys, os, pwd, subprocess | 3 import sys, os, pwd, subprocess |
4 | 4 |
5 app_dir = '/opt/discourse' | 5 app_dir = '/opt/discourse' |
6 airbrake_key = os.environ.get('AIRBRAKE_KEY', None) | 6 airbrake_key = os.environ.get('AIRBRAKE_KEY', None) |
7 | 7 |
8 # HOME environment variable isn't reliable when called via sudo | 8 # HOME environment variable isn't reliable when called via sudo |
9 home_dir = os.path.expanduser('~' + pwd.getpwuid(os.getuid()).pw_name) | 9 home_dir = os.path.expanduser('~' + pwd.getpwuid(os.getuid()).pw_name) |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 data = handle.read() | 37 data = handle.read() |
38 handle.seek(0) | 38 handle.seek(0) |
39 print >>handle, "require 'airbrake'" | 39 print >>handle, "require 'airbrake'" |
40 handle.write(data) | 40 handle.write(data) |
41 | 41 |
42 def runInitCommands(): | 42 def runInitCommands(): |
43 service_path = '/etc/init.d/discourse' | 43 service_path = '/etc/init.d/discourse' |
44 | 44 |
45 callRailsCommand(['bundle', 'install', '--deployment', '--without', 'test', '-
-without', 'development']) | 45 callRailsCommand(['bundle', 'install', '--deployment', '--without', 'test', '-
-without', 'development']) |
46 initAirBrake() | 46 initAirBrake() |
| 47 callRailsCommand(['bundle', 'exec', 'rake', 'db:migrate']) |
47 callRailsCommand(['bundle', 'exec', 'rake', 'assets:precompile']) | 48 callRailsCommand(['bundle', 'exec', 'rake', 'assets:precompile']) |
48 | 49 |
49 if os.path.exists(service_path): | 50 if os.path.exists(service_path): |
50 subprocess.check_call(['sudo', service_path, 'stop']) | 51 subprocess.check_call(['sudo', service_path, 'stop']) |
51 | 52 |
52 callRailsCommand(['bundle', 'exec', 'rake', 'db:migrate']) | |
53 | |
54 if os.path.exists(service_path): | 53 if os.path.exists(service_path): |
55 subprocess.check_call(['sudo', service_path, 'start']) | 54 subprocess.check_call(['sudo', service_path, 'start']) |
56 | 55 |
57 if __name__ == '__main__': | 56 if __name__ == '__main__': |
58 runInitCommands() | 57 runInitCommands() |
OLD | NEW |