Skip to content
Permalink
Browse files

Improve user interface

+ Use names which are easier to remember.
+ Support interactive exploring of the user interface: Add guides into CLI.
  • Loading branch information
Viir committed Feb 1, 2020
1 parent ae548b4 commit 4efb4a5e283a42ed4a5024005166ef2f76c91d73
@@ -24,5 +24,5 @@ steps:
testRunner: VSTest
testResultsFiles: '**/*.trx'

- script: dotnet publish ./implement/PersistentProcess/PersistentProcess.WebHost/PersistentProcess.WebHost.csproj
- script: dotnet publish ./implement/elm-fullstack/elm-fullstack.csproj
displayName: 'publish web host'
@@ -4,7 +4,7 @@ Following is the easiest way to build and deploy your Elm full-stack app:

+ Make sure you have [Docker](https://www.docker.com) installed.
+ Clone this repository.
+ Run the script at [`/implement/PersistentProcess/start-server.ps1`](/implement/PersistentProcess/start-server.ps1). This script takes the example app from [/implement/PersistentProcess/example-elm-apps/default-full-stack-app](/implement/PersistentProcess/example-elm-apps/default-full-stack-app) and builds a docker image running this app.
+ Run the script at [`/implement/PersistentProcess/run-server.ps1`](/implement/run-server.ps1). This script takes the example app from [/implement/PersistentProcess/example-elm-apps/default-full-stack-app](/implement/PersistentProcess/example-elm-apps/default-full-stack-app) and builds a docker image running this app.
This script also contains a `docker run` command to start the app. Docker will then forward you logs like these:
```shell
I start a server.
File renamed without changes.
@@ -4,21 +4,21 @@ WORKDIR /app

# Copy everything and build
COPY . ./
WORKDIR /app/PersistentProcess.WebHost
WORKDIR /app/elm-fullstack
RUN dotnet publish -c Debug -o out

# Build runtime image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS binaries

COPY --from=build-env /app/PersistentProcess.WebHost/out /elm-fullstack/dotnet/
COPY --from=build-env /app/elm-fullstack/out /elm-fullstack/dotnet/

# Build the `web-app-config.zip` for the default app.
FROM binaries AS build-default-config

COPY ./example-elm-apps/default-full-stack-app /default-app/

WORKDIR /default-app
RUN dotnet "/elm-fullstack/dotnet/PersistentProcess.WebHost.dll" build-config --frontend-web-elm-make-appendix="--debug" --output="/build-output/web-app-config.zip"
RUN dotnet "/elm-fullstack/dotnet/elm-fullstack.dll" build-config --frontend-web-elm-make-appendix="--debug" --output="/build-output/web-app-config.zip"

# Reduce startup cost: Produce an image which has popular blobs already in cache: Continue with state after having built a configuration.
FROM build-default-config AS with-default-app
@@ -30,6 +30,6 @@ WORKDIR /elm-fullstack
ENV APPSETTING_webAppConfigurationFilePath="/elm-fullstack/web-app-config.zip"
ENV APPSETTING_processStoreDirectoryPath="/elm-fullstack/process-store"

ENTRYPOINT ["dotnet", "/elm-fullstack/dotnet/PersistentProcess.WebHost.dll", "start-server"]
ENTRYPOINT ["dotnet", "/elm-fullstack/dotnet/elm-fullstack.dll", "run-server"]

# ENV APPSETTING_adminRootPassword="password-for-elm-fullstack-root"
@@ -3,5 +3,5 @@ FROM elm-fullstack-test
COPY . /demo-app/

WORKDIR /demo-app
RUN dotnet "/elm-fullstack/dotnet/PersistentProcess.WebHost.dll" build-config --frontend-web-elm-make-appendix="--debug" --output="/elm-fullstack/web-app-config.zip"
RUN dotnet "/elm-fullstack/dotnet/elm-fullstack.dll" build-config --frontend-web-elm-make-appendix="--debug" --output="/elm-fullstack/web-app-config.zip"

@@ -0,0 +1,3 @@
/obj/
/bin/

@@ -0,0 +1,54 @@
using System;
using McMaster.Extensions.CommandLineUtils;

namespace elm_fullstack
{
class Program
{
static string AppVersionId => "2020-02-01";

static int Main(string[] args)
{
var app = new CommandLineApplication
{
Name = "elm-fullstack",
Description = "Welcome to Elm fullstack! This tool helps you build and run fullstack web applications using the Elm programming language.\nTo get help or report an issue, see the project website at http://elm-fullstack.org/",
};

app.HelpOption(inherited: true);

app.VersionOption(template: "-v|--version", shortFormVersion: "version " + AppVersionId);

app.Command("run-server", runServerCmd =>
{
runServerCmd.Description = "Run a web server with your Elm app.";

runServerCmd.OnExecute(() =>
{
var webHostBuilder = Kalmit.PersistentProcess.WebHost.Program.CreateWebHostBuilder(runServerCmd.RemainingArguments.ToArray());
Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(webHostBuilder.Build());
});
});

app.Command("build-config", buildConfigCmd =>
{
buildConfigCmd.Description = "Build a configuration file that can be used to run a server.";

buildConfigCmd.OnExecute(() =>
{
Kalmit.PersistentProcess.WebHost.BuildConfigurationFromArguments.BuildConfiguration(args);
});
});

app.OnExecute(() =>
{
Console.WriteLine("Please specify a subcommand.");
app.ShowHelp();

return 1;
});

return app.Execute(args);
}
}
}
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>elm_fullstack</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="2.5.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\PersistentProcess\PersistentProcess.WebHost\PersistentProcess.WebHost.csproj" />
<ProjectReference Include="..\PersistentProcess\PersistentProcess.Common\PersistentProcess.Common.csproj" />
</ItemGroup>

</Project>
File renamed without changes.

0 comments on commit 4efb4a5

Please sign in to comment.
You can’t perform that action at this time.