Skip to content

Commit 6719dc1

Browse files
jshacpu
authored andcommitted
Remove AMQP config and code (letsencrypt#2634)
We now use gRPC everywhere.
1 parent 98addd5 commit 6719dc1

File tree

37 files changed

+203
-3160
lines changed

37 files changed

+203
-3160
lines changed

cmd/admin-revoker/main.go

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"github.com/letsencrypt/boulder/metrics"
2424
rapb "github.com/letsencrypt/boulder/ra/proto"
2525
"github.com/letsencrypt/boulder/revocation"
26-
"github.com/letsencrypt/boulder/rpc"
2726
"github.com/letsencrypt/boulder/sa"
2827
sapb "github.com/letsencrypt/boulder/sa/proto"
2928
)
@@ -50,10 +49,6 @@ args:
5049
type config struct {
5150
Revoker struct {
5251
cmd.DBConfig
53-
// The revoker isn't a long running service, so doesn't get a full
54-
// ServiceConfig, just an AMQPConfig.
55-
AMQP *cmd.AMQPConfig
56-
5752
// Similarly, the Revoker needs a TLSConfig to set up its GRPC client certs,
5853
// but doesn't get the TLS field from ServiceConfig, so declares its own.
5954
TLS cmd.TLSConfig
@@ -80,33 +75,19 @@ func setupContext(c config) (core.RegistrationAuthority, blog.Logger, *gorp.DbMa
8075
cmd.FailOnError(err, "TLS config")
8176
}
8277

83-
amqpConf := c.Revoker.AMQP
84-
var rac core.RegistrationAuthority
85-
if c.Revoker.RAService != nil {
86-
conn, err := bgrpc.ClientSetup(c.Revoker.RAService, tls, scope)
87-
cmd.FailOnError(err, "Failed to load credentials and create gRPC connection to RA")
88-
rac = bgrpc.NewRegistrationAuthorityClient(rapb.NewRegistrationAuthorityClient(conn))
89-
} else {
90-
var err error
91-
rac, err = rpc.NewRegistrationAuthorityClient(clientName, amqpConf, scope)
92-
cmd.FailOnError(err, "Unable to create RA AMQP client")
93-
}
78+
raConn, err := bgrpc.ClientSetup(c.Revoker.RAService, tls, scope)
79+
cmd.FailOnError(err, "Failed to load credentials and create gRPC connection to RA")
80+
rac := bgrpc.NewRegistrationAuthorityClient(rapb.NewRegistrationAuthorityClient(raConn))
9481

9582
dbURL, err := c.Revoker.DBConfig.URL()
9683
cmd.FailOnError(err, "Couldn't load DB URL")
9784
dbMap, err := sa.NewDbMap(dbURL, c.Revoker.DBConfig.MaxDBConns)
9885
cmd.FailOnError(err, "Couldn't setup database connection")
9986
go sa.ReportDbConnCount(dbMap, scope)
10087

101-
var sac core.StorageAuthority
102-
if c.Revoker.SAService != nil {
103-
conn, err := bgrpc.ClientSetup(c.Revoker.SAService, tls, scope)
104-
cmd.FailOnError(err, "Failed to load credentials and create gRPC connection to SA")
105-
sac = bgrpc.NewStorageAuthorityClient(sapb.NewStorageAuthorityClient(conn))
106-
} else {
107-
sac, err = rpc.NewStorageAuthorityClient(clientName, amqpConf, scope)
108-
cmd.FailOnError(err, "Failed to create SA client")
109-
}
88+
saConn, err := bgrpc.ClientSetup(c.Revoker.SAService, tls, scope)
89+
cmd.FailOnError(err, "Failed to load credentials and create gRPC connection to SA")
90+
sac := bgrpc.NewStorageAuthorityClient(sapb.NewStorageAuthorityClient(saConn))
11091

11192
return rac, logger, dbMap, sac, scope
11293
}

cmd/boulder-ca/main.go

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
bgrpc "github.com/letsencrypt/boulder/grpc"
2525
"github.com/letsencrypt/boulder/metrics"
2626
"github.com/letsencrypt/boulder/policy"
27-
"github.com/letsencrypt/boulder/rpc"
2827
sapb "github.com/letsencrypt/boulder/sa/proto"
2928
)
3029

@@ -176,20 +175,9 @@ func main() {
176175
cmd.FailOnError(err, "TLS config")
177176
}
178177

179-
amqpConf := c.CA.AMQP
180-
if c.CA.SAService != nil {
181-
conn, err := bgrpc.ClientSetup(c.CA.SAService, tls, scope)
182-
cmd.FailOnError(err, "Failed to load credentials and create gRPC connection to SA")
183-
cai.SA = bgrpc.NewStorageAuthorityClient(sapb.NewStorageAuthorityClient(conn))
184-
} else {
185-
cai.SA, err = rpc.NewStorageAuthorityClient(clientName, amqpConf, scope)
186-
cmd.FailOnError(err, "Failed to create SA client")
187-
}
188-
189-
if amqpConf.Publisher != nil {
190-
cai.Publisher, err = rpc.NewPublisherClient(clientName, amqpConf, scope)
191-
cmd.FailOnError(err, "Failed to create Publisher client")
192-
}
178+
conn, err := bgrpc.ClientSetup(c.CA.SAService, tls, scope)
179+
cmd.FailOnError(err, "Failed to load credentials and create gRPC connection to SA")
180+
cai.SA = bgrpc.NewStorageAuthorityClient(sapb.NewStorageAuthorityClient(conn))
193181

194182
var caSrv *grpc.Server
195183
if c.CA.GRPCCA != nil {
@@ -216,11 +204,7 @@ func main() {
216204
ocspSrv = s
217205
}
218206

219-
cas, err := rpc.NewAmqpRPCServer(amqpConf, c.CA.MaxConcurrentRPCServerRequests, scope, logger)
220-
cmd.FailOnError(err, "Unable to create CA RPC server")
221-
222207
go cmd.CatchSignals(logger, func() {
223-
cas.Stop()
224208
if caSrv != nil {
225209
caSrv.GracefulStop()
226210
}
@@ -229,12 +213,8 @@ func main() {
229213
}
230214
})
231215

232-
err = rpc.NewCertificateAuthorityServer(cas, cai)
233-
cmd.FailOnError(err, "Failed to create Certificate Authority RPC server")
234-
235216
go cmd.DebugServer(c.CA.DebugAddr)
236217
go cmd.ProfileCmd(scope)
237218

238-
err = cas.Start(amqpConf)
239-
cmd.FailOnError(err, "Unable to run CA RPC server")
219+
select {}
240220
}

cmd/boulder-publisher/main.go

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"github.com/letsencrypt/boulder/metrics"
1616
"github.com/letsencrypt/boulder/publisher"
1717
pubPB "github.com/letsencrypt/boulder/publisher/proto"
18-
"github.com/letsencrypt/boulder/rpc"
1918
sapb "github.com/letsencrypt/boulder/sa/proto"
2019
)
2120

@@ -24,10 +23,9 @@ const clientName = "Publisher"
2423
type config struct {
2524
Publisher struct {
2625
cmd.ServiceConfig
27-
SubmissionTimeout cmd.ConfigDuration
28-
MaxConcurrentRPCServerRequests int64
29-
SAService *cmd.GRPCClientConfig
30-
Features map[string]bool
26+
SubmissionTimeout cmd.ConfigDuration
27+
SAService *cmd.GRPCClientConfig
28+
Features map[string]bool
3129
}
3230

3331
Statsd cmd.StatsdConfig
@@ -94,16 +92,9 @@ func main() {
9492
cmd.FailOnError(err, "TLS config")
9593
}
9694

97-
amqpConf := c.Publisher.AMQP
98-
var sac core.StorageAuthority
99-
if c.Publisher.SAService != nil {
100-
conn, err := bgrpc.ClientSetup(c.Publisher.SAService, tls, scope)
101-
cmd.FailOnError(err, "Failed to load credentials and create gRPC connection to SA")
102-
sac = bgrpc.NewStorageAuthorityClient(sapb.NewStorageAuthorityClient(conn))
103-
} else {
104-
sac, err = rpc.NewStorageAuthorityClient(clientName, amqpConf, scope)
105-
cmd.FailOnError(err, "Unable to create SA client")
106-
}
95+
conn, err := bgrpc.ClientSetup(c.Publisher.SAService, tls, scope)
96+
cmd.FailOnError(err, "Failed to load credentials and create gRPC connection to SA")
97+
sac := bgrpc.NewStorageAuthorityClient(sapb.NewStorageAuthorityClient(conn))
10798

10899
pubi := publisher.New(
109100
bundle,
@@ -126,22 +117,14 @@ func main() {
126117
grpcSrv = s
127118
}
128119

129-
pubs, err := rpc.NewAmqpRPCServer(amqpConf, c.Publisher.MaxConcurrentRPCServerRequests, scope, logger)
130-
cmd.FailOnError(err, "Unable to create Publisher RPC server")
131-
132120
go cmd.CatchSignals(logger, func() {
133-
pubs.Stop()
134121
if grpcSrv != nil {
135122
grpcSrv.GracefulStop()
136123
}
137124
})
138125

139-
err = rpc.NewPublisherServer(pubs, pubi)
140-
cmd.FailOnError(err, "Unable to setup Publisher RPC server")
141-
142126
go cmd.DebugServer(c.Publisher.DebugAddr)
143127
go cmd.ProfileCmd(scope)
144128

145-
err = pubs.Start(amqpConf)
146-
cmd.FailOnError(err, "Unable to run Publisher RPC server")
129+
select {}
147130
}

cmd/boulder-ra/main.go

Lines changed: 13 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
pubPB "github.com/letsencrypt/boulder/publisher/proto"
2424
"github.com/letsencrypt/boulder/ra"
2525
rapb "github.com/letsencrypt/boulder/ra/proto"
26-
"github.com/letsencrypt/boulder/rpc"
2726
sapb "github.com/letsencrypt/boulder/sa/proto"
2827
)
2928

@@ -36,8 +35,6 @@ type config struct {
3635

3736
RateLimitPoliciesFilename string
3837

39-
MaxConcurrentRPCServerRequests int64
40-
4138
MaxContactsPerRegistration int
4239

4340
// UseIsSafeDomain determines whether to call VA.IsSafeDomain
@@ -128,29 +125,16 @@ func main() {
128125
cmd.FailOnError(err, "TLS config")
129126
}
130127

131-
amqpConf := c.RA.AMQP
132-
var vac core.ValidationAuthority
133-
if c.RA.VAService != nil {
134-
conn, err := bgrpc.ClientSetup(c.RA.VAService, tls, scope)
135-
cmd.FailOnError(err, "Unable to create VA client")
136-
vac = bgrpc.NewValidationAuthorityGRPCClient(conn)
137-
} else {
138-
vac, err = rpc.NewValidationAuthorityClient(clientName, amqpConf, scope)
139-
cmd.FailOnError(err, "Unable to create VA client")
140-
}
128+
vaConn, err := bgrpc.ClientSetup(c.RA.VAService, tls, scope)
129+
cmd.FailOnError(err, "Unable to create VA client")
130+
vac := bgrpc.NewValidationAuthorityGRPCClient(vaConn)
141131

142-
var cac core.CertificateAuthority
143-
if c.RA.CAService != nil {
144-
conn, err := bgrpc.ClientSetup(c.RA.CAService, tls, scope)
145-
cmd.FailOnError(err, "Unable to create CA client")
146-
// Build a CA client that is only capable of issuing certificates, not
147-
// signing OCSP. TODO(jsha): Once we've fully moved to gRPC, replace this
148-
// with a plain caPB.NewCertificateAuthorityClient.
149-
cac = bgrpc.NewCertificateAuthorityClient(caPB.NewCertificateAuthorityClient(conn), nil)
150-
} else {
151-
cac, err = rpc.NewCertificateAuthorityClient(clientName, amqpConf, scope)
152-
cmd.FailOnError(err, "Unable to create CA client")
153-
}
132+
caConn, err := bgrpc.ClientSetup(c.RA.CAService, tls, scope)
133+
cmd.FailOnError(err, "Unable to create CA client")
134+
// Build a CA client that is only capable of issuing certificates, not
135+
// signing OCSP. TODO(jsha): Once we've fully moved to gRPC, replace this
136+
// with a plain caPB.NewCertificateAuthorityClient.
137+
cac := bgrpc.NewCertificateAuthorityClient(caPB.NewCertificateAuthorityClient(caConn), nil)
154138

155139
var pubc core.Publisher
156140
if c.RA.PublisherService != nil {
@@ -159,15 +143,9 @@ func main() {
159143
pubc = bgrpc.NewPublisherClientWrapper(pubPB.NewPublisherClient(conn))
160144
}
161145

162-
var sac core.StorageAuthority
163-
if c.RA.SAService != nil {
164-
conn, err := bgrpc.ClientSetup(c.RA.SAService, tls, scope)
165-
cmd.FailOnError(err, "Failed to load credentials and create gRPC connection to SA")
166-
sac = bgrpc.NewStorageAuthorityClient(sapb.NewStorageAuthorityClient(conn))
167-
} else {
168-
sac, err = rpc.NewStorageAuthorityClient(clientName, amqpConf, scope)
169-
cmd.FailOnError(err, "Unable to create SA client")
170-
}
146+
conn, err := bgrpc.ClientSetup(c.RA.SAService, tls, scope)
147+
cmd.FailOnError(err, "Failed to load credentials and create gRPC connection to SA")
148+
sac := bgrpc.NewStorageAuthorityClient(sapb.NewStorageAuthorityClient(conn))
171149

172150
// TODO(patf): remove once RA.authorizationLifetimeDays is deployed
173151
authorizationLifetime := 300 * 24 * time.Hour
@@ -241,22 +219,14 @@ func main() {
241219
}()
242220
}
243221

244-
ras, err := rpc.NewAmqpRPCServer(amqpConf, c.RA.MaxConcurrentRPCServerRequests, scope, logger)
245-
cmd.FailOnError(err, "Unable to create RA RPC server")
246-
247222
go cmd.CatchSignals(logger, func() {
248-
ras.Stop()
249223
if grpcSrv != nil {
250224
grpcSrv.GracefulStop()
251225
}
252226
})
253227

254-
err = rpc.NewRegistrationAuthorityServer(ras, rai, logger)
255-
cmd.FailOnError(err, "Unable to setup RA RPC server")
256-
257228
go cmd.DebugServer(c.RA.DebugAddr)
258229
go cmd.ProfileCmd(scope)
259230

260-
err = ras.Start(amqpConf)
261-
cmd.FailOnError(err, "Unable to run RA RPC server")
231+
select {}
262232
}

cmd/boulder-sa/main.go

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"github.com/letsencrypt/boulder/features"
1313
bgrpc "github.com/letsencrypt/boulder/grpc"
1414
"github.com/letsencrypt/boulder/metrics"
15-
"github.com/letsencrypt/boulder/rpc"
1615
"github.com/letsencrypt/boulder/sa"
1716
sapb "github.com/letsencrypt/boulder/sa/proto"
1817
)
@@ -24,8 +23,6 @@ type config struct {
2423
cmd.ServiceConfig
2524
cmd.DBConfig
2625

27-
MaxConcurrentRPCServerRequests int64
28-
2926
Features map[string]bool
3027
}
3128

@@ -82,23 +79,14 @@ func main() {
8279
}()
8380
}
8481

85-
amqpConf := saConf.AMQP
86-
sas, err := rpc.NewAmqpRPCServer(amqpConf, c.SA.MaxConcurrentRPCServerRequests, scope, logger)
87-
cmd.FailOnError(err, "Unable to create SA RPC server")
88-
8982
go cmd.CatchSignals(logger, func() {
90-
sas.Stop()
9183
if grpcSrv != nil {
9284
grpcSrv.GracefulStop()
9385
}
9486
})
9587

96-
err = rpc.NewStorageAuthorityServer(sas, sai)
97-
cmd.FailOnError(err, "Unable to setup SA RPC server")
98-
9988
go cmd.DebugServer(c.SA.DebugAddr)
10089
go cmd.ProfileCmd(scope)
10190

102-
err = sas.Start(amqpConf)
103-
cmd.FailOnError(err, "Unable to run SA RPC server")
91+
select {}
10492
}

cmd/boulder-va/main.go

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@ import (
66
"time"
77

88
"github.com/jmhodges/clock"
9-
"google.golang.org/grpc"
109

1110
"github.com/letsencrypt/boulder/bdns"
1211
"github.com/letsencrypt/boulder/cdr"
1312
"github.com/letsencrypt/boulder/cmd"
1413
"github.com/letsencrypt/boulder/features"
1514
bgrpc "github.com/letsencrypt/boulder/grpc"
1615
"github.com/letsencrypt/boulder/metrics"
17-
"github.com/letsencrypt/boulder/rpc"
1816
"github.com/letsencrypt/boulder/va"
1917
)
2018

@@ -30,8 +28,6 @@ type config struct {
3028

3129
PortConfig cmd.PortConfig
3230

33-
MaxConcurrentRPCServerRequests int64
34-
3531
GoogleSafeBrowsing *cmd.GoogleSafeBrowsingConfig
3632

3733
CAADistributedResolver *cmd.CAADistributedResolverConfig
@@ -151,38 +147,25 @@ func main() {
151147
clk,
152148
logger)
153149

154-
amqpConf := c.VA.AMQP
155-
var grpcSrv *grpc.Server
156-
if c.VA.GRPC != nil {
157-
tls, err := c.VA.TLS.Load()
158-
cmd.FailOnError(err, "TLS config")
159-
s, l, err := bgrpc.NewServer(c.VA.GRPC, tls, scope)
160-
cmd.FailOnError(err, "Unable to setup VA gRPC server")
161-
err = bgrpc.RegisterValidationAuthorityGRPCServer(s, vai)
162-
cmd.FailOnError(err, "Unable to register VA gRPC server")
163-
go func() {
164-
err = s.Serve(l)
165-
cmd.FailOnError(err, "VA gRPC service failed")
166-
}()
167-
grpcSrv = s
168-
}
169-
170-
vas, err := rpc.NewAmqpRPCServer(amqpConf, c.VA.MaxConcurrentRPCServerRequests, scope, logger)
171-
cmd.FailOnError(err, "Unable to create VA RPC server")
150+
tls, err := c.VA.TLS.Load()
151+
cmd.FailOnError(err, "TLS config")
152+
grpcSrv, l, err := bgrpc.NewServer(c.VA.GRPC, tls, scope)
153+
cmd.FailOnError(err, "Unable to setup VA gRPC server")
154+
err = bgrpc.RegisterValidationAuthorityGRPCServer(grpcSrv, vai)
155+
cmd.FailOnError(err, "Unable to register VA gRPC server")
156+
go func() {
157+
err = grpcSrv.Serve(l)
158+
cmd.FailOnError(err, "VA gRPC service failed")
159+
}()
172160

173161
go cmd.CatchSignals(logger, func() {
174-
vas.Stop()
175162
if grpcSrv != nil {
176163
grpcSrv.GracefulStop()
177164
}
178165
})
179166

180-
err = rpc.NewValidationAuthorityServer(vas, vai)
181-
cmd.FailOnError(err, "Unable to setup VA RPC server")
182-
183167
go cmd.DebugServer(c.VA.DebugAddr)
184168
go cmd.ProfileCmd(scope)
185169

186-
err = vas.Start(amqpConf)
187-
cmd.FailOnError(err, "Unable to run VA RPC server")
170+
select {}
188171
}

0 commit comments

Comments
 (0)