Menu

Tree [3528fe] master /
 History

HTTPS access


File Date Author Commit
 mongo 2019-07-15 David Ljuba David Ljuba [a681c1] trace logging HTTPBuilder in test and prod; syn...
 rest 2022-01-11 David Ljuba David Ljuba [3528fe] changed paths and scraping; updated version of ...
 ui 2022-01-11 David Ljuba David Ljuba [3528fe] changed paths and scraping; updated version of ...
 .gitignore 2018-01-16 David David [531708] hardcoded default 14 category for girls in 2018...
 README.md 2022-01-11 David Ljuba David Ljuba [3528fe] changed paths and scraping; updated version of ...

Read Me

Tenniswall site - Azure

Prerequisites

  • Azure account/subscription
  • Azure CLI installed
  • Install nvm
  • Ftp installed (Ubuntu)
  • sdkman

UI frontent prepare

Install nvm

Goto ui folder:

    nvm install node # to install npm
    npm install -g grunt grunt-cli
    npm install
    grunt build

Login to Azure

    az login
    az account set --subscription Azure\ subscription\ 1 # in this example set default subscription
    az webapp list-runtimes --linux # check available runtimes (example)
[
  "DOTNETCORE|2.1",
  "DOTNETCORE|3.1",
  "DOTNET|5.0",
  "NODE|14-lts",
  "NODE|12-lts",
  "NODE|10-lts",
  "NODE|10.1",
  "NODE|10.6",
  "NODE|10.14",
  "JAVA|8-jre8",
  "JAVA|11-java11",
  "TOMCAT|8.5-jre8",
  "TOMCAT|9.0-jre8",
  "TOMCAT|8.5-java11",
  "TOMCAT|9.0-java11",
  "JBOSSEAP|7.2-java8",
  "PHP|7.2",
  "PHP|7.3",
  "PHP|7.4",
  "PYTHON|3.8",
  "PYTHON|3.7",
  "PYTHON|3.6",
  "RUBY|2.5",
  "RUBY|2.6"
]

Rest backend prepare

Goto rest folder:

sdk install java 11.0.13-zulu # Java 11 used on Azure Cloud    

gradle bootJar -x test --warning-mode all # generates self-executable rest.jar in build/libs folder 

# or
gradle clean build -x test -i --warning-mode all # generate rest.war in in build/libs folder

Azure prepare rest

az appservice plan create --sku F1 --location westeurope --is-linux --resource-group rg289 --name tenniswall-rg-plan # Azure service plan (F1 - free)
az webapp create --plan tenniswall-plan --name tenniswall-rest --runtime "JAVA|8-jre8" --resource-group rg288 # simple java runtime

Rest backend publish (ftp) to Azure

To get information about url, username and password
https://docs.microsoft.com/en-us/azure/app-service/deploy-configure-credentials?tabs=cli#appscope

Goto rest folder

  rest git:(master)  ftp waws-prod-am2-373.ftp.azurewebsites.windows.net
Connected to waws-prod-am2-373.drip.azurewebsites.windows.net.
220 Microsoft FTP Service
Name (waws-prod-am2-373.ftp.azurewebsites.windows.net:david): tenniswall-rest\$tenniswall-rest
331 Password required
Password:
230 User logged in.
ftp> binary
200 Type set to I.
Remote system type is Windows_NT.
ftp> put
(local-file) build/libs/rest.war
(remote-file) /home/site/wwwroot/rest.war
...

UI frontend publish to Azure

Goto ui/dist folder

  dist git:(master)  az webapp up --location westeurope --name tenniswall-ui --html
The webapp 'tenniswall-ui' doesn't exist
Creating AppServicePlan 'test381638194288_asp_Windows_westeurope_0' ...
Creating webapp 'tenniswall-ui' ...
Configuring default logging for the app, if not already enabled
Creating zip with contents of dir /home/david/dev/workspaces/workspace-tss/tenniswall-code/ui/dist ...
Getting scm site credentials for zip deployment
Starting zip deployment. This operation can take a while to complete ...
Deployment endpoint responded with status code 202
You can launch the app at http://tenniswall-ui.azurewebsites.net
{
  "URL": "http://tenniswall-ui.azurewebsites.net",
  "appserviceplan": "test381638194288_asp_Windows_westeurope_0",
  "location": "westeurope",
  "name": "tenniswall-ui",
  "os": "Windows",
  "resourcegroup": "test381638194288_rg_Windows_westeurope",
  "runtime_version": "-",
  "runtime_version_detected": "-",
  "sku": "FREE",
  "src_path": "//home//david//dev//workspaces//workspace-tss//tenniswall-code//ui//dist"
}

Create file /home/site/wwwroot/web.config remotely using Development/Tools SSH in Azure Portal

Modification from https://vaadin.com/learn/tutorials/cloud-deployment/azure :

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
   <system.webServer>
       <handlers>
           <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
       </handlers>
       <httpPlatform processPath="java" arguments="-Djava.net.preferIPv4Stack=true -Dserver.port=80 -jar /home/site/wwwroot/rest.war"> </httpPlatform>
   </system.webServer>
</configuration>

Deprecated: Tennis wall site - Pivotal Cloud Foundry

Some commands (will improve in later iterations)

Webapp prepare

install [nvm](https://github.com/nvm-sh/nvm)
nvm install node (to install npm)
npm install -g grunt grunt-cli
npm install
grunt build
touch dist/Staticfile
cd dist/ && zip -r ui.zip . && cd ..

Push ui, rest on Pivotal using Cloudfoundry cli

cf login -a api.run.pivotal.io -u dtennis@sharklasers.com -p *********
cf marketplace -s mlab (to search for name of mongo free service)
cf create-service mlab sandbox dtennis-mongo
cf bind-service dtennis-rest dtennis-mongo
cf push dtennis-rest -p rest/build/libs/rest.war -m 768M
cf push dtennis-ui -p ui/dist/ui.zip -m 64M
cf restage dtennis-rest

Run locally

# start mongo
docker-compose -f mongo/stack.yml up -d mongo mongo-express

# run ui
grunt serve

# run backend (to remote debug on port 5005 uncomment # --debug-jvm ) https://stackoverflow.com/questions/39490624/how-to-debug-spring-application-with-gradle
gradle run -x test -i --warning-mode all --offline # --debug-jvm

# stop mongo
docker-compose -f mongo/stack.yml down --remove-orphans

Logs

cf logs pytennis-rest

Upgrade gradle wrapper

# in case of zsh and oh_my_zsh plugin that has alias for gradle to use gradlew
unalias gradle

# actual upgrade follows:
gradle wrapper -i --warning-mode all --gradle-version=6.5

Atlas MongoDB login

https://account.mongodb.com/account/login