Compare commits
15 Commits
8dbec29c45
...
master
Author | SHA1 | Date | |
---|---|---|---|
448f645f6f | |||
a30978d20c | |||
a0bb698c02 | |||
8cad86560d | |||
e2bd375198 | |||
3af1ffa11a | |||
03b8b4baca | |||
7ff0f28ed4 | |||
99370803e3 | |||
9a07f9fc74 | |||
28445e30d2 | |||
f21c3fdb52 | |||
f46b00c896 | |||
40ab734bb3 | |||
154e73b291 |
12
_install.sh
Normal file → Executable file
12
_install.sh
Normal file → Executable file
@ -1,14 +1,18 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
SOURCE=$(dirname $0)
|
SOURCE=$(pwd)
|
||||||
[[ -e "$SOURCE/dbash" ]] || { echo "Please cd to the directory containing this file and try to run _install.sh again." ; exit 1 }
|
TARGET="/usr/local/bin"
|
||||||
TARGET=/usr/local/bin
|
|
||||||
|
if [ ! -e "$SOURCE/dbash" ]; then
|
||||||
|
echo "Please cd to the directory containing this file and try to run _install.sh again."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
ln -sf "$SOURCE/dbash" "$TARGET/dbash"
|
ln -sf "$SOURCE/dbash" "$TARGET/dbash"
|
||||||
ln -sf "$SOURCE/dhelp" "$TARGET/dhelp"
|
ln -sf "$SOURCE/dhelp" "$TARGET/dhelp"
|
||||||
ln -sf "$SOURCE/dlogs" "$TARGET/dlogs"
|
ln -sf "$SOURCE/dlogs" "$TARGET/dlogs"
|
||||||
ln -sf "$SOURCE/dlogsl" "$TARGET/dlogsl"
|
ln -sf "$SOURCE/dlogsl" "$TARGET/dlogsl"
|
||||||
ln -sf "$SOURCE/dlr" "$TARGET/dlr"
|
ln -sf "$SOURCE/drl" "$TARGET/drl"
|
||||||
ln -sf "$SOURCE/dps.rb" "$TARGET/dps"
|
ln -sf "$SOURCE/dps.rb" "$TARGET/dps"
|
||||||
ln -sf "$SOURCE/dsh" "$TARGET/dsh"
|
ln -sf "$SOURCE/dsh" "$TARGET/dsh"
|
||||||
ln -sf "$SOURCE/dstats" "$TARGET/dstats"
|
ln -sf "$SOURCE/dstats" "$TARGET/dstats"
|
||||||
|
2
dbash
2
dbash
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
. $(dirname $0)/_get_container.sh
|
. $(dirname "$(readlink -f "$0")")/_get_container.sh
|
||||||
|
|
||||||
docker exec -it "$container" /bin/bash
|
docker exec -it "$container" /bin/bash
|
||||||
|
2
dlogs
2
dlogs
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
. $(dirname $0)/_get_container.sh
|
. $(dirname "$(readlink -f "$0")")/_get_container.sh
|
||||||
|
|
||||||
docker logs --tail=100 -f "$container"
|
docker logs --tail=100 -f "$container"
|
||||||
|
2
dlogsl
2
dlogsl
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
. $(dirname $0)/_get_container.sh
|
. $(dirname "$(readlink -f "$0")")/_get_container.sh
|
||||||
|
|
||||||
docker logs -f "$container" 2>&1 | less
|
docker logs -f "$container" 2>&1 | less
|
||||||
|
22
dps.rb
22
dps.rb
@ -9,7 +9,7 @@ COLOR_GRAY = "[1;30m"
|
|||||||
COLOR_RESET = "[0m"
|
COLOR_RESET = "[0m"
|
||||||
|
|
||||||
class Container
|
class Container
|
||||||
FIELDS = [:state, :dup, :ouroboros, :name, :vhosts, :nginx_allow, :status, :image, :ports]
|
FIELDS = [:state, :dup, :ouroboros, :name, :vhosts, :authelia, :status, :image, :ports]
|
||||||
@@lengths = Hash.new(0)
|
@@lengths = Hash.new(0)
|
||||||
|
|
||||||
def initialize(data)
|
def initialize(data)
|
||||||
@ -21,7 +21,7 @@ class Container
|
|||||||
set :ouroboros, @data[:Labels][:"com.centurylinklabs.watchtower.enable"]=="true" ? "✓" : ""
|
set :ouroboros, @data[:Labels][:"com.centurylinklabs.watchtower.enable"]=="true" ? "✓" : ""
|
||||||
set :name, @data[:Names].first[1..-1]
|
set :name, @data[:Names].first[1..-1]
|
||||||
|
|
||||||
vh = @data[:Labels][:"nginx_virtual_host"]&.split(",")&.collect(&:strip)
|
vh = @data[:Labels][:"nginx_virtual_host"]&.split(",")&.map{|h| h.split("@").first.strip}
|
||||||
if vh.nil? || vh.count==0
|
if vh.nil? || vh.count==0
|
||||||
vh = ""
|
vh = ""
|
||||||
elsif vh.count==1
|
elsif vh.count==1
|
||||||
@ -45,9 +45,23 @@ class Container
|
|||||||
else
|
else
|
||||||
"#{COLOR_RED}#{p[:PrivatePort]}->#{p[:PublicPort]}#{type}"
|
"#{COLOR_RED}#{p[:PrivatePort]}->#{p[:PublicPort]}#{type}"
|
||||||
end
|
end
|
||||||
end.join(" ")
|
end.uniq.join(" ")
|
||||||
|
|
||||||
set :nginx_allow, @data[:Labels][:"nginx_allow"]
|
#set :nginx_allow, @data[:Labels][:"nginx_allow"]
|
||||||
|
if vh==""
|
||||||
|
set :authelia, ""
|
||||||
|
elsif @data[:Labels][:"authelia_policy"]=="one_factor"
|
||||||
|
set :authelia, "1#{COLOR_GRAY}FA#{COLOR_RESET}"
|
||||||
|
elsif @data[:Labels][:"authelia_policy"]=="two_factor"
|
||||||
|
set :authelia, "2#{COLOR_GRAY}FA#{COLOR_RESET}"
|
||||||
|
elsif @data[:Labels][:"authelia_policy"]=="bypass"
|
||||||
|
set :authelia, "#{COLOR_GREEN}BYP#{COLOR_RESET}"
|
||||||
|
elsif @data[:Labels][:"authelia_policy"]=="none"
|
||||||
|
set :authelia, "#{COLOR_GREEN}NONE#{COLOR_RESET}"
|
||||||
|
else
|
||||||
|
set :authelia, "#{COLOR_RED}?#{COLOR_RESET}"
|
||||||
|
end
|
||||||
|
|
||||||
st = @data[:Status]
|
st = @data[:Status]
|
||||||
if st.end_with?("(healthy)")
|
if st.end_with?("(healthy)")
|
||||||
st = COLOR_GREEN + st.gsub("(healthy)", "(v)") + COLOR_RESET
|
st = COLOR_GREEN + st.gsub("(healthy)", "(v)") + COLOR_RESET
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
. $(dirname $0)/_get_container.sh
|
. $(dirname "$(readlink -f "$0")")/_get_container.sh
|
||||||
|
|
||||||
docker restart "$container" && docker logs --tail=100 -f "$container"
|
docker restart "$container" && docker logs --tail=100 -f "$container"
|
2
dsh
2
dsh
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
. $(dirname $0)/_get_container.sh
|
. $(dirname "$(readlink -f "$0")")/_get_container.sh
|
||||||
|
|
||||||
docker exec -it "$container" /bin/sh
|
docker exec -it "$container" /bin/sh
|
||||||
|
2
dstats
2
dstats
@ -1,3 +1,3 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo docker stats $(docker inspect --format "{{.Name}}" $(docker ps -q))
|
docker stats $(docker inspect --format "{{.Name}}" $(docker ps -q))
|
||||||
|
25
dup.rb
25
dup.rb
@ -70,14 +70,26 @@ def get_sample(name="container")
|
|||||||
- "/etc/localtime:/etc/localtime:ro"
|
- "/etc/localtime:/etc/localtime:ro"
|
||||||
|
|
||||||
labels:
|
labels:
|
||||||
|
# Syntax:
|
||||||
|
# <hostname>: Uses the given hostname and the default cert (*.schle.nz)
|
||||||
|
# <hostname>@: Uses the given hostname and the cert with the same name
|
||||||
|
# <hostname>@<cert>: Uses the given hostname and cert
|
||||||
nginx_virtual_host: container.home.schle.nz
|
nginx_virtual_host: container.home.schle.nz
|
||||||
nginx_port: 80
|
nginx_port: 80
|
||||||
nginx_additional_ports: "443, 5050"
|
nginx_additional_ports: "443, 5050"
|
||||||
nginx_allow: fabian # "user" or "@group" or "user, user, @group" or "all"
|
|
||||||
nginx_no_robots: true
|
nginx_no_robots: true
|
||||||
nginx_public_paths: "/public, /api"
|
nginx_public_paths: "/public, /api"
|
||||||
nginx_type: # "http" (default), "https", "fastcgi", "skip" (doesn't create any entries)
|
nginx_type: # "http" (default), "https", "fastcgi", "skip" (doesn't create any entries)
|
||||||
nginx_client_max_body_size: "25M"
|
nginx_client_max_body_size: "25M"
|
||||||
|
# Syntax:
|
||||||
|
# user:<username>
|
||||||
|
# group:<groupname>
|
||||||
|
authelia_allow: "user:fabian"
|
||||||
|
# Policies:
|
||||||
|
# one_factor
|
||||||
|
# two_factor
|
||||||
|
# bypass
|
||||||
|
authelia_policy: one_factor
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
- "nginx"
|
- "nginx"
|
||||||
@ -140,6 +152,7 @@ def action_help
|
|||||||
puts " --regenerate Generates YAML content from a running container."
|
puts " --regenerate Generates YAML content from a running container."
|
||||||
puts " --all Use all containers defined in yml files."
|
puts " --all Use all containers defined in yml files."
|
||||||
puts "-v, --verbose More verbose output."
|
puts "-v, --verbose More verbose output."
|
||||||
|
puts "-q, --quiet Don't open log after starting a new container."
|
||||||
exit 1
|
exit 1
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -424,7 +437,9 @@ class Container
|
|||||||
if ! @data["detach"]
|
if ! @data["detach"]
|
||||||
self.attach
|
self.attach
|
||||||
else
|
else
|
||||||
self.log
|
unless $quiet
|
||||||
|
self.log
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -464,12 +479,13 @@ needs_container = true
|
|||||||
completion_str = ""
|
completion_str = ""
|
||||||
silent_basedir = false
|
silent_basedir = false
|
||||||
$net_host = false
|
$net_host = false
|
||||||
|
$quiet = false
|
||||||
|
|
||||||
if ENV['DUP_DIR']
|
if ENV['DUP_DIR']
|
||||||
$base_dir = ENV['DUP_DIR']
|
$base_dir = ENV['DUP_DIR']
|
||||||
else
|
else
|
||||||
$base_dir = File.join(Dir.home, ".dup")
|
$base_dir = File.join(Dir.home, ".dup")
|
||||||
puts "Environment variable DUP_DIR is not set. Looking for .yml files in #{$base_dir}" unless silent_basedir
|
STDERR.puts "Environment variable DUP_DIR is not set. Looking for .yml files in #{$base_dir}" unless silent_basedir
|
||||||
end
|
end
|
||||||
|
|
||||||
opts = GetoptLong.new(
|
opts = GetoptLong.new(
|
||||||
@ -485,6 +501,7 @@ opts = GetoptLong.new(
|
|||||||
[ '--regenerate', GetoptLong::NO_ARGUMENT ],
|
[ '--regenerate', GetoptLong::NO_ARGUMENT ],
|
||||||
[ '--verbose', '-v', GetoptLong::NO_ARGUMENT ],
|
[ '--verbose', '-v', GetoptLong::NO_ARGUMENT ],
|
||||||
[ '--all', GetoptLong::NO_ARGUMENT ],
|
[ '--all', GetoptLong::NO_ARGUMENT ],
|
||||||
|
[ '--quiet', '-q', GetoptLong::NO_ARGUMENT ]
|
||||||
)
|
)
|
||||||
|
|
||||||
opts.each do |opt, arg|
|
opts.each do |opt, arg|
|
||||||
@ -520,6 +537,8 @@ opts.each do |opt, arg|
|
|||||||
$verbose = true
|
$verbose = true
|
||||||
when '--all'
|
when '--all'
|
||||||
container = Dir[$base_dir + "/*.yml"].sort.map{|f| Container.new(File.basename(f, ".yml"))}
|
container = Dir[$base_dir + "/*.yml"].sort.map{|f| Container.new(File.basename(f, ".yml"))}
|
||||||
|
when '--quiet'
|
||||||
|
$quiet = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user