get your mobile app in production in 3 months: devops and infrastructure
TRANSCRIPT
Case study: App4Fest
Mobile apps (Android, iOS)
Backend (Node.Js API server)
Web administration (React)
Web app (React)
Continuous integration
Essential process
Single point where all kind of apps get build
Jenkins is the swiss knife
Jenkins pipeline as a code
stage 'Checkout' checkout scm stage 'Build Docker image' sh("docker build -t ${imageTag} .") stage 'Run Docker tests' … stage 'Run Docker lint' … stage 'Push image to registry' sh("gcloud docker push ${imageTag}") stage 'Create namespace for app'
Jenkins pipeline as a code
buildNodejs{ // MODIFY projectName = ‘node-template' slackChannel = '#ci-nodetemplate' appName = ‘node-template' cloudProject = [development: 'infrastruktura-1307', master: ‘ackee-production'] buildCommand = 'npm install && npm run postinstall' // MODIFY ONLY IF YOU KNOW WHAT YOU ARE DOING nodeImage = 'node:5.12.0' nodeEnv = "-e NODE_PATH=./app:./config" nodeTestEnv = '-e NODE_ENV=test -e NODE_PATH=./app:./
How to run the apps
Monolithic VPS
Application platform (such as Cloud Foundry)
Containers (…Docker)
Dockerfile
FROM node:5.12.0ENV NODE_PATH=./config:./appWORKDIR /usr/src/app
# Bundle app sourceCOPY . /usr/src/appEXPOSE 3000CMD [ "npm", "start" ]
Kubernetes
Open-source or hosted
Run / Stop / Restart a container
(Auto) Scale up / down
Manage resources
Load balance traffic
Manage logs
Kubernetes
apiVersion: extensions/v1beta1kind: Deploymentmetadata: name: APP_NAMEspec: replicas: 2 spec: containers: - name: APP_NAME image: IMAGE_URL env: - name: TZ value: "Europe/Prague"
Kubernetes
resources: requests: memory: "128Mi" cpu: "5m" limits: memory: "256Mi" cpu: "80m" ports: - name: frontend containerPort: 3000
Google Container Engine
Built-in Kubernetes support
WebGUI + command line interface
Health Checks
Container Registry
Monitoring
Alerts