Skip to content

Commit 65cb272

Browse files
committed
Add a start.py to run in non-monolithic mode.
1 parent 1110666 commit 65cb272

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

start.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env python2.7
2+
"""
3+
Run a local instance of Boulder for testing purposes.
4+
5+
This runs in non-monolithic mode and requires RabbitMQ on localhost.
6+
"""
7+
import os
8+
import shutil
9+
import socket
10+
import subprocess
11+
import sys
12+
import tempfile
13+
import time
14+
15+
tempdir = tempfile.mkdtemp()
16+
17+
def run(path):
18+
binary = os.path.join(tempdir, os.path.basename(path))
19+
cmd = 'go build -o %s %s' % (binary, path)
20+
print(cmd)
21+
if subprocess.Popen(cmd, shell=True).wait() != 0:
22+
sys.exit(1)
23+
return subprocess.Popen('''
24+
exec %s --config test/boulder-config.json
25+
''' % binary, shell=True)
26+
27+
processes = []
28+
29+
def start():
30+
# A strange Go bug: If cfssl is up-to-date, we'll get a failure building
31+
# Boulder. Work around by touching cfssl.go.
32+
subprocess.Popen('touch Godeps/_workspace/src/github.com/cloudflare/cfssl/cmd/cfssl/cfssl.go', shell=True).wait()
33+
global processes
34+
processes = [
35+
run('./cmd/boulder-wfe'),
36+
run('./cmd/boulder-ra'),
37+
run('./cmd/boulder-sa'),
38+
run('./cmd/boulder-ca'),
39+
run('./cmd/boulder-va'),
40+
subprocess.Popen('''
41+
exec %s/cfssl \
42+
-loglevel 0 \
43+
serve \
44+
-port 9300 \
45+
-ca test/test-ca.pem \
46+
-ca-key test/test-ca.key \
47+
-config test/cfssl-config.json
48+
''' % tempdir, shell=True, stdout=None)]
49+
time.sleep(100000)
50+
51+
try:
52+
start()
53+
finally:
54+
for p in processes:
55+
if p.poll() is None:
56+
p.kill()

0 commit comments

Comments
 (0)