Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Commit

Permalink
fix dns using proper dns server
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsiaw committed Jun 26, 2024
1 parent 1c3e450 commit 080c08c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 17 deletions.
44 changes: 28 additions & 16 deletions lib/kaiser/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def attach_app
attach_mounts = Config.kaiserfile.attach_mounts
volumes = attach_mounts.map { |from, to| "-v #{`pwd`.chomp}/#{from}:#{to}" }.join(' ')

system "docker run -ti
cmd = "docker run -ti
--name #{app_container_name}
--network #{network_name}
--dns #{ip_of_container(Config.config[:shared_names][:dns])}
Expand All @@ -265,6 +265,9 @@ def attach_app
#{app_params}
kaiser:#{envname}-#{current_branch} #{cmd}".tr("\n", ' ')

puts cmd
system cmd

stop_services

Config.out.puts 'Cleaning up...'
Expand Down Expand Up @@ -555,15 +558,6 @@ def ensure_setup
--network #{Config.config[:networkname]}
redis:7-alpine"
)
run_if_dead(
Config.config[:shared_names][:chrome],
"docker run -d
-p 5900:5900
--shm-size='2g'
--name #{Config.config[:shared_names][:chrome]}
--network #{Config.config[:networkname]}
#{selenium_node_image}"
)
run_if_dead(
Config.config[:shared_names][:nginx],
"docker run -d
Expand All @@ -576,17 +570,35 @@ def ensure_setup
--network #{Config.config[:networkname]}
jwilder/nginx-proxy"
)

dnsconffile = "#{ENV['HOME']}/.kaiser/dnsconf"
File.write(dnsconffile, <<~HOSTS)
log-queries
no-resolv
server=8.8.8.8
server=1.1.1.1
address=/.#{http_suffix}/#{ip_of_container(Config.config[:shared_names][:nginx])}
HOSTS

run_if_dead(
Config.config[:shared_names][:dns],
"docker run -d
--name #{Config.config[:shared_names][:dns]}
--network #{Config.config[:networkname]}
--privileged
-e DOCKER_HOST='unix:///var/run/docker.sock'
-v /var/run/docker.sock:/var/run/docker.sock:ro
davidsiaw/dockerdns
--domain #{http_suffix}
--record :#{ip_of_container(Config.config[:shared_names][:nginx])}"
-v #{dnsconffile}:/etc/dnsmasq.conf:ro
degica/dnsmasq
"
)

run_if_dead(
Config.config[:shared_names][:chrome],
"docker run -d
-p 5900:5900
--shm-size='2g'
--name #{Config.config[:shared_names][:chrome]}
--network #{Config.config[:networkname]}
--dns #{ip_of_container(Config.config[:shared_names][:dns])}
#{selenium_node_image}"
)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/kaiser/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Kaiser
VERSION = '0.8.2'
VERSION = '0.8.3'
end

0 comments on commit 080c08c

Please sign in to comment.