Skip to content

Alpha #2

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 49 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
ba4ac55
Primer Commit PL - Validacion de TF Manifest
LuchoN83 May 12, 2023
569733c
Update A-Provision-por-Terraform-de-AKS-Cluster-PL.yml for Azure Pipe…
LuchoN83 May 12, 2023
b9b62b0
Update A-Provision-por-Terraform-de-AKS-Cluster-PL.yml for Azure Pipe…
LuchoN83 May 12, 2023
3126714
Update A-Provision-por-Terraform-de-AKS-Cluster-PL.yml for Azure Pipe…
LuchoN83 May 12, 2023
e5f6061
Segundo Commit - Provision AKS DEV por Terraform
LuchoN83 May 12, 2023
83e52b7
Update A-Provision-por-Terraform-de-AKS-Cluster-PL.yml for Azure Pipe…
LuchoN83 May 12, 2023
de692ec
Update A-Provision-por-Terraform-de-AKS-Cluster-PL.yml for Azure Pipe…
LuchoN83 May 12, 2023
613f966
Update 02-variables.tf
LuchoN83 May 12, 2023
11d1790
Update 02-variables.tf
LuchoN83 May 12, 2023
1d5ec26
Cambio de Region
May 12, 2023
3e56c87
update 01
May 12, 2023
a5a781c
update 02
May 12, 2023
a3e6ae2
Update A-Provision-por-Terraform-de-AKS-Cluster-PL.yml for Azure Pipe…
LuchoN83 May 12, 2023
5cf1053
Nuevo Alpha 01
May 12, 2023
f5e436d
Update 07-aks-cluster.tf
LuchoN83 May 12, 2023
b6f9c6f
Update 02-variables.tf
LuchoN83 May 12, 2023
481ef40
Update README.md
LuchoN83 May 12, 2023
d509e10
Update A-Provision-por-Terraform-de-AKS-Cluster-PL.yml for Azure Pipe…
LuchoN83 May 17, 2023
54eb75c
Update 09-aks-cluster-linux-user-nodepools.tf
LuchoN83 May 18, 2023
852c3d4
Create 12 -azurecosmos.tf
LuchoN83 May 18, 2023
1805620
Update 12 -azurecosmos.tf
LuchoN83 May 18, 2023
f02420a
Update 02-variables.tf
LuchoN83 May 18, 2023
9c8d64d
Update 12 -azurecosmos.tf
LuchoN83 May 18, 2023
d0fe735
Update 02-variables.tf
LuchoN83 May 18, 2023
2276bb4
Update 12 -azurecosmos.tf
LuchoN83 May 18, 2023
08eb966
Update 02-variables.tf
LuchoN83 May 18, 2023
f93aadd
Update 12 -azurecosmos.tf
LuchoN83 May 18, 2023
24e8119
Update 12 -azurecosmos.tf
LuchoN83 May 19, 2023
c0c00dd
Update 02-variables.tf
LuchoN83 May 19, 2023
1654920
Creacion de BackEnd
LuchoN83 May 19, 2023
1420798
Merge branch 'Alpha' of https://github.com/LuchoN83/azure-devops-aks-…
LuchoN83 May 19, 2023
09b9b22
Update 12 -azurecosmos.tf
LuchoN83 May 19, 2023
6a3d743
Creacion de Backend con Azure Cosmos DB de tipo Mongo DB
LuchoN83 May 19, 2023
4c985d7
Cambio de Parametros para CosmoDB kind MONGODB
LuchoN83 May 19, 2023
5723805
Cambio de Parametros para CosmoDB kind MONGODB 01
LuchoN83 May 19, 2023
3913c32
Cambio de Parametros para CosmoDB kind MONGODB 02
LuchoN83 May 19, 2023
c80bc2a
Creacion de equipo WIndows y cambio de clave MongoDB
LuchoN83 May 19, 2023
bcac9a0
Creacion de equipo WIndows y cambio de clave MongoDB 01
LuchoN83 May 19, 2023
6d09f6a
Creacion de equipo WIndows y cambio de clave MongoDB cambio de capaci…
LuchoN83 May 19, 2023
e9a849e
Creacion de equipo WIndows y cambio de clave MongoDB cambio de capaci…
LuchoN83 May 19, 2023
3915f84
Creacion de carpetas para BE y FE
LuchoN83 May 19, 2023
f7a8e49
actualizacion de elementos para imagenes
LuchoN83 May 19, 2023
dbb42d0
Destroy imagen Windows, COstruccion Imagen Linux 101
LuchoN83 May 19, 2023
123442c
Destroy imagen Windows, COstruccion Imagen Linux 101 sc01
LuchoN83 May 19, 2023
f9845c8
Cambio de Imagen MONGODB Latest
LuchoN83 May 19, 2023
4a1083f
cambio de llave de acceso
LuchoN83 May 19, 2023
694c28b
Desactivacion VM Scalesets
LuchoN83 May 19, 2023
b23541b
Desactivacion VM Scalesets
LuchoN83 May 19, 2023
c1d145b
Update 07-aks-cluster.tf
LuchoN83 May 19, 2023
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
102 changes: 102 additions & 0 deletions A-Provision-por-Terraform-de-AKS-Cluster-PL.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
trigger:
- Alpha

pool:
vmImage: 'ubuntu-latest'
# Definicion de Variales para Ambientes
variables:
- name: DEV_ENVIRONMENT
value: dev
# Stage-1: Terraform Validate Stage
## Step-1: Publish Artifacts to Pipeline (Pipeline artifacts provide a way to share files between stages in a pipeline or between different pipelines. )
## Step-2: Install Latest Terraform (0.13.5) (Ideally not needed if we use default Ubuntu Agents)
## Step-3: Validate Terraform Manifests (terraform init, terraform validate)

stages:
- stage: TerraformValidate
jobs:
- job: TerraformValidateJob
continueOnError: false
steps:
- task: PublishPipelineArtifact@1
displayName: Publish Artifacts
inputs:
targetPath: '$(System.DefaultWorkingDirectory)/terraform-manifests'
artifact: 'terraform-manifests-out'
publishLocation: 'pipeline'
- task: TerraformInstaller@0
displayName: Terraform Install
inputs:
terraformVersion: 'latest'
- task: TerraformCLI@0
displayName: Terraform Init
inputs:
command: 'init'
workingDirectory: '$(System.DefaultWorkingDirectory)/terraform-manifests'
backendType: 'azurerm'
backendServiceArm: 'SVC-Terraform-Azure-Connection'
ensureBackend: true
backendAzureRmResourceGroupName: 'terraform-storage-rg'
backendAzureRmStorageAccountName: 'terraformstatechallenge'
backendAzureRmContainerName: 'tfstatefiles'
backendAzureRmKey: 'aks-base.tfstate'
allowTelemetryCollection: false
- task: TerraformCLI@0
displayName: Terraform Validate
inputs:
command: 'validate'
workingDirectory: '$(System.DefaultWorkingDirectory)/terraform-manifests'
allowTelemetryCollection: false

# Stage-2: Despliegues de Stages para Dev & QA
# Deployment-1: Despliegue de Dev AKS Cluster
## Step-1: DEfinir Variables para los ambientes
## Step-2: Descarga de SSH Secure File
## Step-3: Terraform Initialize (State Storage to store in Azure Storage Account for Dev AKS Cluster)
## Step-4: Terraform Plan (Creacion del Plan)
## Step-5: Terraform Apply (Uso del plan en el paso anterior)

- stage: DeployAKSClusters
jobs:
- deployment: DeployDevAKSCluster
displayName: DeployDevAKSCluster
pool:
vmImage: 'ubuntu-latest'
environment: $(DEV_ENVIRONMENT)
strategy:
runOnce:
deploy:
steps:
- task: DownloadSecureFile@1
displayName: Download SSH Key
name: sshkey
inputs:
secureFile: 'id_rsa.pub'
- task: TerraformCLI@0
displayName: Terraform Init
inputs:
command: 'init'
workingDirectory: '$(Pipeline.Workspace)/terraform-manifests-out'
backendType: 'azurerm'
backendServiceArm: 'SVC-Terraform-Azure-Connection'
backendAzureRmResourceGroupName: 'terraform-storage-rg'
backendAzureRmStorageAccountName: 'terraformstatechallenge'
backendAzureRmContainerName: 'tfstatefiles'
backendAzureRmKey: 'aks-$(DEV_ENVIRONMENT).tfstate'
allowTelemetryCollection: false
- task: TerraformCLI@0
displayName: Terraform Plan
inputs:
command: 'plan'
workingDirectory: '$(Pipeline.Workspace)/terraform-manifests-out'
environmentServiceName: 'SVC-Terraform-Azure-Connection'
commandOptions: '-var ssh_public_key=$(sshkey.secureFilePath) -var environment=$(DEV_ENVIRONMENT) -out $(Pipeline.Workspace)/terraform-manifests-out/$(DEV_ENVIRONMENT)-$(Build.BuildId).out'
allowTelemetryCollection: false
- task: TerraformCLI@0
displayName: Terraform Apply
inputs:
command: 'apply'
workingDirectory: '$(Pipeline.Workspace)/terraform-manifests-out'
environmentServiceName: 'SVC-Terraform-Azure-Connection'
commandOptions: '$(Pipeline.Workspace)/terraform-manifests-out/$(DEV_ENVIRONMENT)-$(Build.BuildId).out'
allowTelemetryCollection: false
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
# Provision Azure AKS Cluster using Terraform and Azure DevOps

## For Step by Step Instructions
- [Step by Step Instructions](https://github.com/stacksimplify/azure-aks-kubernetes-masterclass/tree/master/25-Azure-DevOps-Terraform-Azure-AKS)
RETO GLOBANT ALPHA
6 changes: 6 additions & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
.envrc
.envrc.sample
.gitignore
.editorconfig
.prettierrc
7 changes: 7 additions & 0 deletions backend/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
root = true

[*]
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
2 changes: 2 additions & 0 deletions backend/.envrc.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export DATABASE_MONGODB_URI=mongodb://localhost:27017
export DATABASE_MONGODB_DBNAME=mydb
154 changes: 154 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# Project distributables and hidden vars
.envrc
dist/

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*
*.log

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk
15 changes: 15 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:12-alpine

ENV DEBUG expresso:*,gg:*

RUN mkdir -p /usr/src/app
COPY ["./package.json", "./package-lock.json", "/usr/src/app/"]
COPY ["./src", "./tsconfig.json", "/usr/src/app/"]
WORKDIR /usr/src/app

RUN npm i
RUN npm run build

EXPOSE 3000

ENTRYPOINT [ "npm", "start" ]
32 changes: 32 additions & 0 deletions backend/backend-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: reto-backend
spec:
replicas: 1
selector:
matchLabels:
app: reto-backend
template:
metadata:
labels:
app: reto-backend
spec:
containers:
- image: mongo:latest
name: reto-backend
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
ports:
- containerPort: 3000
name: http
env:
- name: DATABASE_URI
value: "mongodb://retocosmosdb-alpha:8IRPyPR5UzvvAwgx2PiBEaP6jDqgfv06GIKpwylyxx5YvnEpMhpa8W0PX8p8c67f2cJ30Cf3ZvDyACDbkbKg5Q==@retocosmosdb-alpha.mongo.cosmos.azure.com:10255/?ssl=true&replicaSet=globaldb&retrywrites=false&maxIdleTimeMS=120000&appName=@retocosmosdb-alpha@"
- name: DATABASE_DBNAME
value: DemoDB-alpha
30 changes: 30 additions & 0 deletions backend/backend-network.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: v1
kind: Service
metadata:
name: reto-backend
spec:
selector:
app: reto-backend
ports:
- name: http
port: 80
targetPort: 3000
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: reto-backend
annotations:
kubernetes.io/ingress.class: addon-http-application-routing
spec:
rules:
- host: reto-backend.e083fab983c544c098d9.eastus.aksapp.io
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: reto-backend
port:
number: 80
23 changes: 23 additions & 0 deletions backend/doctor.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const { Ship } = require('./dist/domain/ship/entity')
const { ShipRepository } = require('./dist/data/repositories/ShipRepository')
const { Port } = require('./dist/domain/port/entity')
const { PortRepository } = require('./dist/data/repositories/PortRepository')

module.exports = {
mongodb: {
uri: process.env.DATABASE_MONGODB_URI,
dbName: process.env.DATABASE_MONGODB_DBNAME
},
entities: {
ship: {
entity: Ship,
collection: 'ships',
repository: (mongodbConnection) => new ShipRepository(mongodbConnection)
},
port: {
entity: Port,
collection: 'ports',
repository: (mongodbConnection) => new PortRepository(mongodbConnection)
}
}
}
Loading