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: Clone from GitHub, updated to Discourse 1.6.4 Created Oct. 12, 2016, 1:17 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
« no previous file with comments | « hiera/roles/intraforumserver.yaml ('k') | modules/discourse/files/site.conf » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « hiera/roles/intraforumserver.yaml ('k') | modules/discourse/files/site.conf » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld