Skip to content

Commit

Permalink
Travis draf
Browse files Browse the repository at this point in the history
  • Loading branch information
Salva Corts committed Mar 14, 2018
1 parent e4bf633 commit 13bb977
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 3 deletions.
1 change: 0 additions & 1 deletion Backend/naturalLanguage/nlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ func (nlp *NaturalLanguageProcessor) AnalyzeText(text string) ([]r.Tag, error) {

if entity.Salience < salienceThreshold ||
entity.Sentiment.Magnitude < magnitudeThreshold {
// fmt.Printf("\n\n%s\n\tScore: %f\n\tMagnitude: %f\n\tSalience: %f", entity.Name, entity.Sentiment.Score, entity.Sentiment.Magnitude, entity.Salience)
continue
}

Expand Down
26 changes: 26 additions & 0 deletions build-and-deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

## Note: credentials files are created from env variables created with:
## base64 <credentials-file-example.json>

# Remove env vars
set -e

# Configure Google Cloud SDK
echo $GCLOUD_SERVICE_KEY_STG | base64 --decode -i > ${HOME}/Backend/creds.json
gcloud auth activate-service-account --key-file ${HOME}/Backend/creds.json
gcloud --quiet config set project $PROJECT_NAME
gcloud --quiet config set compute/zone $CLOUDSDK_COMPUTE_ZONE


# Build Backend
cd Backend/
docker build -f dockerfile -t gcr.io/how-it-does/backend:latest .
gcloud docker -- push gcr.io/how-it-does/backend:latest
kubectl rolling-update backend --image=gcr.io/how-it-does/backend:latest

# Move from backent to Frontend
cd ../Frontend/
docker build -f dockerfile -t gcr.io/how-it-does/frontend:latest .
gcloud docker -- push gcr.io/how-it-does/frontend:latest
kubectl rolling-update frontend --image=gcr.io/how-it-does/frontend:latest
4 changes: 2 additions & 2 deletions deployment.yaml → kubernetes-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ spec:
spec:
containers:
- name: frontend
image: gcr.io/how-it-does/frontend:$FRONTEND_VERSION
image: gcr.io/how-it-does/frontend:latest
imagePullPolicy: Always
ports:
- name: http
containerPort: 80
- name: backend
image: gcr.io/how-it-does/backend:$BACKEND_VERSION
image: gcr.io/how-it-does/backend:latest
imagePullPolicy: Always
ports:
- name: http
Expand Down
28 changes: 28 additions & 0 deletions travis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# REF: https://medium.com/google-cloud/continuous-delivery-in-a-microservice-infrastructure-with-google-container-engine-docker-and-fb9772e81da7
sudo: false

language: golang # Unimportant

# Cache Gcloud SDK between commands
cache:
directories:
- "$HOME/google-cloud-sdk/"

services:
- docker

# Install gcloud sdk if it doesnt exists
before_deploy:
- if [ ! -d "$HOME/google-cloud-sdk/bin" ]; then rm -rf $HOME/google-cloud-sdk; export CLOUDSDK_CORE_DISABLE_PROMPTS=1; curl https://sdk.cloud.google.com | bash; fi
- source /home/travis/google-cloud-sdk/path.bash.inc
- gcloud --quiet version
- gcloud --quiet components update
- gcloud --quiet components beta update
- gcloud --quiet components update kubectl

deploy:
- provider: script
script: ./build-and-deploy.sh
skip_cleanup: true
on:
branch: master

0 comments on commit 13bb977

Please sign in to comment.