diff --git a/Server/Common/Config.cs b/Server/Common/Config.cs
index 040ee29..7e1a460 100644
--- a/Server/Common/Config.cs
+++ b/Server/Common/Config.cs
@@ -1,5 +1,33 @@
namespace Common;
+public class ExecProcess
+{
+ ///
+ /// 步骤
+ ///
+ public SyncProcessStep Step { get; set; }
+
+ ///
+ /// A after B before
+ ///
+ public required string StepBeforeOrAfter { get; set; }
+
+ ///
+ /// L Local S Server
+ ///
+ public required string ExecInLocalOrServer { get; set; }
+
+ ///
+ /// 执行的应用程序名称
+ ///
+ public required string FileName { get; set; }
+
+ ///
+ /// 执行的应用程序参数
+ ///
+ public required string Argumnets { get; set; }
+}
+
public class DirFileConfig
{
///
@@ -21,10 +49,12 @@ public class DirFileConfig
/// 本地文件信息,也是即将发布的文件信息,通常是最新的版本
///
public Dir? LocalDirInfo { get; set; }
+
///
/// 差异文件信息
///
public Dir? DiffDirInfo { get; set; }
+
///
/// 远程文件信息,通常是较旧的版本
///
@@ -41,7 +71,7 @@ public class MSSqlConfig
///
/// db名称
///
- public required string DatebaseName { get; set; }
+ public required string DatabaseName { get; set; }
///
/// 用户
@@ -125,4 +155,9 @@ public class Config
/// 同步的文件夹配置
///
public required List DirFileConfigs { get; set; }
+
+ ///
+ /// 按照步骤执行应用程序扩展列表
+ ///
+ public required List ExecProcesses { get; set; }
}
diff --git a/Server/Common/ConnectPipeline.cs b/Server/Common/ConnectPipeline.cs
index 7c3626b..9b41b35 100644
--- a/Server/Common/ConnectPipeline.cs
+++ b/Server/Common/ConnectPipeline.cs
@@ -6,7 +6,6 @@ namespace Common;
public abstract class AbsPipeLine(bool isAES)
{
-
///
/// pipeLine工作函数,生效期间永久阻塞
///
@@ -18,6 +17,7 @@ public abstract class AbsPipeLine(bool isAES)
{
return true;
};
+
///
/// 监听pipeline 消息,由Work 函数调用
///
@@ -48,7 +48,6 @@ public abstract class AbsPipeLine(bool isAES)
/// 上传完成时返回/
public abstract Task UploadFile(string url, string filePath, Func progressCb);
-
///
/// 管道消息是否使用AES加密
///
@@ -147,7 +146,7 @@ public class WebSocPipeLine(TSocket socket, bool isAES) : AbsPipeLine(i
new SyncMsg
{
Type = SyncMsgType.Error,
- Step = SyncProcessStep.CloseError,
+ Step = SyncProcessStep.Close,
Body = CloseReason ?? ""
}
);
diff --git a/Server/Common/Message.cs b/Server/Common/Message.cs
index a7f9b9a..9c0c93b 100644
--- a/Server/Common/Message.cs
+++ b/Server/Common/Message.cs
@@ -16,7 +16,7 @@ public enum SyncProcessStep
PackSqlServer = 4,
UploadAndUnpack = 5,
Publish = 6,
- CloseError = 7
+ Close = 7
}
public class SyncMsg
diff --git a/Server/LocalServer/LocalSyncServer.cs b/Server/LocalServer/LocalSyncServer.cs
index bdf9011..496f31a 100644
--- a/Server/LocalServer/LocalSyncServer.cs
+++ b/Server/LocalServer/LocalSyncServer.cs
@@ -1,3 +1,5 @@
+using System.Diagnostics;
+using System.IO.Pipelines;
using System.Xml.Linq;
using Common;
@@ -8,6 +10,7 @@ public class LocalSyncServer
#pragma warning disable CA2211 // Non-constant fields should not be visible
public static string TempRootFile = "C:/TempPack";
public static string SqlPackageAbPath = "sqlpackage";
+
// 使用msdeploy 将会打包当前可运行的内容,它很有可能不包含最新的构建
//public static string MsdeployAbPath = "msdeploy";
@@ -15,16 +18,88 @@ public class LocalSyncServer
//使用msbuild 会缺少.net frame的运行环境 bin\roslyn 里面的内容,第一次需要人为复制一下,后面就就好了。
public static string MSBuildAbPath = "MSBuild";
#pragma warning restore CA2211 // Non-constant fields should not be visible
-
+
///
/// 连接状态,流程管理,LocalPipe 和 remotePipe 也在此处交换信息
///
private StateHelpBase StateHelper;
-
public void SetStateHelper(StateHelpBase helper)
{
- StateHelper = helper;
+ try
+ {
+ StateHelper = helper;
+ if (SyncConfig != null)
+ {
+ var LastExec = NotNullSyncConfig.ExecProcesses.Find(x =>
+ {
+ return x.StepBeforeOrAfter == "A"
+ && x.Step == (helper.Step - 1)
+ && x.ExecInLocalOrServer == "L";
+ });
+ ExecProcess(LastExec);
+ var CurrentExec = NotNullSyncConfig.ExecProcesses.Find(x =>
+ {
+ return x.StepBeforeOrAfter == "B"
+ && x.Step == helper.Step
+ && x.ExecInLocalOrServer == "L";
+ });
+ ExecProcess(CurrentExec);
+ }
+ }
+ catch (Exception ex)
+ {
+ Close(ex.Message);
+ }
+ }
+
+ public void ExecProcess(ExecProcess? ep)
+ {
+ if (ep != null)
+ {
+ ProcessStartInfo startInfo =
+ new()
+ {
+ StandardOutputEncoding = System.Text.Encoding.UTF8,
+ Arguments = ep.Argumnets,
+ FileName = ep.FileName, // The command to execute (can be any command line tool)
+ // The arguments to pass to the command (e.g., list directory contents)
+ RedirectStandardOutput = true, // Redirect the standard output to a string
+ UseShellExecute = false, // Do not use the shell to execute the command
+ CreateNoWindow = true // Do not create a new window for the command
+ };
+ using Process process = new() { StartInfo = startInfo };
+ // Start the process
+ process.Start();
+
+ // Read the output from the process
+ string output = process.StandardOutput.ReadToEnd();
+
+ // Wait for the process to exit
+ process.WaitForExit();
+
+ if (process.ExitCode == 0)
+ {
+ LocalPipe
+ .SendMsg(
+ StateHelper.CreateMsg(
+ $"{ep.Step}-{ep.StepBeforeOrAfter}-{ep.ExecInLocalOrServer}-{ep.FileName} {ep.Argumnets} 执行成功!"
+ )
+ )
+ .Wait();
+ }
+ else
+ {
+ LocalPipe
+ .SendMsg(
+ StateHelper.CreateMsg(
+ $"{ep.Step}-{ep.StepBeforeOrAfter}-{ep.ExecInLocalOrServer}-{ep.FileName} {ep.Argumnets} 失败 {output}!"
+ )
+ )
+ .Wait();
+ throw new Exception("错误,信息参考上一条消息!");
+ }
+ }
}
///
@@ -103,7 +178,7 @@ public class LocalSyncServer
public readonly AbsPipeLine LocalPipe;
///
- /// local server 和 remote server 的连接,它有加密
+ /// local server 和 remote server 的连接,它有加密
///
public readonly AbsPipeLine RemotePipe;
diff --git a/Server/LocalServer/Properties/launchSettings.json b/Server/LocalServer/Properties/launchSettings.json
index 8b5cb2f..fe91e70 100644
--- a/Server/LocalServer/Properties/launchSettings.json
+++ b/Server/LocalServer/Properties/launchSettings.json
@@ -14,7 +14,7 @@
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
- "applicationUrl": "http://localhost:5014",
+ "applicationUrl": "http://localhost:6818",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
diff --git a/Server/LocalServer/StateHelper.cs b/Server/LocalServer/StateHelper.cs
index 3981388..0bc1f49 100644
--- a/Server/LocalServer/StateHelper.cs
+++ b/Server/LocalServer/StateHelper.cs
@@ -40,7 +40,7 @@ public abstract class StateHelpBase(
var syncMsg =
JsonSerializer.Deserialize(msg)
?? throw new NullReferenceException("msg is null");
- if (syncMsg.Step != Step)
+ if (syncMsg.Step != Step && syncMsg.Step != SyncProcessStep.Close)
{
throw new Exception("Sync step error!");
}
@@ -55,7 +55,7 @@ public abstract class StateHelpBase(
var syncMsg =
JsonSerializer.Deserialize(msg)
?? throw new NullReferenceException("msg is null");
- if (syncMsg.Step != Step)
+ if (syncMsg.Step != Step && syncMsg.Step != SyncProcessStep.Close)
{
throw new Exception("Sync step error!");
}
@@ -323,7 +323,7 @@ public class DeployMSSqlHelper(LocalSyncServer context)
// 不要log file 了
//+ $" /DiagnosticsFile:{LocalSyncServer.TempRootFile}/{Context.NotNullSyncConfig.Id.ToString()}/{Context.NotNullSyncConfig.Id.ToString()}.log"
+ $" /p:ExtractAllTableData=false /p:VerifyExtraction=true /SourceServerName:{Context.NotNullSyncConfig.SrcDb.ServerName}"
- + $" /SourceDatabaseName:{Context.NotNullSyncConfig.SrcDb.DatebaseName} /SourceUser:{Context.NotNullSyncConfig.SrcDb.User}"
+ + $" /SourceDatabaseName:{Context.NotNullSyncConfig.SrcDb.DatabaseName} /SourceUser:{Context.NotNullSyncConfig.SrcDb.User}"
+ $" /SourcePassword:{Context.NotNullSyncConfig.SrcDb.Password} /SourceTrustServerCertificate:{Context.NotNullSyncConfig.SrcDb.TrustServerCertificate}"
+ $" /p:ExtractReferencedServerScopedElements=False /p:IgnoreUserLoginMappings=True /p:IgnorePermissions=True";
if (Context.NotNullSyncConfig.SrcDb.SyncTablesData != null)
@@ -416,7 +416,7 @@ public class FinallyPublishHelper(LocalSyncServer context)
{
protected override void HandleLocalMsg(SyncMsg msg)
{
- throw new NotImplementedException();
+ //throw new NotImplementedException();
}
///
@@ -425,6 +425,18 @@ public class FinallyPublishHelper(LocalSyncServer context)
///
protected override void HandleRemoteMsg(SyncMsg msg)
{
+ if (msg.Body == "发布完成!")
+ {
+ Context.SetStateHelper(new NormalCloseHelper(Context));
+ }
Context.LocalPipe.SendMsg(msg).Wait();
}
-}
\ No newline at end of file
+}
+
+public class NormalCloseHelper(LocalSyncServer context)
+ : StateHelpBase(context, SyncProcessStep.Close)
+{
+ protected override void HandleRemoteMsg(SyncMsg msg) { }
+
+ protected override void HandleLocalMsg(SyncMsg msg) { }
+}
diff --git a/Server/RemoteServer/Properties/PublishProfiles/FolderProfile.pubxml b/Server/RemoteServer/Properties/PublishProfiles/FolderProfile.pubxml
new file mode 100644
index 0000000..4583d5d
--- /dev/null
+++ b/Server/RemoteServer/Properties/PublishProfiles/FolderProfile.pubxml
@@ -0,0 +1,17 @@
+
+
+
+
+ false
+ false
+ true
+ Release
+ Any CPU
+ FileSystem
+ bin\Release\net8.0\publish\
+ FileSystem
+ <_TargetId>Folder
+
+
\ No newline at end of file
diff --git a/Server/RemoteServer/Properties/PublishProfiles/FolderProfile.pubxml.user b/Server/RemoteServer/Properties/PublishProfiles/FolderProfile.pubxml.user
new file mode 100644
index 0000000..072b0c4
--- /dev/null
+++ b/Server/RemoteServer/Properties/PublishProfiles/FolderProfile.pubxml.user
@@ -0,0 +1,11 @@
+
+
+
+
+ True|2024-10-28T10:24:22.2791029Z||;True|2024-10-28T17:30:28.6485638+08:00||;False|2024-10-28T17:29:49.7948159+08:00||;
+
+ <_PublishTargetUrl>D:\git\FileSqlServerSync\Server\RemoteServer\bin\Release\net8.0\publish\
+
+
\ No newline at end of file
diff --git a/Server/RemoteServer/RemoteServer.csproj.user b/Server/RemoteServer/RemoteServer.csproj.user
index 94e6971..ac64b5f 100644
--- a/Server/RemoteServer/RemoteServer.csproj.user
+++ b/Server/RemoteServer/RemoteServer.csproj.user
@@ -5,5 +5,6 @@
http
+ D:\git\FileSqlServerSync\Server\RemoteServer\Properties\PublishProfiles\FolderProfile.pubxml
\ No newline at end of file
diff --git a/Server/RemoteServer/RemoteSyncServer.cs b/Server/RemoteServer/RemoteSyncServer.cs
index 76b7a40..fa61859 100644
--- a/Server/RemoteServer/RemoteSyncServer.cs
+++ b/Server/RemoteServer/RemoteSyncServer.cs
@@ -1,3 +1,4 @@
+using System.Diagnostics;
using System.Net.WebSockets;
using Common;
@@ -13,7 +14,78 @@ public class RemoteSyncServer
public void SetStateHelpBase(StateHelpBase stateHelper)
{
- StateHelper = stateHelper;
+ try
+ {
+ StateHelper = stateHelper;
+ if (SyncConfig != null)
+ {
+ var LastExec = NotNullSyncConfig.ExecProcesses.Find(x =>
+ {
+ return x.StepBeforeOrAfter == "A"
+ && x.Step == (stateHelper.Step - 1)
+ && x.ExecInLocalOrServer == "S";
+ });
+ ExecProcess(LastExec);
+ var CurrentExec = NotNullSyncConfig.ExecProcesses.Find(x =>
+ {
+ return x.StepBeforeOrAfter == "B"
+ && x.Step == stateHelper.Step
+ && x.ExecInLocalOrServer == "S";
+ });
+ ExecProcess(CurrentExec);
+ }
+ }
+ catch (Exception ex)
+ {
+ Close(ex.Message);
+ }
+ }
+
+ public void ExecProcess(ExecProcess? ep)
+ {
+ if (ep != null)
+ {
+ ProcessStartInfo startInfo =
+ new()
+ {
+ StandardOutputEncoding = System.Text.Encoding.UTF8,
+ Arguments = ep.Argumnets,
+ FileName = ep.FileName, // The command to execute (can be any command line tool)
+ // The arguments to pass to the command (e.g., list directory contents)
+ RedirectStandardOutput = true, // Redirect the standard output to a string
+ UseShellExecute = false, // Do not use the shell to execute the command
+ CreateNoWindow = true // Do not create a new window for the command
+ };
+ using Process process = new() { StartInfo = startInfo };
+ // Start the process
+ process.Start();
+
+ // Read the output from the process
+ string output = process.StandardOutput.ReadToEnd();
+
+ // Wait for the process to exit
+ process.WaitForExit();
+
+ if (process.ExitCode == 0)
+ {
+ Pipe.SendMsg(
+ StateHelper.CreateMsg(
+ $"{ep.Step}-{ep.StepBeforeOrAfter}-{ep.ExecInLocalOrServer}-{ep.FileName} {ep.Argumnets} 执行成功!"
+ )
+ )
+ .Wait();
+ }
+ else
+ {
+ Pipe.SendMsg(
+ StateHelper.CreateMsg(
+ $"{ep.Step}-{ep.StepBeforeOrAfter}-{ep.ExecInLocalOrServer}-{ep.FileName} {ep.Argumnets} 失败 {output}!"
+ )
+ )
+ .Wait();
+ throw new Exception("错误,信息参考上一条消息!");
+ }
+ }
}
public StateHelpBase GetStateHelpBase()
diff --git a/Server/RemoteServer/StateHelper.cs b/Server/RemoteServer/StateHelper.cs
index 5730138..0d249ee 100644
--- a/Server/RemoteServer/StateHelper.cs
+++ b/Server/RemoteServer/StateHelper.cs
@@ -13,7 +13,7 @@ public abstract class StateHelpBase(
{
protected readonly RemoteSyncServer Context = context;
- protected readonly SyncProcessStep Step = step;
+ public readonly SyncProcessStep Step = step;
public SyncMsg CreateErrMsg(string Body)
{
@@ -42,7 +42,7 @@ public abstract class StateHelpBase(
var syncMsg =
JsonSerializer.Deserialize(msg)
?? throw new NullReferenceException("msg is null");
- if (syncMsg.Step != Step)
+ if (syncMsg.Step != Step && syncMsg.Step != SyncProcessStep.Close)
{
throw new Exception("Sync step error!");
}
@@ -134,7 +134,14 @@ public class UnPackAndReleaseHelper(RemoteSyncServer context)
Context.Pipe.SendMsg(h.CreateMsg("将要发布数据库,可能时间会较长!")).Wait();
Task.Run(() =>
{
- h.FinallyPublish();
+ try
+ {
+ h.FinallyPublish();
+ }
+ catch (Exception e)
+ {
+ Context.Close(e.Message);
+ }
});
}
@@ -151,9 +158,12 @@ public class FinallyPublishHelper(RemoteSyncServer context)
{
var arguments =
$" /Action:Publish /SourceFile:{RemoteSyncServer.TempRootFile}/{Context.NotNullSyncConfig.Id.ToString()}/{Context.NotNullSyncConfig.Id}.dacpac"
- + $" /TargetServerName:{Context.NotNullSyncConfig.DstDb.ServerName} /TargetDatabaseName:{Context.NotNullSyncConfig.DstDb.DatebaseName}"
+ + $" /TargetServerName:{Context.NotNullSyncConfig.DstDb.ServerName} /TargetDatabaseName:{Context.NotNullSyncConfig.DstDb.DatabaseName}"
+ $" /TargetUser:{Context.NotNullSyncConfig.DstDb.User} /TargetPassword:{Context.NotNullSyncConfig.DstDb.Password} /TargetTrustServerCertificate:True";
+ //Context
+ // .Pipe.SendMsg(CreateMsg($"发布脚本为: {RemoteSyncServer.SqlPackageAbPath} {arguments}"))
+ // .Wait();
ProcessStartInfo startInfo =
new()
{
@@ -201,8 +211,15 @@ public class FinallyPublishHelper(RemoteSyncServer context)
}
});
+ Context.SetStateHelpBase(new NormalCloseHelper(Context));
Context.Pipe.SendMsg(CreateMsg("发布完成!")).Wait();
}
protected override void HandleMsg(SyncMsg msg) { }
}
+
+public class NormalCloseHelper(RemoteSyncServer context)
+ : StateHelpBase(context, SyncProcessStep.Close)
+{
+ protected override void HandleMsg(SyncMsg msg) { }
+}
diff --git a/Server/ServerTest/PipeSeed.cs b/Server/ServerTest/PipeSeed.cs
index fc8125d..ce3aa1a 100644
--- a/Server/ServerTest/PipeSeed.cs
+++ b/Server/ServerTest/PipeSeed.cs
@@ -22,7 +22,7 @@ public class PipeSeed : IDisposable
SrcDb = new MSSqlConfig
{
ServerName = "172.16.12.2",
- DatebaseName = "HMES_H7_HNFYMF",
+ DatabaseName = "HMES_H7_HNFYMF",
User = "hmes-h7",
Password = "Hmes-h7666",
TrustServerCertificate = "True",
@@ -37,7 +37,7 @@ public class PipeSeed : IDisposable
DstDb = new MSSqlConfig
{
ServerName = "127.0.0.1",
- DatebaseName = "HMES_H7_HNFYMF",
+ DatabaseName = "HMES_H7_HNFYMF",
User = "sa",
Password = "0",
TrustServerCertificate = "True"
@@ -45,6 +45,36 @@ public class PipeSeed : IDisposable
DirFileConfigs = new List
{
new DirFileConfig { DirPath = "/bin", Excludes = ["/roslyn", "/Views"] }
+ },
+
+ // C:/Windows/System32/inetsrv/appcmd.exe stop sites "publicserver"
+ // C:/Windows/System32/inetsrv/appcmd.exe start sites "publicserver"
+ ExecProcesses = new List
+ {
+ new ExecProcess
+ {
+ Argumnets = "ls",
+ FileName = "powershell",
+ StepBeforeOrAfter = "A",
+ ExecInLocalOrServer = "L",
+ Step = SyncProcessStep.DeployProject,
+ },
+ new ExecProcess
+ {
+ Argumnets = "ls",
+ FileName = "powershell",
+ StepBeforeOrAfter = "B",
+ ExecInLocalOrServer = "S",
+ Step = SyncProcessStep.Publish,
+ },
+ new ExecProcess
+ {
+ Argumnets = "ls",
+ FileName = "powershell",
+ StepBeforeOrAfter = "A",
+ ExecInLocalOrServer = "S",
+ Step = SyncProcessStep.Publish,
+ },
}
};
}
diff --git a/Server/ServerTest/PipeTest.cs b/Server/ServerTest/PipeTest.cs
index 0768820..a5b2ec8 100644
--- a/Server/ServerTest/PipeTest.cs
+++ b/Server/ServerTest/PipeTest.cs
@@ -14,7 +14,12 @@ public class PipeTest
[Fact]
public async void TestCase()
{
- //msbuild ֻwindows
+ //if (System.IO.File.Exists("Pipe.txt"))
+ //{
+ // System.IO.File.Delete("Pipe.txt");
+ //}
+ //System.IO.File.Create("Pipe.txt");
+ //msbuild ֻwindows
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
var p1 = new TestPipe(false, "1");
@@ -27,9 +32,18 @@ public class PipeTest
#pragma warning disable CS8602 // Dereference of a possibly null reference.
if (msg.Body == "ɣ")
{
- _ = p1.Close("˳");
+ Task.Run(() =>
+ {
+ Task.Delay(1000).Wait();
+ _ = p1.Close("˳");
+ });
}
#pragma warning restore CS8602 // Dereference of a possibly null reference.
+ System.IO.File.AppendAllText(
+ "Pipe.txt",
+ $"{msg.Step}-{msg.Type}:{msg.Body}\n"
+ );
+
Console.WriteLine(b);
return true;
}
diff --git a/Tool/JsScript/release.js b/Tool/JsScript/release.js
index f2da249..2ce4a76 100644
--- a/Tool/JsScript/release.js
+++ b/Tool/JsScript/release.js
@@ -4,15 +4,14 @@ import WebSocket from "ws";
//#region ############################## 配置文件 ###################################
const LocalHost = "127.0.0.1";
-//这是个例子,请在`config`中写你的配置
-const example_config = {
+const config = {
//发布的名称,每个项目具有唯一的一个名称
- Name: "Test",
- RemotePwd: "t123",
+ Name: "FYMF",
+ RemotePwd: "FYMF",
//远程服务器地址,也就是发布的目的地,它是正式环境
- RemoteUrl: "127.0.0.1:6819",
+ RemoteUrl: "127.0.0.1:8007",
//是否发布数据库 sqlserver
- IsDeployDb: false,
+ IsDeployDb: true,
//是否发布前重新构建项目
IsDeployProject: false,
//项目地址
@@ -21,13 +20,13 @@ const example_config = {
//源文件目录地址,是要发布的文件根目录,它是绝对路径,!执行发布时将发布到这个目录!
LocalRootPath: "D:/FileSyncTest/src",
//目标文件目录地址,也就是部署服务的机器上的项目文件根目录,它是绝对路径
- RemoteRootPath: "D:/FileSyncTest/dst",
+ RemoteRootPath: "D:/FYMF",
//源数据库配置 SqlServer,将会同步数据库的结构
SrcDb: {
//Host
ServerName: "172.16.12.2",
//数据库名
- DatebaseName: "HMES_H7_HNFYMF",
+ DatabaseName: "HMES_H7_HNFYMF",
User: "hmes-h7",
Password: "Hmes-h7666",
//是否信任服务器证书
@@ -43,63 +42,9 @@ const example_config = {
//目标数据库配置 sqlserver
DstDb: {
ServerName: "127.0.0.1",
- DatebaseName: "HMES_H7_HNFYMF",
+ DatabaseName: "HMES_H7_HNFYMF",
User: "sa",
- Password: "0",
- TrustServerCertificate: "True",
- },
- //子目录配置,每个子目录都有自己不同的发布策略,它是相对路径,即相对于LocalRootPath和RemoteRootPath(注意 '/',这将拼成一个完整的路径),文件数据依此进行,
- DirFileConfigs: [
- {
- DirPath: "/bin",
- //排除的文件或目录,它是相对路径,相对于!!!LocalRootPath和RemoteRootPath!!!
- Excludes: ["/roslyn", "/Views"],
- //只追踪文件或目录,它是相对路径,相对于!!!LocalRootPath和RemoteRootPath!!!,它的优先级最高,如果你指定了它的值,Excludes将会失效
- // CherryPicks:[]
- },
- ],
-};
-const config = {
- //发布的名称,每个项目具有唯一的一个名称
- Name: "Test",
- RemotePwd: "t123",
- //远程服务器地址,也就是发布的目的地,它是正式环境
- RemoteUrl: "127.0.0.1:6819",
- //是否发布数据库 sqlserver
- IsDeployDb: true,
- //是否发布前重新构建项目
- IsDeployProject: true,
- //项目地址
- LocalProjectAbsolutePath:
- "D:/git/HMES-H7-HNFY/HMES-H7-HNFYMF/HMES-H7-HNFYMF.WEB",
- //源文件目录地址,是要发布的文件根目录,它是绝对路径,!执行发布时将发布到这个目录!
- LocalRootPath: "D:/FileSyncTest/src",
- //目标文件目录地址,也就是部署服务的机器上的项目文件根目录,它是绝对路径
- RemoteRootPath: "D:/FileSyncTest/dst",
- //源数据库配置 SqlServer,将会同步数据库的结构
- SrcDb: {
- //Host
- ServerName: "172.16.12.2",
- //数据库名
- DatebaseName: "HMES_H7_HNFYMF",
- User: "hmes-h7",
- Password: "Hmes-h7666",
- //是否信任服务器证书
- TrustServerCertificate: "True",
- //同步的数据,这些数据将会同步
- SyncTablesData: [
- "dbo.sys_Button",
- "dbo.sys_Menu",
- "dbo.sys_Module",
- "dbo.sys_Page",
- ],
- },
- //目标数据库配置 sqlserver
- DstDb: {
- ServerName: "127.0.0.1",
- DatebaseName: "HMES_H7_HNFYMF",
- User: "sa",
- Password: "0",
+ Password: "Yuanmo520...",
TrustServerCertificate: "True",
},
//子目录配置,每个子目录都有自己不同的发布策略,它是相对路径,即相对于LocalRootPath和RemoteRootPath(注意 '/',这将拼成一个完整的路径),文件数据依此进行,
@@ -112,6 +57,21 @@ const config = {
// CherryPicks:[]
},
],
+ ExecProcesses: [],
+ // ExecProcesses:[
+ // {
+ // // 参数
+ // Argumnets:"ls",
+ // // 执行命令位置
+ // FileName:"powershell",
+ // // 相关步骤开始之前(B)或之后 (A)
+ // StepBeforeOrAfter:"A",
+ // // 本地(L)或远程 (R) 执行
+ // ExecInLocalOrServer:"L",
+ // // 步骤 1. 连接远程 2. 发布项目 3. 文件对比 4. 提取sqlserver 5. 打包上传 6. 发布
+ // Step:1
+ // }
+ // ]
};
//#endregion
@@ -142,10 +102,10 @@ function PrintSuccessInNewLine(str) {
* 在新行打印一般信息
*/
function PrintCloseNewLine(str) {
- if(IsSuccess) {
- PrintSuccessInNewLine(str)
+ if (IsSuccess) {
+ PrintSuccessInNewLine(str);
} else {
- PrintErrInNewLine(str)
+ PrintErrInNewLine(str);
}
}
/**
@@ -171,14 +131,14 @@ function MsgCb(MsgIt) {
PrintSuccessInNewLine(`(${MsgIt.Step}/6) ${MsgIt.Body}`);
if (MsgIt.Step == 6) {
if (MsgIt.Body == "发布完成!") {
- IsSuccess = true
+ IsSuccess = true;
ws.close();
}
}
- } else if(MsgIt == 7) {
+ } else if (MsgIt == 7) {
PrintErrInNewLine(MsgIt.Body);
} else {
- PrintCloseNewLine("(关闭)"+ MsgIt.Body);
+ PrintCloseNewLine("(关闭)" + MsgIt.Body);
}
}
}
diff --git a/Tool/webtool/src/App.vue b/Tool/webtool/src/App.vue
index 37188d0..e3e4764 100644
--- a/Tool/webtool/src/App.vue
+++ b/Tool/webtool/src/App.vue
@@ -16,22 +16,33 @@ let Pipe = null
const Msgs = ref([])
const code = ref(`
config = {
- Name: "Test",
- RemoteUrl: "127.0.0.1:6819",
- RemotePwd: "t123",
- IsDeployDb: false,
+ //发布的名称,每个项目具有唯一的一个名称
+ Name: "FYMF",
+ RemotePwd: "FYMF",
+ //远程服务器地址,也就是发布的目的地,它是正式环境
+ RemoteUrl: "127.0.0.1:8007",
+ //是否发布数据库 sqlserver
+ IsDeployDb: true,
+ //是否发布前重新构建项目
IsDeployProject: false,
+ //项目地址
LocalProjectAbsolutePath:
"D:/git/HMES-H7-HNFY/HMES-H7-HNFYMF/HMES-H7-HNFYMF.WEB",
+ //源文件目录地址,是要发布的文件根目录,它是绝对路径,!执行发布时将发布到这个目录!
LocalRootPath: "D:/FileSyncTest/src",
-
- RemoteRootPath: "D:/FileSyncTest/dst",
+ //目标文件目录地址,也就是部署服务的机器上的项目文件根目录,它是绝对路径
+ RemoteRootPath: "D:/FYMF",
+ //源数据库配置 SqlServer,将会同步数据库的结构
SrcDb: {
+ //Host
ServerName: "172.16.12.2",
- DatebaseName: "HMES_H7_HNFYMF",
+ //数据库名
+ DatabaseName: "HMES_H7_HNFYMF",
User: "hmes-h7",
Password: "Hmes-h7666",
+ //是否信任服务器证书
TrustServerCertificate: "True",
+ //同步的数据,这些数据将会同步
SyncTablesData: [
"dbo.sys_Button",
"dbo.sys_Menu",
@@ -39,19 +50,39 @@ config = {
"dbo.sys_Page",
],
},
+ //目标数据库配置 sqlserver
DstDb: {
ServerName: "127.0.0.1",
- DatebaseName: "HMES_H7_HNFYMF",
+ DatabaseName: "HMES_H7_HNFYMF",
User: "sa",
- Password: "0",
+ Password: "Yuanmo520...",
TrustServerCertificate: "True",
},
+ //子目录配置,每个子目录都有自己不同的发布策略,它是相对路径,即相对于LocalRootPath和RemoteRootPath(注意 '/',这将拼成一个完整的路径),文件数据依此进行,
DirFileConfigs: [
{
DirPath: "/bin",
+ //排除的文件或目录,它是相对路径,相对于!!!LocalRootPath和RemoteRootPath!!!
Excludes: ["/roslyn", "/Views"],
+ //只追踪文件或目录,它是相对路径,相对于!!!LocalRootPath和RemoteRootPath!!!,它的优先级最高,如果你指定了它的值,Excludes将会失效
+ // CherryPicks:[]
},
],
+ ExecProcesses: [],
+ // ExecProcesses:[
+ // {
+ // // 参数
+ // Argumnets:"ls",
+ // // 执行命令位置
+ // FileName:"powershell",
+ // // 相关步骤开始之前(B)或之后 (A)
+ // StepBeforeOrAfter:"A",
+ // // 本地(L)或远程 (R) 执行
+ // ExecInLocalOrServer:"L",
+ // // 步骤 1. 连接远程 2. 发布项目 3. 文件对比 4. 提取sqlserver 5. 打包上传 6. 发布
+ // Step:1
+ // }
+ // ]
};
`)
var CStatus = ref('None')