try updating travis to have deploy script
This commit is contained in:
parent
d44027c58e
commit
16b54b89ca
4 changed files with 61 additions and 96 deletions
57
.travis.yml
57
.travis.yml
|
@ -3,31 +3,40 @@ language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
- "8.11.1"
|
- "8.11.1"
|
||||||
|
|
||||||
|
cache:
|
||||||
|
directories:
|
||||||
|
- "$HOME/google-cloud-sdk/"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
stages:
|
before_install:
|
||||||
- test
|
- docker-compose -f docker-compose-development.yml up -d
|
||||||
- build
|
- docker ps -a
|
||||||
|
|
||||||
jobs:
|
install: true
|
||||||
include:
|
|
||||||
- stage: test
|
script:
|
||||||
before_install:
|
- docker-compose exec -T app npm run test --verbose
|
||||||
- docker-compose -f docker-compose-development.yml up -d
|
|
||||||
- docker ps -a
|
after_success:
|
||||||
install: true
|
- docker-compose stop
|
||||||
script:
|
|
||||||
# Run unit tests in the app container
|
before_deploy:
|
||||||
- docker-compose exec -T app npm run test --verbose
|
- 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
|
||||||
- stage: build
|
- source /home/travis/google-cloud-sdk/path.bash.inc
|
||||||
if: branch = master OR branch = production-docker
|
- gcloud --quiet version
|
||||||
env:
|
- gcloud --quiet components update
|
||||||
- APP_IMAGE_NAME=p5jswebeditor_app
|
- gcloud --quiet components beta update
|
||||||
script:
|
- gcloud --quiet components update kubectl
|
||||||
- docker-compose stop
|
|
||||||
- docker-compose build --no-cache
|
deploy:
|
||||||
- docker image ls
|
- provider: script
|
||||||
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
|
script: bash deploy.sh
|
||||||
- docker tag $APP_IMAGE_NAME $DOCKER_USERNAME/$DOCKER_REPOSITORY:latest
|
skip_cleanup: true
|
||||||
- docker push $DOCKER_USERNAME/$DOCKER_REPOSITORY:latest
|
on:
|
||||||
|
branch: master OR production-docker
|
||||||
|
|
||||||
|
env:
|
||||||
|
global:
|
||||||
|
- APP_IMAGE_NAME=p5jswebeditor_app
|
||||||
|
|
28
deploy.sh
Normal file
28
deploy.sh
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#!/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_REPOSITORY:$TRAVIS_COMMIT
|
||||||
|
docker push $DOCKER_USERNAME/$DOCKER_REPOSITORY:$TRAVIS_COMMIT
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# gcloud docker push gcr.io/${PROJECT_NAME_PRD}/${DOCKER_IMAGE_NAME}
|
||||||
|
|
||||||
|
# yes | gcloud beta container images add-tag gcr.io/${PROJECT_NAME_PRD}/${DOCKER_IMAGE_NAME}:$TRAVIS_COMMIT gcr.io/${PROJECT_NAME_PRD}/${DOCKER_IMAGE_NAME}:latest
|
||||||
|
|
||||||
|
# kubectl config view
|
||||||
|
# kubectl config current-context
|
||||||
|
|
||||||
|
# kubectl set image deployment/${KUBE_DEPLOYMENT_NAME} ${KUBE_DEPLOYMENT_CONTAINER_NAME}=gcr.io/${PROJECT_NAME_PRD}/${DOCKER_IMAGE_NAME}:$TRAVIS_COMMIT
|
||||||
|
|
||||||
|
# sleep 30
|
||||||
|
# npm run e2e_test
|
|
@ -18,16 +18,6 @@ services:
|
||||||
- MONGO_INITDB_DATABASE
|
- MONGO_INITDB_DATABASE
|
||||||
- MONGO_RW_USERNAME
|
- MONGO_RW_USERNAME
|
||||||
- MONGO_RW_PASSWORD
|
- MONGO_RW_PASSWORD
|
||||||
nginx:
|
|
||||||
image: nginx:1.13
|
|
||||||
volumes:
|
|
||||||
- "$PWD/nginx/alpha.editor.p5js.org.conf:/etc/nginx/conf.d/default.conf"
|
|
||||||
ports:
|
|
||||||
- '80:80'
|
|
||||||
depends_on:
|
|
||||||
- app
|
|
||||||
links:
|
|
||||||
- app
|
|
||||||
app:
|
app:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
|
@ -73,7 +63,6 @@ services:
|
||||||
- /opt/node/app/node_modules
|
- /opt/node/app/node_modules
|
||||||
ports:
|
ports:
|
||||||
- '8000:8000'
|
- '8000:8000'
|
||||||
# - '443:443'
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- mongo
|
- mongo
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
@ -1,61 +0,0 @@
|
||||||
# HTTP - redirect all requests to HTTPS:
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
#server_name alpha.editor.p5js.org;
|
|
||||||
location / {
|
|
||||||
proxy_pass http://app:8000;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection 'upgrade';
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_cache_bypass $http_upgrade;
|
|
||||||
}
|
|
||||||
# location ~* \/login(\/)* {
|
|
||||||
# return 301 https://$host$request_uri;
|
|
||||||
# }
|
|
||||||
# location ~* \/signup(\/)* {
|
|
||||||
# return 301 https://$host$request_uri;
|
|
||||||
# }
|
|
||||||
# location ~* \/reset-password(\/)* {
|
|
||||||
# return 301 https://$host$request_uri;
|
|
||||||
# }
|
|
||||||
# location ~* "\/[a-zA-Z0-9._-]{1,20}\/account(\/)*" {
|
|
||||||
# return 301 https://$host$request_uri;
|
|
||||||
# }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
# server {
|
|
||||||
# listen 443;
|
|
||||||
# ssl on;
|
|
||||||
# ssl_certificate /etc/letsencrypt/live/alpha.editor.p5js.org/fullchain.pem;
|
|
||||||
# ssl_certificate_key /etc/letsencrypt/live/alpha.editor.p5js.org/privkey.pem;
|
|
||||||
# server_name alpha.editor.p5js.org;
|
|
||||||
# location / {
|
|
||||||
# proxy_pass http://127.0.0.1:8000;
|
|
||||||
# proxy_http_version 1.1;
|
|
||||||
# proxy_set_header Upgrade $http_upgrade;
|
|
||||||
# proxy_set_header Connection 'upgrade';
|
|
||||||
# proxy_set_header Host $host;
|
|
||||||
# proxy_cache_bypass $http_upgrade;
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
|
|
||||||
# server {
|
|
||||||
# listen 80;
|
|
||||||
# server_name editor.p5js.org;
|
|
||||||
# location ~ ^/(.*) {
|
|
||||||
# return 302 http://alpha.editor.p5js.org/$1;
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
|
|
||||||
# server {
|
|
||||||
# listen 443;
|
|
||||||
# ssl on;
|
|
||||||
# ssl_certificate /etc/letsencrypt/live/editor.p5js.org/fullchain.pem;
|
|
||||||
# ssl_certificate_key /etc/letsencrypt/live/editor.p5js.org/privkey.pem;
|
|
||||||
# server_name editor.p5js.org;
|
|
||||||
# location ~ ^/(.*) {
|
|
||||||
# return 302 https://alpha.editor.p5js.org/$1;
|
|
||||||
# }
|
|
||||||
# }
|
|
Loading…
Reference in a new issue