|
| 1 | +_Copyright (c) 2019, 2020, 2021 Oracle and/or its affiliates The Universal Permissive License (UPL), Version 1.0_ |
| 2 | + |
| 3 | +# Local Development |
| 4 | + |
| 5 | +This document explains how to setup your development machine to perform development where the microservices can be built and then deployed onto OKE for testing. |
| 6 | + |
| 7 | +These tests have been tested on MacOS |
| 8 | + |
| 9 | +## Prerequisites |
| 10 | + |
| 11 | +1. Install OCI CLI |
| 12 | + |
| 13 | + https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/cliinstall.htm |
| 14 | + |
| 15 | +2. Install kubectl |
| 16 | + |
| 17 | + https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/ |
| 18 | + |
| 19 | +3. Install GraalVM |
| 20 | +``` |
| 21 | +cd ~ |
| 22 | +curl -sL https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-20.1.0/graalvm-ce-java11-darwin-amd64-20.1.0.tar.gz | tar -xz |
| 23 | +``` |
| 24 | + |
| 25 | +4. Install Maven |
| 26 | + |
| 27 | + https://maven.apache.org/install.html |
| 28 | +``` |
| 29 | +cd ~ |
| 30 | +curl -sL https://downloads.apache.org/maven/maven-3/3.8.1/binaries/apache-maven-3.8.1-bin.tar.gz | tar xz |
| 31 | +export PATH=~/apache-maven-3.8.1/bin:$PATH |
| 32 | +``` |
| 33 | + |
| 34 | + Also, add ~/apache-maven-3.8.1/bin to your /etc/paths |
| 35 | + |
| 36 | +5. Install Docker |
| 37 | + |
| 38 | + https://docs.docker.com/get-docker/ |
| 39 | + |
| 40 | +6. Clone your github development branch to your machine and make a note of the location, for example _/Users/freddy/Documents/GitHub/microservices-datadriven_. |
| 41 | + |
| 42 | +## Setup Steps |
| 43 | +These steps are required every time you perform a new grabdish workshop setup. |
| 44 | + |
| 45 | +1. Configure the OCI CLI to connect to your TENANCY_OCID |
| 46 | +``` |
| 47 | +oci setup config |
| 48 | +``` |
| 49 | + |
| 50 | +2. Create a folder to hold the grabdish workshop state |
| 51 | +``` |
| 52 | +mkdir ~/grabdish_state |
| 53 | +cd ~/grabdish_state |
| 54 | +``` |
| 55 | + |
| 56 | +2. Using the download feature of cloud shell (hamburger menu about cloud shell window), download the ./grabdish_state.tgz file to your machine. This file is generated when the workshop setup completes. |
| 57 | + |
| 58 | +3. Copy the _grabdish_state.tgz_ file to the _~/grabdish_state_ folder. |
| 59 | + |
| 60 | +4. Unpack the _grabdish_state.tgz_ file |
| 61 | +``` |
| 62 | +cd ~/grabdish-state |
| 63 | +rm -rf state |
| 64 | +tar -xzf grabdish-state.tgz |
| 65 | +``` |
| 66 | + |
| 67 | +5. Set the shell environment using the env.sh script located in the cloned code |
| 68 | +``` |
| 69 | +source /Users/rexley/Documents/GitHub/microservices-datadriven/grabdish/env.sh |
| 70 | +``` |
| 71 | +This step will need to be repeated whenever you start a new shell. |
| 72 | + |
| 73 | +6. Configure kubectl |
| 74 | +``` |
| 75 | +oci ce cluster create-kubeconfig --cluster-id "$(state_get OKE_OCID)" --file $HOME/.kube/config --region "$(state_get REGION)" --token-version 2.0.0 |
| 76 | +``` |
| 77 | + |
| 78 | +7. Generate an auth token through the OCI Console. Copy the token. |
| 79 | + |
| 80 | +8. Login to Docker using the OCI Registry |
| 81 | +``` |
| 82 | +docker login -u "$(state_get NAMESPACE)/$(state_get USER_NAME)" "$(state_get REGION).ocir.io" |
| 83 | +``` |
| 84 | +You will be prompted for a password. Paste the auth token generated in the previous step. |
0 commit comments