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 (#102)
Browse files Browse the repository at this point in the history
* fix dns using proper dns server

* im sorry
  • Loading branch information
davidsiaw authored Jun 27, 2024
1 parent 466a5d5 commit a67f843
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 21 deletions.
8 changes: 4 additions & 4 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-06-07 07:43:43 UTC using RuboCop version 1.50.2.
# on 2024-06-27 01:53:02 UTC using RuboCop version 1.50.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand Down Expand Up @@ -37,7 +37,7 @@ Lint/ConstantDefinitionInBlock:
# Offense count: 13
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 58
Max: 64

# Offense count: 1
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Expand All @@ -48,7 +48,7 @@ Metrics/BlockLength:
# Offense count: 1
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Max: 477
Max: 485

# Offense count: 1
# Configuration parameters: AllowedMethods, AllowedPatterns.
Expand All @@ -58,7 +58,7 @@ Metrics/CyclomaticComplexity:
# Offense count: 17
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 45
Max: 51

# Offense count: 1
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
Expand Down
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 a67f843

Please sign in to comment.