Skip to content

Commit

Permalink
[DEVX-2511] Pact Improvements (#1)
Browse files Browse the repository at this point in the history
* Change entrypoint.sh to start puma with PID 1
* Add puma-metrics
* Share puma-metrics port in docker-compose.yml
  • Loading branch information
catks authored and id-ilych committed Oct 30, 2024
1 parent 2511826 commit 211a8b0
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ services:
image: "pactfoundation/pact-broker:2.110.0-pactbroker2.107.1"
ports:
- "9292:9292"
- "9293:9293" # puma-metrics port
depends_on:
- postgres
environment:
Expand Down
3 changes: 2 additions & 1 deletion pact_broker/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ gem "pg", "~>1.5"
gem "puma", "~> 5.6"
gem "mysql2", "~>0.3"
gem "sqlite3", "~>1.6", force_ruby_platform: true
gem "rake", "~> 13.0"
gem "rake", "~> 13.0"
gem 'puma-metrics'
6 changes: 6 additions & 0 deletions pact_broker/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,15 @@ GEM
padrino-support (0.15.3)
parslet (2.0.0)
pg (1.5.8)
prometheus-client (4.2.3)
base64
psych (5.1.2)
stringio
puma (5.6.9)
nio4r (~> 2.0)
puma-metrics (1.2.5)
prometheus-client (>= 0.10)
puma (>= 5.0)
racc (1.8.1)
rack (2.2.9)
rack-protection (3.2.0)
Expand Down Expand Up @@ -169,6 +174,7 @@ DEPENDENCIES
pact_broker
pg (~> 1.5)
puma (~> 5.6)
puma-metrics
rake (~> 13.0)
sqlite3 (~> 1.6)

Expand Down
5 changes: 5 additions & 0 deletions pact_broker/config/puma.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
require_relative "../docker_configuration"

plugin 'metrics'
puma_metrics_port = ENV['PACT_BROKER_PUMA_METRICS_PORT'] || (PactBroker.docker_configuration.port.to_i + 1).to_s

port PactBroker.docker_configuration.port

metrics_url "tcp://0.0.0.0:#{puma_metrics_port}"

if PactBroker.docker_configuration.puma_persistent_timeout
persistent_timeout PactBroker.docker_configuration.puma_persistent_timeout
end
2 changes: 1 addition & 1 deletion pact_broker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ if [ "${PACT_BROKER_DATABASE_CLEAN_ENABLED}" = "true" ]; then
/usr/local/bin/supercronic -quiet -passthrough-logs /pact_broker/crontab &
fi

bundle exec puma
exec bundle exec puma

0 comments on commit 211a8b0

Please sign in to comment.