Merge pull request #15 from OriolBonjoch/master
Removed notes, fixed footer gap and hide Twitter if not configured
This commit is contained in:
Коммит
dec38c3d8f
|
@ -1,19 +0,0 @@
|
|||
1. Get the application URL by running these commands:
|
||||
{{- if .Values.ingress.enabled }}
|
||||
{{- range .Values.ingress.hosts }}
|
||||
http{{ if $.Values.ingress.tlsEnabled }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
|
||||
{{- end }}
|
||||
{{- else if contains "NodePort" .Values.service.type }}
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "rpsls-dotnet.fullname" . }})
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
echo http://$NODE_IP:$NODE_PORT
|
||||
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
You can watch the status of by running 'kubectl get svc -w {{ template "rpsls-dotnet.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "rpsls-dotnet.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||
echo http://$SERVICE_IP:{{ .Values.service.port }}
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "rpsls-dotnet.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||
kubectl port-forward $POD_NAME 8080:80
|
||||
{{- end }}
|
|
@ -1,19 +1,6 @@
|
|||
1. Get the application URL by running these commands:
|
||||
{{- if .Values.ingress.enabled }}
|
||||
{{- range .Values.ingress.hosts }}
|
||||
http{{ if $.Values.ingress.tlsEnabled }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
|
||||
http{{ if $.Values.ingress.tlsEnabled }}s{{ end }}://{{ . }}{{ $.Values.inf.ingress.game.path }}
|
||||
{{- end }}
|
||||
{{- else if contains "NodePort" .Values.service.type }}
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "rpsls-game.fullname" . }})
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
echo http://$NODE_IP:$NODE_PORT
|
||||
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
You can watch the status of by running 'kubectl get svc -w {{ template "rpsls-game.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "rpsls-game.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||
echo http://$SERVICE_IP:{{ .Values.service.port }}
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "rpsls-game.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||
kubectl port-forward $POD_NAME 8080:80
|
||||
{{- end }}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
1. Get the application URL by running these commands:
|
||||
{{- if .Values.ingress.enabled }}
|
||||
{{- range .Values.ingress.hosts }}
|
||||
http{{ if $.Values.ingress.tlsEnabled }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
|
||||
{{- end }}
|
||||
{{- else if contains "NodePort" .Values.service.type }}
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "rpsls-java.fullname" . }})
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
echo http://$NODE_IP:$NODE_PORT
|
||||
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
You can watch the status of by running 'kubectl get svc -w {{ template "rpsls-java.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "rpsls-java.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||
echo http://$SERVICE_IP:{{ .Values.service.port }}
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "rpsls-java.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||
kubectl port-forward $POD_NAME 8080:80
|
||||
{{- end }}
|
|
@ -12,4 +12,5 @@ metadata:
|
|||
heritage: {{ .Release.Service }}
|
||||
data:
|
||||
APPLICATION_INSIGHTS_IKEY: {{ .Values.inf.appinsights.id }}
|
||||
APPLICATION_INSIGHTS_ENABLED: {{ if .Values.inf.appinsights.id }}'true'{{ else }}'false'{{ end }}
|
||||
PREDICTOR_URL: {{ .Values.inf.apiurls.predictor }}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
1. Get the application URL by running these commands:
|
||||
{{- if .Values.ingress.enabled }}
|
||||
{{- range .Values.ingress.hosts }}
|
||||
http{{ if $.Values.ingress.tlsEnabled }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
|
||||
{{- end }}
|
||||
{{- else if contains "NodePort" .Values.service.type }}
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "rpsls-node.fullname" . }})
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
echo http://$NODE_IP:$NODE_PORT
|
||||
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
You can watch the status of by running 'kubectl get svc -w {{ template "rpsls-node.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "rpsls-node.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||
echo http://$SERVICE_IP:{{ .Values.service.port }}
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "rpsls-node.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||
kubectl port-forward $POD_NAME 8080:80
|
||||
{{- end }}
|
|
@ -1,19 +0,0 @@
|
|||
1. Get the application URL by running these commands:
|
||||
{{- if .Values.ingress.enabled }}
|
||||
{{- range .Values.ingress.hosts }}
|
||||
http{{ if $.Values.ingress.tlsEnabled }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
|
||||
{{- end }}
|
||||
{{- else if contains "NodePort" .Values.service.type }}
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "rpsls-php.fullname" . }})
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
echo http://$NODE_IP:$NODE_PORT
|
||||
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
You can watch the status of by running 'kubectl get svc -w {{ template "rpsls-php.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "rpsls-php.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||
echo http://$SERVICE_IP:{{ .Values.service.port }}
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "rpsls-php.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||
kubectl port-forward $POD_NAME 8080:80
|
||||
{{- end }}
|
|
@ -1,19 +0,0 @@
|
|||
1. Get the application URL by running these commands:
|
||||
{{- if .Values.ingress.enabled }}
|
||||
{{- range .Values.ingress.hosts }}
|
||||
http{{ if $.Values.ingress.tlsEnabled }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
|
||||
{{- end }}
|
||||
{{- else if contains "NodePort" .Values.service.type }}
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "rpsls-python.fullname" . }})
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
echo http://$NODE_IP:$NODE_PORT
|
||||
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
You can watch the status of by running 'kubectl get svc -w {{ template "rpsls-python.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "rpsls-python.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||
echo http://$SERVICE_IP:{{ .Values.service.port }}
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "rpsls-python.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
echo "Visit http://127.0.0.1:80 to use your application"
|
||||
kubectl port-forward $POD_NAME 80:80
|
||||
{{- end }}
|
|
@ -1,19 +1,9 @@
|
|||
1. Get the application URL by running these commands:
|
||||
{{- if .Values.ingress.enabled }}
|
||||
{{- range .Values.ingress.hosts }}
|
||||
http{{ if $.Values.ingress.tlsEnabled }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
|
||||
http{{ if $.Values.ingress.tlsEnabled }}s{{ end }}://{{ . }}{{ $.Values.inf.ingress.web.path }}
|
||||
{{- if $.Values.uploaderEnabled }}
|
||||
http{{ if $.Values.ingress.tlsEnabled }}s{{ end }}://{{ . }}{{ $.Values.inf.ingress.web.uploaderPath }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else if contains "NodePort" .Values.service.type }}
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "rpsls-web.fullname" . }})
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
echo http://$NODE_IP:$NODE_PORT
|
||||
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
You can watch the status of by running 'kubectl get svc -w {{ template "rpsls-web.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "rpsls-web.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||
echo http://$SERVICE_IP:{{ .Values.service.port }}
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "rpsls-web.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||
kubectl port-forward $POD_NAME 8080:80
|
||||
{{- end }}
|
||||
|
|
|
@ -6,16 +6,6 @@ inf:
|
|||
googleanalytics:
|
||||
id: {{googleanalyticsid}}
|
||||
ingress:
|
||||
dotnet:
|
||||
path: /dotnet-player
|
||||
node:
|
||||
path: /node-player
|
||||
python:
|
||||
path: /python-player
|
||||
php:
|
||||
path: /php-player
|
||||
java:
|
||||
path: /java-player
|
||||
game:
|
||||
path: /game-manager
|
||||
web:
|
||||
|
|
|
@ -6,16 +6,6 @@ inf:
|
|||
googleanalytics:
|
||||
id: {{googleanalyticsid}}
|
||||
ingress:
|
||||
dotnet:
|
||||
path: /dotnet-player
|
||||
node:
|
||||
path: /node-player
|
||||
python:
|
||||
path: /python-player
|
||||
php:
|
||||
path: /php-player
|
||||
java:
|
||||
path: /java-player
|
||||
game:
|
||||
path: /game-manager
|
||||
web:
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.8.2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.4.10" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -7,9 +7,6 @@ using RPSLS.DotNetPlayer.Api.Services;
|
|||
using RPSLS.DotNetPlayer.Api.Settings;
|
||||
using RPSLS.DotNetPlayer.API.Services;
|
||||
using RPSLS.DotNetPlayer.API.Settings;
|
||||
using RPSLS.DotNetPlayer.API.Strategies;
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
|
||||
namespace RPSLS.DotNetPlayer.API
|
||||
{
|
||||
|
@ -27,6 +24,7 @@ namespace RPSLS.DotNetPlayer.API
|
|||
{
|
||||
services.Configure<StrategySettings>(Configuration);
|
||||
services.Configure<PredictorSettings>(Configuration);
|
||||
services.AddApplicationInsightsTelemetry();
|
||||
services.AddControllers();
|
||||
services.AddHealthChecks();
|
||||
services.AddHttpClient("Predictor");
|
||||
|
|
|
@ -39,6 +39,11 @@
|
|||
<artifactId>json-simple</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.microsoft.azure</groupId>
|
||||
<artifactId>applicationinsights-spring-boot-starter</artifactId>
|
||||
<version>2.5.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
rpsls.player.pick.strategy=${PICK_STRATEGY:random}
|
||||
rpsls.predictor.pick.url=${PREDICTOR_URL:}
|
||||
azure.application-insights.instrumentation-key=${APPLICATION_INSIGHTS_IKEY:00000000-0000-0000-0000-000000000000}
|
||||
azure.application-insights.enabled=${APPLICATION_INSIGHTS_ENABLED:false}
|
|
@ -1,7 +1,3 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
|
|
@ -1,9 +1,17 @@
|
|||
const express = require('express');
|
||||
const cors = require('cors');
|
||||
require('dotenv').config();
|
||||
const appInsights = require("applicationinsights");
|
||||
|
||||
const routes = require('./api/routes/index.route');
|
||||
|
||||
require('dotenv').config();
|
||||
|
||||
// Start application insights
|
||||
const applicationInsightsIK = process.env.APPLICATION_INSIGHTS_IKEY;
|
||||
if (applicationInsightsIK) {
|
||||
appInsights.setup(applicationInsightsIK).start();
|
||||
}
|
||||
|
||||
const app = express();
|
||||
|
||||
// Application-Level Middleware
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -11,6 +11,7 @@
|
|||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"applicationinsights": "^1.6.0",
|
||||
"axios": "^0.19.0",
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^8.1.0",
|
||||
|
|
|
@ -7,25 +7,29 @@ use Illuminate\Support\Facades\Log;
|
|||
use Illuminate\Support\Facades\Request;
|
||||
use App\Services\PickStrategyFactory;
|
||||
use App\Services\PredictorProxy;
|
||||
use App\Services\AppInsightsService;
|
||||
|
||||
class PickController extends BaseController
|
||||
{
|
||||
private $_context;
|
||||
private $_strategy;
|
||||
private $_predictor;
|
||||
private $_appinsights;
|
||||
|
||||
public function __construct(PickStrategyFactory $strategyFactory, PredictorProxy $predictorProxy)
|
||||
public function __construct(PickStrategyFactory $strategyFactory, PredictorProxy $predictorProxy, AppInsightsService $appinsights)
|
||||
{
|
||||
$this->_strategy = config('strategies.PICK_STRATEGY');
|
||||
$strategyFactory->setDefaultStrategy($this->_strategy);
|
||||
Log::info('Configured pick strategy with '.$this->_strategy);
|
||||
$this->_context = $strategyFactory->getStrategy();
|
||||
$this->_predictor = $predictorProxy;
|
||||
$this->_appinsights = $appinsights;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$username = Request::get('username', '');
|
||||
$this->_appinsights->trackRequest('PickController:index()', 'GET /pick', time());
|
||||
if($username != '') {
|
||||
try {
|
||||
$predicted = $this->_predictor->getPickPredicted($username);
|
||||
|
@ -33,6 +37,7 @@ class PickController extends BaseController
|
|||
return response()->json($predicted);
|
||||
} catch(\Throwable $e) {
|
||||
Log::error('Predictor had a problem');
|
||||
$this->_appinsights->trackException($e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,5 +20,9 @@ class AppServiceProvider extends ServiceProvider
|
|||
$this->app->singleton(PredictorProxy::class, function ($app) {
|
||||
return new PredictorProxy();
|
||||
});
|
||||
|
||||
$this->app->singleton(AppInsightsService::class, function($app) {
|
||||
return new AppInsightsService();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
class AppInsightsService
|
||||
{
|
||||
private $_telemetryClient;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$key = config('appinsights.APPLICATION_INSIGHTS_IKEY');
|
||||
$this->_telemetryClient = new \ApplicationInsights\Telemetry_Client();
|
||||
$context = $this->_telemetryClient->getContext();
|
||||
$context->setInstrumentationKey($key);
|
||||
}
|
||||
|
||||
public function trackRequest($name, $url, $startTime)
|
||||
{
|
||||
$this->_telemetryClient->trackRequest($name, $url, $startTime);
|
||||
$this->_telemetryClient->flush();
|
||||
}
|
||||
|
||||
public function trackException($ex)
|
||||
{
|
||||
$telemetryClient->trackException($ex);
|
||||
$telemetryClient->flush();
|
||||
}
|
||||
}
|
|
@ -93,6 +93,7 @@ $app->register(App\Providers\AppServiceProvider::class);
|
|||
|
||||
$app->configure('strategies');
|
||||
$app->configure('predictor');
|
||||
$app->configure('appinsights');
|
||||
|
||||
$app->router->group([
|
||||
'namespace' => 'App\Http\Controllers',
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
"type": "project",
|
||||
"require": {
|
||||
"php": "^7.2",
|
||||
"guzzlehttp/guzzle": "^6.4",
|
||||
"laravel/lumen-framework": "^6.0"
|
||||
"guzzlehttp/guzzle": "~5.0",
|
||||
"laravel/lumen-framework": "^6.0",
|
||||
"microsoft/application-insights": "~0.2.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"fzaninotto/faker": "^1.4",
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'APPLICATION_INSIGHTS_IKEY' => getenv('APPLICATION_INSIGHTS_IKEY') ?: env('APPLICATION_INSIGHTS_IKEY', ''),
|
||||
];
|
|
@ -1,17 +1,24 @@
|
|||
from flask import Flask, request
|
||||
from healthcheck import HealthCheck
|
||||
from applicationinsights.flask.ext import AppInsights
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
from .pick import Picker
|
||||
|
||||
app = Flask(__name__)
|
||||
appinsightskey = os.getenv('APPLICATION_INSIGHTS_IKEY', '')
|
||||
if appinsightskey:
|
||||
app.config['APPINSIGHTS_INSTRUMENTATIONKEY'] = appinsightskey
|
||||
# log requests, traces and exceptions to the Application Insights service
|
||||
appinsights = AppInsights(app)
|
||||
|
||||
health = HealthCheck()
|
||||
|
||||
app.add_url_rule("/healthcheck", "healthcheck", view_func=lambda: health.run())
|
||||
app.add_url_rule('/pick', 'pick', view_func=Picker.as_view('picker'))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(threaded=True)
|
||||
else:
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import random
|
||||
import socket
|
||||
from flask import jsonify
|
||||
|
||||
from .rpsls import RPSLS
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
gunicorn
|
||||
flask
|
||||
py-healthcheck
|
||||
applicationinsights
|
|
@ -159,6 +159,12 @@ else
|
|||
shakeHand = true;
|
||||
|
||||
await Game.Play(Username, isTwitterUser);
|
||||
if (!Game.GameResult.IsValid)
|
||||
{
|
||||
shakeHand = false;
|
||||
return;
|
||||
}
|
||||
|
||||
await Task.Delay(2000);
|
||||
shakeHand = false;
|
||||
userHandToShow = pickedToPlay.Image;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
@layout MainLayout
|
||||
@inject IOptions<TwitterOptions> TwitterOptions
|
||||
@page "/"
|
||||
|
||||
<div class="index-content">
|
||||
|
@ -11,13 +12,21 @@
|
|||
<h2 class="subtitle">Can you defeat our bot?</h2>
|
||||
</div>
|
||||
<input name="username" class="user" type="text" placeholder="Type Username" required />
|
||||
<div class="sign_twitter">or <a href="/api/account/login/twitter">Sign in with Twitter</a></div>
|
||||
|
||||
<div class="sign_twitter">
|
||||
@if (!string.IsNullOrWhiteSpace(TwitterOptions?.Value?.ConsumerKey) && !string.IsNullOrWhiteSpace(TwitterOptions?.Value?.ConsumerSecret))
|
||||
{
|
||||
<span>or <a href="/api/account/login/twitter"> Sign in with Twitter</a></span>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="custom-button">
|
||||
<button type="submit" class="custom-button-link">Enter Game</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="github">
|
||||
<a class="github-text" target="_blank" href="https://github.com/microsoft/RockPaperScissorsLizardSpock">Get the code from GitHub</a>
|
||||
</div>
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
@code
|
||||
{
|
||||
ResultDto result = new ResultDto();
|
||||
string resultMessage = null;
|
||||
string resultMessage = string.Empty;
|
||||
bool userIsWinner = false;
|
||||
bool userIsLoser = false;
|
||||
string resultStyle = "";
|
||||
|
@ -99,13 +99,16 @@
|
|||
NavigationManager.NavigateTo("/challenger");
|
||||
return;
|
||||
}
|
||||
|
||||
result.UserPick = Game.Pick;
|
||||
result = Game.GameResult;
|
||||
|
||||
if (result.IsValid)
|
||||
{
|
||||
resultMessage = CreateResult(result.Result);
|
||||
|
||||
userIsWinner = result.Result == 1;
|
||||
userIsLoser = result.Result == 2;
|
||||
}
|
||||
|
||||
resultStyle = GetResultClass(result.Result);
|
||||
error = errors.FirstOrDefault(c => c.Name == result.Challenger);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using Microsoft.AspNetCore.Authentication.Twitter;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
|
@ -37,6 +38,7 @@ namespace RPSLS.Web
|
|||
services.AddOptions();
|
||||
services.Configure<RecognitionSettings>(Configuration);
|
||||
services.Configure<GoogleAnalyticsSettings>(Configuration);
|
||||
services.Configure<TwitterOptions>(Configuration.GetSection("Authentication:Twitter"));
|
||||
services.Configure<GameManagerSettings>(Configuration.GetSection("GameManager"));
|
||||
if (Configuration.GetValue<bool>("GameManager:Grpc:GrpcOverHttp", false))
|
||||
{
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
@using System.Net.Http
|
||||
@using Microsoft.AspNetCore.Authorization
|
||||
@using Microsoft.AspNetCore.Authentication.Twitter
|
||||
@using Microsoft.AspNetCore.Components.Authorization
|
||||
@using Microsoft.AspNetCore.Components.Forms
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@using Microsoft.Extensions.Options
|
||||
@using Microsoft.JSInterop
|
||||
@using RPSLS.Web
|
||||
@using RPSLS.Web.Shared
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
flex-direction: column;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
min-height: calc(100vh - 250px);
|
||||
min-height: calc(100vh - 199px);
|
||||
background-image: url(../assets/images/svg/screens_panel.svg),
|
||||
url(../assets/images/svg/platform_opponents.svg),
|
||||
linear-gradient(
|
||||
|
|
|
@ -57,7 +57,7 @@ body {
|
|||
|
||||
/* Footer */
|
||||
.footer {
|
||||
height: 3.3rem;
|
||||
height: 47px;
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
width: 100%;
|
||||
display: flex;
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
.game-content-title {
|
||||
position: relative;
|
||||
margin: 0;
|
||||
padding-top: 2.8rem;
|
||||
margin-bottom: 2.7rem;
|
||||
padding-top: 40px;
|
||||
margin-bottom: 37px;
|
||||
height: 75px;
|
||||
font-family: "Voyager";
|
||||
font-weight: 300;
|
||||
font-size: 3.75rem;
|
||||
font-size: 75px;
|
||||
text-shadow: 0 2px 2px rgba(0, 0, 0, 0.9);
|
||||
line-height: 3.75rem;
|
||||
line-height: 75px;
|
||||
color: #ffaa44;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
|
|
|
@ -5,37 +5,44 @@ services:
|
|||
ports:
|
||||
- "5003:5000"
|
||||
environment:
|
||||
- PICK_STRATEGY=scissors
|
||||
- APPLICATION_INSIGHTS_IKEY=
|
||||
- PICK_STRATEGY=random
|
||||
- PREDICTOR_URL=
|
||||
node.player:
|
||||
ports:
|
||||
- "5002:3000"
|
||||
environment:
|
||||
- PICK_STRATEGY=paper
|
||||
- APPLICATION_INSIGHTS_IKEY=
|
||||
- PICK_STRATEGY=random
|
||||
- PREDICTOR_URL=
|
||||
dotnet.player:
|
||||
ports:
|
||||
- "5001:80"
|
||||
environment:
|
||||
- PICK_STRATEGY=rock
|
||||
- APPINSIGHTS_INSTRUMENTATIONKEY=
|
||||
- PICK_STRATEGY=random
|
||||
- PREDICTOR_Url=
|
||||
php.player:
|
||||
ports:
|
||||
- "5004:80"
|
||||
environment:
|
||||
- PICK_STRATEGY=lizard
|
||||
- APPLICATION_INSIGHTS_IKEY=
|
||||
- PICK_STRATEGY=random
|
||||
- PREDICTOR_URL=
|
||||
java.player:
|
||||
ports:
|
||||
- "5005:8080"
|
||||
environment:
|
||||
- PICK_STRATEGY=spock
|
||||
- APPLICATION_INSIGHTS_IKEY=
|
||||
- APPLICATION_INSIGHTS_ENABLED=false
|
||||
- PICK_STRATEGY=random
|
||||
- PREDICTOR_URL=
|
||||
game.api:
|
||||
ports:
|
||||
- "5101:80"
|
||||
- "5102:81"
|
||||
environment:
|
||||
- APPINSIGHTS_INSTRUMENTATIONKEY=
|
||||
- GRPC_PORT=81
|
||||
- Challengers__0__Url=http://dotnet.player/
|
||||
- Challengers__1__Url=http://node.player:3000/
|
||||
|
@ -46,6 +53,7 @@ services:
|
|||
ports:
|
||||
- "5100:80"
|
||||
environment:
|
||||
- APPINSIGHTS_INSTRUMENTATIONKEY=
|
||||
- GameManager__Url=http://game.api:81/
|
||||
- GameManager__Grpc__GrpcOverHttp=true
|
||||
- Authentication__Twitter__ConsumerKey=
|
||||
|
@ -56,6 +64,7 @@ services:
|
|||
ports:
|
||||
- "5110:80"
|
||||
environment:
|
||||
- APPINSIGHTS_INSTRUMENTATIONKEY=
|
||||
- UploadPath=model
|
||||
volumes:
|
||||
- model-data:/app/model
|
||||
|
|
Загрузка…
Ссылка в новой задаче