more deployment stuff

pull/9/head
sleevezipper 4 years ago
parent c4ac3a5932
commit d864f43cfe

@ -13,6 +13,9 @@ It will try to futher accomplish this goal in the future by:
- Being easy to configure
- Using secure communication
## Deployments
## Installation
1.
You can get the installer from [here](https://hassworkstationstorage.z6.web.core.windows.net/publish/setup.exe). When using the installer, the application checks for updates on startup.
Note: You'll get a Windows Smartscreen warning because the code was self signed. You can click "More info" and then "Run anyway" to proceed with installing.
Alternatively, you can find releases on GitHub [here](https://github.com/sleevezipper/hass-workstation-service/releases).

@ -6,7 +6,7 @@ using System;
namespace UserInterface
{
class Program
public class Program
{
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
@ -20,5 +20,6 @@ namespace UserInterface
.UsePlatformDetect()
.LogToDebug()
.UseReactiveUI();
}
}

@ -6,7 +6,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>bin\Release\netcoreapp3.1\publish\</PublishDir>
<PublishDir>..\hass-workstation-service\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

@ -1,6 +1,7 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using MangaReader.Avalonia.Platform.Win;
namespace UserInterface.Views
{
@ -12,6 +13,7 @@ namespace UserInterface.Views
#if DEBUG
this.AttachDevTools();
#endif
WindowsTrayIcon icon = new WindowsTrayIcon();
}
private void InitializeComponent()

@ -23,3 +23,6 @@ obj/
# ignore logs
logs/
# ignore debugging symbols
*.pdb

@ -89,6 +89,9 @@ namespace hass_workstation_service.Communication
public string Value_template { get; set; }
}
/// <summary>
/// This information will be used when announcing this device on the mqtt topic
/// </summary>
public class DeviceConfigModel
{
/// <summary>

@ -53,7 +53,15 @@ namespace hass_workstation_service.Communication
var factory = new MqttFactory();
this._mqttClient = factory.CreateMqttClient();
this._mqttClient.ConnectAsync(options);
if (options != null)
{
this._mqttClient.ConnectAsync(options);
this._mqttClientMessage = "Connecting...";
}
else
{
this._mqttClientMessage = "Not configured";
}
this._mqttClient.UseConnectedHandler(e => {
this._mqttClientMessage = "All good";

@ -78,12 +78,8 @@ namespace hass_workstation_service.Data
}
else
{
//for now we return defaults until we can actually configure this
return new MqttClientOptionsBuilder()
.WithTcpServer("192.168.2.6")
// .WithTls()
.WithCredentials("tester", "tester")
.Build();
Program.StartUI();
return null;
}
}

@ -31,29 +31,37 @@ namespace hass_workstation_service
.WriteTo.Console()
.WriteTo.File(new RenderedCompactJsonFormatter(), "logs/log.ndjson")
.CreateLogger();
try
// We do it this way because there is currently no way to pass an argument to a dotnet core app when using clickonce
if (Process.GetProcessesByName("hass-workstation-service").Count() > 1) //bg service running
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
StartUI();
}
else
{
try
{
await CreateHostBuilder(args).RunConsoleAsync();
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
await CreateHostBuilder(args).RunConsoleAsync();
}
else
{
// we only support MS Windows for now
throw new NotImplementedException("Your platform is not yet supported");
}
}
else
catch (Exception ex)
{
// we only support MS Windows for now
throw new NotImplementedException("Your platform is not yet supported");
Log.Fatal(ex, "Application start-up failed");
}
finally
{
Log.CloseAndFlush();
}
}
catch (Exception ex)
{
Log.Fatal(ex, "Application start-up failed");
}
finally
{
Log.CloseAndFlush();
}
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
@ -87,5 +95,11 @@ namespace hass_workstation_service
return "Debug";
}
public static void StartUI()
{
Log.Logger.Information(Environment.CurrentDirectory + "\\UserInterface.exe");
Process.Start(Environment.CurrentDirectory + "\\UserInterface.exe");
}
}
}

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ApplicationRevision>15</ApplicationRevision>
<ApplicationVersion>1.0.0.*</ApplicationVersion>
<BootstrapperEnabled>True</BootstrapperEnabled>
<Configuration>Release</Configuration>
<CreateDesktopShortcut>True</CreateDesktopShortcut>
<ErrorReportUrl>https://github.com/sleevezipper/hass-workstation-service/issues</ErrorReportUrl>
<GenerateManifests>True</GenerateManifests>
<Install>true</Install>
<InstallFrom>Web</InstallFrom>
<InstallUrl>https://hassworkstationstorage.z6.web.core.windows.net/publish/</InstallUrl>
<IsRevisionIncremented>True</IsRevisionIncremented>
<IsWebBootstrapper>True</IsWebBootstrapper>
<ManifestCertificateThumbprint>820B7EDF3E26E24BB4C25B177A05B3D0C77BF73A</ManifestCertificateThumbprint>
<ManifestKeyFile>hass-workstation-service_TemporaryKey.pfx</ManifestKeyFile>
<MapFileExtensions>true</MapFileExtensions>
<OpenBrowserOnPublish>false</OpenBrowserOnPublish>
<Platform>Any CPU</Platform>
<ProductName>Hass Workstation Service</ProductName>
<PublishDir>bin\publish\</PublishDir>
<PublishUrl>bin\publish\</PublishUrl>
<PublisherName>Sleevezipper</PublisherName>
<PublishProtocol>ClickOnce</PublishProtocol>
<PublishReadyToRun>False</PublishReadyToRun>
<PublishSingleFile>False</PublishSingleFile>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>False</SelfContained>
<SignatureAlgorithm>sha256RSA</SignatureAlgorithm>
<SignManifests>True</SignManifests>
<SupportUrl>https://github.com/sleevezipper/hass-workstation-service/issues</SupportUrl>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TrustUrlParameters>True</TrustUrlParameters>
<UpdateEnabled>True</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
</PropertyGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.NetCore.CoreRuntime.3.1.x64">
<Install>true</Install>
<ProductName>.NET Core Runtime 3.1.10 (x64)</ProductName>
</BootstrapperPackage>
</ItemGroup>
</Project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>

@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ApplicationRevision>34</ApplicationRevision>
<ApplicationRevision>35</ApplicationRevision>
<ApplicationVersion>1.0.0.*</ApplicationVersion>
<BootstrapperEnabled>True</BootstrapperEnabled>
<Configuration>Release</Configuration>

@ -4,7 +4,7 @@
<TargetFramework>netcoreapp3.1</TargetFramework>
<UserSecretsId>dotnet-hass_workstation_service-C65C2EBE-1977-4C24-AC6B-6921877E1390</UserSecretsId>
<RootNamespace>hass_workstation_service</RootNamespace>
<OutputType>Exe</OutputType>
<OutputType>WinExe</OutputType>
<Authors>Sleevezipper</Authors>
<RepositoryUrl>https://github.com/sleevezipper/hass-workstation-service</RepositoryUrl>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
@ -23,6 +23,17 @@
<Content Remove="appsettings.json" />
</ItemGroup>
<ItemGroup>
<None Remove="UserInterface.exe" />
<None Remove="UserInterface.pdb" />
</ItemGroup>
<ItemGroup>
<Content Include="UserInterface.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="appsettings.json">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_LastSelectedProfileId>C:\Users\Maurits\Documents\Repo\hass-desktop-service\hass-workstation-service\Properties\PublishProfiles\ClickOnceProfile.pubxml</_LastSelectedProfileId>
<_LastSelectedProfileId>C:\Users\Maurits\Documents\Repo\hass-desktop-service\hass-workstation-service\Properties\PublishProfiles\AzureHosted.pubxml</_LastSelectedProfileId>
<ShowAllFiles>true</ShowAllFiles>
</PropertyGroup>
</Project>
Loading…
Cancel
Save