diff --git a/docs/temp/ubuntu开机启动.txt b/docs/temp/ubuntu开机启动.txt deleted file mode 100644 index 221aec60..00000000 --- a/docs/temp/ubuntu开机启动.txt +++ /dev/null @@ -1,21 +0,0 @@ -1.nano /etc/rc.local - -#https://linuxize.com/post/how-to-install-and-use-docker-compose-on-ubuntu-18-04/ -#!/bin/sh -e -# -# rc.local -# -# This script is executed at the end of each multiuser runlevel. -# Make sure that the script will "exit 0" on success or any other -# value on error. -# -# In order to enable or disable this script just change the execution -# bits. -# -# By default this script does nothing. - -#echo `date +"%Y-%m-%d %H:%M:%S"` > /root/start.log - -exit 0 - -2.chmod +x /etc/rc.local \ No newline at end of file diff --git a/projects/IoTNode/DbConfig.cs b/projects/IoTNode/DbConfig.cs index 77380927..0e540cab 100644 --- a/projects/IoTNode/DbConfig.cs +++ b/projects/IoTNode/DbConfig.cs @@ -8,6 +8,7 @@ using Microsoft.EntityFrameworkCore; using System.Collections.Generic; using System.Linq; using Microsoft.Extensions.Configuration; +using System; namespace IoTNode { @@ -77,8 +78,9 @@ namespace IoTNode set.Add(new Setting { Name = "id", Value = macAddress.Md5(), Type = SettingType.Text }); set.Add(new Setting { Name = "code", Value = "根据id生成的授权码", Type = SettingType.Text }); // - var host = "localhost"; - var stream = "localhost"; + var host = this._cfg.GetValue("seed:host", "localhost"); + var stream = this._cfg.GetValue("seed:stream", "localhost"); + var delay = this._cfg.GetValue("seed:delay", "100"); set.Add(new Setting { Name = "debug", Value = "false" }); set.Add(new Setting { Name = "notify:enabled", Value = "true" }); set.Add(new Setting { Name = "notify:host", Value = $"http://{host}/IoTCenter" }); @@ -91,7 +93,7 @@ namespace IoTNode set.Add(new Setting { Name = "ffmpeg.args", Value = " -y -threads {0} -rtsp_transport tcp -use_wallclock_as_timestamps 1 -stimeout 3000000 -i \"{1}\" -fflags +genpts -c copy -f flv \"{2}\"" }); set.Add(new Setting { Name = "fbee.writelist", Value = "" }); set.Add(new Setting { Name = "camera.writelist", Value = "" }); - set.Add(new Setting { Name = "delay", Value = "500", Type = SettingType.Text }); + set.Add(new Setting { Name = "delay", Value = delay, Type = SettingType.Text }); db.SaveChanges(); var sn = macAddress; diff --git a/projects/IoTNode/Views/Shared/_Menu.cshtml b/projects/IoTNode/Views/Shared/_Menu.cshtml index 58b5cc6e..d7b84682 100644 --- a/projects/IoTNode/Views/Shared/_Menu.cshtml +++ b/projects/IoTNode/Views/Shared/_Menu.cshtml @@ -5,6 +5,9 @@ + @functions{ public string GetClass(string action, string controller) diff --git a/projects/Version.cs b/projects/Version.cs index 1880b8d4..bd81b3d4 100644 --- a/projects/Version.cs +++ b/projects/Version.cs @@ -1,4 +1,4 @@ using System.Reflection; [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyInformationalVersion("1.0.0.527")] \ No newline at end of file +[assembly: AssemblyInformationalVersion("1.0.0.529")] \ No newline at end of file diff --git a/publish/exclude.txt b/publish/exclude.txt index 4c87536f..01971801 100644 --- a/publish/exclude.txt +++ b/publish/exclude.txt @@ -1,4 +1,5 @@ .vscode +.gitignore log docker\log\ docker\data\ diff --git a/publish/src/linux-x64/publish/debug.start.ps1 b/publish/src/linux-x64/publish/debug.start.ps1 new file mode 100644 index 00000000..26bee6d8 --- /dev/null +++ b/publish/src/linux-x64/publish/debug.start.ps1 @@ -0,0 +1 @@ +docker-compose up -d --remove-orphans \ No newline at end of file diff --git a/publish/src/linux-x64/publish/debug.stop.ps1 b/publish/src/linux-x64/publish/debug.stop.ps1 new file mode 100644 index 00000000..58694d08 --- /dev/null +++ b/publish/src/linux-x64/publish/debug.stop.ps1 @@ -0,0 +1 @@ +docker-compose down \ No newline at end of file diff --git a/publish/src/linux-x64/publish/docker-compose.yml b/publish/src/linux-x64/publish/docker-compose.yml index faa72f9a..7c099627 100644 --- a/publish/src/linux-x64/publish/docker-compose.yml +++ b/publish/src/linux-x64/publish/docker-compose.yml @@ -1,4 +1,6 @@ version: "3.8" +networks: + default: services: portainer: image: portainer/portainer:1.23.2 diff --git a/publish/src/linux-x64/publish/docker.sh b/publish/src/linux-x64/publish/docker.txt similarity index 57% rename from publish/src/linux-x64/publish/docker.sh rename to publish/src/linux-x64/publish/docker.txt index 6429bd90..1165dbe9 100644 --- a/publish/src/linux-x64/publish/docker.sh +++ b/publish/src/linux-x64/publish/docker.txt @@ -4,8 +4,9 @@ su root cd ~ #enable root ssh login nano /etc/ssh/sshd_config -PermitRootLogin yes -#https://docs.docker.com/engine/install/ubuntu/ + PermitRootLogin yes +service ssh restart +#docker install:https://docs.docker.com/engine/install/ubuntu/ apt-get remove docker docker-engine docker.io containerd runc apt-get update apt-get install \ @@ -23,3 +24,14 @@ add-apt-repository \ apt-get update apt-get install docker-ce docker-ce-cli containerd.io docker run hello-world +#docker compose:https://docs.docker.com/compose/install/ +curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose +chmod +x /usr/local/bin/docker-compose +#publish +upload publish to /root/publish +#rc.local +nano /etc/rc.local + #!/bin/sh -e + /root/publish/start.sh + exit 0 +reboot \ No newline at end of file diff --git a/publish/src/linux-x64/publish/docker/data/portainer/config.json b/publish/src/linux-x64/publish/docker/data/portainer/config.json index 6d51b770..059eb090 100644 --- a/publish/src/linux-x64/publish/docker/data/portainer/config.json +++ b/publish/src/linux-x64/publish/docker/data/portainer/config.json @@ -1 +1 @@ -{"HttpHeaders":{"X-PortainerAgent-ManagerOperation":"1","X-PortainerAgent-PublicKey":"3059301306072a8648ce3d020106082a8648ce3d03010703420004fee75fb7c1d2c2f628be43b1c9d68925563b286d75699d0cfb64e96c2456e7d75517ab1da6469aacf2a647142de38bee207c4ef40c9f8418c2fdfa6b174c880c","X-PortainerAgent-Signature":"t8IScsZ5O2pjmxeV+7RFrpZpmiLvYgc7ew/WbL72QqRNALkiGuTr8MwCrzYRJNtkSXDYVUxyDhjfyqPYqz8UEw"}} \ No newline at end of file +{"HttpHeaders":{"X-PortainerAgent-ManagerOperation":"1","X-PortainerAgent-PublicKey":"3059301306072a8648ce3d020106082a8648ce3d03010703420004fee75fb7c1d2c2f628be43b1c9d68925563b286d75699d0cfb64e96c2456e7d75517ab1da6469aacf2a647142de38bee207c4ef40c9f8418c2fdfa6b174c880c","X-PortainerAgent-Signature":"TEYfASo7Lvc5zDrjgE2dMeit4jSS/ZmHTTDf4Ipw6aBO7uFxBySP6o4TABOFkvGuAD85HQRimq/nPdBeRZWYqg"}} \ No newline at end of file diff --git a/publish/src/linux-x64/publish/docker/data/portainer/portainer.db b/publish/src/linux-x64/publish/docker/data/portainer/portainer.db index 666c43fd..e01d6cb2 100644 Binary files a/publish/src/linux-x64/publish/docker/data/portainer/portainer.db and b/publish/src/linux-x64/publish/docker/data/portainer/portainer.db differ diff --git a/publish/src/linux-x64/publish/install.sh b/publish/src/linux-x64/publish/install.txt similarity index 100% rename from publish/src/linux-x64/publish/install.sh rename to publish/src/linux-x64/publish/install.txt diff --git a/publish/src/linux-x64/publish/start.sh b/publish/src/linux-x64/publish/start.sh new file mode 100644 index 00000000..a076283f --- /dev/null +++ b/publish/src/linux-x64/publish/start.sh @@ -0,0 +1 @@ +docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d \ No newline at end of file diff --git a/publish/src/linux-x64/publish/stop.sh b/publish/src/linux-x64/publish/stop.sh new file mode 100644 index 00000000..58694d08 --- /dev/null +++ b/publish/src/linux-x64/publish/stop.sh @@ -0,0 +1 @@ +docker-compose down \ No newline at end of file