luci-app-docker: add luci docker package

This commit is contained in:
LEAN-ESX 2019-10-11 09:30:44 -07:00
parent d4e5063e47
commit 6b5092f383
10 changed files with 177 additions and 2 deletions

View File

@ -0,0 +1,18 @@
#
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=Luci for Docker-CE
LUCI_DEPENDS:=+docker-ce
LUCI_PKGARCH:=all
PKG_VERSION:=1
PKG_RELEASE:=5
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,17 @@
module("luci.controller.docker", package.seeall)
function index()
if not nixio.fs.access("/etc/config/docker") then
return
end
entry({"admin", "services", "docker"}, cbi("docker"), _("Docker CE Container"), 199).dependent = true
entry({"admin","services","docker","status"},call("act_status")).leaf=true
end
function act_status()
local e={}
e.running=luci.sys.call("pgrep /usr/bin/dockerd >/dev/null")==0
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end

View File

@ -0,0 +1,46 @@
local running = (luci.sys.call("pidof portainer >/dev/null") == 0)
local button = ""
if running then
button = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /><br /><input type=\"button\" value=\" " .. translate("Open Portainer Docker Admin") .. " \" onclick=\"window.open('http://'+window.location.hostname+':" .. 9999 .. "')\"/>"
end
m = Map("docker", "Docker CE", translate("Docker is a set of platform-as-a-service (PaaS) products that use OS-level virtualization to deliver software in packages called containers."))
m:section(SimpleSection).template = "docker/docker_status"
s = m:section(TypedSection, "docker")
s.anonymous = true
wan_mode = s:option(Flag, "enabled", translate("Enable WAN access Dokcer"))
wan_mode.default = 0
wan_mode.rmempty = false
wan_mode.description = translate(("!") .. button)
o = s:option(Button,"certificate",translate("Docker Readme First"))
o.inputtitle = translate("Download DockerReadme.pdf")
o.description = translate("Please download DockerReadme.pdf to read when first-running")
o.inputstyle = "reload"
o.write = function()
Download()
end
function Download()
local t,e
t=nixio.open("/www/DockerReadme.pdf","r")
luci.http.header('Content-Disposition','attachment; filename="DockerReadme.pdf"')
luci.http.prepare_content("application/octet-stream")
while true do
e=t:read(nixio.const.buffersize)
if(not e)or(#e==0)then
break
else
luci.http.write(e)
end
end
t:close()
luci.http.close()
end
return m

View File

@ -0,0 +1,22 @@
<script type="text/javascript">//<![CDATA[
XHR.poll(3, '<%=url([[admin]], [[services]], [[docker]], [[status]])%>', null,
function(x, data) {
var tb = document.getElementById('docker_status');
if (data && tb) {
if (data.running) {
var links = '<em><b><font color=green>Docker CE <%:RUNNING%></font></b></em>';
tb.innerHTML = links;
} else {
tb.innerHTML = '<em><b><font color=red>Docker CE <%:NOT RUNNING%></font></b></em>';
}
}
}
);
//]]>
</script>
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
<fieldset class="cbi-section">
<p id="docker_status">
<em><%:Collecting data...%></em>
</p>
</fieldset>

View File

@ -0,0 +1,39 @@
msgid ""
msgstr ""
"Project-Id-Version: Luci ARP Bind\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-06-23 20:16+0800\n"
"PO-Revision-Date: 2015-06-23 20:17+0800\n"
"Last-Translator: 981213 <gch981213@gmail.com>\n"
"Language-Team: PandoraBox Team\n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Poedit 1.8.1\n"
"X-Poedit-SourceCharset: UTF-8\n"
msgid "Docker CE Container"
msgstr "Docker CE 容器"
msgid "Open Portainer Docker Admin"
msgstr "打开 Portainer Docker 管理页面"
msgid "Docker is a set of platform-as-a-service (PaaS) products that use OS-level virtualization to deliver software in packages called containers."
msgstr "Docker是一组平台即服务platform-as-a-servicePaaS产品它使用操作系统级容器虚拟化来交付软件包。"
msgid "Enable WAN access Dokcer"
msgstr "允许 WAN 访问 Dokcer"
msgid "Enable WAN access docker mapped ports"
msgstr "允许 WAN 访问 Dokcer 映射后的端口(易受攻击,不推荐!)"
msgid "Docker Readme First"
msgstr "Docker 初始化无脑配置教程"
msgid "Download DockerReadme.pdf"
msgstr "下载 Docker 初始化无脑配置教程"
msgid "Please download DockerReadme.pdf to read when first-running"
msgstr "初次在OpenWrt中运行Docker必读只需执行一次流程"

View File

@ -0,0 +1,13 @@
#!/bin/sh
sleep 10
docker_ok=$(iptables -t filter -L FORWARD | grep DOCKER)
while [ -z "$docker_ok" ]; do
echo "DOCKER Chain not ready" && sleep 10
docker_ok=$(iptables -t filter -L FORWARD | grep DOCKER)
done
iptables -D FORWARD -i pppoe-wan -o docker0 -j DROP 2>/dev/null
iptables -I FORWARD -i pppoe-wan -o docker0 -j DROP

View File

@ -0,0 +1,16 @@
#!/bin/sh /etc/rc.common
USE_PROCD=1
START=25
start_service() {
local nofile=$(cat /proc/sys/fs/nr_open)
procd_open_instance
procd_set_param stderr 1
procd_set_param command /usr/bin/dockerd
procd_set_param limits nofile="${nofile} ${nofile}"
procd_close_instance
/etc/docker-pppoe &>/dev/null &
}

View File

@ -0,0 +1,4 @@
#!/bin/sh
rm -f /tmp/luci-indexcache
exit 0

Binary file not shown.

View File

@ -21,11 +21,11 @@ include $(INCLUDE_DIR)/target.mk
DEFAULT_PACKAGES += partx-utils mkf2fs fdisk e2fsprogs wpad kmod-usb-hid \
kmod-ath5k kmod-ath9k kmod-ath9k-htc kmod-ath10k kmod-rt2800-usb kmod-e1000e kmod-igb kmod-igbvf kmod-ixgbe kmod-pcnet32 kmod-tulip kmod-vmxnet3 kmod-i40e kmod-i40evf kmod-fs-f2fs \
htop lm-sensors autocore automount autosamba luci-app-zerotier luci-app-ipsec-vpnd luci-app-pptp-server luci-proto-bonding luci-app-zerotier luci-app-unblockmusic \
htop lm-sensors autocore automount autosamba luci-app-zerotier luci-app-ipsec-vpnd luci-app-pptp-server luci-proto-bonding luci-app-zerotier luci-app-unblockmusic luci-app-docker \
ath10k-firmware-qca988x ath10k-firmware-qca9888 ath10k-firmware-qca9984 brcmfmac-firmware-43602a1-pcie intel-microcode amd64-microcode\
alsa-utils kmod-ac97 kmod-sound-hda-core kmod-sound-hda-codec-realtek kmod-sound-hda-codec-via kmod-sound-via82xx kmod-usb-audio \
kmod-usb-net kmod-usb-net-asix kmod-usb-net-asix-ax88179 kmod-usb-net-rtl8150 kmod-usb-net-rtl8152 \
shadowsocks-libev-ss-redir v2ray shadowsocksr-libev-server shadowsocksr-libev-ssr-local dsmboot cfdisk docker-ce
shadowsocks-libev-ss-redir v2ray shadowsocksr-libev-server shadowsocksr-libev-ssr-local dsmboot cfdisk
$(eval $(call BuildTarget))