diff --git a/Install/Program.cs b/Install/Program.cs index 1914ceab..24dfcaad 100644 --- a/Install/Program.cs +++ b/Install/Program.cs @@ -5,12 +5,36 @@ using System.Text; try { + + // SCP Settings + string scpHost = "123.56.94.154"; + string scpUsername = "Administrator"; + string scpPassword = "WHxckj2019"; + + // SCP Connection + using (var scpClient = new ScpClient(scpHost, scpUsername, scpPassword)) + { + scpClient.Connect(); + + // Upload File using SCP + using (var fs = new FileStream(@"D:\favicon.png", FileMode.Open)) + { + //默认是C盘根目录 + scpClient.Upload(fs, @"/mytest/favicon.png"); + } + + scpClient.Disconnect(); + } + + + + + // 创建一个SSH客户端实例 using (var client = new SshClient("123.56.94.154", "Administrator", "WHxckj2019")) { // 连接到远程服务器 client.Connect(); - //&& .\\IRaCIS_Vue_Web.bat //&& ./IRaCIS_Vue_Web.bat string command = $@"cd C:\Users\Administrator\VueSourceCode && npm i && npm run build"; diff --git a/PublishSite/PublishForm.Designer.cs b/PublishSite/PublishForm.Designer.cs index 21e11713..2a376c56 100644 --- a/PublishSite/PublishForm.Designer.cs +++ b/PublishSite/PublishForm.Designer.cs @@ -37,6 +37,11 @@ logTBox = new RichTextBox(); tabControl1 = new TabControl(); tabPage1 = new TabPage(); + groupBox2 = new GroupBox(); + stopServiceBtn = new Button(); + startServiceBtn = new Button(); + label2 = new Label(); + startOrStopServiceTbox = new TextBox(); deleteService_Btn = new Button(); createService_Btn = new Button(); en_TBox = new TextBox(); @@ -49,10 +54,21 @@ label11 = new Label(); label10 = new Label(); tabPage2 = new TabPage(); + label3 = new Label(); + bakPathTBox = new TextBox(); + label4 = new Label(); + bakDbName = new TextBox(); + label5 = new Label(); + bakPublishPath = new TextBox(); + startBakBtn = new Button(); + groupBox4 = new GroupBox(); groupBox1.SuspendLayout(); groupBox3.SuspendLayout(); tabControl1.SuspendLayout(); tabPage1.SuspendLayout(); + groupBox2.SuspendLayout(); + tabPage2.SuspendLayout(); + groupBox4.SuspendLayout(); SuspendLayout(); // // groupBox1 @@ -75,7 +91,6 @@ rb_production.Name = "rb_production"; rb_production.Size = new Size(50, 21); rb_production.TabIndex = 3; - rb_production.TabStop = true; rb_production.Text = "正式"; rb_production.UseVisualStyleBackColor = true; // @@ -86,7 +101,6 @@ rb_Verify.Name = "rb_Verify"; rb_Verify.Size = new Size(50, 21); rb_Verify.TabIndex = 2; - rb_Verify.TabStop = true; rb_Verify.Text = "验证"; rb_Verify.UseVisualStyleBackColor = true; // @@ -97,13 +111,13 @@ rb_test.Name = "rb_test"; rb_test.Size = new Size(50, 21); rb_test.TabIndex = 1; - rb_test.TabStop = true; rb_test.Text = "测试"; rb_test.UseVisualStyleBackColor = true; // // rb_local // rb_local.AutoSize = true; + rb_local.Checked = true; rb_local.Location = new Point(24, 53); rb_local.Name = "rb_local"; rb_local.Size = new Size(50, 21); @@ -117,16 +131,16 @@ groupBox3.Controls.Add(logTBox); groupBox3.Location = new Point(691, 24); groupBox3.Name = "groupBox3"; - groupBox3.Size = new Size(412, 770); + groupBox3.Size = new Size(412, 1048); groupBox3.TabIndex = 3; groupBox3.TabStop = false; groupBox3.Text = "日志"; // // logTBox // - logTBox.Location = new Point(24, 21); + logTBox.Location = new Point(23, 21); logTBox.Name = "logTBox"; - logTBox.Size = new Size(359, 743); + logTBox.Size = new Size(359, 1013); logTBox.TabIndex = 1; logTBox.Text = ""; // @@ -137,34 +151,75 @@ tabControl1.Location = new Point(12, 148); tabControl1.Name = "tabControl1"; tabControl1.SelectedIndex = 0; - tabControl1.Size = new Size(609, 646); + tabControl1.Size = new Size(609, 914); tabControl1.TabIndex = 4; // // tabPage1 // - tabPage1.Controls.Add(deleteService_Btn); - tabPage1.Controls.Add(createService_Btn); - tabPage1.Controls.Add(en_TBox); - tabPage1.Controls.Add(label1); - tabPage1.Controls.Add(selectPathBtn); - tabPage1.Controls.Add(exePathTbox); - tabPage1.Controls.Add(label9); - tabPage1.Controls.Add(serviceDisplayNameTBox); - tabPage1.Controls.Add(serviceNameTBox); - tabPage1.Controls.Add(label11); - tabPage1.Controls.Add(label10); + tabPage1.Controls.Add(groupBox4); + tabPage1.Controls.Add(groupBox2); tabPage1.Location = new Point(4, 26); tabPage1.Name = "tabPage1"; tabPage1.Padding = new Padding(3); - tabPage1.Size = new Size(601, 616); + tabPage1.Size = new Size(601, 884); tabPage1.TabIndex = 0; - tabPage1.Text = "后端服务"; + tabPage1.Text = "服务"; tabPage1.UseVisualStyleBackColor = true; // + // groupBox2 + // + groupBox2.Controls.Add(stopServiceBtn); + groupBox2.Controls.Add(startServiceBtn); + groupBox2.Controls.Add(label2); + groupBox2.Controls.Add(startOrStopServiceTbox); + groupBox2.Location = new Point(20, 341); + groupBox2.Name = "groupBox2"; + groupBox2.Size = new Size(538, 187); + groupBox2.TabIndex = 39; + groupBox2.TabStop = false; + groupBox2.Text = "服务停止与启动"; + // + // stopServiceBtn + // + stopServiceBtn.Enabled = false; + stopServiceBtn.Location = new Point(261, 101); + stopServiceBtn.Name = "stopServiceBtn"; + stopServiceBtn.Size = new Size(128, 40); + stopServiceBtn.TabIndex = 39; + stopServiceBtn.Text = "停止服务"; + stopServiceBtn.UseVisualStyleBackColor = true; + // + // startServiceBtn + // + startServiceBtn.Enabled = false; + startServiceBtn.Location = new Point(94, 101); + startServiceBtn.Name = "startServiceBtn"; + startServiceBtn.Size = new Size(128, 40); + startServiceBtn.TabIndex = 38; + startServiceBtn.Text = "启动服务"; + startServiceBtn.UseVisualStyleBackColor = true; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(20, 52); + label2.Name = "label2"; + label2.Size = new Size(56, 17); + label2.TabIndex = 32; + label2.Text = "服务名称"; + // + // startOrStopServiceTbox + // + startOrStopServiceTbox.Location = new Point(99, 49); + startOrStopServiceTbox.Name = "startOrStopServiceTbox"; + startOrStopServiceTbox.Size = new Size(259, 23); + startOrStopServiceTbox.TabIndex = 31; + startOrStopServiceTbox.Text = "EI_Image_Viewer"; + // // deleteService_Btn // deleteService_Btn.Enabled = false; - deleteService_Btn.Location = new Point(446, 57); + deleteService_Btn.Location = new Point(417, 33); deleteService_Btn.Name = "deleteService_Btn"; deleteService_Btn.Size = new Size(95, 27); deleteService_Btn.TabIndex = 38; @@ -174,16 +229,17 @@ // createService_Btn // createService_Btn.Enabled = false; - createService_Btn.Location = new Point(196, 256); + createService_Btn.Location = new Point(167, 232); createService_Btn.Name = "createService_Btn"; createService_Btn.Size = new Size(128, 40); createService_Btn.TabIndex = 37; createService_Btn.Text = "创建服务"; createService_Btn.UseVisualStyleBackColor = true; + createService_Btn.Click += createService_Btn_Click; // // en_TBox // - en_TBox.Location = new Point(169, 200); + en_TBox.Location = new Point(140, 176); en_TBox.Name = "en_TBox"; en_TBox.Size = new Size(259, 23); en_TBox.TabIndex = 36; @@ -192,7 +248,7 @@ // label1 // label1.AutoSize = true; - label1.Location = new Point(100, 200); + label1.Location = new Point(71, 176); label1.Name = "label1"; label1.Size = new Size(44, 17); label1.TabIndex = 35; @@ -201,7 +257,7 @@ // selectPathBtn // selectPathBtn.Enabled = false; - selectPathBtn.Location = new Point(446, 149); + selectPathBtn.Location = new Point(417, 125); selectPathBtn.Name = "selectPathBtn"; selectPathBtn.Size = new Size(95, 27); selectPathBtn.TabIndex = 34; @@ -211,7 +267,7 @@ // exePathTbox // exePathTbox.Enabled = false; - exePathTbox.Location = new Point(169, 150); + exePathTbox.Location = new Point(140, 126); exePathTbox.Name = "exePathTbox"; exePathTbox.Size = new Size(259, 23); exePathTbox.TabIndex = 33; @@ -219,7 +275,7 @@ // label9 // label9.AutoSize = true; - label9.Location = new Point(100, 154); + label9.Location = new Point(71, 130); label9.Name = "label9"; label9.Size = new Size(32, 17); label9.TabIndex = 32; @@ -227,7 +283,7 @@ // // serviceDisplayNameTBox // - serviceDisplayNameTBox.Location = new Point(169, 103); + serviceDisplayNameTBox.Location = new Point(140, 79); serviceDisplayNameTBox.Name = "serviceDisplayNameTBox"; serviceDisplayNameTBox.Size = new Size(259, 23); serviceDisplayNameTBox.TabIndex = 31; @@ -235,7 +291,7 @@ // // serviceNameTBox // - serviceNameTBox.Location = new Point(169, 57); + serviceNameTBox.Location = new Point(140, 33); serviceNameTBox.Name = "serviceNameTBox"; serviceNameTBox.Size = new Size(259, 23); serviceNameTBox.TabIndex = 30; @@ -244,7 +300,7 @@ // label11 // label11.AutoSize = true; - label11.Location = new Point(28, 106); + label11.Location = new Point(-1, 82); label11.Name = "label11"; label11.Size = new Size(128, 17); label11.TabIndex = 29; @@ -253,7 +309,7 @@ // label10 // label10.AutoSize = true; - label10.Location = new Point(52, 60); + label10.Location = new Point(23, 36); label10.Name = "label10"; label10.Size = new Size(104, 17); label10.TabIndex = 28; @@ -261,19 +317,107 @@ // // tabPage2 // + tabPage2.Controls.Add(startBakBtn); + tabPage2.Controls.Add(bakPublishPath); + tabPage2.Controls.Add(label5); + tabPage2.Controls.Add(bakDbName); + tabPage2.Controls.Add(label4); + tabPage2.Controls.Add(bakPathTBox); + tabPage2.Controls.Add(label3); tabPage2.Location = new Point(4, 26); tabPage2.Name = "tabPage2"; tabPage2.Padding = new Padding(3); - tabPage2.Size = new Size(601, 616); + tabPage2.Size = new Size(601, 884); tabPage2.TabIndex = 1; - tabPage2.Text = "tabPage2"; + tabPage2.Text = "备份与发布"; tabPage2.UseVisualStyleBackColor = true; // + // label3 + // + label3.AutoSize = true; + label3.Location = new Point(6, 79); + label3.Name = "label3"; + label3.Size = new Size(92, 17); + label3.TabIndex = 0; + label3.Text = "数据库备份路径"; + // + // bakPathTBox + // + bakPathTBox.Enabled = false; + bakPathTBox.Location = new Point(115, 75); + bakPathTBox.Name = "bakPathTBox"; + bakPathTBox.Size = new Size(474, 23); + bakPathTBox.TabIndex = 1; + // + // label4 + // + label4.AutoSize = true; + label4.Location = new Point(20, 31); + label4.Name = "label4"; + label4.Size = new Size(68, 17); + label4.TabIndex = 2; + label4.Text = "备份数据库"; + // + // bakDbName + // + bakDbName.Enabled = false; + bakDbName.Location = new Point(114, 28); + bakDbName.Name = "bakDbName"; + bakDbName.Size = new Size(474, 23); + bakDbName.TabIndex = 3; + // + // label5 + // + label5.AutoSize = true; + label5.Location = new Point(6, 128); + label5.Name = "label5"; + label5.Size = new Size(104, 17); + label5.TabIndex = 4; + label5.Text = "发布程序备份路径"; + // + // bakPublishPath + // + bakPublishPath.Enabled = false; + bakPublishPath.Location = new Point(117, 125); + bakPublishPath.Name = "bakPublishPath"; + bakPublishPath.Size = new Size(474, 23); + bakPublishPath.TabIndex = 5; + // + // startBakBtn + // + startBakBtn.Location = new Point(160, 204); + startBakBtn.Name = "startBakBtn"; + startBakBtn.Size = new Size(213, 53); + startBakBtn.TabIndex = 6; + startBakBtn.Text = "开始备份"; + startBakBtn.UseVisualStyleBackColor = true; + startBakBtn.Click += startBakBtn_Click; + // + // groupBox4 + // + groupBox4.Controls.Add(serviceNameTBox); + groupBox4.Controls.Add(label10); + groupBox4.Controls.Add(deleteService_Btn); + groupBox4.Controls.Add(label11); + groupBox4.Controls.Add(createService_Btn); + groupBox4.Controls.Add(serviceDisplayNameTBox); + groupBox4.Controls.Add(en_TBox); + groupBox4.Controls.Add(label9); + groupBox4.Controls.Add(label1); + groupBox4.Controls.Add(exePathTbox); + groupBox4.Controls.Add(selectPathBtn); + groupBox4.Location = new Point(20, 28); + groupBox4.Name = "groupBox4"; + groupBox4.Size = new Size(538, 289); + groupBox4.TabIndex = 40; + groupBox4.TabStop = false; + groupBox4.Text = "服务创建与删除"; + // // PublishForm // AutoScaleDimensions = new SizeF(7F, 17F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1131, 815); + ClientSize = new Size(1131, 1074); Controls.Add(tabControl1); Controls.Add(groupBox3); Controls.Add(groupBox1); @@ -285,7 +429,12 @@ groupBox3.ResumeLayout(false); tabControl1.ResumeLayout(false); tabPage1.ResumeLayout(false); - tabPage1.PerformLayout(); + groupBox2.ResumeLayout(false); + groupBox2.PerformLayout(); + tabPage2.ResumeLayout(false); + tabPage2.PerformLayout(); + groupBox4.ResumeLayout(false); + groupBox4.PerformLayout(); ResumeLayout(false); } @@ -311,5 +460,18 @@ private Label label11; private Label label10; private TabPage tabPage2; + private GroupBox groupBox2; + private Button stopServiceBtn; + private Button startServiceBtn; + private Label label2; + private TextBox startOrStopServiceTbox; + private Label label4; + private TextBox bakPathTBox; + private Label label3; + private TextBox bakDbName; + private TextBox bakPublishPath; + private Label label5; + private GroupBox groupBox4; + private Button startBakBtn; } } \ No newline at end of file diff --git a/PublishSite/PublishForm.cs b/PublishSite/PublishForm.cs index c9257c4e..8ecbaac1 100644 --- a/PublishSite/PublishForm.cs +++ b/PublishSite/PublishForm.cs @@ -36,6 +36,14 @@ namespace PublishSite CopyFileToRemote(localFilePath, remoteFilePath, remoteComputerName, userName, password); } + private void startBakBtn_Click(object sender, EventArgs e) + { + } + + private void createService_Btn_Click(object sender, EventArgs e) + { + + } } } diff --git a/PublishSite/PublishSite.csproj b/PublishSite/PublishSite.csproj index c9ff4dff..bfa6d29d 100644 --- a/PublishSite/PublishSite.csproj +++ b/PublishSite/PublishSite.csproj @@ -9,6 +9,36 @@ AnyCPU;x64 + + + + + + + + + + PreserveNewest + true + PreserveNewest + + + PreserveNewest + true + PreserveNewest + + + PreserveNewest + true + PreserveNewest + + + PreserveNewest + true + PreserveNewest + + + diff --git a/PublishSite/appsettings.Development.json b/PublishSite/appsettings.Development.json new file mode 100644 index 00000000..f091dac3 --- /dev/null +++ b/PublishSite/appsettings.Development.json @@ -0,0 +1,20 @@ +{ + "BackUp": { + "DataBaseName": "IRaCIS_New_Tet", + "FullDBRootPath": "Warning", + "ProgramRootPath": "D:\\Develop\\PublishSite\\发布备份", + "ConnectionStrings": "Server=.;Database=IRaCIS;Trusted_Connection=True;TrustServerCertificate=true" + }, + "Credential": { + "Host": "123.56.94.154", + "UserName": "Administrator", + "Password": "WHxckj2019" + }, + "DefaultService": { + "ServiceName": "NetCore.IRaCIS.Api", + "ServiceDisplayName": "CICD_IRaCIS.Core.API", + "ServicePort": "7100", + "BinPath": "D:\\Develop\\PublishSite\\IRaCIS.NetCore.API\\IRaCIS.Core.API.exe", + "Env": "Development" + } +} diff --git a/PublishSite/appsettings.Production.json b/PublishSite/appsettings.Production.json new file mode 100644 index 00000000..f091dac3 --- /dev/null +++ b/PublishSite/appsettings.Production.json @@ -0,0 +1,20 @@ +{ + "BackUp": { + "DataBaseName": "IRaCIS_New_Tet", + "FullDBRootPath": "Warning", + "ProgramRootPath": "D:\\Develop\\PublishSite\\发布备份", + "ConnectionStrings": "Server=.;Database=IRaCIS;Trusted_Connection=True;TrustServerCertificate=true" + }, + "Credential": { + "Host": "123.56.94.154", + "UserName": "Administrator", + "Password": "WHxckj2019" + }, + "DefaultService": { + "ServiceName": "NetCore.IRaCIS.Api", + "ServiceDisplayName": "CICD_IRaCIS.Core.API", + "ServicePort": "7100", + "BinPath": "D:\\Develop\\PublishSite\\IRaCIS.NetCore.API\\IRaCIS.Core.API.exe", + "Env": "Development" + } +} diff --git a/PublishSite/appsettings.Verify.json b/PublishSite/appsettings.Verify.json new file mode 100644 index 00000000..f091dac3 --- /dev/null +++ b/PublishSite/appsettings.Verify.json @@ -0,0 +1,20 @@ +{ + "BackUp": { + "DataBaseName": "IRaCIS_New_Tet", + "FullDBRootPath": "Warning", + "ProgramRootPath": "D:\\Develop\\PublishSite\\发布备份", + "ConnectionStrings": "Server=.;Database=IRaCIS;Trusted_Connection=True;TrustServerCertificate=true" + }, + "Credential": { + "Host": "123.56.94.154", + "UserName": "Administrator", + "Password": "WHxckj2019" + }, + "DefaultService": { + "ServiceName": "NetCore.IRaCIS.Api", + "ServiceDisplayName": "CICD_IRaCIS.Core.API", + "ServicePort": "7100", + "BinPath": "D:\\Develop\\PublishSite\\IRaCIS.NetCore.API\\IRaCIS.Core.API.exe", + "Env": "Development" + } +} diff --git a/PublishSite/appsettings.local.json b/PublishSite/appsettings.local.json new file mode 100644 index 00000000..f091dac3 --- /dev/null +++ b/PublishSite/appsettings.local.json @@ -0,0 +1,20 @@ +{ + "BackUp": { + "DataBaseName": "IRaCIS_New_Tet", + "FullDBRootPath": "Warning", + "ProgramRootPath": "D:\\Develop\\PublishSite\\发布备份", + "ConnectionStrings": "Server=.;Database=IRaCIS;Trusted_Connection=True;TrustServerCertificate=true" + }, + "Credential": { + "Host": "123.56.94.154", + "UserName": "Administrator", + "Password": "WHxckj2019" + }, + "DefaultService": { + "ServiceName": "NetCore.IRaCIS.Api", + "ServiceDisplayName": "CICD_IRaCIS.Core.API", + "ServicePort": "7100", + "BinPath": "D:\\Develop\\PublishSite\\IRaCIS.NetCore.API\\IRaCIS.Core.API.exe", + "Env": "Development" + } +}