Skip to content

Commit 44b7cab

Browse files
author
Rob Percival
authored
Move server binaries to /cmd directory (#2027)
Also moves /server/main.go to /cmd/internal/serverutil, because this part of the "server" package is fairly specific to those binaries.
1 parent e07600f commit 44b7cab

File tree

11 files changed

+34
-23
lines changed

11 files changed

+34
-23
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44

55
Not yet released; provisionally v1.4.0 (may change).
66

7+
### Server Binaries
8+
9+
The `trillian_log_server`, `trillian_log_signer` and `trillian_map_server`
10+
binaries have moved from `github.com/google/trillian/server/` to
11+
`github.com/google/trillian/cmd`. A subset of the `server` package has also
12+
moved and now resides in `github.com/google/trillian/cmd/internal/serverutil`.
13+
714
### Bazel Changes
815
Python support is disabled unless we hear that the community cares about this
916
being re-enabled. This was broken by a downstream change and without a signal

server/main.go renamed to cmd/internal/serverutil/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
// Package server holds code for running Trillian servers.
16-
package server
15+
// Package serverutil holds code for running Trillian servers.
16+
package serverutil
1717

1818
import (
1919
"context"

server/trillian_log_server/main.go renamed to cmd/trillian_log_server/main.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
"github.com/golang/protobuf/proto"
2929
"github.com/google/trillian"
3030
"github.com/google/trillian/cmd"
31+
"github.com/google/trillian/cmd/internal/serverutil"
3132
"github.com/google/trillian/crypto/keys/der"
3233
"github.com/google/trillian/crypto/keyspb"
3334
"github.com/google/trillian/extension"
@@ -68,8 +69,8 @@ var (
6869
quotaDryRun = flag.Bool("quota_dry_run", false, "If true no requests are blocked due to lack of tokens")
6970

7071
treeGCEnabled = flag.Bool("tree_gc", true, "If true, tree garbage collection (hard-deletion) is periodically performed")
71-
treeDeleteThreshold = flag.Duration("tree_delete_threshold", server.DefaultTreeDeleteThreshold, "Minimum period a tree has to remain deleted before being hard-deleted")
72-
treeDeleteMinRunInterval = flag.Duration("tree_delete_min_run_interval", server.DefaultTreeDeleteMinInterval, "Minimum interval between tree garbage collection sweeps. Actual runs happen randomly between [minInterval,2*minInterval).")
72+
treeDeleteThreshold = flag.Duration("tree_delete_threshold", serverutil.DefaultTreeDeleteThreshold, "Minimum period a tree has to remain deleted before being hard-deleted")
73+
treeDeleteMinRunInterval = flag.Duration("tree_delete_min_run_interval", serverutil.DefaultTreeDeleteMinInterval, "Minimum interval between tree garbage collection sweeps. Actual runs happen randomly between [minInterval,2*minInterval).")
7374

7475
tracing = flag.Bool("tracing", false, "If true opencensus Stackdriver tracing will be enabled. See https://opencensus.io/.")
7576
tracingProjectID = flag.String("tracing_project_id", "", "project ID to pass to stackdriver. Can be empty for GCP, consult docs for other platforms.")
@@ -119,10 +120,10 @@ func main() {
119120
}
120121

121122
// Announce our endpoints to etcd if so configured.
122-
unannounce := server.AnnounceSelf(ctx, client, *etcdService, *rpcEndpoint)
123+
unannounce := serverutil.AnnounceSelf(ctx, client, *etcdService, *rpcEndpoint)
123124
defer unannounce()
124125
if *httpEndpoint != "" {
125-
unannounceHTTP := server.AnnounceSelf(ctx, client, *etcdHTTPService, *httpEndpoint)
126+
unannounceHTTP := serverutil.AnnounceSelf(ctx, client, *etcdHTTPService, *httpEndpoint)
126127
defer unannounceHTTP()
127128
}
128129

@@ -148,7 +149,7 @@ func main() {
148149
defer pprof.StopCPUProfile()
149150
}
150151

151-
m := server.Main{
152+
m := serverutil.Main{
152153
RPCEndpoint: *rpcEndpoint,
153154
HTTPEndpoint: *httpEndpoint,
154155
TLSCertFile: *tlsCertFile,

server/trillian_log_signer/main.go renamed to cmd/trillian_log_signer/main.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626

2727
"github.com/golang/glog"
2828
"github.com/google/trillian/cmd"
29+
"github.com/google/trillian/cmd/internal/serverutil"
2930
"github.com/google/trillian/extension"
3031
"github.com/google/trillian/log"
3132
"github.com/google/trillian/monitoring"
@@ -43,6 +44,7 @@ import (
4344
"google.golang.org/grpc"
4445

4546
tpb "github.com/google/trillian"
47+
4648
// Register key ProtoHandlers
4749
_ "github.com/google/trillian/crypto/keys/der/proto"
4850
_ "github.com/google/trillian/crypto/keys/pem/proto"
@@ -148,7 +150,7 @@ func main() {
148150
// Start HTTP server (optional)
149151
if *httpEndpoint != "" {
150152
// Announce our endpoint to etcd if so configured.
151-
unannounceHTTP := server.AnnounceSelf(ctx, client, *etcdHTTPService, *httpEndpoint)
153+
unannounceHTTP := serverutil.AnnounceSelf(ctx, client, *etcdHTTPService, *httpEndpoint)
152154
defer unannounceHTTP()
153155
}
154156

@@ -180,7 +182,7 @@ func main() {
180182
defer pprof.StopCPUProfile()
181183
}
182184

183-
m := server.Main{
185+
m := serverutil.Main{
184186
RPCEndpoint: *rpcEndpoint,
185187
HTTPEndpoint: *httpEndpoint,
186188
TLSCertFile: *tlsCertFile,

server/trillian_map_server/main.go renamed to cmd/trillian_map_server/main.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/golang/protobuf/proto"
2727
"github.com/google/trillian"
2828
"github.com/google/trillian/cmd"
29+
"github.com/google/trillian/cmd/internal/serverutil"
2930
"github.com/google/trillian/crypto/keys/der"
3031
"github.com/google/trillian/crypto/keyspb"
3132
"github.com/google/trillian/extension"
@@ -64,8 +65,8 @@ var (
6465
quotaDryRun = flag.Bool("quota_dry_run", false, "If true no requests are blocked due to lack of tokens")
6566

6667
treeGCEnabled = flag.Bool("tree_gc", true, "If true, tree garbage collection (hard-deletion) is periodically performed")
67-
treeDeleteThreshold = flag.Duration("tree_delete_threshold", server.DefaultTreeDeleteThreshold, "Minimum period a tree has to remain deleted before being hard-deleted")
68-
treeDeleteMinRunInterval = flag.Duration("tree_delete_min_run_interval", server.DefaultTreeDeleteMinInterval, "Minimum interval between tree garbage collection sweeps. Actual runs happen randomly between [minInterval,2*minInterval).")
68+
treeDeleteThreshold = flag.Duration("tree_delete_threshold", serverutil.DefaultTreeDeleteThreshold, "Minimum period a tree has to remain deleted before being hard-deleted")
69+
treeDeleteMinRunInterval = flag.Duration("tree_delete_min_run_interval", serverutil.DefaultTreeDeleteMinInterval, "Minimum interval between tree garbage collection sweeps. Actual runs happen randomly between [minInterval,2*minInterval).")
6970

7071
tracing = flag.Bool("tracing", false, "If true opencensus Stackdriver tracing will be enabled. See https://opencensus.io/.")
7172
tracingProjectID = flag.String("tracing_project_id", "", "project ID to pass to Stackdriver client. Can be empty for GCP, consult docs for other platforms.")
@@ -138,7 +139,7 @@ func main() {
138139
defer pprof.StopCPUProfile()
139140
}
140141

141-
m := server.Main{
142+
m := serverutil.Main{
142143
RPCEndpoint: *rpcEndpoint,
143144
HTTPEndpoint: *httpEndpoint,
144145
TLSCertFile: *tlsCertFile,

examples/ct/ctmapper/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ which have that domain in their subject/SAN fields.
1414
# contents of storage/mysql/schema/storage.sql
1515
yes | scripts/resetdb.sh
1616

17-
go build ./server/trillian_map_server
17+
go build ./cmd/trillian_map_server
1818
go build ./examples/ct/ctmapper/mapper
1919
go build ./examples/ct/ctmapper/lookup
2020

examples/deployment/aws/terraform.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ mkdir -p /go
132132
export GOPATH=/go
133133
134134
# Install Trillian
135-
go get github.com/google/trillian/server/trillian_log_server
135+
go get github.com/google/trillian/cmd/trillian_log_server
136136
137137
# Setup the DB
138138
cd /go/src/github.com/google/trillian

examples/deployment/docker/log_server/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ RUN go mod download
1414
COPY . .
1515

1616
# Build the server.
17-
RUN go get ./server/trillian_log_server
17+
RUN go get ./cmd/trillian_log_server
1818
# Run the licensing tool and save licenses, copyright notices, etc.
19-
RUN go run github.com/google/go-licenses save ./server/trillian_log_server --save_path /THIRD_PARTY_NOTICES
19+
RUN go run github.com/google/go-licenses save ./cmd/trillian_log_server --save_path /THIRD_PARTY_NOTICES
2020

2121
# Make a minimal image.
2222
FROM gcr.io/distroless/base

examples/deployment/docker/log_signer/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ RUN go mod download
1414
COPY . .
1515

1616
# Build the signer.
17-
RUN go get ./server/trillian_log_signer
17+
RUN go get ./cmd/trillian_log_signer
1818
# Run the licensing tool and save licenses, copyright notices, etc.
19-
RUN go run github.com/google/go-licenses save ./server/trillian_log_signer --save_path /THIRD_PARTY_NOTICES
19+
RUN go run github.com/google/go-licenses save ./cmd/trillian_log_signer --save_path /THIRD_PARTY_NOTICES
2020

2121
# Make a minimal image.
2222
FROM gcr.io/distroless/base

examples/deployment/docker/map_server/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ RUN go mod download
1414
COPY . .
1515

1616
# Build the server.
17-
RUN go get ./server/trillian_map_server
17+
RUN go get ./cmd/trillian_map_server
1818
# Run the licensing tool and save licenses, copyright notices, etc.
19-
RUN go run github.com/google/go-licenses save ./server/trillian_map_server --save_path /THIRD_PARTY_NOTICES
19+
RUN go run github.com/google/go-licenses save ./cmd/trillian_map_server --save_path /THIRD_PARTY_NOTICES
2020

2121
# Make a minimal image.
2222
FROM gcr.io/distroless/base

0 commit comments

Comments
 (0)