Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: modules/discourse/files/init-discourse

Issue 29347356: Issue 4234 - Migrate Discourse to a Docker-based setup (Closed)
Patch Set: Updated to Discourse 1.6.0 beta11 and increased memory size Created July 12, 2016, 4:56 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/env python
2
3 import sys, os, pwd, subprocess
4
5 app_dir = '/opt/discourse'
6
7 # HOME environment variable isn't reliable when called via sudo
8 home_dir = os.path.expanduser('~' + pwd.getpwuid(os.getuid()).pw_name)
9
10 env = dict(os.environ)
11 env['RAILS_ENV'] = 'production'
12
13 # See http://meta.discourse.org/t/tuning-ruby-and-rails-for-discourse/4126
14 env['RUBY_GC_MALLOC_LIMIT'] = '90000000'
15
16 def callRailsCommand(command):
17 subprocess.check_call(command, env=env, cwd=app_dir)
18
19 def runInitCommands():
20 service_path = '/etc/init.d/discourse'
21
22 callRailsCommand(['bundle', 'install', '--deployment', '--without', 'test', '- -without', 'development'])
23 callRailsCommand(['bundle', 'exec', 'rake', 'db:migrate'])
24 callRailsCommand(['bundle', 'exec', 'rake', 'assets:precompile'])
25
26 if os.path.exists(service_path):
27 subprocess.check_call(['sudo', service_path, 'stop'])
28
29 if os.path.exists(service_path):
30 subprocess.check_call(['sudo', service_path, 'start'])
31
32 if __name__ == '__main__':
33 runInitCommands()
OLDNEW

Powered by Google App Engine
This is Rietveld