Giter Site home page Giter Site logo

hacknightvol4's Introduction

Instructions

Fork Repo https://github.com/anhaaD/hacknightvol4.git
git clone https://github.com/$YOURUSERNAME/hacknightvol4.git
cd hacknightvol4

Configure SSH on github

Generating a new SSH key

Open Terminal.


$ ssh-keygen -t rsa -b 4096 -C "[email protected]"

$ pbcopy < ~/.ssh/id_rsa.pub
https://help.github.com/en/articles/adding-a-new-ssh-key-to-your-github-account


```bash

# Google cloud login
https://console.cloud.google.com/
# Create Api Credential
and Download .Json file
# create .circleCI config file
version: 2
jobs:
  build_and_test:
    docker:
      - image: circleci/node:10
    working_directory: ~/repo
    steps:
      - checkout
      - restore_cache:
          keys:
            - v1-dependencies-{{ checksum "package.json" }}
            - v1-dependencies-
      - run:
          name: Install dependencies
          command: npm install
      - save_cache:
          paths:
            - node_modules
          key: v1-dependencies-{{ checksum "package.json" }}
      - run:
          name: Run tests
          command: npm test
      - store_test_results:
          path: test-results
  deploy_to_staging:
    docker:
      - image: google/cloud-sdk
    environment:
      - PROJECT_NAME: "hacknightvol4"  <----- Өөрчлөх
      - GOOGLE_PROJECT_ID: "united-tempest-228204"  // <----- Өөрчлөх
      - GOOGLE_COMPUTE_ZONE: "asia-east1-a" 
      - GOOGLE_CLUSTER_NAME: "hacknightvol4-cluster"  // <----- Өөрчлөх
    steps:
      - checkout
      - run: 
          name: Setup Google Cloud SDK 
          command: |
            apt-get install -qq -y gettext
            echo $GOOGLE_AUTH > ${HOME}/gcloud-service-key.json
            gcloud auth activate-service-account --key-file=${HOME}/gcloud-service-key.json
            gcloud --quiet config set project ${GOOGLE_PROJECT_ID}
            gcloud --quiet container clusters create ${GOOGLE_CLUSTER_NAME} --zone ${GOOGLE_COMPUTE_ZONE} 
            gcloud --quiet config set project ${GOOGLE_PROJECT_ID}
            gcloud --quiet config set compute/zone ${GOOGLE_COMPUTE_ZONE}
            gcloud --quiet container clusters get-credentials ${GOOGLE_CLUSTER_NAME}
      - setup_remote_docker
      - run: 
          name: Docker build and  push
          command: |
            docker build \
              --build-arg COMMIT_REF=${CIRCLE_SHA1} \
              --build-arg BUILD_DATE=`date -u +”%Y-%m-%dT%H:%M:%SZ”` \
              -t ${PROJECT_NAME} .
            docker tag ${PROJECT_NAME} eu.gcr.io/${GOOGLE_PROJECT_ID}/${PROJECT_NAME}:${CIRCLE_SHA1}
            gcloud auth print-access-token | docker login -u oauth2accesstoken --password-stdin https://eu.gcr.io
            docker push eu.gcr.io/${GOOGLE_PROJECT_ID}/${PROJECT_NAME}:${CIRCLE_SHA1}
      - run: 
          name: Deploy to Kubernetes
          command: |
            envsubst < ${HOME}/project/k8s.yml > ${HOME}/patched_k8s.yml
            kubectl apply -f ${HOME}/patched_k8s.yml
            kubectl rollout status deployment/${PROJECT_NAME}
workflows:
  version: 2
  build_test_deploy:
    jobs:
      - build_and_test
      - deploy_to_staging:
          requires:
            - build_and_test
          filters:
            branches:
              only: master
# Login CircleCI 
https://circleci.com/
# Browse Project From github

hacknightvol4
# ADD Variable on CircleCI 

Copy downloaded google credential and paste --> $GOOGLE_AUTH  

Survey

hacknightvol4's People

Contributors

anhaad avatar otgontugs avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.