-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: deadlock issue caused by migration scripts * gitignore src/types/ * update nodejs version to node:18 * added 'generate-migrations' makefile command to generate migrations * add npm command to get graphql chema * add opentelemetry tracing integration with graphql-server and auth-server * update docker.yml github workflow * fix: DistributionBucketsCache init bug * Improved offchain import/export script * fix: dockerfile * fix: dockerfile * fix eslint issues * fix checks.yml github workflow * regenerate db migration files * fix: Don't expose db container ports * fix notification errors * merge upstream/master
- Loading branch information
1 parent
6aff669
commit 05fb302
Showing
30 changed files
with
24,859 additions
and
18,662 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
@@ -1,22 +1,58 @@ | ||
name: Build and publish to Docker Hub | ||
name: Build & Publish Orion Docker image | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
docker: | ||
build_and_publish: | ||
name: Build and Publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18.x' | ||
|
||
- name: Extract Package Version | ||
id: extract_version | ||
shell: bash | ||
run: | | ||
echo "orion_version=$(cat package.json | jq -r '.version')" >> $GITHUB_OUTPUT | ||
- name: Make some space | ||
shell: bash | ||
run: | | ||
sudo rm -rf /usr/share/dotnet | ||
sudo rm -rf /opt/ghc | ||
sudo rm -rf "/usr/local/share/boost" | ||
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
if: github.event_name == 'workflow_dispatch' | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
|
||
- name: Build orion | ||
uses: docker/build-push-action@v3 | ||
with: | ||
push: true | ||
context: . | ||
file: Dockerfile | ||
push: false | ||
load: true | ||
tags: joystream/orion:latest | ||
|
||
- name: Push Orion Image | ||
run: | | ||
docker image tag joystream/orion:latest joystream/orion:${{ steps.extract_version.outputs.orion_version }} | ||
docker push joystream/orion:${{ steps.extract_version.outputs.orion_version }} | ||
- name: Push Orion latest tag | ||
if: github.ref == 'refs/heads/master' | ||
run: | | ||
docker push joystream/orion:latest |
This file contains 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 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 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 was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
db/migrations/1701263174334-Data.js → db/migrations/1704732670595-Data.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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 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 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 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,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
# docker entrypoint fot auth api, to allow running with telemetry | ||
if [[ "$TELEMETRY_ENABLED" = "yes" ]]; then | ||
node --require ./opentelemetry/index.js ./lib/auth-server/index.js $* | ||
else | ||
node ./lib/auth-server/index.js $* | ||
fi |
This file contains 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,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
# docker entrypoint fot graphql-server, to allow running with telemetry | ||
if [[ "$TELEMETRY_ENABLED" = "yes" ]]; then | ||
node --require ./opentelemetry/index.js ./node_modules/@subsquid/graphql-server/bin/run.js --subscriptions $* | ||
else | ||
node ./node_modules/@subsquid/graphql-server/bin/run.js --subscriptions $* | ||
fi |
This file contains 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 @@ | ||
# Required env variables for the Elasticsearch exporters | ||
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:8200 | ||
OTEL_RESOURCE_ATTRIBUTES="service.name=orion-graphql-server,deployment.environment=production" | ||
OTEL_METRICS_EXPORTER="otlp" | ||
|
||
# Optional env vars to configure the opentelemetry exporters | ||
OTEL_MAX_QUEUE_SIZE=8192 # 4 times of default queue size | ||
OTEL_MAX_EXPORT_BATCH_SIZE=1024 # 2 times of default batch size |
This file contains 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,59 @@ | ||
const { DiagConsoleLogger, DiagLogLevel, diag } = require('@opentelemetry/api') | ||
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node') | ||
|
||
/** | ||
* Error: "@opentelemetry/instrumentation-grpc Module @grpc/grpc-js has | ||
* been loaded before @opentelemetry/instrumentation-grpc so it might not work, | ||
* please initialize it before requiring @grpc/grpc-js" | ||
* | ||
* Fix: "call getNodeAutoInstrumentations() before require('@opentelemetry/sdk-node');" | ||
*/ | ||
// | ||
|
||
// Disable DNS instrumentation, because the instrumentation does not correctly patches `dns.lookup` function | ||
// if the function is converted to a promise-based method using `utils.promisify(dns.lookup)` | ||
// See: https://github.com/Joystream/joystream/pull/4779#discussion_r1262515887 | ||
const instrumentations = getNodeAutoInstrumentations({ | ||
'@opentelemetry/instrumentation-dns': { enabled: false }, | ||
'@opentelemetry/instrumentation-pg': { enhancedDatabaseReporting: true }, | ||
}) | ||
|
||
const { NodeSDK } = require('@opentelemetry/sdk-node') | ||
const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-proto') | ||
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-proto') | ||
const { PeriodicExportingMetricReader } = require('@opentelemetry/sdk-metrics') | ||
const { BatchSpanProcessor } = require('@opentelemetry/sdk-trace-node') | ||
|
||
const path = require('path') | ||
require('dotenv').config({ path: path.resolve(__dirname, `.env`) }) | ||
|
||
// For troubleshooting, set the log level to DiagLogLevel.DEBUG | ||
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.INFO) | ||
|
||
function addInstrumentation() { | ||
const instrumentation = new NodeSDK({ | ||
spanProcessor: new BatchSpanProcessor(new OTLPTraceExporter(), { | ||
maxQueueSize: parseInt(process.env.OTEL_MAX_QUEUE_SIZE || '8192'), | ||
maxExportBatchSize: parseInt(process.env.OTEL_MAX_EXPORT_BATCH_SIZE || '1024'), | ||
}), | ||
metricReader: new PeriodicExportingMetricReader({ | ||
exporter: new OTLPMetricExporter(), | ||
}), | ||
instrumentations, | ||
}) | ||
|
||
// Start Opentelemetry NodeJS Instrumentation | ||
diag.info('Starting tracing...') | ||
instrumentation.start() | ||
|
||
// gracefully shut down the SDK on process exit | ||
process.on('SIGTERM', () => { | ||
instrumentation | ||
.shutdown() | ||
.then(() => console.log('Tracing terminated')) | ||
.catch((error) => console.log('Error terminating tracing', error)) | ||
.finally(() => process.exit(0)) | ||
}) | ||
} | ||
|
||
addInstrumentation() |
Oops, something went wrong.