-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Start of a local development directory #337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
b6c1017
initial skeleton notes for local dev
ldemailly fb598c0
tweaks
ldemailly 8846efa
Merge branch 'master' of github.com:istio/istio into local_dev
ldemailly 5a91f17
adding the rules.yaml for local dev and updating the scripts
ldemailly a12f129
Fixing English typo
ldemailly 67d11ba
Merge branch 'master' into local_dev
ldemailly d1fb6d1
Also start to address dev getting started
ldemailly 93eecc8
incorporated most of my noogler notes
ldemailly 8a7d419
Adding the sample quota
ldemailly fbacf79
adding note about -v=5
ldemailly 9c45a11
Code review comments
ldemailly 6ce77e8
typo fix
ldemailly 8a04264
Merge branch 'master' into local_dev
ldemailly File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,4 +9,6 @@ | |
| vendor | ||
| # Generated pb files | ||
| *.pb.go | ||
| # vi backups | ||
| *.bak | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # Developing for Istio | ||
|
|
||
| See also the [broker](https://github.com/istio/broker/blob/master/doc/dev/development.md) and [mixer](https://github.com/istio/mixer/blob/master/doc/dev/development.md) | ||
| development setup and guidelines | ||
|
|
||
| ## Collection of scripts and notes for developing for Istio | ||
|
|
||
| For local development (building from source and running the major components) on Ubuntu/raw VM: | ||
|
|
||
| Assuming you did (once): | ||
| 1. [Install bazel](https://bazel.build/versions/master/docs/install-ubuntu.html), note that as of this writing Bazel needs the `openjdk-8-jdk` VM (you might need to uninstall or get out of the way the `ibm-java80-jdk` that comes by default with GCE for instance) | ||
| 2. Install required packages: `sudo apt-get install make openjdk-8-jdk libtool m4 autoconf uuid-dev` | ||
| 3. Get the source trees | ||
| ```bash | ||
| mkdir github | ||
| cd github/ | ||
| git clone https://github.com/istio/proxy.git | ||
| git clone https://github.com/istio/mixer.git | ||
| git clone https://github.com/istio/istio.git | ||
| # if you want to do load tests: | ||
| git clone https://github.com/wg/wrk.git | ||
| ``` | ||
| 4. You can then use | ||
| - [update_all](update_all) : script to build from source | ||
| - [setup_run](setup_run) : run locally | ||
| - Also found in this directory: [rules.yml](rules.yml) : the version of mixer/testdata/configroot/scopes/global/subjects/global/rules.yml that works locally and [quota.yml](quota.yml) a very simple 1 qps quota example used below. | ||
| 5. And run things like | ||
| ```bash | ||
| # Test the echo server: | ||
| curl -v http://localhost:8080/ | ||
| # Test through the proxy: | ||
| curl -v http://localhost:9090/echo | ||
| # Add a rule locally (simply drop the file or exercise the API:) | ||
| curl -v http://localhost:9094/api/v1/scopes/global/subjects/foo.svc.cluster.local/rules --data-binary @quota.yaml -X PUT -H "Content-Type: application/yaml" | ||
| # Test under some load: | ||
| wrk http://localhost:9090/echo | ||
|
|
||
| ``` | ||
| Note that this is done for you by [setup_run](setup_run) but to use the correct go environment: | ||
| ```bash | ||
| cd mixer/ | ||
| source bin/use_bazel_go.sh | ||
| ``` | ||
|
|
||
|
|
||
| ## MacOs tips | ||
|
|
||
| Get GitHub desktop https://desktop.github.com/ | ||
|
|
||
| If you want to make changes to the [website](https://github.com/istio/istio.github.io), and want to run jekyll locally and natively, without docker): | ||
|
|
||
| You will need a newer ruby than the default: get and install rvm https://rvm.io/ | ||
|
|
||
| Then rvm install ruby-2.1 (or later) rvm use ruby-2.1 then `gem install jekyll bundler` then `bundle install` and then finally you can run successfully `bundle exec jekyll serve` in the directory you cloned the iostio doc repo. To avoid `GitHub Metadata: No GitHub API authentication could be found. Some fields may be missing or have incorrect data.` errors you need to set a public repo access token at https://github.com/settings/tokens and export it in `JEKYLL_GITHUB_TOKEN` env var (in your `.bash_profile`) - then http://127.0.0.1:4000/docs/ will work and auto update when pulling. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| rules: | ||
| - aspects: | ||
| - kind: quotas | ||
| params: | ||
| quotas: | ||
| - descriptorName: RequestCount | ||
| maxAmount: 1 | ||
| expiration: 1s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| subject: namespace:ns | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. used https://github.com/istio/istio/pull/337/files#diff-ad310135e477fb2632b2043cc24c646fR4 |
||
| revision: "2022" | ||
| rules: | ||
| - selector: # must be empty for preprocessing adapters | ||
| aspects: | ||
| - kind: quotas | ||
| params: | ||
| quotas: | ||
| - descriptorName: RequestCount | ||
| maxAmount: 5000 | ||
| expiration: 1s | ||
| - kind: metrics | ||
| adapter: prometheus | ||
| params: | ||
| metrics: | ||
| - descriptor_name: request_count | ||
| # we want to increment this counter by 1 for each unique (source, target, service, method, response_code) tuple | ||
| value: "1" | ||
| labels: | ||
| source: source.labels["app"] | "unknown" | ||
| target: target.service | "unknown" | ||
| service: target.labels["app"] | "unknown" | ||
| method: request.path | "unknown" | ||
| version: target.labels["version"] | "unknown" | ||
| response_code: response.code | 200 | ||
| - descriptor_name: request_duration | ||
| value: response.latency | response.duration | "0ms" | ||
| labels: | ||
| source: source.labels["app"] | "unknown" | ||
| target: target.service | "unknown" | ||
| service: target.labels["app"] | "unknown" | ||
| method: request.path | "unknown" | ||
| version: target.labels["version"] | "unknown" | ||
| response_code: response.code | 200 | ||
| - kind: access-logs | ||
| params: | ||
| logName: access_log | ||
| log: | ||
| descriptor_name: accesslog.common | ||
| template_expressions: | ||
| originIp: origin.ip | ||
| sourceUser: origin.user | ||
| timestamp: request.time | ||
| method: request.method | ||
| url: request.path | ||
| protocol: request.scheme | ||
| responseCode: response.code | ||
| responseSize: response.size | ||
| labels: | ||
| originIp: origin.ip | ||
| sourceUser: origin.user | ||
| timestamp: request.time | ||
| method: request.method | ||
| url: request.path | ||
| protocol: request.scheme | ||
| responseCode: response.code | ||
| responseSize: response.size | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # very basic local run | ||
| set -x | ||
| ulimit -n 16384 | ||
| cp istio/devel/rules.yml mixer/testdata/configroot/scopes/global/subjects/global/rules.yml | ||
| cd mixer; set +x; source bin/use_bazel_go.sh ; set -x; cd .. | ||
| ( cd proxy/test/backend/echo; go run echo.go > /tmp/echo.log ) & | ||
| ( cd proxy/src/envoy/mixer; ./start_envoy > /tmp/envoy.log ) & | ||
| # add -v=5 for verbose/debug | ||
| ./mixer/bazel-bin/cmd/server/mixs server --configStoreURL=fs://$(pwd)/mixer/testdata/configroot --logtostderr 2> /tmp/mixs.2.log & | ||
| echo "starting everything..." | ||
| sleep 3 | ||
| curl -v http://localhost:9090/echo | ||
| curl -v http://localhost:42422/metrics | ||
| set +x | ||
| export PATH=$PATH:$(pwd)/wrk | ||
| echo "you can now run: wrk http://localhost:9090/echo" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #! /bin/bash | ||
| # update and rebuild from source | ||
| set -e | ||
| set -x | ||
| cd istio | ||
| git pull | ||
| cd ../mixer | ||
| git pull | ||
| cd ../proxy | ||
| git pull | ||
| cd ../wrk | ||
| git pull | ||
| make | ||
| cd ../proxy | ||
| bazel build src/envoy/mixer:envoy | ||
| cd ../mixer | ||
| bazel build cmd/server:mixs | ||
| set +x | ||
| echo "### All done... source istio/devel/setup_run now" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DO we need this? The docker variation is very stable and avoids dealing with Ruby stuff. I'd rather remove this option from our docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well it's much lighter running natively and only 1 paragraph, I had that in my notes and think it may be useful to someone else - I'd like eventually to run everything natively on the mac btw (low pri but still)