- Windows or Mac OS X
- 16GB of Memory
- 30GB of Available Storage
This allows you to do something like this:
- OSX/Windows workstation, with an Ubuntu VM running in multipass, with everything directly wired up.
- Some services running locally in your workstation (via IntelliJ)
- All other services running in Minnaker (on the VM)
For example:
- OSX/Windows using IP 192.168.64.1 and the VM using 192.168.64.6
- Orca running on http://192.168.64.1:8083
- All other services running on 192.168.64.6 (for example, Clouddriver will be on http://192.168.64.6:7002)
-
Install homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
-
Install a JDK 11.0.8
- Mac OS X
brew tap AdoptOpenJDK/openjdk brew cask install adoptopenjdk11
- Windows instructions
-
Install Multipass
- Mac instructions
brew cask install multipass
- Windows instructions
-
Install IntelliJ Community Edition
- Mac instructions
brew cask install intellij-idea-ce
- Windows instructions
-
Install Yarn (installs Node.js if not installed).
- Mac instructions
brew install yarn
- Windows instructions
-
Install
kubectl
.- Mac instructions
brew install kubectl
- Windows instructions
Open two terminals one will be for shell access into minnaker-vm the other will be for host machine.
- Windows or Mac OS X terminal will be referred to as [host]
- minnaker-vm terminal will be referred to as [minnaker-vm]
-
[minnaker-vm] Start a multipass vm with 2 cores, 10GB of memory, 30GB of storage
multipass launch -c 2 -m 10G -d 30G --name minnaker-vm
-
[minnaker-vm] Shell into your multipass vm
multipass shell minnaker-vm
-
[minnaker-vm] Download and install Minnaker (use open source, no-auth mode)
curl -LO https://github.com/armory/minnaker/releases/latest/download/minnaker.tgz tar -xzvf minnaker.tgz ./minnaker/scripts/no_auth_install.sh -o
-
[minnaker-vm] When it's done, you'll get the IP address of Minnaker. Remember this (or you can always just run
cat /etc/spinnaker/.hal/public_endpoint
)(if you accidentally forget to use no auth or open source, you can run
./minnaker/scripts/utils/remove_auth.sh
and./minnaker/scripts/utils/switch_to_oss.sh
)
-
[minnaker-vm] Run this script to ensure each Spinnaker service gets a K8s LoadBalancer and can be accessed from your host machine.
./minnaker/scripts/utils/expose_local.sh
-
[minnaker-vm] Check on the status of spinnaker
kubectl get pods -n spinnaker
All pods need to show
1/1
forREADY
. -
[host] You can now browse to spinnaker at https://192.168.64.6
- Troubleshooting:
Service Unavailable
: wait until spinnaker starts up, it can take a while to start up (download all docker images) the above step will show you if it is up and running.
- Troubleshooting:
-
[minnaker-vm] Expose the service you want to debug (example here is orca)
./minnaker/scripts/utils/external_service_setup.sh orca
You can also expose multiple services
./minnaker/scripts/utils/external_service_setup.sh orca echo
-
[host] Setup your host config files
- Create/edit the file
~/.spinnaker/spinnaker-local.yml
, and paste the previously copied output.
services: front50: baseUrl: http://192.168.64.6:8080 redis: baseUrl: http://192.168.64.6:6379 clouddriver: baseUrl: http://192.168.64.6:7002 orca: host: 0.0.0.0 echo: baseUrl: http://192.168.64.6:8089 deck: baseUrl: http://192.168.64.6:9000 rosco: baseUrl: http://192.168.64.6:8087 gate: baseUrl: http://192.168.64.6:8084
- Create/edit the config file for the service you are going to debug (example orca).
- [minnaker-vm]
cat /etc/spinnaker/.hal/default/staging/orca.yml
- [host] create a
~/.spinnaker/orca.yml
file with the above files contents.
- [minnaker-vm]
- Create/edit the file
-
Choose a working directory, and go there. I usually use
~/git/spinnaker
mkdir -p ~/git/spinnaker cd ~/git/spinnaker
-
Clone the service you want
git clone https://github.com/spinnaker/orca.git
or, if you have a Git SSH key set up
git clone [email protected]:spinnaker/orca.git
-
Change the branch
cd orca git branch -a
You'll see a list of branches (like
remotes/origin/release-1.22.x
). The last bit (after the last slash) is the branch name. Check out that branch.git checkout release-1.22.x
-
Open IntelliJ
-
Open your project
-
If you don't have a project open, you'll see a "Welcome to IntellJ IDEA".
-
Click "Open or Import"
-
Navigate to your directory (e.g.,
~/git/spinnaker/orca
) -
Click on
build.gradle
and click "Open" -
Select "Open as Project"
-
-
If you already have one or more projects open, do the following:
-
Use the menu "File" > "Open"
-
Navigate to your directory (e.g.,
~/git/spinnaker/orca
) -
Click on
build.gradle
and click "Open" -
Select "Open as Project"
-
-
-
Wait for the thing to do the thing. It's gotta load the stuff.
-
Through the next few steps, if you hit an "Unable to find Main" or fields are grayed out, reimport the project:
-
View > Tool Windows > Gradle
-
In the Gradle window, right click "Orca" and then click "Reimport Gradle Project"
-
-
In the top right corner of the project window, there's a "Add Configuration" button. Click it.
-
Click the little '+' sign in the top left corner, and select "Application"
-
Give it a name. Like "Main" or "Run Orca"
-
Click the three dots next to "Main Class". Either wait for it to load and select "Main (com.netflix.spinnaker.orca) or click on "Project" and navigate to
orca > orca-web > src > main > groovy > com.netflix.spinnaker > orca > Main
-
In the dropdown for "Use classpath of module", select "orca-web_main"
-
Click "Apply" and then "OK"
-
To build and run the thing, click the little green triangle next to your configuration (top right corner, kinda)
Now magic happens.
[minnaker-vm] Run the following to no longer debug from host
```bash
./minnaker/scripts/utils/external_service_setup.sh
```
[host] Run the following to stop the minnaker-vm (spinnaker)
multipass stop minnaker-vm
-
[minnaker-vm] Get your kubernetes config file
kubectl config view --raw
Example Output:
apiVersion: v1 clusters: - cluster: certificate-authority-data: YOUR_CERT_HERE server: https://127.0.0.1:6443 name: default contexts: - context: cluster: default namespace: spinnaker user: default name: default current-context: default kind: Config preferences: {} users: - name: default user: password: YOUR_PASSWORD_HERE username: admin
-
[host] Save the command output from above command
kubectl config view --raw
to~/.kube/minnaker
on host machine -
[minnaker-vm] To get the IP of minnaker-vm
cat /etc/spinnaker/.hal/public_endpoint
-
[host] Edit
~/.kube/minnaker
to have the IP address of the minnaker-vm New File:apiVersion: v1 clusters: - cluster: certificate-authority-data: YOUR_CERT_HERE server: https://192.168.64.6:6443 name: default contexts: - context: cluster: default namespace: spinnaker user: default name: default current-context: default kind: Config preferences: {} users: - name: default user: password: YOUR_PASSWORD_HERE username: admin
-
[host] Setup
kubectl
from HOST to check on the deployexport KUBECONFIG=~/.kube/minnaker kubectl get pods -n spinnaker
or always specify
--kubeconfig ~/.kube/minnaker
kubectl --kubeconfig ~/.kube/minnaker get pods -n spinnaker
-
[host] Now you can run local kubectl command
kubectl get pods -n spinnaker
Follow the "debugging" section here: https://github.com/spinnaker-plugin-examples/pf4jStagePlugin
notes:
- Create the
plugins
directory in the git repo (e.g.,~/git/spinnaker/orca/plugins
) and put the.plugin-ref
in there - If you don't see the gradle tab, you can get to it with View > Tool Windows > Gradle
This assumes you have a Github account, and are logged in.
-
You probably want to work on a fork. Go to github.com/spinnaker-plugin-examples/pf4jStagePlugin
-
In the top right corner, click "Fork" and choose your username to create a fork. For example, mine is
justinrlee
so I end up with github.com/justinrlee/pf4jStagePlugin -
On your workstation, choose a working directory. For example,
~/git/justinrlee
mkdir -p ~/git/justinrlee cd ~/git/justinrlee
-
Clone the repo
git clone https://github.com/justinrlee/pf4jStagePlugin.git
or, if you have a Git SSH key set up
git clone [email protected]:justinrlee/pf4jStagePlugin.git
-
Check out a tag.
If you are using Spinnaker 1.19.x, you probably need a 1.0.x tag (1.0.x is compatible 1.19, 1.1.x is compatible with 1.20)
List available tags:
cd pf4jStagePlugin git tag -l
Check out the tag you want:
git checkout v1.0.17
Create a branch off of it (optional, but good if you're gonna be making changes). This creates a branch called custom-stage
git switch -c custom-stage
-
Build the thing from the CLI
./gradlew releaseBundle
This will generate an orca .plugin-ref file (
random-wait-orca/build/orca.plugin-ref
). -
Copy the
orca.plugin-ref
file to theplugins
directory in yourorca
repo.Create the destination directory - this will depend on where you cloned the orca repo
mkdir -p ~/git/spinnaker/orca/plugins
Copy the file
cp random-wait-orca/build/orca.plugin-ref ~/git/spinnaker/orca/plugins/
-
Create the orca-local.yml file in
~/.spinnaker/
This tells Spinnaker to enable and use the plugin
Create this file at
~/.spinnaker/orca-local.yml
:# ~/.spinnaker/orca-local.yml spinnaker: extensibility: plugins: Armory.RandomWaitPlugin: enabled: true version: 1.0.17 extensions: armory.randomWaitStage: enabled: true config: defaultMaxWaitTime: 60
-
In IntelliJ (where you have the Orca project open), Link the plugin project to your current project
-
Open the Gradle window if it's not already open (View > Tool Windows > Gradle)
-
In the Gradle window, click the little '+' sign
-
Navigate to your plugin directory (e.g.,
/git/justinrlee/pf4jStagePlugin
), and selectbuild.gradle
and click Open
-
-
In the Gradle window, right click "orca" and click "Reimport Gralde Project"
-
In IntelliJ, create a new build configuration
-
In the top right, next to the little hammer icon, there's a dropdown. Click "Edit Configurations..."
-
Click the '+' sign in the top left, and select "Application"
-
Call it something cool. Like "Build and Test Plugin"
-
Select the main class (Either wait for it to load and select "Main (com.netflix.spinnaker.orca) or click on "Project" and navigate to
orca > orca-web > src > main > groovy > com.netflix.spinnaker > orca > Main
) -
In the dropdown for "Use classpath of module", select "orca-web_main"
-
Put this in the "VM Options" field put this: '
-Dpf4j.mode=development
' -
In the "Before launch" section of the window, click the '+' sign and add "Build Project"
-
Select "Build" in the "Before launch" section and click the '-' sign to remove it (you don't need both "Build" and "Build Project")
-
Click "Apply" and then "OK"
-
-
Run your stuff.
-
If the unmodified Orca is still running, click the little stop icon (red square in top right corner)
-
Select your new build configuration in the dropdown
-
Click the runicon (little green triangle)
-
In the console output you should see something that looks like this:
2020-04-30 10:17:41.242 INFO 53937 --- [ main] com.netflix.spinnaker.orca.Main : [] Starting Main on justin-mbp-16.lan with PID 53937 (/Users/justin/dev/spinnaker/orca/orca-web/build/classes/groovy/main started by justin in /Users/justin/dev/spinnaker/orca) 2020-04-30 10:17:41.245 INFO 53937 --- [ main] com.netflix.spinnaker.orca.Main : [] The following profiles are active: test,local ... 2020-04-30 10:17:44.276 WARN 53937 --- [ main] c.n.s.config.PluginsAutoConfiguration : [] No remote repositories defined, will fallback to looking for a 'repositories.json' file next to the application executable 2020-04-30 10:17:44.410 INFO 53937 --- [ main] org.pf4j.AbstractPluginManager : [] Plugin 'Armory.RandomWaitPlugin@unspecified' resolved 2020-04-30 10:17:44.411 INFO 53937 --- [ main] org.pf4j.AbstractPluginManager : [] Start plugin 'Armory.RandomWaitPlugin@unspecified' 2020-04-30 10:17:44.413 INFO 53937 --- [ main] i.a.p.s.wait.random.RandomWaitPlugin : [] RandomWaitPlugin.start()
-
If you see "no class Main.main" or something, in the Gradle window, try right click on "orca" and reimport Gradle project and try again.
-
-
Test your stuff
-
Go into the Spinnaker UI (should be http://your-VM-ip:9000)
-
Go to applications > spin > pipelines
-
Create a new pipeline
-
Add stage
-
Edit stage as JSON (bottom right)
-
Paste this in there:
{ "maxWaitTime": 15, "name": "Test RandomWait", "type": "randomWait" }
-
Update stage
-
Save changes
-
Click back to pipelines (pipelines tab at top)
-
Magic. Maybe. Maybe not.