Skip to content

React Clock #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 87 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
640ea53
dockerizing/k8s
jaydestro Jul 26, 2019
79bb797
added k8s - docker
jaydestro Jul 26, 2019
298fdd3
minor test changes
jaydestro Jul 29, 2019
fdbb3b7
default add
jaydestro Aug 6, 2019
4c12925
Create nodejs.yml
jaydestro Nov 13, 2019
de7aece
Update README.md
jaydestro Feb 24, 2020
4eb4bfa
Workflow asset
jaydestro Apr 8, 2020
f9c6460
Workflow asset
jaydestro Apr 8, 2020
e670073
Workflow asset
jaydestro Apr 8, 2020
adf2f62
Adding workflow file
jaydestro Apr 8, 2020
151fd8f
Create vm-install-ubuntu.sh
jaydestro Apr 29, 2020
1a594bc
Delete vm-install-ubuntu.sh
jaydestro Apr 29, 2020
30d015d
Create vm-install.sh
jaydestro Apr 29, 2020
c807846
Update vm-install.sh
jaydestro Apr 29, 2020
8f0ae1f
Set up CI with Azure Pipelines
jaydestro May 10, 2020
2855cad
Update App.js
jaydestro May 10, 2020
1a0aa53
Delete deploytoAksCluster.yml
jaydestro May 10, 2020
e5d2599
Delete nodejs.yml
jaydestro May 10, 2020
3bd99fb
Delete deploytoAksCluster.yml
jaydestro May 10, 2020
579d0d1
Delete nodejs.yml
jaydestro May 10, 2020
2104cde
Merge pull request #1 from jaydestro/jaydestro-patch-1
jaydestro May 10, 2020
f3e4ec4
new
jaydestro May 15, 2020
a51fb18
Update Dockerfile
jaydestro May 15, 2020
65716d1
Delete azure-pipelines.yml
jaydestro May 15, 2020
a4ec78a
break app.js for demo
jaydestro May 15, 2020
20a9b88
fixing broken code
jaydestro May 15, 2020
ea616fe
Add or update the App Service deployment workflow configuration from …
jaydestro May 16, 2020
acd9087
Delete test-pages.js
jaydestro May 16, 2020
48e37e1
removing errant test
jaydestro May 16, 2020
d213af4
Delete master_clocktwo.yml
jaydestro May 18, 2020
bf36027
Add or update the App Service deployment workflow configuration from …
jaydestro May 20, 2020
de7618f
updated docs
jaydestro May 20, 2020
db94db2
Workflow asset
jaydestro May 26, 2020
fc8ebc3
Workflow asset
jaydestro May 26, 2020
412b6d5
Workflow asset
jaydestro May 26, 2020
e73901e
Adding workflow file
jaydestro May 26, 2020
1d5b3ca
Update deployment-1.yml
jaydestro May 26, 2020
d057057
Update deployment-1.yml
jaydestro May 26, 2020
985bea4
Delete deployment.yml
jaydestro May 26, 2020
561be6e
Delete ingress.yml
jaydestro May 26, 2020
3ed966c
Delete service.yml
jaydestro May 26, 2020
4006696
Update service-1.yml
jaydestro May 26, 2020
a3dd632
Update deployment-1.yml
jaydestro May 26, 2020
d5d458a
Update service-1.yml
jaydestro May 26, 2020
dbc629d
Create deploytoAKS2.yaml
jaydestro May 26, 2020
f87efd0
Workflow asset
jaydestro May 26, 2020
e270071
Workflow asset
jaydestro May 26, 2020
8d65ece
Workflow asset
jaydestro May 26, 2020
e1dd667
Adding workflow file
jaydestro May 26, 2020
6c74b59
Delete deploytoAksCluster-1.yml
jaydestro May 26, 2020
ea84da0
Delete deploytoAKS2.yaml
jaydestro May 26, 2020
f441a45
Delete deploytoAksCluster.yml
jaydestro May 27, 2020
cf445c9
remove old manifests
jaydestro May 27, 2020
798cc59
Workflow asset
jaydestro May 27, 2020
fb62820
Workflow asset
jaydestro May 27, 2020
7338337
Workflow asset
jaydestro May 27, 2020
68d8206
Adding workflow file
jaydestro May 27, 2020
c166c83
updated manifests
jaydestro May 27, 2020
4bc0ad9
removed workflow file
jaydestro May 27, 2020
7c86db1
Set up CI with Azure Pipelines
jaydestro May 27, 2020
3a34c4f
Delete deploytoAksCluster.yml
jaydestro Jun 24, 2020
46845ac
Add or update the App Service deployment workflow configuration from …
jaydestro Jul 27, 2020
09f0c85
Update index.html
jaydestro Jul 27, 2020
aade42f
Update index.html
jaydestro Jul 30, 2020
aadb3f4
Delete master_reactclockxops.yml
jaydestro Jul 30, 2020
268074c
Add or update the App Service deployment workflow configuration from …
jaydestro Aug 10, 2020
f77833f
Create touch.txt
jaydestro Aug 10, 2020
3db9b8c
Workflow asset
jaydestro Aug 10, 2020
9e75221
Workflow asset
jaydestro Aug 10, 2020
c94c29e
Workflow asset
jaydestro Aug 10, 2020
d90e342
Adding workflow file
jaydestro Aug 10, 2020
011d5ea
Update deploytoAksCluster.yml
jaydestro Aug 10, 2020
815e0e5
Update deployment.yml
jaydestro Aug 10, 2020
104227d
Delete deploytoAksCluster.yml
jaydestro Sep 2, 2020
5552a71
Delete master_clockforjason.yml
jaydestro Sep 2, 2020
22070ab
Add or update the App Service deployment workflow configuration from …
jaydestro Sep 3, 2020
9a8396e
Add or update the App Service deployment workflow configuration from …
jaydestro Jan 14, 2021
1e3f737
Add or update the App Service deployment workflow configuration from …
jaydestro Jan 14, 2021
44fd45e
Add or update the App Service deployment workflow configuration from …
jaydestro Mar 14, 2021
f89bd7d
Delete master_clock123123.yml
jaydestro Mar 14, 2021
dfab9a7
Delete master_demotry123.yml
jaydestro Mar 14, 2021
7657a9d
Workflow asset
jaydestro Apr 28, 2021
b314b8a
Workflow asset
jaydestro Apr 28, 2021
90c8484
Workflow asset
jaydestro Apr 28, 2021
d55255d
Adding workflow file
jaydestro Apr 28, 2021
09a8f7d
Delete master_nodedemojay.yml
jaydestro Jul 21, 2021
d18e677
Delete deploytoAksCluster.yml
jaydestro Jul 21, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .deployment
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[config]
SCM_DO_BUILD_DURING_DEPLOYMENT=true
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM node:12

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./

RUN npm install
# If you are building your code for production
# RUN npm install --only=production

# Bundle app source
COPY . .

EXPOSE 8080
CMD [ "npm", "start" ]
30 changes: 28 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# React Clock

This is a fork of this clock app that includes deployments for Azure Kubernetes Service and Docker.


### App Service Deployment Method:

In Azure cloud shell:

```
git clone https://github.com/jaydestro/react-clock-basic.git

az group create --name $NAME --location eastus

az network vnet create --name $nameVNET --resource-group $NAME --subnet-name default

az acr create --resource-group $NAME--name $NAMEacr --sku Basic --admin-enabled true

az acr build --registry $NAMEacr --image react-clock-basic:v1 .
```

Go to portal in Azure, create a new app service, select your resource group, pick linux, pick docker container, create a new service plan, select dev/test - click Docker

Drop down source, select Azure Container Registry. Click the registry you created above then select the image name and version.

Click Review and create.


A basic clock that displays the current date and time

Go **[here](http://react-clock-basic.drminnaar.me/)** for live demo.
Expand Down Expand Up @@ -83,7 +109,7 @@ These instructions will get you a copy of the project up and running on your loc

The following software is required to be installed on your system:

* Node 8.x
* Node 12.x
* Npm 3.x

Type the following commands in the terminal to verify your node and npm versions
Expand Down Expand Up @@ -190,4 +216,4 @@ I use [SemVer](http://semver.org/) for versioning. For the versions available, s
[react-movie-cards]: https://github.com/drminnaar/react-movie-cards
[react-calculator-standard]: https://github.com/drminnaar/react-calculator-standard
[react-bitcoin-monitor]: https://github.com/drminnaar/react-bitcoin-monitor
[react-weather-standard]: https://github.com/drminnaar/react-weather-standard
[react-weather-standard]: https://github.com/drminnaar/react-weather-standard
24 changes: 24 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Node.js with React
# Build a Node.js project that uses React.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

trigger:
- master

pool:
vmImage: 'ubuntu-latest'

steps:


- task: AzureVmssDeployment@0
inputs:
azureSubscription: 'ca-jagord-demo-test(f9b5da45-54cc-42d3-a58b-87adf6ad27ad)'
action: 'Update image'
vmssName: 'vmclock'
vmssOsType: 'Linux'
imageUrl: '/subscriptions/f9b5da45-54cc-42d3-a58b-87adf6ad27ad/resourceGroups/vmclock/providers/Microsoft.Compute/images/vmclockimg'
customScriptsDirectory: '/root'
customScript: 'bash install.sh'
customScriptsStorageAccount: 'vmdeployclock'
15 changes: 15 additions & 0 deletions k8s/acr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

AKS_RESOURCE_GROUP=
AKS_CLUSTER_NAME=
ACR_RESOURCE_GROUP=
ACR_NAME=

# Get the id of the service principal configured for AKS
CLIENT_ID=$(az aks show --resource-group $AKS_RESOURCE_GROUP --name $AKS_CLUSTER_NAME --query "servicePrincipalProfile.clientId" --output tsv)

# Get the ACR registry resource id
ACR_ID=$(az acr show --name $ACR_NAME --resource-group $ACR_RESOURCE_GROUP --query "id" --output tsv)

# Create role assignment
az role assignment create --assignee $CLIENT_ID --role acrpull --scope $ACR_ID
33 changes: 33 additions & 0 deletions k8s/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: react-clock-basic
spec:
selector:
matchLabels:
app: react-clock-basic
replicas: 3
template:
metadata:
labels:
app: react-clock-basic
spec:
containers:
- name: react-clock-basic
image: <>.azurecr.io/react-clock-basic:v1
imagePullPolicy: Always
readinessProbe:
httpGet:
port: 8080
path: /
livenessProbe:
httpGet:
port: 8080
path: /
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "256Mi"
cpu: "500m"
13 changes: 13 additions & 0 deletions k8s/loadbalancer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: react-clock-basic-loadbalancer
spec:
type: LoadBalancer
selector:
app: react-clock-basic
ports:
- protocol: TCP
port: 80
targetPort: 8080

1 change: 1 addition & 0 deletions k8s/touch.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test
16 changes: 16 additions & 0 deletions manifests/deployment-1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion : apps/v1beta1
kind: Deployment
metadata:
name: "jayaks2-c927"
spec:
replicas: 2
template:
metadata:
labels:
app: "jayaks2-c927"
spec:
containers:
- name: "jayaks2-c927"
image: "jayacr002.azurecr.io/jayaks2"
ports:
- containerPort: 8080
19 changes: 19 additions & 0 deletions manifests/deployment-2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion : apps/v1
kind: Deployment
metadata:
name: "jayaksdemo-4ca2"
spec:
replicas: 2
selector:
matchLabels:
app: "jayaksdemo-4ca2"
template:
metadata:
labels:
app: "jayaksdemo-4ca2"
spec:
containers:
- name: "jayaksdemo-4ca2"
image: "jayacrdemo.azurecr.io/jayaksdemo"
ports:
- containerPort: 8080
33 changes: 33 additions & 0 deletions manifests/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: jayaks2
spec:
selector:
matchLabels:
app: jayacr002
replicas: 3
template:
metadata:
labels:
app: jayaks2
spec:
containers:
- name: jayacr002
image: "jayacr002.azurecr.io/jayaks2:v1"
imagePullPolicy: Always
readinessProbe:
httpGet:
port: 8080
path: /
livenessProbe:
httpGet:
port: 8080
path: /
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "256Mi"
cpu: "500m"
17 changes: 17 additions & 0 deletions manifests/ingress-1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: "jayaks2-c927"
labels:
app: "jayaks2-c927"
annotations:
kubernetes.io/ingress.class: addon-http-application-routing
spec:
rules:
- host: jayaks210cf-jayaks2-c927.86b44fad5c574b39b67a.eastus.aksapp.io
http:
paths:
- path: /
backend:
serviceName: "jayaks2-c927"
servicePort: 8080
17 changes: 17 additions & 0 deletions manifests/ingress-2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: "jayaksdemo-4ca2"
labels:
app: "jayaksdemo-4ca2"
annotations:
kubernetes.io/ingress.class: addon-http-application-routing
spec:
rules:
- host: jayaksdemo9cfa-jayaksdemo-4ca2.7566743ebff34eb6b579.eastus.aksapp.io
http:
paths:
- path: /
backend:
serviceName: "jayaksdemo-4ca2"
servicePort: 8080
17 changes: 17 additions & 0 deletions manifests/ingress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: "clockaks01"
labels:
app: "clockaks01"
annotations:
kubernetes.io/ingress.class: addon-http-application-routing
spec:
rules:
- host: clockaks01d3f1-clockaks01.b9c65ff5ed3a47ef88be.eastus.aksapp.io
http:
paths:
- path: /
backend:
serviceName: "clockaks01"
servicePort: 8080
15 changes: 15 additions & 0 deletions manifests/service-1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: "jayaks2-c927"
labels:
app: "jayaks2-c927"
spec:
type: ClusterIP
ports:
- port: 8080
targetPort: 8080
protocol: TCP
name: http
selector:
app: "jayaks2-c927"
15 changes: 15 additions & 0 deletions manifests/service-2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: "jayaksdemo-4ca2"
labels:
app: "jayaksdemo-4ca2"
spec:
type: ClusterIP
ports:
- port: 8080
targetPort: 8080
protocol: TCP
name: http
selector:
app: "jayaksdemo-4ca2"
12 changes: 12 additions & 0 deletions manifests/service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: clockaks01
spec:
type: LoadBalancer
selector:
app: clockaks01
ports:
- protocol: TCP
port: 80
targetPort: 8080
10 changes: 10 additions & 0 deletions other/default
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
server {
listen 80;
server_name example.com;

location / {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_pass "http://127.0.0.1:1337";
}
}
Loading