parent
b41b3538b9
commit
b7ead2a4de
4 changed files with 91 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,6 +1,7 @@
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.env
|
.env
|
||||||
.env.production
|
.env.production
|
||||||
|
.env.staging
|
||||||
.vscode/
|
.vscode/
|
||||||
node_modules/
|
node_modules/
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
|
|
|
@ -38,6 +38,11 @@ deploy:
|
||||||
skip_cleanup: true
|
skip_cleanup: true
|
||||||
on:
|
on:
|
||||||
branch: master
|
branch: master
|
||||||
|
- provider: script
|
||||||
|
script: ./deploy-staging.sh
|
||||||
|
skip_cleanup: true
|
||||||
|
on:
|
||||||
|
branch: feature/public-api
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
|
|
23
deploy_staging.sh
Executable file
23
deploy_staging.sh
Executable 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
|
|
@ -118,3 +118,65 @@ spec:
|
||||||
# - secretRef:
|
# - secretRef:
|
||||||
# name: web-editor-credentials
|
# name: web-editor-credentials
|
||||||
# restartPolicy: Never
|
# 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
|
||||||
|
|
Loading…
Reference in a new issue