示例#1
0
        public Task Execute(CancellationToken cancellationToken)
        {
            if (dashboardOptions.HostSelf)
            {
                try
                {
                    host =
                        new WebHostBuilder()
                        .ConfigureServices(services =>
                    {
                        services.AddServicesForHostedDashboard(grainFactory, siloDispatcher, dashboardOptions);
                    })
                        .Configure(app =>
                    {
                        if (dashboardOptions.HasUsernameAndPassword())
                        {
                            // only when usename and password are configured
                            // do we inject basicauth middleware in the pipeline
                            app.UseMiddleware <BasicAuthMiddleware>();
                        }

                        app.UseOrleansDashboard(dashboardOptions);
                    })
                        .UseKestrel()
                        .UseUrls($"http://{dashboardOptions.Host}:{dashboardOptions.Port}")
                        .Build();

                    host.Start();
                }
                catch (Exception ex)
                {
                    logger.Error(10001, ex.ToString());
                }

                logger.LogInformation($"Dashboard listening on {dashboardOptions.Port}");
            }

            // horrible hack to grab the scheduler
            // to allow the stats publisher to push
            // counters to grains
            this.siloDispatcher.Setup();

            return(Task.WhenAll(
                       ActivateDashboardGrainAsync(),
                       ActivateSiloGrainAsync()));
        }
示例#2
0
        public async Task Execute(CancellationToken cancellationToken)
        {
            if (dashboardOptions.HostSelf)
            {
                try
                {
                    host =
                        new WebHostBuilder()
                        .ConfigureServices(services =>
                    {
                        services.AddServicesForHostedDashboard(grainFactory, dashboardOptions);
                    })
                        .Configure(app =>
                    {
                        if (dashboardOptions.HasUsernameAndPassword())
                        {
                            // only when usename and password are configured
                            // do we inject basicauth middleware in the pipeline
                            app.UseMiddleware <BasicAuthMiddleware>();
                        }

                        app.UseOrleansDashboard(dashboardOptions);
                    })
                        .UseKestrel()
                        .UseUrls($"http://{dashboardOptions.Host}:{dashboardOptions.Port}")
                        .Build();

                    await host.StartAsync(cancellationToken);
                }
                catch (Exception ex)
                {
                    logger.Error(10001, ex.ToString());
                }

                logger.LogInformation($"Dashboard listening on {dashboardOptions.Port}");
            }

            await Task.WhenAll(
                ActivateDashboardGrainAsync(),
                ActivateSiloGrainAsync());
        }