re #1086, initial staging configuration (#1087)

This commit is contained in:
Cassie Tarakajian 2019-05-29 16:11:26 -04:00 committed by GitHub
parent 507b0b28b1
commit 27b80104c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 91 additions and 0 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
.DS_Store
.env
.env.production
.env.staging
.vscode/
node_modules/
npm-debug.log

View File

@ -38,6 +38,11 @@ deploy:
skip_cleanup: true
on:
branch: master
- provider: script
script: ./deploy-staging.sh
skip_cleanup: true
on:
branch: feature/public-api
env:
global:

23
deploy_staging.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
set -e
docker-compose build --no-cache
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
docker tag $APP_IMAGE_NAME $DOCKER_USERNAME/$DOCKER_STAGING_REPOSITORY:$TRAVIS_COMMIT
docker tag $APP_IMAGE_NAME $DOCKER_USERNAME/$DOCKER_STAGING_REPOSITORY:latest
docker push $DOCKER_USERNAME/$DOCKER_STAGING_REPOSITORY:$TRAVIS_COMMIT
docker push $DOCKER_USERNAME/$DOCKER_STAGING_REPOSITORY:latest
echo $GCLOUD_SERVICE_KEY_PRD | base64 --decode -i > ${HOME}/gcloud-service-key.json
gcloud auth activate-service-account --key-file ${HOME}/gcloud-service-key.json
gcloud --quiet config set project $PROJECT_NAME_PRD
gcloud --quiet config set container/cluster $CLUSTER_NAME_PRD
gcloud --quiet config set compute/zone ${CLOUDSDK_COMPUTE_ZONE}
gcloud --quiet container clusters get-credentials $CLUSTER_NAME_PRD
kubectl config view
kubectl config current-context
kubectl set image deployment/${KUBE_DEPLOYMENT_NAME} ${KUBE_DEPLOYMENT_CONTAINER_NAME}=index.docker.io/$DOCKER_USERNAME/$DOCKER_STAGING_REPOSITORY:$TRAVIS_COMMIT --namespace=staging

View File

@ -118,3 +118,65 @@ spec:
# - secretRef:
# name: web-editor-credentials
# restartPolicy: Never
---
apiVersion: v1
kind: Namespace
metadata:
name: staging
labels:
name: staging
---
apiVersion: v1
kind: Service
metadata:
name: web-editor-node
namespace: staging
labels:
app: web-editor
spec:
# if your cluster supports it, uncomment the following to automatically create
# an external load-balanced IP for the frontend service.
type: LoadBalancer
# type: NodePort
ports:
- port: 8001
targetPort: 8000
selector:
app: web-editor
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: web-editor-node
namespace: staging
spec:
selector:
matchLabels:
app: web-editor
replicas: 1
template:
metadata:
labels:
app: web-editor
spec:
containers:
- name: web-editor-app
image: index.docker.io/catarak/p5.js-web-editor:latest
# temp, just to test kubernetes
# envFrom:
# - configMapRef:
# name: web-editor-env
envFrom:
- secretRef:
name: web-editor-credentials
imagePullPolicy: Always
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 8000
readinessProbe:
httpGet:
path: /health
port: 8000