This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create KeyVault to store the secrets | |
$kv_name = 'kvnamecv1' | |
$keyvault_rg = 'keyvaultrg1' | |
$keyvault_rg_location = 'westeurope' | |
az group create --name $keyvault_rg --location $keyvault_rg_location | |
az keyvault create --name $kv_name --resource-group $keyvault_rg --enabled-for-template-deployment --enabled-for-deployment | |
###END | |
# Save Service Principal password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Update for e.g. caCertificate from | |
"caCertificate": { | |
"value": "[CERTIFICATE THAT CAN BE SEEN]" | |
}, | |
# to | |
"caCertificate": { | |
"reference": { | |
"keyVault": { | |
"id": "[KEY_VAULT_ID]" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"agentpool1Count": { | |
"value": 1 | |
}, | |
"agentpool1Subnet": { | |
"value": "10.240.0.0/12" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"agentpool1Count": { | |
"value": 1 | |
}, | |
"agentpool1Subnet": { | |
"value": "10.240.0.0/12" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@CrossOrigin(origins = "*") | |
@RestController | |
public class SentimentController { | |
@Value("${sa.logic.api.url}") // #1 | |
private String saLogicApiUrl; | |
@PostMapping("/sentiment") | |
public SentimentDto sentimentAnalysis(@RequestBody SentenceDto sentenceDto) { | |
RestTemplate restTemplate = new RestTemplate(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from textblob import TextBlob | |
from flask import Flask, request, jsonify | |
app = Flask(__name__) #1 | |
@app.route("/analyse/sentiment", methods=['POST']) #2 | |
def analyse_sentiment(): | |
sentence = request.get_json()['sentence'] #3 | |
polarity = TextBlob(sentence).sentences[0].polarity #4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
analyzeSentence() { | |
fetch('http://localhost:8080/sentiment', { // #1 | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/json' | |
}, | |
body: JSON.stringify({sentence: this.textField.getValue()}) // #2 | |
}) | |
.then(response => response.json()) | |
.then(data => this.setState(data)); // #3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Pod # 1 | |
metadata: | |
name: sa-frontend # 2 | |
spec: # 3 | |
containers: | |
- image: rinormaloku/sentiment-analysis-frontend # 4 | |
name: sa-frontend # 5 | |
ports: | |
- containerPort: 80 # 6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: sa-frontend2 # Only change | |
spec: | |
containers: | |
- image: rinormaloku/sentiment-analysis-frontend | |
name: sa-frontend | |
ports: | |
- containerPort: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Service # 1 | |
metadata: | |
name: sa-frontend-lb | |
spec: | |
type: LoadBalancer # 2 | |
ports: | |
- port: 80 # 3 | |
protocol: TCP # 4 | |
targetPort: 80 # 5 |
OlderNewer