forked from letsencrypt/boulder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.py
executable file
·69 lines (60 loc) · 1.83 KB
/
start.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env python2.7
"""
Run a local instance of Boulder for testing purposes.
This runs in non-monolithic mode and requires RabbitMQ on localhost.
"""
import os
import shutil
import socket
import subprocess
import sys
import tempfile
import time
tempdir = tempfile.mkdtemp()
config = os.environ.get('BOULDER_CONFIG')
if config is None:
config = 'test/boulder-config.json'
cfsslConfig = os.environ.get('CFSSL_CONFIG')
if cfsslConfig is None:
cfsslConfig = 'test/cfssl-config.json'
def run(path):
binary = os.path.join(tempdir, os.path.basename(path))
cmd = 'go build -o %s %s' % (binary, path)
print(cmd)
if subprocess.Popen(cmd, shell=True).wait() != 0:
sys.exit(1)
return subprocess.Popen('''
exec %s --config %s
''' % (binary, config), shell=True)
processes = []
def start():
# A strange Go bug: If cfssl is up-to-date, we'll get a failure building
# Boulder. Work around by touching cfssl.go.
subprocess.Popen('touch Godeps/_workspace/src/github.com/cloudflare/cfssl/cmd/cfssl/cfssl.go', shell=True).wait()
cmd = 'go build -o %s/cfssl ./Godeps/_workspace/src/github.com/cloudflare/cfssl/cmd/cfssl' % (tempdir)
print(cmd)
if subprocess.Popen(cmd, shell=True).wait() != 0:
die()
global processes
processes = [
run('./cmd/boulder-wfe'),
run('./cmd/boulder-ra'),
run('./cmd/boulder-sa'),
run('./cmd/boulder-ca'),
run('./cmd/boulder-va'),
subprocess.Popen('''
exec %s/cfssl \
-loglevel 0 \
serve \
-port 9000 \
-ca test/test-ca.pem \
-ca-key test/test-ca.key \
-config %s
''' % (tempdir, cfsslConfig), shell=True, stdout=None)]
time.sleep(100000)
try:
start()
finally:
for p in processes:
if p.poll() is None:
p.kill()