Skip to content

Commit

Permalink
Initial commit (ported from previous repo)
Browse files Browse the repository at this point in the history
  • Loading branch information
timbotnik committed Sep 12, 2024
0 parents commit 3fe2576
Show file tree
Hide file tree
Showing 29 changed files with 4,719 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
APOLLO_GRAPH_REF="O11Y-Workshop-0@current"
APOLLO_KEY="CHANGE-ME"
70 changes: 70 additions & 0 deletions .github/workflows/apollo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# .github/workflows/check.yml

name: Apollo

# Controls when the action will run. Triggers the workflow on push request events
on: [push]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
check:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# https://docs.github.com/en/actions/reference/environments
environment: apollo

# https://docs.github.com/en/actions/reference/encrypted-secrets
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsenv
env:
APOLLO_KEY: ${{ secrets.APOLLO_KEY }}
APOLLO_VCS_COMMIT: ${{ github.sha }}

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Install Rover
run: |
curl -sSL https://rover.apollo.dev/nix/v0.26.1 | sh
# Add Rover to the $GITHUB_PATH so it can be used in another step
# https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#adding-a-system-path
echo "$HOME/.rover/bin" >> $GITHUB_PATH
# TBD: only run this command with the `--background` flag once we have the Apollo Studio GitHub integration enabled on your repository
- name: Run destinations subgraph check
working-directory: ./summit-2024
run: |
rover subgraph check O11Y-Workshop-0@current --schema ./subgraphs/destinations/schema.graphql --name destinations --background
- name: Run experiences subgraph check
working-directory: ./summit-2024
run: |
rover subgraph check O11Y-Workshop-0@current --schema ./subgraphs/experiences/schema.graphql --name experiences --background
publish:
needs: check
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
environment: apollo
env:
APOLLO_KEY: ${{ secrets.APOLLO_KEY }}
APOLLO_VCS_COMMIT: ${{ github.sha }}

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Install Rover
run: |
curl -sSL https://rover.apollo.dev/nix/v0.26.1 | sh
# Add Rover to the $GITHUB_PATH so it can be used in another step
# https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#adding-a-system-path
echo "$HOME/.rover/bin" >> $GITHUB_PATH
- name: Publish destinations subgraph
working-directory: ./summit-2024
run: |
./publish-destinations-current.sh
- name: Publish experiences subgraph
working-directory: ./summit-2024
run: |
./publish-experiences-current.sh
132 changes: 132 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
router/bin/
.env.dev
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Apollo GraphQL

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Summit 2024 Observability Workshop

## Getting Started

### Install Router

[Download the Router binary](https://www.apollographql.com/docs/router/quickstart/) and place it into ./router/bin/.

### Running Locally

- Copy `.env.example` to `.env.dev`.
- Create an API key for [this Graph in Studio](https://studio.apollographql.com/graph/O11Y-Workshop-0/variant/current/settings/graph/api-keys).
- Update the `APOLLO_KEY` variable in the `.env.dev` file with your new key.

### Start Up The Services

- `./start-router-dev.sh` - Starts up the router
- `./start-destinations.sh` - Starts up the destinations subgraph
- `/.start-experiences.sh` - Starts up the experiences subgraph
8 changes: 8 additions & 0 deletions publish-destinations-current.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

set -a && source ".env" && set +a

rover subgraph publish O11Y-Workshop-0@current \
--schema ./subgraphs/destinations/schema.graphql \
--name destinations \
--routing-url https://o11y-ws-destinations-subgraph-bc58fdd49285.herokuapp.com/
8 changes: 8 additions & 0 deletions publish-destinations-dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

set -a && source ".env.dev" && set +a

rover subgraph publish O11Y-Workshop-0@dev \
--schema ./subgraphs/destinations/schema.graphql \
--name destinations \
--routing-url http://localhost:4003/graphql
8 changes: 8 additions & 0 deletions publish-experiences-current.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

set -a && source ".env" && set +a

rover subgraph publish O11Y-Workshop-0@current \
--schema ./subgraphs/experiences/schema.graphql \
--name experiences \
--routing-url https://o11y-ws-experiences-subgraph-b7c7a4369650.herokuapp.com/
8 changes: 8 additions & 0 deletions publish-experiences-dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

set -a && source ".env.dev" && set +a

rover subgraph publish O11Y-Workshop-0@dev \
--schema ./subgraphs/experiences/schema.graphql \
--name experiences \
--routing-url http://localhost:4002/graphql
1 change: 1 addition & 0 deletions router/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: sh -c 'curl -sSL https://router.apollo.dev/download/nix/v1.53.0 | sh && APOLLO_KEY=$APOLLO_KEY APOLLO_GRAPH_REF=$APOLLO_GRAPH_REF ./router --config router.yaml'
59 changes: 59 additions & 0 deletions router/router.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
sandbox:
enabled: true
homepage:
enabled: false
supergraph:
introspection: true
listen: 0.0.0.0:${env.PORT:-4000}
cors:
allow_any_origin: true
health_check:
listen: 0.0.0.0:8088
headers:
all: # Header rules for all subgraphs
request:
- propagate:
matching: .*
include_subgraph_errors:
all: true
telemetry:
instrumentation:
spans:
mode: spec_compliant
apollo:
batch_processor:
# default 5s
scheduled_delay: 10s
# default 1
max_concurrent_exports: 20
# default 512
max_export_batch_size: 2048
max_export_timeout: 30s
# default 2048
max_queue_size: 8192
field_level_instrumentation_sampler: always_on
experimental_otlp_tracing_sampler: always_on
experimental_otlp_tracing_protocol: grpc
experimental_apollo_signature_normalization_algorithm: enhanced
experimental_apollo_metrics_reference_mode: extended
send_headers: all
send_variable_values: all
errors:
subgraph:
all:
send: true
redact: false
exporters:
tracing:
common:
sampler: always_on

telemetry:
apollo:
send_headers: all
send_variable_values: all
errors:
subgraph:
all:
send: true
redact: false
8 changes: 8 additions & 0 deletions start-destinations-dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

source .env.dev

cd subgraphs/destinations
npm i
npm start
cd ../..
8 changes: 8 additions & 0 deletions start-experiences-dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

source .env.dev

cd subgraphs/experiences
npm i
npm start
cd ../..
5 changes: 5 additions & 0 deletions start-router-dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

set -a && source .env.dev && set +a

router/bin/router -c router/router.yaml --hr
5 changes: 5 additions & 0 deletions start-router.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

set -a && source .env && set +a

router/bin/router -c router/router.yaml --hr
6 changes: 6 additions & 0 deletions subgraphs/destinations/nodemon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"watch": ["src", "schema.graphql"],
"ext": "ts,json",
"ignore": ["src/**/*.spec.ts"],
"exec": "node --no-warnings=ExperimentalWarning --loader ts-node/esm src/index.ts"
}
Loading

0 comments on commit 3fe2576

Please sign in to comment.