Skip to content

Commit

Permalink
Merge pull request #53 from letsencrypt/bifurcation-exec-refactor
Browse files Browse the repository at this point in the history
Bifurcation exec refactor
  • Loading branch information
jsha committed Mar 23, 2015
2 parents 8dc0012 + 6a98f2d commit cbf5c28
Show file tree
Hide file tree
Showing 12 changed files with 489 additions and 419 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ _cgo_export.*

_testmain.go

*.sw?
*.exe
*.test
*.prof
Expand Down
19 changes: 15 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
FROM golang:1.4
FROM golang:1.4.2

MAINTAINER J.C. Jones "jjones@mozilla.com"
MAINTAINER J.C. Jones "jjones@letsencrypt.org"

# Boulder exposes its web application at port TCP 4000
EXPOSE 4000

# Assume the configuration is in /etc/boulder
ENV BOULDER_CONFIG=/boulder/config.json

# Load the dependencies
RUN go-wrapper download github.com/bifurcation/gose && \
go-wrapper download github.com/codegangsta/cli && \
go-wrapper download github.com/streadway/amqp && \
go-wrapper download github.com/mattn/go-sqlite3 && \
go-wrapper download github.com/go-sql-driver/mysql && \
go-wrapper download github.com/cloudflare/cfssl/auth && \
go-wrapper download github.com/cloudflare/cfssl/config && \
go-wrapper download github.com/cloudflare/cfssl/signer
Expand All @@ -19,6 +23,13 @@ RUN mkdir -p /go/src/github.com/letsencrypt/boulder
COPY . /go/src/github.com/letsencrypt/boulder

# Build Boulder
RUN go install github.com/letsencrypt/boulder/cmd/boulder-start
RUN go install \
github.com/letsencrypt/boulder/cmd/activity-monitor \
github.com/letsencrypt/boulder/cmd/boulder \
github.com/letsencrypt/boulder/cmd/boulder-ca \
github.com/letsencrypt/boulder/cmd/boulder-ra \
github.com/letsencrypt/boulder/cmd/boulder-sa \
github.com/letsencrypt/boulder/cmd/boulder-va \
github.com/letsencrypt/boulder/cmd/boulder-wfe

ENTRYPOINT ["/go/bin/boulder-start"]
CMD ["/go/bin/boulder"]
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,35 @@ This is an initial implementation of an ACME-based CA. The [ACME protocol](https
Docker
------

Boulder is available as a [Docker image from Quay.io](https://quay.io/repository/letsencrypt/boulder). The entrypoint is the Boulder main method; you can load and run it using in monolithic mode (without AMQP) like:
Boulder is available as a [Docker image from Quay.io](https://quay.io/repository/letsencrypt/boulder). The Docker image expects the `config.json` file to be located at `/boulder/config.json` within the container.

(Note: You can override the `config.json` location by specifying a different BOULDER_CONFIG environment variable, such as with `-e BOULDER_CONFIG=mypath/myfile.config`.)

The default command is the monolithic "boulder" executable, which does not require an AMQP service.

A quick-start method for running a Boulder instance is to use one of the example configurations:

```
docker run -p 4000:4000 quay.io/letsencrypt/boulder monolithic
> mkdir .boulder-config
> cp test/example-config.json .boulder-config/config.json
> docker run --name=boulder --rm=true -v $(pwd)/.boulder-config:/boulder:ro -p 4000:4000 quay.io/letsencrypt/boulder:latest boulder
```

To run a single module, specifying the AMQP server, you might use something more like:

```
docker run -p 4000:4000 quay.io/letsencrypt/boulder --amqp 'amqp://guest:guest@amqp-server:15672' wfe
> docker run --name=boulder --rm=true -v $(pwd)/.boulder-config:/boulder:ro quay.io/letsencrypt/boulder:latest boulder-ra
```

The submodules are under the `cmd/` directory.


Quickstart
----------

```
> go build github.com/letsencrypt/boulder/boulder-start
> ./boulder-start monolithic # without AMQP
> ./boulder-start monolithic-amqp # with AMQP
> go build github.com/letsencrypt/boulder/cmd/boulder
> ./boulder --config test/example-config.json
```


Expand Down
34 changes: 34 additions & 0 deletions cmd/boulder-ca/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright 2014 ISRG. All rights reserved
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

package main

import (
"github.com/letsencrypt/boulder/ca"
"github.com/letsencrypt/boulder/cmd"
"github.com/letsencrypt/boulder/rpc"
)

func main() {
app := cmd.NewAppShell("boulder-ca")
app.Action = func(c cmd.Config) {
ch := cmd.AmqpChannel(c.AMQP.Server)

sac, err := rpc.NewStorageAuthorityClient(c.AMQP.SA.Client, c.AMQP.SA.Client, ch)
cmd.FailOnError(err, "Failed to create SA client")

cai, err := ca.NewCertificateAuthorityImpl(c.CA.Server, c.CA.AuthKey, c.CA.Profile)
cmd.FailOnError(err, "Failed to create CA impl")

cai.SA = &sac

cas, err := rpc.NewCertificateAuthorityServer(c.AMQP.CA.Server, ch, cai)
cmd.FailOnError(err, "Unable to create CA server")

cmd.RunForever(cas)
}

app.Run()
}
39 changes: 39 additions & 0 deletions cmd/boulder-ra/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright 2014 ISRG. All rights reserved
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

package main

import (
"github.com/letsencrypt/boulder/cmd"
"github.com/letsencrypt/boulder/ra"
"github.com/letsencrypt/boulder/rpc"
)

func main() {
app := cmd.NewAppShell("boulder-ra")
app.Action = func(c cmd.Config) {
ch := cmd.AmqpChannel(c.AMQP.Server)

vac, err := rpc.NewValidationAuthorityClient(c.AMQP.VA.Client, c.AMQP.VA.Server, ch)
cmd.FailOnError(err, "Unable to create VA client")

cac, err := rpc.NewCertificateAuthorityClient(c.AMQP.CA.Client, c.AMQP.CA.Server, ch)
cmd.FailOnError(err, "Unable to create CA client")

sac, err := rpc.NewStorageAuthorityClient(c.AMQP.SA.Client, c.AMQP.SA.Server, ch)
cmd.FailOnError(err, "Unable to create SA client")

rai := ra.NewRegistrationAuthorityImpl()
rai.VA = &vac
rai.CA = &cac
rai.SA = &sac

ras, err := rpc.NewRegistrationAuthorityServer(c.AMQP.RA.Server, ch, &rai)
cmd.FailOnError(err, "Unable to create RA server")
cmd.RunForever(ras)
}

app.Run()
}
31 changes: 31 additions & 0 deletions cmd/boulder-sa/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2014 ISRG. All rights reserved
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

package main

import (
// Load both drivers to allow configuring either
_ "github.com/go-sql-driver/mysql"
_ "github.com/mattn/go-sqlite3"

"github.com/letsencrypt/boulder/cmd"
"github.com/letsencrypt/boulder/rpc"
"github.com/letsencrypt/boulder/sa"
)

func main() {
app := cmd.NewAppShell("boulder-sa")
app.Action = func(c cmd.Config) {
ch := cmd.AmqpChannel(c.AMQP.Server)

sai, err := sa.NewSQLStorageAuthority(c.SA.DBDriver, c.SA.DBName)
cmd.FailOnError(err, "Failed to create SA impl")

sas := rpc.NewStorageAuthorityServer(c.AMQP.SA.Server, ch, sai)
cmd.RunForever(sas)
}

app.Run()
}
Loading

0 comments on commit cbf5c28

Please sign in to comment.