Skip to content

Commit

Permalink
swap killswitch for 'docker-compose restart'
Browse files Browse the repository at this point in the history
Signed-off-by: Bob Callaway <bcallaway@google.com>
  • Loading branch information
bobcallaway committed Jun 25, 2023
1 parent c2e3149 commit 4ca4082
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 29 deletions.
2 changes: 0 additions & 2 deletions cmd/rekor-server/app/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ func init() {
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.rekor-server.yaml)")
rootCmd.PersistentFlags().StringVar(&logType, "log_type", "dev", "logger type to use (dev/prod)")
rootCmd.PersistentFlags().BoolVar(&enablePprof, "enable_pprof", false, "enable pprof for profiling on port 6060")
rootCmd.PersistentFlags().Bool("enable_killswitch", false, "enable killswitch for TESTING ONLY on port 2345")
_ = rootCmd.PersistentFlags().MarkHidden("enable_killswitch")

rootCmd.PersistentFlags().String("trillian_log_server.address", "127.0.0.1", "Trillian log server address")
rootCmd.PersistentFlags().Uint16("trillian_log_server.port", 8090, "Trillian log server port")
Expand Down
21 changes: 0 additions & 21 deletions cmd/rekor-server/app/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,27 +126,6 @@ var serveCmd = &cobra.Command{
_ = srv.ListenAndServe()
}()

if viper.GetBool("enable_killswitch") {
go func() {
mux := http.NewServeMux()
mux.Handle("/kill", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if err := server.Shutdown(); err != nil {
log.Logger.Error(err)
}
w.WriteHeader(http.StatusOK)
}))

srv := &http.Server{
Addr: ":2345",
ReadTimeout: 10 * time.Second,
WriteTimeout: 10 * time.Second,
Handler: mux,
}

_ = srv.ListenAndServe()
}()
}

if err := server.Serve(); err != nil {
log.Logger.Fatal(err)
}
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ services:
"--rekor_server.signer=memory",
"--enable_attestation_storage",
"--attestation_storage_bucket=file:///var/run/attestations",
"--enable_killswitch",
"--max_request_body_size=32792576",
]
ports:
- "3000:3000"
- "2112:2112"
- "2345:2345"
3 changes: 1 addition & 2 deletions e2e-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ if docker-compose logs --no-color | grep -q "panic: runtime error:" ; then
fi

echo "generating code coverage"
curl -X GET 0.0.0.0:2345/kill
sleep 5
docker-compose restart rekor-server

if ! docker cp $(docker ps -aqf "name=rekor_rekor-server"):go/rekor-server.cov /tmp/pkg-rekor-server.cov ; then
# failed to copy code coverage report from server
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ if docker-compose logs --no-color | grep -q "panic: runtime error:" ; then
fi

echo "generating code coverage"
curl -X GET 0.0.0.0:2345/kill
sleep 5
docker-compose restart rekor-server

if ! docker cp $(docker ps -aqf "name=rekor_rekor-server"):go/rekor-server.cov /tmp/rekor-server.cov ; then
# failed to copy code coverage report from server
Expand Down

0 comments on commit 4ca4082

Please sign in to comment.