Coder Social home page Coder Social logo

loopback-deploy-to-gcp's Introduction

loopback-deploy-to-gcp

Sample loopback app which can be deployed to Google Cloud Platform (GCP)

  1. git clone https://github.com/pulkitsinghal/loopback-deploy-to-gcp.git
  2. cd loopback-deploy-to-gcp
  3. gcloud auth login
  4. gcloud config set project loopbackers
  5. replace loopbackers with you own project-id from GCP
  6. gcloud preview app run app.yaml
  7. gcloud preview app deploy app.yaml
  8. gcloud preview app deploy app.yaml --project will also work. But if you've already set the project in a previous step, there isn't really any need for it.
  9. View it at: http://loopbackers.appspot.com/explorer/

Setting up CI with Jenkins

https://cloud.google.com/tools/repo/push-to-deploy?hl=en_US&_ga=1.107528961.260942391.1429898500#connect_your_git_repository_to_the_cloud_repository

  1. Get gcloud from https://cloud.google.com/sdk/#Quick_Start
  2. On your terminal run gcloud auth login
  3. Get the name and version number of the most recent Bitnami Jenkins image. gcloud compute images list --project bitnami-launchpad | grep jenkins
  4. Run the following to create the Jenkins VM (password is what's used for the Jenkins admin console, and feel free to pick a higher config VM based on values defined in https://cloud.google.com/compute/docs/machine-types).
  gcloud compute \
      instances create bitnami-jenkins \
      --project double-platform-92304 \
      --image-project bitnami-launchpad \
      --image bitnami-jenkins-1-610-0-linux-debian-7-x86-64  \
      --zone us-central1-a \
      --machine-type n1-standard-4 \
      --metadata "bitnami-base-password=gN3wu1X9tLv9" \
                 "bitnami-default-user=user" \
                 "bitnami-key=jenkins" \
                 "bitnami-name=Jenkins" \
                 "bitnami-url=//bitnami.com/stack/jenkins" \
                 "bitnami-description=Jenkins." \
                 "startup-script-url=https://dl.google.com/dl/jenkins/p2dsetup/setup-script.sh" \
      --scopes "https://www.googleapis.com/auth/userinfo.email" \
               "https://www.googleapis.com/auth/devstorage.full_control" \
               "https://www.googleapis.com/auth/projecthosting" \
               "https://www.googleapis.com/auth/appengine.admin" \
      --tags "bitnami-launchpad"
  1. Locate the VM under Compute Engine > VM instances in the GCP dashboard. Click on the IP address and allow HTTP and HTTPS traffic. Optionally CloudFlare (or similar service to assign a domain name - for now we have jenkins.shoppinpal.com).
  2. Go to http://jenkins.shoppinpal.com/jenkins/manage > manage plugins and pick Git Plugin, GitHub Authn Plugin, GitHub plugin. One or more of these maybe already installed which is fine. Pick the option to install without restart.
  3. Login to the Jenkins console and choose 'create new job'. Ignore the tooling env settings, doesn't matter since it just seems to be a way to have separate thread executors based on language.
  4. Under 'Source Code Management' pick the Git Repo option and give the full URL (the one you'd use for cloning), for e.g. https://github.com/pulkitsinghal/loopback-deploy-to-gcp.git. Creds are not needed if its a public repo.
  5. Set the Repo Browser to 'Auto'.
  6. Build Trigger > select 'when a change is pushed to GitHub'.
  7. Setup github webhook linking to Jenkins along the lines of Step5 here: http://fourword.fourkitchens.com/article/trigger-jenkins-builds-pushing-github ... and here are some subtle differences to keep in mind:
  8. Instead of .../github-webhook/ we used .../jenkins/github-webhook/ because that's where jenkins is actually hosted in the bitnami image on GCP.
  9. For the Content type dropdown in Webhooks / Manage webhook on the github project, we selected application/x-www-form-urlencoded as the value
  10. We clicked the Disable SSL Verification button because while the basic authN should still be secure over https, there is no way for github to validate the server certificate of the generic jenkins image on GCP.

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.