Skip to content

Commit 54151e7

Browse files
committed
Add debug
1 parent 99c86c2 commit 54151e7

6 files changed

Lines changed: 28 additions & 2 deletions

File tree

bin/docker-entrypoint

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ if [ "${1}" == "./bin/rails" ] && [ "${2}" == "server" ]; then
1010
orchestrator:await_healthy[redis,5] \
1111
orchestrator:connect_self
1212

13+
bundle exec orchestrator:debug
14+
1315
# create connection environment variables
1416
eval $(bundle exec rake orchestrator:create_connection_environment[postgresql,redis])
1517
fi

lib/sagittarius/orchestrator/container.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ def healthy?
3636
internal_container.info['State']['Status'] == 'running'
3737
end
3838

39+
def last_ip_number
40+
raise NotImplementedError
41+
end
42+
3943
def self.[](container)
4044
Containers.const_get(container.capitalize).new
4145
end

lib/sagittarius/orchestrator/containers/postgresql.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ def healthy?
3939
super && internal_container.exec(%w[pg_isready]).last.zero?
4040
end
4141

42+
def last_ip_number
43+
4
44+
end
45+
4246
def orchestrator_connection_details
4347
return {} unless healthy?
4448

lib/sagittarius/orchestrator/containers/redis.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ def ports
2828
}
2929
end
3030

31+
def last_ip_number
32+
5
33+
end
34+
3135
def orchestrator_connection_details
3236
return {} unless healthy?
3337

lib/sagittarius/orchestrator/operator.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def ensure_container_down!(container)
3333
destroy_container!(container) unless State[container.name].internal_container.nil?
3434
end
3535

36-
private
36+
# private
3737

3838
def ensure_network!
3939
return unless network.nil?
@@ -45,7 +45,10 @@ def ensure_network!
4545
end
4646

4747
def network
48-
Docker::Network.all(filters: JSON.dump({ 'label' => ["#{ORCHESTRATOR_LABEL_PREFIX}=network"] })).first
48+
network_id = Docker::Network.all(filters: JSON.dump(
49+
{ 'label' => ["#{ORCHESTRATOR_LABEL_PREFIX}=network"] }
50+
)).first.id
51+
Docker::Network.get(network_id)
4952
end
5053

5154
def ensure_volumes!(container)

lib/tasks/orchestrator.rake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ namespace :orchestrator do
8686
puts env_variables.map { |key, value| "export #{key}=#{value}" }.join("\n")
8787
end
8888

89+
task debug: :build_state do
90+
puts '=====> volumes'
91+
p Sagittarius::Orchestrator::State.volumes
92+
puts '=====> containers'
93+
p Sagittarius::Orchestrator::State.containers
94+
puts '=====> network'
95+
p Sagittarius::Orchestrator::Operator.network
96+
end
97+
8998
if Rails.env.local?
9099
namespace :dev do
91100
task start: :build_state do

0 commit comments

Comments
 (0)