Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
6cf66f9
Set up CI with Azure Pipelines
Jan563 Feb 20, 2019
3db575b
Update azure-pipelines.yml for Azure Pipelines
Jan563 Feb 20, 2019
16a4d50
Update README.md
Jan563 Feb 20, 2019
fb519e9
Merge pull request #1 from Jan563/Jan563-patch-1
Jan563 Feb 20, 2019
8b0a674
Update azure-pipelines.yml for Azure Pipelines
Jan563 Feb 20, 2019
52a468c
Update azure-pipelines.yml for Azure Pipelines
Jan563 Feb 20, 2019
5c7e644
Run 'npm test'
Jan563 Feb 20, 2019
f183229
Update azure-pipelines.yml for Azure Pipelines
Jan563 Feb 20, 2019
bb8f33e
krneki test
Jan563 Feb 20, 2019
9a0146b
Update azure-pipelines.yml for Azure Pipelines
Jan563 Feb 20, 2019
aacb9a9
mini html addition
Jan563 Feb 20, 2019
e3a0d48
dodan deploy.ps1
Jan563 Feb 20, 2019
d94673d
Update azure-pipelines.yml for Azure Pipelines
Jan563 Feb 20, 2019
5f77f3e
Update azure-pipelines.yml for Azure Pipelines
Jan563 Feb 20, 2019
27aad37
Update azure-pipelines.yml for Azure Pipelines
Jan563 Feb 20, 2019
47e1256
Update azure-pipelines.yml for Azure Pipelines
Jan563 Feb 20, 2019
3f641ca
Update azure-pipelines.yml for Azure Pipelines
Jan563 Feb 21, 2019
5ab639d
Update azure-pipelines.yml for Azure Pipelines
Jan563 Feb 21, 2019
91badb2
Update azure-pipelines.yml for Azure Pipelines
Jan563 Feb 21, 2019
55c9a20
Update azure-pipelines.yml for Azure Pipelines
Jan563 Feb 21, 2019
f3bb3f2
Update azure-pipelines.yml for Azure Pipelines
Jan563 Feb 21, 2019
b855c2f
Update azure-pipelines.yml for Azure Pipelines
Jan563 Feb 21, 2019
fe8402f
Update azure-pipelines.yml for Azure Pipelines
Jan563 Feb 21, 2019
21efa50
Update azure-pipelines.yml for Azure Pipelines
Jan563 Feb 21, 2019
5c9aca5
source = projektPoste
Jan563 Feb 21, 2019
6cd4284
revert source, public je dodan /ProjektPoste
Jan563 Feb 21, 2019
08761be
Update firebase.json
Jan563 Feb 21, 2019
3182965
base href projekt poste
Jan563 Feb 21, 2019
23767d6
ssss
Jan563 Feb 21, 2019
a36fae7
ddd
Jan563 Feb 21, 2019
ae8b5c5
Update azure-pipelines.yml for Azure Pipelines
Jan563 Feb 21, 2019
5a8f916
Update azure-pipelines.yml for Azure Pipelines
Jan563 Feb 21, 2019
8d170d0
Update azure-pipelines.yml for Azure Pipelines
Jan563 Feb 21, 2019
9ce4f6b
Update azure-pipelines.yml for Azure Pipelines
Jan563 Feb 21, 2019
b12ef27
Create azure-pipelines2.yml
Jan563 Feb 21, 2019
f863084
Update azure-pipelines2.yml for Azure Pipelines
Jan563 Feb 21, 2019
9f06902
Update azure-pipelines2.yml for Azure Pipelines
Jan563 Feb 21, 2019
8c2f614
Update azure-pipelines2.yml for Azure Pipelines
Jan563 Feb 21, 2019
b84542f
Update azure-pipelines2.yml for Azure Pipelines
Jan563 Feb 21, 2019
5aaf321
Update azure-pipelines2.yml for Azure Pipelines
Jan563 Feb 21, 2019
20f5506
Update azure-pipelines.yml for Azure Pipelines
Jan563 Feb 21, 2019
798c7c1
Create Dockerfile
Jan563 Feb 22, 2019
923c185
Create nginx.conf
Jan563 Feb 22, 2019
950a317
Update Dockerfile
Jan563 Feb 22, 2019
f1c2236
Update Dockerfile
Jan563 Feb 22, 2019
258ddd2
Update base href
Jan563 Feb 22, 2019
618451d
Update Dockerfile
Jan563 Feb 22, 2019
346c525
Revert base href
Jan563 Feb 22, 2019
01e5bac
update readme
Jan563 Feb 25, 2019
1e11d42
readme
Jan563 Feb 25, 2019
ed98330
README2
Jan563 Feb 25, 2019
f45e8f3
readme again
Jan563 Feb 25, 2019
72df0f2
readme shakur
Jan563 Feb 25, 2019
f2ca290
počistil vaja1-dva typescript
Jan563 Feb 27, 2019
e7303f6
Update dva.component.ts
Jan563 Feb 27, 2019
e81d766
Update dva.component.ts
Jan563 Feb 27, 2019
0dab5f8
Update README.md
Jan563 Feb 28, 2019
da71166
Update README.md
Jan563 Feb 28, 2019
784de63
Update README.md
Jan563 Feb 28, 2019
4b2566e
Update README.md
Jan563 Feb 28, 2019
1e2fd5f
Update README.md
Jan563 Feb 28, 2019
0fe0e68
Update README.md
Jan563 Feb 28, 2019
624312a
Update README.md
Jan563 Mar 4, 2019
690f36a
Update README.md
Jan563 Mar 4, 2019
72e8d6c
Add files via upload
Jan563 Mar 4, 2019
ddac824
Update README.md
Jan563 Mar 4, 2019
b175bb3
Update README.md
Jan563 Mar 4, 2019
6b5c1d5
Update README.md
Jan563 Mar 4, 2019
247559b
Update README.md
Jan563 Mar 4, 2019
85ffbc1
Update README.md
Jan563 Mar 4, 2019
800bce3
Add files via upload
Jan563 Mar 4, 2019
9fc6d20
Update README.md
Jan563 Mar 4, 2019
e6b1195
Update README.md
Jan563 Mar 4, 2019
f15080c
Update firebase.json
Jan563 Mar 4, 2019
de0d60e
Update firebase.json
Jan563 Mar 4, 2019
53fc223
Update firebase.json
Jan563 Mar 4, 2019
9b5ffa6
Update firebase.json
Jan563 Mar 4, 2019
2dc76d8
Create test.md
Jan563 Mar 5, 2019
1452a6f
Update README.md
Jan563 Mar 5, 2019
237f30c
Update README.md
Jan563 Mar 5, 2019
8e34f69
Create template.html.tmpl
Jan563 Mar 5, 2019
593b0b1
Update README.md
Jan563 Mar 5, 2019
b903fb1
Update README.md
Jan563 Mar 5, 2019
74ab5cc
Update README.md
Jan563 Mar 5, 2019
becefbb
Update template.html.tmpl
Jan563 Mar 5, 2019
55e1a2a
Create krneki.jpg
Jan563 Mar 8, 2019
25ba0da
Add files via upload
Jan563 Mar 8, 2019
a6f12c0
Update powershell.ps1
Jan563 Mar 8, 2019
95294b7
Update powershell.ps1
Jan563 Mar 8, 2019
d2e2611
Update powershell.ps1
Jan563 Mar 8, 2019
8233f2c
Update powershell.ps1
Jan563 Mar 8, 2019
0b8c8e4
Update powershell.ps1
Jan563 Mar 8, 2019
2c3f5e5
Update powershell.ps1
Jan563 Mar 8, 2019
18da00d
Update powershell.ps1
Jan563 Mar 8, 2019
8acba61
Update powershell.ps1
Jan563 Mar 8, 2019
0eaf026
Update powershell.ps1
Jan563 Mar 8, 2019
9b59ab1
Update powershell.ps1
Jan563 Mar 8, 2019
6e709ed
Update powershell.ps1
Jan563 Mar 8, 2019
5bb1639
Update powershell.ps1
Jan563 Mar 8, 2019
d1baf4c
Update powershell.ps1
Jan563 Mar 8, 2019
7b3ace8
Update powershell.ps1
Jan563 Mar 8, 2019
a858e95
Update powershell.ps1
Jan563 Mar 8, 2019
0a0fc1a
Update powershell.ps1
Jan563 Mar 8, 2019
be305c6
Update powershell.ps1
Jan563 Mar 8, 2019
aff7cd7
Update powershell.ps1
Jan563 Mar 11, 2019
b18fe83
Update powershell.ps1
Jan563 Mar 11, 2019
bcfdbdc
Update powershell.ps1
Jan563 Mar 11, 2019
37dcea1
Update powershell.ps1
Jan563 Mar 11, 2019
5bbaf1a
Delete krneki.jpg
Jan563 Mar 11, 2019
ce98125
Update powershell.ps1
Jan563 Mar 11, 2019
a1b2261
Update powershell.ps1
Jan563 Mar 11, 2019
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
7 changes: 7 additions & 0 deletions ProjektPoste/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM nginx:alpine

COPY nginx.conf /etc/nginx/nginx.conf

WORKDIR /usr/share/nginx/html
COPY dist/ProjektPoste/ .

3 changes: 3 additions & 0 deletions ProjektPoste/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Build Status](https://dev.azure.com/sebit-test/TestingAzure/_apis/build/status/Jan563.AngularTest?branchName=master)](https://dev.azure.com/sebit-test/TestingAzure/_build/latest?definitionId=1&branchName=master)

# ProjektPoste

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.2.1.
Expand Down Expand Up @@ -25,3 +27,4 @@ Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protrac
## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
aaaargd
10 changes: 10 additions & 0 deletions ProjektPoste/deploy.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
$dir = Split-Path $MyInvocation.MyCommand.Path
Push-Location $dir

npm i -g firebase-tools
write-host "starting deploy...";
firebase --version;
firebase deploy --token "1/5DTQvFZGLxga-T1xrgvrfbnnbc6nnMk2LV9FCVqZpH0" --project "my-test-project-c4ce1" --message "Release: 1.0" --only hosting;
write-host "deployment completed";

Pop-Location
6 changes: 3 additions & 3 deletions ProjektPoste/firebase.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"hosting": {
"public": "dist",
"public": "src",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**", // projektPoste here ???
"destination": "/index.html"
"source": "**",
"destination": "/README.html"
}
]
},
Expand Down
25 changes: 25 additions & 0 deletions ProjektPoste/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
worker_processes 1;

events {
worker_connections 1024;
}

http {
server {
listen 80;
server_name localhost;

root /usr/share/nginx/html;
index index.html index.htm;
include /etc/nginx/mime.types;

gzip on;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;

location / {
try_files $uri $uri/ /index.html;
}
}
}
2 changes: 2 additions & 0 deletions ProjektPoste/src/app/vaja1/dva/dva.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<div style=" margin-left: 20px">
<p >
dva works!
krneki
alestorm
</p>
</div>
12 changes: 4 additions & 8 deletions ProjektPoste/src/app/vaja1/dva/dva.component.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
import { Component, OnInit } from '@angular/core';
import { AngularFireFunctions } from '@angular/fire/functions';
import { Observable } from 'rxjs';


@Component({
selector: 'app-dva',
template: `{{ data$ | async }}`,
templateUrl: './dva.component.html',
styleUrls: ['./dva.component.css']
})
export class DvaComponent implements OnInit {

data$: Observable<string>;

constructor(private fns: AngularFireFunctions) {
// const cors = require('cors')({origin: true});
const callable = fns.httpsCallable('helloWorld');
this.data$ = callable({ name: 'Jan'});

constructor() {
}

ngOnInit() {
Expand Down
3 changes: 3 additions & 0 deletions ProjektPoste/test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### Test page

Works
91 changes: 90 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,90 @@
# AngularTest
{body|s}

# Navodila za postavitev

V prvi fazi je potrebno v Azure postaviti Kubernetes service, ki nam omogoča izvajanje kubernetes komand v 'cmd' prompt ter vpogled v dashboard z navodili, ki so na njihovi strani.
Za testiranje napišemo v command prompt 'kubectl'.
### 'Build' faza
Nato se povežemo na Azure DevOps, kjer najdemo zavihek Pipelines. Pod zavihkom 'builds' se prvo povežemo na naš GitHub repozitorij in določimo tip proženja (ob vsaki spremembi, ročno). Agent pool naj bo tipa **Hosted Ubuntu**. Nato pod prvim in edinim Agent Job začnemo nizati taske:
1. **Use Node 8.x** (Inštalacija poljubne verzije Node.js)
2. **Command line** (V njem naredimo production build, torej:)
- *npm install -g @angular/cli
cd ./ProjektPoste
npm install
ng build --prod
echo Production build finished!*
2. **Docker login** (Pri čemer naredimo service connection
Primer Image name: *janp110191/jan-repo:$(Build.BuildId)*)
3. **Docker build** (Naša mapa, ki jo z Gita vlečemo, naj ima Dockerfile, v katerem je določeno katere datoteke se vključijo v naš build.)
4. **Docker tag** (Kopiramo Image name iz Docker build taska)
5. **Docker push** (Upload v določen repozitorij. Login je potreben za to fazo. Kopiramo zopet Image name od zgoraj.)

Pri vseh docker taskih potrebujemo delujoč service connection.

Agent Job naj bo linux, saj so v primeru Windows bile neke komplikacije.

![Build slika](https://i.imgur.com/4UP3vvW.png)

### 'Release' faza
Nato skočimo v 'Releases' zavihek, kjer ustvarimo nov release in kot artifact določimo ta build. V proženju lahko izberemo, ali se release izvaja ročno ali avtomatsko po uspešno končanem buildu.
Pri release imamo dva načina postavitve storitve:
1. **Tekstovni ukazi**
S tem primerom postavimo Kubernetesu argumenete kar v command line. Naredimo dva **'Deploy to Kubernetes'** tasks na Agent jobu, pri čemer je prvi **run** in drugi **expose**. Task naredi '*kubectl run/expose*' del, mi pa ostalo v Arguments.
Pri 'run' so argumenti takšni:
- $(Release.ReleaseId) --image=janp110191/jan-repo:$(Build.BuildId) --port=80
- Pri **expose** pa: deployment $(Release.ReleaseId) --name=service-$(Release.ReleaseId) --type=LoadBalancer --port=3000 --target-port=80

![Build slika](https://i.imgur.com/NDnZjIH.png)

2. **YAML navodili**
S tem primerom naredimo enako '*Deploy to Kubernetes*' task, v katerem uporabimo '**apply**'. Tam kličemo našo YAML datoteko, ki bi jo vključili v naš GitHub repozitorij. (YAML mora vsebovati navodila za deployment in service tipa LoadBalancer)
Ker YAML ne dopušča dinamičnih zunanjih spremenljivk, z še enim '**set**' taskom popravimo image na najnoveji:
- kubectl set deployment (ime) --image janp110191/jan-repo:$(Build.BuildId)

V obeh primerih pazimo, da so porti pravilno konfigurirani glede na image, ki ga uporabljamo. Servis pa mora biti tipa '*LoadBalancer*' [Dodatna navodila so tu.](https://blog.jreypo.io/containers/microsoft/azure/cloud/cloud-native/how-to-expose-your-kubernetes-workloads-on-azure/)

Na Kubernetes dashboardu bi sedaj morali videti naš deployment in toliko podov, kolikor smo jih definirali. Servis bi moral biti z statusom 'pending' za kratek čas, preden se mu dodeli External IP in je aplikacija dosegljiva.

#### Kubernetes (kubectl) ukazi
Kubernetes nam ponuja dostop poleg dashboarda tudi v command promptu, kjer ima vedno pripono '**kubectl**'.
- ##### Yaml
Za poganjanje naših .yaml datotek, ki definirajo različne stvari v Kubernetesu uporabljamo:
1. *kubectl create -f (datoteka)*
2. *kubectl apply -f (datoteka)*

'Create' uporabljamo le, kadar ne nameravamo storitve v prihodnosti nikoli spreminjati - če hočemo spremenljivo verzijo, ga vedno ustvarimo kar z 'apply'.
- ##### Ogled storitev
Če si hočemo ogledati listo storitev katerega tipa ali pa le eno v podrobnosti, uporabimo:
1. *kubectl get (deployments, services, pods, persistentVolumes, itd.) (ime_storitve(ni obvezno))*
2. *kubectl describe (deployment, service, pod, itd.) (ime_storitve(ni obvezno))*
3. *kubectl run (za ročno ustvarjanje deploymentov in drugi storitev*)

#### YAML
Kreiranje osnovnega deploymenta:

![Slika deploy](https://github.com/Jan563/AngularTest/blob/master/pic3.PNG)

Kreiranje servisa za nek deployment:

![Slika deploy](https://github.com/Jan563/AngularTest/blob/master/pic4.PNG)

**Persistent volumes**

![Slika deploy](https://github.com/Jan563/AngularTest/blob/master/volume1.PNG)

Kot se vidi na sliki, potrebujemo za persistent volume deployment, Persistent Volume claim zanj, Storage Class, Persistent volume sam in pa secret.
Postopek je bolje opisan [na tem linku](https://pascalnaber.wordpress.com/2018/01/26/persistent-storage-and-volumes-using-kubernetes-on-azure-with-aks-or-azure-container-service/)*(pod 'Static Persistent Volume')*

#### Viri:
- [Video z podobnimi koraki](https://www.youtube.com/watch?v=K4uNl6JA7g8)
- [Blog z navodili (na koncu vključuje Helm)](https://medium.com/@timfpark/application-ci-cd-on-kubernetes-with-visual-studio-team-services-ccacecdea8a5)


[Test link](/ProjektPoste/src/test.html)


[Test link 2](/ProjektPoste/test.md)

[Test link 3](/ProjektPoste/src/test.md)

[Test link 4](/ProjektPoste/test.html)
62 changes: 62 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Node.js with Angular
# Build a Node.js project that uses Angular.
# 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-16.04'
# vmImage: 'Hosted VS2017'

steps:
- task: NodeTool@0
inputs:
versionSpec: '8.x'
displayName: 'Install Node.js'

- script: |
npm install -g @angular/cli
cd ./ProjektPoste
npm install
ng build --prod
displayName: 'npm install, build and test'

- powershell: gci env:* | sort-object name | Format-Table -AutoSize | Out-File $env:BUILD_ARTIFACTSTAGINGDIRECTORY/environment-variables.txt

- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: drop

- task: PublishBuildArtifacts@1
displayName: 'Publish Firebase.json'
inputs:
PathtoPublish: ProjektPoste/firebase.json
ArtifactName: drop

- task: PublishBuildArtifacts@1
displayName: 'Publish deploy ps1'
inputs:
PathtoPublish: ProjektPoste/deploy.ps1
ArtifactName: drop


# - task: CopyFiles@2
# inputs:
# contents: '_buildOutput\ProjektPoste\dist\**'
# targetFolder: $(Build.ArtifactStagingDirectory)

- task: PublishBuildArtifacts@1
displayName: 'Publish Build'
inputs:
PathtoPublish: ProjektPoste/dist
ArtifactName: drop
publishLocation: FilePath
TargetPath: dist


# tu odstranimo drop in zgoraj odstranimo dist

#######s dfsesfsd
62 changes: 62 additions & 0 deletions azure-pipelines2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Node.js with Angular
# Build a Node.js project that uses Angular.
# 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-16.04'
# # vmImage: 'Hosted VS2017'

steps:
- task: NodeTool@0
inputs:
versionSpec: '8.x'
displayName: 'Install Node.js'

# - script: |
# npm install -g @angular/cli
# cd ./ProjektPoste
# npm install
# ng build --prod
# displayName: 'npm install and build'

- powershell: gci env:* | sort-object name | Format-Table -AutoSize | Out-File $env:BUILD_ARTIFACTSTAGINGDIRECTORY/environment-variables.txt

- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: drop

- task: PublishBuildArtifacts@1
displayName: 'Publish Firebase.json'
inputs:
PathtoPublish: ProjektPoste/angular.json
ArtifactName: drop

- task: PublishBuildArtifacts@1
displayName: 'Publish deploy ps1'
inputs:
PathtoPublish: ProjektPoste/src/assets/images/noimg.jpeg
ArtifactName: drop
publishLocation: FilePath
TargetPath: src/assets/images


# - task: CopyFiles@2
# inputs:
# contents: '_buildOutput\ProjektPoste\dist\**'
# targetFolder: $(Build.ArtifactStagingDirectory)

# - task: PublishBuildArtifacts@1
# displayName: 'Publish Build'
# inputs:
# PathtoPublish: ProjektPoste/dist
# ArtifactName: drop
# publishLocation: FilePath
# TargetPath: dist


# tu odstranimo drop in zgoraj odstranimo dist
6 changes: 6 additions & 0 deletions composetest/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: '3'
services:
test:
image: janp110191/jan-repo:${APP_IMAGE}
ports:
- "3015:80"
16 changes: 16 additions & 0 deletions composetest/powershell.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
param (
[string]$imageIdName = "275",
[string]$artifactPath = "_containertest/drop/"

)

Write-Host $PSScriptRoot

cd\
cd $Env:SYSTEM_DEFAULTWORKINGDIRECTORY\$artifactPath

$Env:APP_IMAGE = "$imageIdName"

docker-compose up -d

echo Done!
Binary file added pic1.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pic2.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pic3.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pic4.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading