mirror of
https://github.com/standardnotes/server
synced 2026-04-20 11:02:33 -04:00
Compare commits
58 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a1d60630a0 | |||
| e96fd6d69e | |||
| 1423b3fc35 | |||
| fd10b4d585 | |||
| 8a79437668 | |||
| 85a87dc40a | |||
| 95aa0a0024 | |||
| d0c44d1376 | |||
| b0e31ff305 | |||
| f11569ac53 | |||
| fbf7a61bc9 | |||
| 2265165fa3 | |||
| b216b17ef5 | |||
| b2c7b924ac | |||
| 1349f950c9 | |||
| f1c398a3a4 | |||
| 369231ff11 | |||
| 271dee5be6 | |||
| a0c8f40e7b | |||
| 4db0aef0ff | |||
| 5ed9bd243f | |||
| 2c53306f5a | |||
| a3624357dc | |||
| afe0be31f2 | |||
| 71854b704d | |||
| 0907773d6f | |||
| 787eedc8af | |||
| 040a2b5e5f | |||
| 347ee275fa | |||
| 1c0a9e6726 | |||
| c4f038ab9a | |||
| 3746ac5fc1 | |||
| 5c4353dd0c | |||
| f64caed220 | |||
| 863d590292 | |||
| 0dcf64c82b | |||
| 48fd5c5ff6 | |||
| 84fa374072 | |||
| 2313b0b450 | |||
| 4fa6f579af | |||
| 08c1328932 | |||
| 4586308210 | |||
| 5aa561dcb2 | |||
| e07612fe24 | |||
| c9289204c4 | |||
| 51bb1081a6 | |||
| 25066bb33c | |||
| bfdb176445 | |||
| 42233fa756 | |||
| 55de4319ed | |||
| 306f6edd4e | |||
| bf55bbccd9 | |||
| 6e26c0a0be | |||
| 11bcd318ab | |||
| 2f6d19dc91 | |||
| 989e1ce175 | |||
| 1c2fd46401 | |||
| b7967b34d1 |
@@ -0,0 +1,13 @@
|
|||||||
|
dist
|
||||||
|
coverage
|
||||||
|
|
||||||
|
.yarn/*
|
||||||
|
!.yarn/cache
|
||||||
|
!.yarn/patches
|
||||||
|
!.yarn/plugins
|
||||||
|
!.yarn/releases
|
||||||
|
!.yarn/unplugged
|
||||||
|
!.yarn/sdks
|
||||||
|
!.yarn/versions
|
||||||
|
|
||||||
|
data/*
|
||||||
+12
@@ -1,6 +1,18 @@
|
|||||||
|
######
|
||||||
|
# DB #
|
||||||
|
######
|
||||||
|
|
||||||
|
DB_HOST=db
|
||||||
DB_PORT=3306
|
DB_PORT=3306
|
||||||
DB_USERNAME=std_notes_user
|
DB_USERNAME=std_notes_user
|
||||||
DB_PASSWORD=changeme123
|
DB_PASSWORD=changeme123
|
||||||
DB_DATABASE=standard_notes_db
|
DB_DATABASE=standard_notes_db
|
||||||
|
DB_DEBUG_LEVEL=all
|
||||||
|
DB_MIGRATIONS_PATH=dist/migrations/*.js
|
||||||
|
|
||||||
|
#########
|
||||||
|
# CACHE #
|
||||||
|
#########
|
||||||
|
|
||||||
REDIS_PORT=6379
|
REDIS_PORT=6379
|
||||||
|
REDIS_HOST=cache
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
PUBLIC_FILES_SERVER_URL=http://localhost:3125
|
||||||
|
DB_HOST=db
|
||||||
|
DB_USERNAME=std_notes_user
|
||||||
|
DB_PASSWORD=changeme123
|
||||||
|
DB_DATABASE=standard_notes_db
|
||||||
|
REDIS_PORT=6379
|
||||||
|
REDIS_HOST=cache
|
||||||
|
AUTH_SERVER_ACCESS_TOKEN_AGE=4
|
||||||
|
AUTH_SERVER_REFRESH_TOKEN_AGE=10
|
||||||
|
AUTH_SERVER_EPHEMERAL_SESSION_AGE=300
|
||||||
|
SYNCING_SERVER_REVISIONS_FREQUENCY=5
|
||||||
|
AUTH_SERVER_LOG_LEVEL=debug
|
||||||
|
SYNCING_SERVER_LOG_LEVEL=debug
|
||||||
|
FILES_SERVER_LOG_LEVEL=debug
|
||||||
|
REVISIONS_SERVER_LOG_LEVEL=debug
|
||||||
|
API_GATEWAY_LOG_LEVEL=debug
|
||||||
|
|
||||||
|
MYSQL_DATABASE=standard_notes_db
|
||||||
|
MYSQL_USER=std_notes_user
|
||||||
|
MYSQL_PASSWORD=changeme123
|
||||||
|
MYSQL_ROOT_PASSWORD=changeme123
|
||||||
@@ -55,6 +55,11 @@ updates:
|
|||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "daily"
|
||||||
|
|
||||||
|
- package-ecosystem: "npm"
|
||||||
|
directory: "/packages/revisions"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
|
||||||
- package-ecosystem: "npm"
|
- package-ecosystem: "npm"
|
||||||
directory: "/packages/scheduler"
|
directory: "/packages/scheduler"
|
||||||
schedule:
|
schedule:
|
||||||
@@ -85,6 +90,11 @@ updates:
|
|||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "daily"
|
||||||
|
|
||||||
|
- package-ecosystem: "npm"
|
||||||
|
directory: "/packages/websockets"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
|
||||||
- package-ecosystem: "npm"
|
- package-ecosystem: "npm"
|
||||||
directory: "/packages/workspace"
|
directory: "/packages/workspace"
|
||||||
schedule:
|
schedule:
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
call_server_utility_workflow:
|
call_server_application_workflow:
|
||||||
name: Server Utility
|
name: Server Application
|
||||||
uses: standardnotes/server/.github/workflows/common-server-utility.yml@main
|
uses: standardnotes/server/.github/workflows/common-server-application.yml@main
|
||||||
with:
|
with:
|
||||||
service_name: analytics
|
service_name: analytics
|
||||||
workspace_name: "@standardnotes/analytics"
|
workspace_name: "@standardnotes/analytics"
|
||||||
@@ -22,7 +22,7 @@ jobs:
|
|||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
newrelic:
|
newrelic:
|
||||||
needs: call_server_utility_workflow
|
needs: call_server_application_workflow
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
service_name: api-gateway
|
service_name: api-gateway
|
||||||
workspace_name: "@standardnotes/api-gateway"
|
workspace_name: "@standardnotes/api-gateway"
|
||||||
e2e_tag_parameter_name: api_gateway_image_tag
|
|
||||||
deploy_worker: false
|
deploy_worker: false
|
||||||
package_path: packages/api-gateway
|
package_path: packages/api-gateway
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
service_name: auth
|
service_name: auth
|
||||||
workspace_name: "@standardnotes/auth-server"
|
workspace_name: "@standardnotes/auth-server"
|
||||||
e2e_tag_parameter_name: auth_image_tag
|
|
||||||
package_path: packages/auth
|
package_path: packages/auth
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,6 @@ on:
|
|||||||
service_name:
|
service_name:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
bundle_dir:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
package_path:
|
package_path:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
@@ -32,13 +29,17 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Create Bundle Dir
|
||||||
|
id: bundle-dir
|
||||||
|
run: echo "temp_dir=$(mktemp -d -t ${{ inputs.service_name }}-${{ github.sha }}-XXXXXXX)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Cache build
|
- name: Cache build
|
||||||
id: cache-build
|
id: cache-build
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
packages/**/dist
|
packages/**/dist
|
||||||
${{ inputs.bundle_dir }}
|
${{ steps.bundle-dir.outputs.temp_dir }}
|
||||||
key: ${{ runner.os }}-${{ inputs.service_name }}-build-${{ github.sha }}
|
key: ${{ runner.os }}-${{ inputs.service_name }}-build-${{ github.sha }}
|
||||||
|
|
||||||
- name: Set up Node
|
- name: Set up Node
|
||||||
@@ -53,7 +54,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Bundle
|
- name: Bundle
|
||||||
if: steps.cache-build.outputs.cache-hit != 'true'
|
if: steps.cache-build.outputs.cache-hit != 'true'
|
||||||
run: yarn workspace ${{ inputs.workspace_name }} bundle --no-compress --output-directory ${{ inputs.bundle_dir }}
|
run: yarn workspace ${{ inputs.workspace_name }} bundle --no-compress --output-directory ${{ steps.bundle-dir.outputs.temp_dir }}
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
@@ -85,8 +86,8 @@ jobs:
|
|||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
builder: ${{ steps.buildx.outputs.name }}
|
builder: ${{ steps.buildx.outputs.name }}
|
||||||
context: ${{ inputs.bundle_dir }}
|
context: ${{ steps.bundle-dir.outputs.temp_dir }}
|
||||||
file: ${{ inputs.bundle_dir }}/${{ inputs.package_path }}/Dockerfile
|
file: ${{ steps.bundle-dir.outputs.temp_dir }}/${{ inputs.package_path }}/Dockerfile
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
name: Reusable Run E2E Test Suite Workflow
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
snjs_image_tag:
|
||||||
|
type: string
|
||||||
|
default: latest
|
||||||
|
description: The Docker image tag used for SNJS container
|
||||||
|
secrets:
|
||||||
|
DOCKER_USERNAME:
|
||||||
|
required: true
|
||||||
|
DOCKER_PASSWORD:
|
||||||
|
required: true
|
||||||
|
AWS_ACCESS_KEY_ID:
|
||||||
|
required: true
|
||||||
|
AWS_SECRET_ACCESS_KEY:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
e2e:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
services:
|
||||||
|
snjs:
|
||||||
|
image: standardnotes/snjs:${{ inputs.snjs_image_tag }}
|
||||||
|
ports:
|
||||||
|
- 9001:9001
|
||||||
|
mock-event-publisher:
|
||||||
|
image: standardnotes/mock-event-publisher
|
||||||
|
ports:
|
||||||
|
- 3124:3000
|
||||||
|
env:
|
||||||
|
LOG_LEVEL: debug
|
||||||
|
NODE_ENV: production
|
||||||
|
VERSION: snjs-test
|
||||||
|
SNS_TOPIC_ARN: arn:aws:sns:us-east-1:000000000000:payments-local-topic
|
||||||
|
SNS_ENDPOINT: http://localstack:4566
|
||||||
|
SNS_DISABLE_SSL: true
|
||||||
|
SNS_SECRET_ACCESS_KEY: x
|
||||||
|
SNS_ACCESS_KEY_ID: x
|
||||||
|
SNS_AWS_REGION: us-east-1
|
||||||
|
NEW_RELIC_ENABLED: false
|
||||||
|
options: >-
|
||||||
|
--name "mock-event-publisher"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up Node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
|
|
||||||
|
- name: Run Server
|
||||||
|
run: docker compose -f docker-compose.ci.yml up -d
|
||||||
|
|
||||||
|
- name: Wait for server to start
|
||||||
|
run: docker/is-available.sh http://localhost:3123 $(pwd)/logs
|
||||||
|
|
||||||
|
- name: Connect external containers to self-hosted network
|
||||||
|
run: docker network connect --alias mock-event-publisher standardnotes_self_hosted mock-event-publisher
|
||||||
|
|
||||||
|
- name: Run E2E Test Suite
|
||||||
|
run: yarn dlx mocha-headless-chrome --timeout 1200000 -f http://localhost:9001/mocha/test.html
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
name: Reusable Publish Docker Self Hosting Image Workflow
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
secrets:
|
||||||
|
DOCKER_USERNAME:
|
||||||
|
required: true
|
||||||
|
DOCKER_PASSWORD:
|
||||||
|
required: true
|
||||||
|
AWS_ACCESS_KEY_ID:
|
||||||
|
required: true
|
||||||
|
AWS_SECRET_ACCESS_KEY:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
e2e:
|
||||||
|
name: E2E
|
||||||
|
uses: standardnotes/server/.github/workflows/common-e2e.yml@main
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
needs: e2e
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@master
|
||||||
|
with:
|
||||||
|
platforms: all
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@master
|
||||||
|
|
||||||
|
- name: Publish Docker image
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
builder: ${{ steps.buildx.outputs.name }}
|
||||||
|
context: .
|
||||||
|
file: Dockerfile
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
standardnotes/server:latest
|
||||||
|
standardnotes/server:${{ github.sha }}
|
||||||
@@ -17,9 +17,6 @@ on:
|
|||||||
required: false
|
required: false
|
||||||
default: true
|
default: true
|
||||||
type: boolean
|
type: boolean
|
||||||
e2e_tag_parameter_name:
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
package_path:
|
package_path:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
@@ -36,177 +33,11 @@ on:
|
|||||||
required: true
|
required: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
outputs:
|
|
||||||
temp_dir: ${{ steps.bundle-dir.outputs.temp_dir }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Create Bundle Dir
|
|
||||||
id: bundle-dir
|
|
||||||
run: echo "temp_dir=$(mktemp -d -t ${{ inputs.service_name }}-${{ github.sha }}-XXXXXXX)" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Cache build
|
|
||||||
id: cache-build
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
packages/**/dist
|
|
||||||
${{ steps.bundle-dir.outputs.temp_dir }}
|
|
||||||
key: ${{ runner.os }}-${{ inputs.service_name }}-build-${{ github.sha }}
|
|
||||||
|
|
||||||
- name: Set up Node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
registry-url: 'https://registry.npmjs.org'
|
|
||||||
node-version-file: '.nvmrc'
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: yarn build ${{ inputs.package_path }}
|
|
||||||
|
|
||||||
- name: Bundle
|
|
||||||
run: yarn workspace ${{ inputs.workspace_name }} bundle --no-compress --output-directory ${{ steps.bundle-dir.outputs.temp_dir }}
|
|
||||||
|
|
||||||
lint:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
needs: build
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Cache build
|
|
||||||
id: cache-build
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
packages/**/dist
|
|
||||||
${{ needs.build.outputs.temp_dir }}
|
|
||||||
key: ${{ runner.os }}-${{ inputs.service_name }}-build-${{ github.sha }}
|
|
||||||
|
|
||||||
- name: Set up Node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
registry-url: 'https://registry.npmjs.org'
|
|
||||||
node-version-file: '.nvmrc'
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
if: steps.cache-build.outputs.cache-hit != 'true'
|
|
||||||
run: yarn build ${{ inputs.package_path }}
|
|
||||||
|
|
||||||
- name: Lint
|
|
||||||
run: yarn lint:${{ inputs.service_name }}
|
|
||||||
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
needs: build
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Cache build
|
|
||||||
id: cache-build
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
packages/**/dist
|
|
||||||
${{ needs.build.outputs.temp_dir }}
|
|
||||||
key: ${{ runner.os }}-${{ inputs.service_name }}-build-${{ github.sha }}
|
|
||||||
|
|
||||||
- name: Set up Node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
registry-url: 'https://registry.npmjs.org'
|
|
||||||
node-version-file: '.nvmrc'
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
if: steps.cache-build.outputs.cache-hit != 'true'
|
|
||||||
run: yarn build ${{ inputs.package_path }}
|
|
||||||
|
|
||||||
- name: Test
|
|
||||||
run: yarn test ${{ inputs.package_path }}
|
|
||||||
|
|
||||||
e2e:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
needs: build
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Cache build
|
|
||||||
id: cache-build
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
packages/**/dist
|
|
||||||
${{ needs.build.outputs.temp_dir }}
|
|
||||||
key: ${{ runner.os }}-${{ inputs.service_name }}-build-${{ github.sha }}
|
|
||||||
|
|
||||||
- name: Set up Node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
registry-url: 'https://registry.npmjs.org'
|
|
||||||
node-version-file: '.nvmrc'
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
if: steps.cache-build.outputs.cache-hit != 'true'
|
|
||||||
run: yarn build ${{ inputs.package_path }}
|
|
||||||
|
|
||||||
- name: Bundle
|
|
||||||
if: steps.cache-build.outputs.cache-hit != 'true'
|
|
||||||
run: yarn workspace ${{ inputs.workspace_name }} bundle --no-compress --output-directory ${{ needs.build.outputs.temp_dir }}
|
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@master
|
|
||||||
with:
|
|
||||||
platforms: all
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
id: buildx
|
|
||||||
uses: docker/setup-buildx-action@master
|
|
||||||
|
|
||||||
- name: Publish Docker image for E2E testing
|
|
||||||
uses: docker/build-push-action@v3
|
|
||||||
with:
|
|
||||||
builder: ${{ steps.buildx.outputs.name }}
|
|
||||||
context: ${{ needs.build.outputs.temp_dir }}
|
|
||||||
file: ${{ needs.build.outputs.temp_dir }}/${{ inputs.package_path }}/Dockerfile
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
push: true
|
|
||||||
tags: standardnotes/${{ inputs.service_name }}:${{ github.sha }}
|
|
||||||
|
|
||||||
- name: Run E2E test suite
|
|
||||||
uses: convictional/trigger-workflow-and-wait@master
|
|
||||||
with:
|
|
||||||
owner: standardnotes
|
|
||||||
repo: self-hosted
|
|
||||||
github_token: ${{ secrets.CI_PAT_TOKEN }}
|
|
||||||
workflow_file_name: testing-with-updating-client-and-server.yml
|
|
||||||
wait_interval: 30
|
|
||||||
client_payload: '{"${{ inputs.e2e_tag_parameter_name }}": "${{ github.sha }}"}'
|
|
||||||
propagate_failure: true
|
|
||||||
trigger_workflow: true
|
|
||||||
wait_workflow: true
|
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
needs: [ build, test, lint, e2e ]
|
|
||||||
|
|
||||||
name: Publish Docker Image
|
name: Publish Docker Image
|
||||||
uses: standardnotes/server/.github/workflows/common-docker-image.yml@main
|
uses: standardnotes/server/.github/workflows/common-docker-image.yml@main
|
||||||
with:
|
with:
|
||||||
service_name: ${{ inputs.service_name }}
|
service_name: ${{ inputs.service_name }}
|
||||||
bundle_dir: ${{ needs.build.outputs.temp_dir }}
|
|
||||||
package_path: ${{ inputs.package_path }}
|
package_path: ${{ inputs.package_path }}
|
||||||
workspace_name: ${{ inputs.workspace_name }}
|
workspace_name: ${{ inputs.workspace_name }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|||||||
@@ -1,164 +0,0 @@
|
|||||||
name: Reusable Server Utility Workflow
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
service_name:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
workspace_name:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
deploy_web:
|
|
||||||
required: false
|
|
||||||
default: true
|
|
||||||
type: boolean
|
|
||||||
deploy_worker:
|
|
||||||
required: false
|
|
||||||
default: true
|
|
||||||
type: boolean
|
|
||||||
package_path:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
secrets:
|
|
||||||
DOCKER_USERNAME:
|
|
||||||
required: true
|
|
||||||
DOCKER_PASSWORD:
|
|
||||||
required: true
|
|
||||||
CI_PAT_TOKEN:
|
|
||||||
required: true
|
|
||||||
AWS_ACCESS_KEY_ID:
|
|
||||||
required: true
|
|
||||||
AWS_SECRET_ACCESS_KEY:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
outputs:
|
|
||||||
temp_dir: ${{ steps.bundle-dir.outputs.temp_dir }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Create Bundle Dir
|
|
||||||
id: bundle-dir
|
|
||||||
run: echo "temp_dir=$(mktemp -d -t ${{ inputs.service_name }}-${{ github.sha }}-XXXXXXX)" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Cache build
|
|
||||||
id: cache-build
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
packages/**/dist
|
|
||||||
${{ steps.bundle-dir.outputs.temp_dir }}
|
|
||||||
key: ${{ runner.os }}-${{ inputs.service_name }}-build-${{ github.sha }}
|
|
||||||
|
|
||||||
- name: Set up Node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
registry-url: 'https://registry.npmjs.org'
|
|
||||||
node-version-file: '.nvmrc'
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: yarn build ${{ inputs.package_path }}
|
|
||||||
|
|
||||||
- name: Bundle
|
|
||||||
run: yarn workspace ${{ inputs.workspace_name }} bundle --no-compress --output-directory ${{ steps.bundle-dir.outputs.temp_dir }}
|
|
||||||
|
|
||||||
lint:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
needs: build
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Cache build
|
|
||||||
id: cache-build
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
packages/**/dist
|
|
||||||
${{ needs.build.outputs.temp_dir }}
|
|
||||||
key: ${{ runner.os }}-${{ inputs.service_name }}-build-${{ github.sha }}
|
|
||||||
|
|
||||||
- name: Set up Node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
registry-url: 'https://registry.npmjs.org'
|
|
||||||
node-version-file: '.nvmrc'
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
if: steps.cache-build.outputs.cache-hit != 'true'
|
|
||||||
run: yarn build ${{ inputs.package_path }}
|
|
||||||
|
|
||||||
- name: Lint
|
|
||||||
run: yarn lint:${{ inputs.service_name }}
|
|
||||||
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
needs: build
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Cache build
|
|
||||||
id: cache-build
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
packages/**/dist
|
|
||||||
${{ needs.build.outputs.temp_dir }}
|
|
||||||
key: ${{ runner.os }}-${{ inputs.service_name }}-build-${{ github.sha }}
|
|
||||||
|
|
||||||
- name: Set up Node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
registry-url: 'https://registry.npmjs.org'
|
|
||||||
node-version-file: '.nvmrc'
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
if: steps.cache-build.outputs.cache-hit != 'true'
|
|
||||||
run: yarn build ${{ inputs.package_path }}
|
|
||||||
|
|
||||||
- name: Test
|
|
||||||
run: yarn test ${{ inputs.package_path }}
|
|
||||||
|
|
||||||
publish:
|
|
||||||
needs: [ build, test, lint ]
|
|
||||||
|
|
||||||
name: Publish Docker Image
|
|
||||||
uses: standardnotes/server/.github/workflows/common-docker-image.yml@main
|
|
||||||
with:
|
|
||||||
service_name: ${{ inputs.service_name }}
|
|
||||||
bundle_dir: ${{ needs.build.outputs.temp_dir }}
|
|
||||||
package_path: ${{ inputs.package_path }}
|
|
||||||
workspace_name: ${{ inputs.workspace_name }}
|
|
||||||
secrets: inherit
|
|
||||||
|
|
||||||
deploy-web:
|
|
||||||
if: ${{ inputs.deploy_web }}
|
|
||||||
|
|
||||||
needs: publish
|
|
||||||
|
|
||||||
name: Deploy Web
|
|
||||||
uses: standardnotes/server/.github/workflows/common-deploy.yml@main
|
|
||||||
with:
|
|
||||||
service_name: ${{ inputs.service_name }}
|
|
||||||
docker_image: ${{ inputs.service_name }}:${{ github.sha }}
|
|
||||||
secrets: inherit
|
|
||||||
|
|
||||||
deploy-worker:
|
|
||||||
if: ${{ inputs.deploy_worker }}
|
|
||||||
|
|
||||||
needs: publish
|
|
||||||
|
|
||||||
name: Deploy Worker
|
|
||||||
uses: standardnotes/server/.github/workflows/common-deploy.yml@main
|
|
||||||
with:
|
|
||||||
service_name: ${{ inputs.service_name }}-worker
|
|
||||||
docker_image: ${{ inputs.service_name }}:${{ github.sha }}
|
|
||||||
secrets: inherit
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
name: E2E Test Suite On Self Hosted Server
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
snjs_image_tag:
|
||||||
|
type: string
|
||||||
|
default: latest
|
||||||
|
description: The Docker image tag used for SNJS container
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
e2e:
|
||||||
|
name: E2E
|
||||||
|
uses: standardnotes/server/.github/workflows/common-e2e.yml@main
|
||||||
|
with:
|
||||||
|
snjs_image_tag: ${{ inputs.snjs_image_tag }}
|
||||||
|
secrets: inherit
|
||||||
@@ -11,9 +11,9 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
call_server_utility_workflow:
|
call_server_application_workflow:
|
||||||
name: Server Utility
|
name: Server Application
|
||||||
uses: standardnotes/server/.github/workflows/common-server-utility.yml@main
|
uses: standardnotes/server/.github/workflows/common-server-application.yml@main
|
||||||
with:
|
with:
|
||||||
service_name: event-store
|
service_name: event-store
|
||||||
workspace_name: "@standardnotes/event-store"
|
workspace_name: "@standardnotes/event-store"
|
||||||
@@ -22,7 +22,7 @@ jobs:
|
|||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
newrelic:
|
newrelic:
|
||||||
needs: call_server_utility_workflow
|
needs: call_server_application_workflow
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
service_name: files
|
service_name: files
|
||||||
workspace_name: "@standardnotes/files-server"
|
workspace_name: "@standardnotes/files-server"
|
||||||
e2e_tag_parameter_name: files_image_tag
|
|
||||||
package_path: packages/files
|
package_path: packages/files
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
|
|||||||
@@ -89,81 +89,8 @@ jobs:
|
|||||||
run: yarn test
|
run: yarn test
|
||||||
|
|
||||||
e2e:
|
e2e:
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
application:
|
|
||||||
- { "service_name": "api-gateway", "workspace_name": "@standardnotes/api-gateway", "e2e_tag_parameter_name": "api_gateway_image_tag", "package_path": "packages/api-gateway" }
|
|
||||||
- { "service_name": "auth", "workspace_name": "@standardnotes/auth-server", "e2e_tag_parameter_name": "auth_image_tag", "package_path": "packages/auth" }
|
|
||||||
- { "service_name": "files", "workspace_name": "@standardnotes/files-server", "e2e_tag_parameter_name": "files_image_tag", "package_path": "packages/files" }
|
|
||||||
- { "service_name": "revisions", "workspace_name": "@standardnotes/revisions-server", "e2e_tag_parameter_name": "revisions_image_tag", "package_path": "packages/revisions"}
|
|
||||||
- { "service_name": "syncing-server-js", "workspace_name": "@standardnotes/syncing-server", "e2e_tag_parameter_name": "syncing_server_js_image_tag", "package_path": "packages/syncing-server" }
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
needs: build
|
needs: build
|
||||||
|
|
||||||
steps:
|
name: E2E
|
||||||
- uses: actions/checkout@v3
|
uses: standardnotes/server/.github/workflows/common-e2e.yml@main
|
||||||
|
secrets: inherit
|
||||||
- name: Create Bundle Dir
|
|
||||||
id: bundle-dir
|
|
||||||
run: echo "temp_dir=$(mktemp -d -t ${{ matrix.application.service_name }}-${{ github.sha }}-XXXXXXX)" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Cache build
|
|
||||||
id: cache-build
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
packages/**/dist
|
|
||||||
${{ needs.e2e.outputs.temp_dir }}
|
|
||||||
key: ${{ runner.os }}-build-${{ github.sha }}
|
|
||||||
|
|
||||||
- name: Set up Node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
registry-url: 'https://registry.npmjs.org'
|
|
||||||
node-version-file: '.nvmrc'
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
if: steps.cache-build.outputs.cache-hit != 'true'
|
|
||||||
run: yarn build
|
|
||||||
|
|
||||||
- name: Bundle
|
|
||||||
run: yarn workspace ${{ matrix.application.workspace_name }} bundle --no-compress --output-directory ${{ steps.bundle-dir.outputs.temp_dir }}
|
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@master
|
|
||||||
with:
|
|
||||||
platforms: all
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
id: buildx
|
|
||||||
uses: docker/setup-buildx-action@master
|
|
||||||
|
|
||||||
- name: Publish Docker image for E2E testing
|
|
||||||
uses: docker/build-push-action@v3
|
|
||||||
with:
|
|
||||||
builder: ${{ steps.buildx.outputs.name }}
|
|
||||||
context: ${{ steps.bundle-dir.outputs.temp_dir }}
|
|
||||||
file: ${{ steps.bundle-dir.outputs.temp_dir }}/${{ matrix.application.package_path }}/Dockerfile
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
push: true
|
|
||||||
tags: standardnotes/${{ matrix.application.service_name }}:${{ github.sha }}
|
|
||||||
|
|
||||||
- name: Run E2E test suite
|
|
||||||
uses: convictional/trigger-workflow-and-wait@master
|
|
||||||
with:
|
|
||||||
owner: standardnotes
|
|
||||||
repo: self-hosted
|
|
||||||
github_token: ${{ secrets.CI_PAT_TOKEN }}
|
|
||||||
workflow_file_name: testing-with-updating-client-and-server.yml
|
|
||||||
wait_interval: 30
|
|
||||||
client_payload: '{"${{ matrix.application.e2e_tag_parameter_name }}": "${{ github.sha }}"}'
|
|
||||||
propagate_failure: true
|
|
||||||
trigger_workflow: true
|
|
||||||
wait_workflow: true
|
|
||||||
|
|||||||
@@ -5,9 +5,98 @@ on:
|
|||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release_and_publish:
|
build:
|
||||||
if: contains(github.event.head_commit.message, 'chore(release)') == false
|
if: contains(github.event.head_commit.message, 'chore(release)') == false
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Cache build
|
||||||
|
id: cache-build
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
packages/**/dist
|
||||||
|
key: ${{ runner.os }}-build-${{ github.sha }}
|
||||||
|
|
||||||
|
- name: Set up Node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: yarn build
|
||||||
|
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
needs: build
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Cache build
|
||||||
|
id: cache-build
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
packages/**/dist
|
||||||
|
${{ needs.build.outputs.temp_dir }}
|
||||||
|
key: ${{ runner.os }}-build-${{ github.sha }}
|
||||||
|
|
||||||
|
- name: Set up Node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
if: steps.cache-build.outputs.cache-hit != 'true'
|
||||||
|
run: yarn build
|
||||||
|
|
||||||
|
- name: Lint
|
||||||
|
run: yarn lint
|
||||||
|
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
needs: build
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Cache build
|
||||||
|
id: cache-build
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
packages/**/dist
|
||||||
|
${{ needs.build.outputs.temp_dir }}
|
||||||
|
key: ${{ runner.os }}-build-${{ github.sha }}
|
||||||
|
|
||||||
|
- name: Set up Node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
if: steps.cache-build.outputs.cache-hit != 'true'
|
||||||
|
run: yarn build
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: yarn test
|
||||||
|
|
||||||
|
publish-self-hosting:
|
||||||
|
needs: [ test, lint ]
|
||||||
|
name: Publish Self Hosting Docker Image
|
||||||
|
uses: standardnotes/server/.github/workflows/common-self-hosting.yml@main
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
publish-services:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: publish-self-hosting
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@@ -34,7 +123,8 @@ jobs:
|
|||||||
registry-url: 'https://registry.npmjs.org'
|
registry-url: 'https://registry.npmjs.org'
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
|
|
||||||
- name: Build packages
|
- name: Build
|
||||||
|
if: steps.cache-build.outputs.cache-hit != 'true'
|
||||||
run: yarn build
|
run: yarn build
|
||||||
|
|
||||||
- name: Bump version
|
- name: Bump version
|
||||||
@@ -44,4 +134,3 @@ jobs:
|
|||||||
run: yarn publish
|
run: yarn publish
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.CI_NPM_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.CI_NPM_TOKEN }}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
service_name: revisions
|
service_name: revisions
|
||||||
workspace_name: "@standardnotes/revisions-server"
|
workspace_name: "@standardnotes/revisions-server"
|
||||||
e2e_tag_parameter_name: revisions_image_tag
|
|
||||||
package_path: packages/revisions
|
package_path: packages/revisions
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
call_server_utility_workflow:
|
call_server_application_workflow:
|
||||||
name: Server Utility
|
name: Server Application
|
||||||
uses: standardnotes/server/.github/workflows/common-server-utility.yml@main
|
uses: standardnotes/server/.github/workflows/common-server-application.yml@main
|
||||||
with:
|
with:
|
||||||
service_name: scheduler
|
service_name: scheduler
|
||||||
workspace_name: "@standardnotes/scheduler-server"
|
workspace_name: "@standardnotes/scheduler-server"
|
||||||
@@ -22,7 +22,7 @@ jobs:
|
|||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
newrelic:
|
newrelic:
|
||||||
needs: call_server_utility_workflow
|
needs: call_server_application_workflow
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
service_name: syncing-server-js
|
service_name: syncing-server-js
|
||||||
workspace_name: "@standardnotes/syncing-server"
|
workspace_name: "@standardnotes/syncing-server"
|
||||||
e2e_tag_parameter_name: syncing_server_js_image_tag
|
|
||||||
package_path: packages/syncing-server
|
package_path: packages/syncing-server
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
call_server_utility_workflow:
|
call_server_application_workflow:
|
||||||
name: Server Utility
|
name: Server Application
|
||||||
uses: standardnotes/server/.github/workflows/common-server-utility.yml@main
|
uses: standardnotes/server/.github/workflows/common-server-application.yml@main
|
||||||
with:
|
with:
|
||||||
service_name: websockets
|
service_name: websockets
|
||||||
workspace_name: "@standardnotes/websockets-server"
|
workspace_name: "@standardnotes/websockets-server"
|
||||||
@@ -21,7 +21,7 @@ jobs:
|
|||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
newrelic:
|
newrelic:
|
||||||
needs: call_server_utility_workflow
|
needs: call_server_application_workflow
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
call_server_utility_workflow:
|
call_server_application_workflow:
|
||||||
name: Server Utility
|
name: Server Application
|
||||||
uses: standardnotes/server/.github/workflows/common-server-utility.yml@main
|
uses: standardnotes/server/.github/workflows/common-server-application.yml@main
|
||||||
with:
|
with:
|
||||||
service_name: workspace
|
service_name: workspace
|
||||||
workspace_name: "@standardnotes/workspace-server"
|
workspace_name: "@standardnotes/workspace-server"
|
||||||
@@ -21,7 +21,7 @@ jobs:
|
|||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
newrelic:
|
newrelic:
|
||||||
needs: call_server_utility_workflow
|
needs: call_server_application_workflow
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
@@ -20,3 +20,8 @@ packages/files/uploads/*
|
|||||||
|
|
||||||
data/*
|
data/*
|
||||||
!data/.gitkeep
|
!data/.gitkeep
|
||||||
|
|
||||||
|
logs/*
|
||||||
|
!logs/.gitkeep
|
||||||
|
|
||||||
|
docker-compose.yml
|
||||||
|
|||||||
+42
@@ -0,0 +1,42 @@
|
|||||||
|
FROM node:18.13.0-alpine
|
||||||
|
|
||||||
|
ENV NODE_ENV production
|
||||||
|
|
||||||
|
RUN apk add --update --no-cache \
|
||||||
|
openssl \
|
||||||
|
curl \
|
||||||
|
bash \
|
||||||
|
py3-pip
|
||||||
|
|
||||||
|
RUN pip install --no-cache-dir --upgrade supervisor
|
||||||
|
|
||||||
|
RUN mkdir -p /var/lib/server/logs
|
||||||
|
|
||||||
|
COPY docker/supervisord.conf /etc/supervisord.conf
|
||||||
|
|
||||||
|
COPY docker/docker-entrypoint.sh /usr/local/bin/
|
||||||
|
|
||||||
|
COPY . /opt/server
|
||||||
|
|
||||||
|
WORKDIR /opt/server
|
||||||
|
|
||||||
|
RUN corepack enable
|
||||||
|
|
||||||
|
RUN yarn install --immutable
|
||||||
|
|
||||||
|
RUN CI=true yarn build
|
||||||
|
|
||||||
|
RUN mkdir -p \
|
||||||
|
/opt/bundled/syncing-server \
|
||||||
|
/opt/bundled/auth \
|
||||||
|
/opt/bundled/files \
|
||||||
|
/opt/bundled/revisions \
|
||||||
|
/opt/bundled/api-gateway
|
||||||
|
|
||||||
|
RUN yarn workspace @standardnotes/syncing-server bundle --no-compress --output-directory /opt/bundled/syncing-server
|
||||||
|
RUN yarn workspace @standardnotes/auth-server bundle --no-compress --output-directory /opt/bundled/auth
|
||||||
|
RUN yarn workspace @standardnotes/files-server bundle --no-compress --output-directory /opt/bundled/files
|
||||||
|
RUN yarn workspace @standardnotes/revisions-server bundle --no-compress --output-directory /opt/bundled/revisions
|
||||||
|
RUN yarn workspace @standardnotes/api-gateway bundle --no-compress --output-directory /opt/bundled/api-gateway
|
||||||
|
|
||||||
|
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
services:
|
||||||
|
server:
|
||||||
|
build: .
|
||||||
|
env_file: .github/ci.env
|
||||||
|
container_name: server-ci
|
||||||
|
ports:
|
||||||
|
- 3123:3000
|
||||||
|
- 3125:3104
|
||||||
|
volumes:
|
||||||
|
- ./logs:/var/lib/server/logs
|
||||||
|
networks:
|
||||||
|
- standardnotes_self_hosted
|
||||||
|
|
||||||
|
localstack:
|
||||||
|
image: localstack/localstack:1.3
|
||||||
|
container_name: localstack-ci
|
||||||
|
expose:
|
||||||
|
- 4566
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
- SERVICES=sns,sqs
|
||||||
|
- DOCKER_HOST=unix:///var/run/docker.sock
|
||||||
|
- HOSTNAME_EXTERNAL=localstack
|
||||||
|
- LS_LOG=warn
|
||||||
|
volumes:
|
||||||
|
- ./docker/localstack_bootstrap.sh:/etc/localstack/init/ready.d/localstack_bootstrap.sh
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
networks:
|
||||||
|
- standardnotes_self_hosted
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: mysql:8
|
||||||
|
container_name: db-ci
|
||||||
|
env_file: .github/ci.env
|
||||||
|
expose:
|
||||||
|
- 3306
|
||||||
|
restart: unless-stopped
|
||||||
|
command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci
|
||||||
|
volumes:
|
||||||
|
- ./data/mysql:/var/lib/mysql
|
||||||
|
- ./data/import:/docker-entrypoint-initdb.d
|
||||||
|
networks:
|
||||||
|
- standardnotes_self_hosted
|
||||||
|
|
||||||
|
cache:
|
||||||
|
image: redis:6.0-alpine
|
||||||
|
container_name: cache-ci
|
||||||
|
volumes:
|
||||||
|
- ./data/redis/:/data
|
||||||
|
expose:
|
||||||
|
- 6379
|
||||||
|
restart: unless-stopped
|
||||||
|
networks:
|
||||||
|
- standardnotes_self_hosted
|
||||||
|
|
||||||
|
networks:
|
||||||
|
standardnotes_self_hosted:
|
||||||
|
name: standardnotes_self_hosted
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
services:
|
||||||
|
server:
|
||||||
|
image: standardnotes/server
|
||||||
|
env_file: .env.sample
|
||||||
|
container_name: server_self_hosted
|
||||||
|
ports:
|
||||||
|
- 3000:3000
|
||||||
|
- 3125:3104
|
||||||
|
volumes:
|
||||||
|
- ./logs:/var/lib/server/logs
|
||||||
|
networks:
|
||||||
|
- standardnotes_self_hosted
|
||||||
|
|
||||||
|
localstack:
|
||||||
|
image: localstack/localstack:1.3
|
||||||
|
container_name: localstack_self_hosted
|
||||||
|
expose:
|
||||||
|
- 4566
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
- SERVICES=sns,sqs
|
||||||
|
- DOCKER_HOST=unix:///var/run/docker.sock
|
||||||
|
- HOSTNAME_EXTERNAL=localstack
|
||||||
|
- LS_LOG=warn
|
||||||
|
volumes:
|
||||||
|
- ./docker/localstack_bootstrap.sh:/etc/localstack/init/ready.d/localstack_bootstrap.sh
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
networks:
|
||||||
|
- standardnotes_self_hosted
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: mysql:8
|
||||||
|
container_name: db_self_hosted
|
||||||
|
environment:
|
||||||
|
- MYSQL_DATABASE=standard_notes_db
|
||||||
|
- MYSQL_USER=std_notes_user
|
||||||
|
- MYSQL_ROOT_PASSWORD=changeme123
|
||||||
|
- MYSQL_PASSWORD=changeme123
|
||||||
|
expose:
|
||||||
|
- 3306
|
||||||
|
restart: unless-stopped
|
||||||
|
command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci
|
||||||
|
volumes:
|
||||||
|
- ./data/mysql:/var/lib/mysql
|
||||||
|
- ./data/import:/docker-entrypoint-initdb.d
|
||||||
|
networks:
|
||||||
|
- standardnotes_self_hosted
|
||||||
|
|
||||||
|
cache:
|
||||||
|
image: redis:6.0-alpine
|
||||||
|
container_name: cache_self_hosted
|
||||||
|
volumes:
|
||||||
|
- ./data/redis/:/data
|
||||||
|
expose:
|
||||||
|
- 6379
|
||||||
|
restart: unless-stopped
|
||||||
|
networks:
|
||||||
|
- standardnotes_self_hosted
|
||||||
|
|
||||||
|
networks:
|
||||||
|
standardnotes_self_hosted:
|
||||||
|
name: standardnotes_self_hosted
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
version: '3.8'
|
|
||||||
services:
|
|
||||||
db:
|
|
||||||
image: mysql:5.6
|
|
||||||
environment:
|
|
||||||
MYSQL_DATABASE: '${DB_DATABASE}'
|
|
||||||
MYSQL_USER: '${DB_USERNAME}'
|
|
||||||
MYSQL_PASSWORD: '${DB_PASSWORD}'
|
|
||||||
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
|
|
||||||
expose:
|
|
||||||
- ${DB_PORT}:3306
|
|
||||||
restart: unless-stopped
|
|
||||||
command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8 --collation-server=utf8_general_ci
|
|
||||||
volumes:
|
|
||||||
- ./data/mysql:/var/lib/mysql
|
|
||||||
- ./data/import:/docker-entrypoint-initdb.d
|
|
||||||
|
|
||||||
cache:
|
|
||||||
image: redis:6.0-alpine
|
|
||||||
volumes:
|
|
||||||
- ./data/redis/:/data
|
|
||||||
expose:
|
|
||||||
- ${REDIS_PORT}:6379
|
|
||||||
restart: unless-stopped
|
|
||||||
Executable
+370
@@ -0,0 +1,370 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Setup environment variables
|
||||||
|
|
||||||
|
#########
|
||||||
|
# PORTS #
|
||||||
|
#########
|
||||||
|
|
||||||
|
export API_GATEWAY_PORT=3000
|
||||||
|
|
||||||
|
if [ -z "$SYNCING_SERVER_PORT" ]; then
|
||||||
|
export SYNCING_SERVER_PORT=3101
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$AUTH_SERVER_PORT" ]; then
|
||||||
|
export AUTH_SERVER_PORT=3103
|
||||||
|
fi
|
||||||
|
|
||||||
|
export FILES_SERVER_PORT=3104
|
||||||
|
|
||||||
|
if [ -z "$REVISIONS_SERVER_PORT" ]; then
|
||||||
|
export REVISIONS_SERVER_PORT=3105
|
||||||
|
fi
|
||||||
|
|
||||||
|
######
|
||||||
|
# DB #
|
||||||
|
######
|
||||||
|
|
||||||
|
if [ -z "$DB_HOST" ]; then
|
||||||
|
export DB_HOST="db"
|
||||||
|
fi
|
||||||
|
if [ -z "$DB_PORT" ]; then
|
||||||
|
export DB_PORT="3306"
|
||||||
|
fi
|
||||||
|
if [ -z "$DB_USERNAME" ]; then
|
||||||
|
export DB_USERNAME="std_notes_user"
|
||||||
|
fi
|
||||||
|
if [ -z "$DB_PASSWORD" ]; then
|
||||||
|
export DB_PASSWORD=$(openssl rand -hex 32)
|
||||||
|
fi
|
||||||
|
if [ -z "$DB_DATABASE" ]; then
|
||||||
|
export DB_DATABASE="standard_notes_db"
|
||||||
|
fi
|
||||||
|
if [ -z "$DB_DEBUG_LEVEL" ]; then
|
||||||
|
export DB_DEBUG_LEVEL="all"
|
||||||
|
fi
|
||||||
|
if [ -z "$DB_MIGRATIONS_PATH" ]; then
|
||||||
|
export DB_MIGRATIONS_PATH="dist/migrations/*.js"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#########
|
||||||
|
# CACHE #
|
||||||
|
#########
|
||||||
|
|
||||||
|
if [ -z "$REDIS_PORT" ]; then
|
||||||
|
export REDIS_PORT=6379
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$REDIS_HOST" ]; then
|
||||||
|
export REDIS_HOST="cache"
|
||||||
|
fi
|
||||||
|
|
||||||
|
export REDIS_URL="redis://$REDIS_HOST"
|
||||||
|
|
||||||
|
##########
|
||||||
|
# SHARED #
|
||||||
|
##########
|
||||||
|
|
||||||
|
if [ -z "$AUTH_JWT_SECRET" ]; then
|
||||||
|
export AUTH_JWT_SECRET=$(openssl rand -hex 32)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$VALET_TOKEN_SECRET" ]; then
|
||||||
|
export VALET_TOKEN_SECRET=$(openssl rand -base64 32)
|
||||||
|
fi
|
||||||
|
|
||||||
|
########
|
||||||
|
# AUTH #
|
||||||
|
########
|
||||||
|
|
||||||
|
if [ -z "$AUTH_SERVER_LOG_LEVEL" ]; then
|
||||||
|
export AUTH_SERVER_LOG_LEVEL="info"
|
||||||
|
fi
|
||||||
|
export AUTH_SERVER_NODE_ENV="production"
|
||||||
|
export AUTH_SERVER_VERSION="local"
|
||||||
|
|
||||||
|
if [ -z "$AUTH_SERVER_AUTH_JWT_TTL" ]; then
|
||||||
|
export AUTH_SERVER_AUTH_JWT_TTL=60000
|
||||||
|
fi
|
||||||
|
|
||||||
|
export AUTH_SERVER_JWT_SECRET=$AUTH_JWT_SECRET
|
||||||
|
export AUTH_SERVER_LEGACY_JWT_SECRET=$(openssl rand -hex 32)
|
||||||
|
|
||||||
|
export AUTH_SERVER_NEW_RELIC_ENABLED=false
|
||||||
|
export AUTH_SERVER_NEW_RELIC_APP_NAME=Auth
|
||||||
|
export AUTH_SERVER_NEW_RELIC_NO_CONFIG_FILE=true
|
||||||
|
|
||||||
|
if [ -z "$AUTH_SERVER_DISABLE_USER_REGISTRATION" ]; then
|
||||||
|
export AUTH_SERVER_DISABLE_USER_REGISTRATION=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$AUTH_SERVER_PSEUDO_KEY_PARAMS_KEY" ]; then
|
||||||
|
export AUTH_SERVER_PSEUDO_KEY_PARAMS_KEY=$(openssl rand -hex 32)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$AUTH_SERVER_ACCESS_TOKEN_AGE" ]; then
|
||||||
|
export AUTH_SERVER_ACCESS_TOKEN_AGE=5184000
|
||||||
|
fi
|
||||||
|
if [ -z "$AUTH_SERVER_REFRESH_TOKEN_AGE" ]; then
|
||||||
|
export AUTH_SERVER_REFRESH_TOKEN_AGE=31556926
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$AUTH_SERVER_MAX_LOGIN_ATTEMPTS" ]; then
|
||||||
|
export AUTH_SERVER_MAX_LOGIN_ATTEMPTS=6
|
||||||
|
fi
|
||||||
|
if [ -z "$AUTH_SERVER_FAILED_LOGIN_LOCKOUT" ]; then
|
||||||
|
export AUTH_SERVER_FAILED_LOGIN_LOCKOUT=3600
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$AUTH_SERVER_EPHEMERAL_SESSION_AGE" ]; then
|
||||||
|
export AUTH_SERVER_EPHEMERAL_SESSION_AGE=259200
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$AUTH_SERVER_ENCRYPTION_SERVER_KEY" ]; then
|
||||||
|
export AUTH_SERVER_ENCRYPTION_SERVER_KEY=$(openssl rand -hex 32)
|
||||||
|
fi
|
||||||
|
|
||||||
|
export AUTH_SERVER_SYNCING_SERVER_URL=http://localhost:$SYNCING_SERVER_PORT
|
||||||
|
|
||||||
|
# File Uploads
|
||||||
|
if [ -z "$AUTH_SERVER_VALET_TOKEN_TTL" ]; then
|
||||||
|
export AUTH_SERVER_VALET_TOKEN_TTL=7200
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Localstack Setup
|
||||||
|
if [ -z "$AUTH_SERVER_SNS_TOPIC_ARN" ]; then
|
||||||
|
export AUTH_SERVER_SNS_TOPIC_ARN="arn:aws:sns:us-east-1:000000000000:auth-local-topic"
|
||||||
|
fi
|
||||||
|
if [ -z "$AUTH_SERVER_SNS_ENDPOINT" ]; then
|
||||||
|
export AUTH_SERVER_SNS_ENDPOINT="http://localstack:4566"
|
||||||
|
fi
|
||||||
|
if [ -z "$AUTH_SERVER_SNS_SECRET_ACCESS_KEY" ]; then
|
||||||
|
export AUTH_SERVER_SNS_SECRET_ACCESS_KEY="x"
|
||||||
|
fi
|
||||||
|
if [ -z "$AUTH_SERVER_SNS_ACCESS_KEY_ID" ]; then
|
||||||
|
export AUTH_SERVER_SNS_ACCESS_KEY_ID="x"
|
||||||
|
fi
|
||||||
|
if [ -z "$AUTH_SERVER_SNS_AWS_REGION" ]; then
|
||||||
|
export AUTH_SERVER_SNS_AWS_REGION="us-east-1"
|
||||||
|
fi
|
||||||
|
if [ -z "$AUTH_SERVER_SQS_QUEUE_URL" ]; then
|
||||||
|
export AUTH_SERVER_SQS_QUEUE_URL="http://localstack:4566/000000000000/auth-local-queue"
|
||||||
|
fi
|
||||||
|
if [ -z "$AUTH_SERVER_SQS_AWS_REGION" ]; then
|
||||||
|
export AUTH_SERVER_SQS_AWS_REGION="us-east-1"
|
||||||
|
fi
|
||||||
|
if [ -z "$AUTH_SERVER_SQS_ACCESS_KEY_ID" ]; then
|
||||||
|
export AUTH_SERVER_SQS_ACCESS_KEY_ID="x"
|
||||||
|
fi
|
||||||
|
if [ -z "$AUTH_SERVER_SQS_SECRET_ACCESS_KEY" ]; then
|
||||||
|
export AUTH_SERVER_SQS_SECRET_ACCESS_KEY="x"
|
||||||
|
fi
|
||||||
|
if [ -z "$AUTH_SERVER_SQS_ENDPOINT" ]; then
|
||||||
|
export AUTH_SERVER_SQS_ENDPOINT="http://localstack:4566"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# U2F Setup
|
||||||
|
if [ -z "$AUTH_SERVER_U2F_RELYING_PARTY_ID" ]; then
|
||||||
|
export AUTH_SERVER_U2F_RELYING_PARTY_ID="localhost"
|
||||||
|
fi
|
||||||
|
if [ -z "$AUTH_SERVER_U2F_RELYING_PARTY_NAME" ]; then
|
||||||
|
export AUTH_SERVER_U2F_RELYING_PARTY_NAME="Standard Notes"
|
||||||
|
fi
|
||||||
|
if [ -z "$AUTH_SERVER_U2F_EXPECTED_ORIGIN" ]; then
|
||||||
|
export AUTH_SERVER_U2F_EXPECTED_ORIGIN="http://localhost,http://localhost:3001"
|
||||||
|
fi
|
||||||
|
if [ -z "$AUTH_SERVER_U2F_REQUIRE_USER_VERIFICATION" ]; then
|
||||||
|
export AUTH_SERVER_U2F_REQUIRE_USER_VERIFICATION=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
printenv | grep AUTH_SERVER_ | sed 's/AUTH_SERVER_//g' > /opt/bundled/auth/packages/auth/.env
|
||||||
|
|
||||||
|
##################
|
||||||
|
# SYNCING SERVER #
|
||||||
|
##################
|
||||||
|
|
||||||
|
if [ -z "$SYNCING_SERVER_LOG_LEVEL" ]; then
|
||||||
|
export SYNCING_SERVER_LOG_LEVEL="info"
|
||||||
|
fi
|
||||||
|
export SYNCING_SERVER_NODE_ENV=production
|
||||||
|
export SYNCING_SERVER_VERSION=local
|
||||||
|
|
||||||
|
if [ -z "$SYNCING_SERVER_SNS_TOPIC_ARN" ]; then
|
||||||
|
export SYNCING_SERVER_SNS_TOPIC_ARN="arn:aws:sns:us-east-1:000000000000:syncing-server-local-topic"
|
||||||
|
fi
|
||||||
|
if [ -z "$SYNCING_SERVER_SNS_ENDPOINT" ]; then
|
||||||
|
export SYNCING_SERVER_SNS_ENDPOINT="http://localstack:4566"
|
||||||
|
fi
|
||||||
|
if [ -z "$SYNCING_SERVER_SNS_SECRET_ACCESS_KEY" ]; then
|
||||||
|
export SYNCING_SERVER_SNS_SECRET_ACCESS_KEY="x"
|
||||||
|
fi
|
||||||
|
if [ -z "$SYNCING_SERVER_SNS_ACCESS_KEY_ID" ]; then
|
||||||
|
export SYNCING_SERVER_SNS_ACCESS_KEY_ID="x"
|
||||||
|
fi
|
||||||
|
if [ -z "$SYNCING_SERVER_SNS_AWS_REGION" ]; then
|
||||||
|
export SYNCING_SERVER_SNS_AWS_REGION="us-east-1"
|
||||||
|
fi
|
||||||
|
if [ -z "$SYNCING_SERVER_SQS_QUEUE_URL" ]; then
|
||||||
|
export SYNCING_SERVER_SQS_QUEUE_URL="http://localstack:4566/000000000000/syncing-server-local-queue"
|
||||||
|
fi
|
||||||
|
if [ -z "$SYNCING_SERVER_SQS_AWS_REGION" ]; then
|
||||||
|
export SYNCING_SERVER_SQS_AWS_REGION="us-east-1"
|
||||||
|
fi
|
||||||
|
if [ -z "$SYNCING_SERVER_SQS_ACCESS_KEY_ID" ]; then
|
||||||
|
export SYNCING_SERVER_SQS_ACCESS_KEY_ID="x"
|
||||||
|
fi
|
||||||
|
if [ -z "$SYNCING_SERVER_SQS_SECRET_ACCESS_KEY" ]; then
|
||||||
|
export SYNCING_SERVER_SQS_SECRET_ACCESS_KEY="x"
|
||||||
|
fi
|
||||||
|
if [ -z "$SYNCING_SERVER_SQS_ENDPOINT" ]; then
|
||||||
|
export SYNCING_SERVER_SQS_ENDPOINT="http://localstack:4566"
|
||||||
|
fi
|
||||||
|
|
||||||
|
export SYNCING_SERVER_AUTH_SERVER_URL=http://localhost:$AUTH_SERVER_PORT
|
||||||
|
|
||||||
|
if [ -z "$SYNCING_SERVER_EMAIL_ATTACHMENT_MAX_BYTE_SIZE" ]; then
|
||||||
|
export SYNCING_SERVER_EMAIL_ATTACHMENT_MAX_BYTE_SIZE=10485760
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$SYNCING_SERVER_REVISIONS_FREQUENCY" ]; then
|
||||||
|
export SYNCING_SERVER_REVISIONS_FREQUENCY=300
|
||||||
|
fi
|
||||||
|
|
||||||
|
export SYNCING_SERVER_NEW_RELIC_ENABLED=false
|
||||||
|
export SYNCING_SERVER_NEW_RELIC_APP_NAME="Syncing Server JS"
|
||||||
|
export SYNCING_SERVER_NEW_RELIC_NO_CONFIG_FILE=true
|
||||||
|
|
||||||
|
if [ -z "$SYNCING_SERVER_FILE_UPLOAD_PATH" ]; then
|
||||||
|
export SYNCING_SERVER_FILE_UPLOAD_PATH="data/uploads"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printenv | grep SYNCING_SERVER_ | sed 's/SYNCING_SERVER_//g' > /opt/bundled/syncing-server/packages/syncing-server/.env
|
||||||
|
|
||||||
|
|
||||||
|
################
|
||||||
|
# FILES SERVER #
|
||||||
|
################
|
||||||
|
|
||||||
|
if [ -z "$FILES_SERVER_LOG_LEVEL" ]; then
|
||||||
|
export FILES_SERVER_LOG_LEVEL="info"
|
||||||
|
fi
|
||||||
|
export FILES_SERVER_NODE_ENV="production"
|
||||||
|
export FILES_SERVER_VERSION="local"
|
||||||
|
|
||||||
|
if [ -z "$FILES_SERVER_MAX_CHUNK_BYTES" ]; then
|
||||||
|
export FILES_SERVER_MAX_CHUNK_BYTES=100000000
|
||||||
|
fi
|
||||||
|
|
||||||
|
export FILES_SERVER_NEW_RELIC_ENABLED=false
|
||||||
|
|
||||||
|
if [ -z "$FILES_SERVER_SNS_TOPIC_ARN" ]; then
|
||||||
|
export FILES_SERVER_SNS_TOPIC_ARN="arn:aws:sns:us-east-1:000000000000:files-local-topic"
|
||||||
|
fi
|
||||||
|
if [ -z "$FILES_SERVER_SNS_ENDPOINT" ]; then
|
||||||
|
export FILES_SERVER_SNS_ENDPOINT="http://localstack:4566"
|
||||||
|
fi
|
||||||
|
if [ -z "$FILES_SERVER_SNS_SECRET_ACCESS_KEY" ]; then
|
||||||
|
export FILES_SERVER_SNS_SECRET_ACCESS_KEY="x"
|
||||||
|
fi
|
||||||
|
if [ -z "$FILES_SERVER_SNS_ACCESS_KEY_ID" ]; then
|
||||||
|
export FILES_SERVER_SNS_ACCESS_KEY_ID="x"
|
||||||
|
fi
|
||||||
|
if [ -z "$FILES_SERVER_SNS_AWS_REGION" ]; then
|
||||||
|
export FILES_SERVER_SNS_AWS_REGION="us-east-1"
|
||||||
|
fi
|
||||||
|
if [ -z "$FILES_SERVER_SQS_QUEUE_URL" ]; then
|
||||||
|
export FILES_SERVER_SQS_QUEUE_URL="http://localstack:4566/000000000000/files-local-queue"
|
||||||
|
fi
|
||||||
|
if [ -z "$FILES_SERVER_SQS_AWS_REGION" ]; then
|
||||||
|
export FILES_SERVER_SQS_AWS_REGION="us-east-1"
|
||||||
|
fi
|
||||||
|
if [ -z "$FILES_SERVER_SQS_ACCESS_KEY_ID" ]; then
|
||||||
|
export FILES_SERVER_SQS_ACCESS_KEY_ID="x"
|
||||||
|
fi
|
||||||
|
if [ -z "$FILES_SERVER_SQS_SECRET_ACCESS_KEY" ]; then
|
||||||
|
export FILES_SERVER_SQS_SECRET_ACCESS_KEY="x"
|
||||||
|
fi
|
||||||
|
if [ -z "$FILES_SERVER_SQS_ENDPOINT" ]; then
|
||||||
|
export FILES_SERVER_SQS_ENDPOINT="http://localstack:4566"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printenv | grep FILES_SERVER_ | sed 's/FILES_SERVER_//g' > /opt/bundled/files/packages/files/.env
|
||||||
|
|
||||||
|
#############
|
||||||
|
# REVISIONS #
|
||||||
|
#############
|
||||||
|
|
||||||
|
if [ -z "$REVISIONS_SERVER_LOG_LEVEL" ]; then
|
||||||
|
export REVISIONS_SERVER_LOG_LEVEL="info"
|
||||||
|
fi
|
||||||
|
|
||||||
|
export REVISIONS_SERVER_NODE_ENV="production"
|
||||||
|
export REVISIONS_SERVER_VERSION="local"
|
||||||
|
|
||||||
|
export REVISIONS_SERVER_NEW_RELIC_ENABLED=false
|
||||||
|
|
||||||
|
if [ -z "$REVISIONS_SERVER_SNS_TOPIC_ARN" ]; then
|
||||||
|
export REVISIONS_SERVER_SNS_TOPIC_ARN="arn:aws:sns:us-east-1:000000000000:revisions-server-local-topic"
|
||||||
|
fi
|
||||||
|
if [ -z "$REVISIONS_SERVER_SNS_ENDPOINT" ]; then
|
||||||
|
export REVISIONS_SERVER_SNS_ENDPOINT="http://localstack:4566"
|
||||||
|
fi
|
||||||
|
if [ -z "$REVISIONS_SERVER_SNS_SECRET_ACCESS_KEY" ]; then
|
||||||
|
export REVISIONS_SERVER_SNS_SECRET_ACCESS_KEY="x"
|
||||||
|
fi
|
||||||
|
if [ -z "$REVISIONS_SERVER_SNS_ACCESS_KEY_ID" ]; then
|
||||||
|
export REVISIONS_SERVER_SNS_ACCESS_KEY_ID="x"
|
||||||
|
fi
|
||||||
|
if [ -z "$REVISIONS_SERVER_SNS_AWS_REGION" ]; then
|
||||||
|
export REVISIONS_SERVER_SNS_AWS_REGION="us-east-1"
|
||||||
|
fi
|
||||||
|
if [ -z "$REVISIONS_SERVER_SQS_QUEUE_URL" ]; then
|
||||||
|
export REVISIONS_SERVER_SQS_QUEUE_URL="http://localstack:4566/000000000000/revisions-server-local-queue"
|
||||||
|
fi
|
||||||
|
if [ -z "$REVISIONS_SERVER_SQS_AWS_REGION" ]; then
|
||||||
|
export REVISIONS_SERVER_SQS_AWS_REGION="us-east-1"
|
||||||
|
fi
|
||||||
|
if [ -z "$REVISIONS_SERVER_SQS_ACCESS_KEY_ID" ]; then
|
||||||
|
export REVISIONS_SERVER_SQS_ACCESS_KEY_ID="x"
|
||||||
|
fi
|
||||||
|
if [ -z "$REVISIONS_SERVER_SQS_SECRET_ACCESS_KEY" ]; then
|
||||||
|
export REVISIONS_SERVER_SQS_SECRET_ACCESS_KEY="x"
|
||||||
|
fi
|
||||||
|
if [ -z "$REVISIONS_SERVER_SQS_ENDPOINT" ]; then
|
||||||
|
export REVISIONS_SERVER_SQS_ENDPOINT="http://localstack:4566"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printenv | grep REVISIONS_SERVER_ | sed 's/REVISIONS_SERVER_//g' > /opt/bundled/revisions/packages/revisions/.env
|
||||||
|
|
||||||
|
###############
|
||||||
|
# API GATEWAY #
|
||||||
|
###############
|
||||||
|
|
||||||
|
if [ -z "$API_GATEWAY_LOG_LEVEL" ]; then
|
||||||
|
export API_GATEWAY_LOG_LEVEL="info"
|
||||||
|
fi
|
||||||
|
export API_GATEWAY_NODE_ENV=production
|
||||||
|
export API_GATEWAY_VERSION=local
|
||||||
|
|
||||||
|
export API_GATEWAY_NEW_RELIC_ENABLED=false
|
||||||
|
export API_GATEWAY_NEW_RELIC_APP_NAME="API Gateway"
|
||||||
|
export API_GATEWAY_NEW_RELIC_NO_CONFIG_FILE=true
|
||||||
|
|
||||||
|
export API_GATEWAY_SYNCING_SERVER_JS_URL=http://localhost:$SYNCING_SERVER_PORT
|
||||||
|
export API_GATEWAY_AUTH_SERVER_URL=http://localhost:$AUTH_SERVER_PORT
|
||||||
|
export API_GATEWAY_WORKSPACE_SERVER_URL=http://localhost:3004
|
||||||
|
export API_GATEWAY_REVISIONS_SERVER_URL=http://localhost:3005
|
||||||
|
if [ -z "$PUBLIC_FILES_SERVER_URL" ]; then
|
||||||
|
export API_GATEWAY_FILES_SERVER_URL=http://localhost:$FILES_SERVER_PORT
|
||||||
|
else
|
||||||
|
export API_GATEWAY_FILES_SERVER_URL=$PUBLIC_FILES_SERVER_URL
|
||||||
|
fi
|
||||||
|
|
||||||
|
printenv | grep API_GATEWAY_ | sed 's/API_GATEWAY_//g' > /opt/bundled/api-gateway/packages/api-gateway/.env
|
||||||
|
|
||||||
|
# Run supervisor
|
||||||
|
|
||||||
|
supervisord -c /etc/supervisord.conf
|
||||||
|
|
||||||
|
exec "$@"
|
||||||
Executable
+30
@@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
WAIT_FOR_URL="$1"
|
||||||
|
shift
|
||||||
|
LOGS_PATH="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
attempt=0
|
||||||
|
while [ $attempt -le 120 ]; do
|
||||||
|
attempt=$(( $attempt + 1 ))
|
||||||
|
echo "# Waiting for all services to be up (attempt: $attempt) ..."
|
||||||
|
ping_api_gateway_result=`curl -s $WAIT_FOR_URL | grep "Welcome"`
|
||||||
|
if [ "$?" -eq "0" ]; then
|
||||||
|
sleep 2 # for warmup
|
||||||
|
echo "# All services are up!"
|
||||||
|
exit 0
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "# Failed to wait for all services to be up!"
|
||||||
|
|
||||||
|
echo "# Errors:"
|
||||||
|
tail -n 50 $LOGS_PATH/*.err
|
||||||
|
|
||||||
|
echo "# Logs:"
|
||||||
|
tail -n 50 $LOGS_PATH/*.log
|
||||||
|
|
||||||
|
exit 1
|
||||||
Executable
+196
@@ -0,0 +1,196 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
echo "configuring sns/sqs"
|
||||||
|
echo "==================="
|
||||||
|
LOCALSTACK_HOST=localhost
|
||||||
|
AWS_REGION=us-east-1
|
||||||
|
LOCALSTACK_DUMMY_ID=000000000000
|
||||||
|
|
||||||
|
get_all_queues() {
|
||||||
|
awslocal --endpoint-url=http://${LOCALSTACK_HOST}:4566 sqs list-queues
|
||||||
|
}
|
||||||
|
|
||||||
|
create_queue() {
|
||||||
|
local QUEUE_NAME_TO_CREATE=$1
|
||||||
|
awslocal --endpoint-url=http://${LOCALSTACK_HOST}:4566 sqs create-queue --queue-name ${QUEUE_NAME_TO_CREATE}
|
||||||
|
}
|
||||||
|
|
||||||
|
get_all_topics() {
|
||||||
|
awslocal --endpoint-url=http://${LOCALSTACK_HOST}:4566 sns list-topics
|
||||||
|
}
|
||||||
|
|
||||||
|
create_topic() {
|
||||||
|
local TOPIC_NAME_TO_CREATE=$1
|
||||||
|
awslocal --endpoint-url=http://${LOCALSTACK_HOST}:4566 sns create-topic --name ${TOPIC_NAME_TO_CREATE}
|
||||||
|
}
|
||||||
|
|
||||||
|
link_queue_and_topic() {
|
||||||
|
local TOPIC_ARN_TO_LINK=$1
|
||||||
|
local QUEUE_ARN_TO_LINK=$2
|
||||||
|
awslocal --endpoint-url=http://${LOCALSTACK_HOST}:4566 sns subscribe --topic-arn ${TOPIC_ARN_TO_LINK} --protocol sqs --notification-endpoint ${QUEUE_ARN_TO_LINK}
|
||||||
|
}
|
||||||
|
|
||||||
|
get_queue_arn_from_name() {
|
||||||
|
local QUEUE_NAME=$1
|
||||||
|
echo "arn:aws:sns:${AWS_REGION}:${LOCALSTACK_DUMMY_ID}:$QUEUE_NAME"
|
||||||
|
}
|
||||||
|
|
||||||
|
get_topic_arn_from_name() {
|
||||||
|
local TOPIC_NAME=$1
|
||||||
|
echo "arn:aws:sns:${AWS_REGION}:${LOCALSTACK_DUMMY_ID}:$TOPIC_NAME"
|
||||||
|
}
|
||||||
|
|
||||||
|
PAYMENTS_TOPIC_NAME="payments-local-topic"
|
||||||
|
|
||||||
|
echo "creating topic $PAYMENTS_TOPIC_NAME"
|
||||||
|
TOPIC_CREATED_RESULT=$(create_topic ${PAYMENTS_TOPIC_NAME})
|
||||||
|
echo "created topic: $TOPIC_CREATED_RESULT"
|
||||||
|
PAYMENTS_TOPIC_ARN=$(get_topic_arn_from_name $PAYMENTS_TOPIC_NAME)
|
||||||
|
|
||||||
|
SYNCING_SERVER_TOPIC_NAME="syncing-server-local-topic"
|
||||||
|
|
||||||
|
echo "creating topic $SYNCING_SERVER_TOPIC_NAME"
|
||||||
|
TOPIC_CREATED_RESULT=$(create_topic ${SYNCING_SERVER_TOPIC_NAME})
|
||||||
|
echo "created topic: $TOPIC_CREATED_RESULT"
|
||||||
|
SYNCING_SERVER_TOPIC_ARN=$(get_topic_arn_from_name $SYNCING_SERVER_TOPIC_NAME)
|
||||||
|
|
||||||
|
AUTH_TOPIC_NAME="auth-local-topic"
|
||||||
|
|
||||||
|
echo "creating topic $AUTH_TOPIC_NAME"
|
||||||
|
TOPIC_CREATED_RESULT=$(create_topic ${AUTH_TOPIC_NAME})
|
||||||
|
echo "created topic: $TOPIC_CREATED_RESULT"
|
||||||
|
AUTH_TOPIC_ARN=$(get_topic_arn_from_name $AUTH_TOPIC_NAME)
|
||||||
|
|
||||||
|
FILES_TOPIC_NAME="files-local-topic"
|
||||||
|
|
||||||
|
echo "creating topic $FILES_TOPIC_NAME"
|
||||||
|
TOPIC_CREATED_RESULT=$(create_topic ${FILES_TOPIC_NAME})
|
||||||
|
echo "created topic: $TOPIC_CREATED_RESULT"
|
||||||
|
FILES_TOPIC_ARN=$(get_topic_arn_from_name $FILES_TOPIC_NAME)
|
||||||
|
|
||||||
|
ANALYTICS_TOPIC_NAME="analytics-local-topic"
|
||||||
|
|
||||||
|
echo "creating topic $ANALYTICS_TOPIC_NAME"
|
||||||
|
TOPIC_CREATED_RESULT=$(create_topic ${ANALYTICS_TOPIC_NAME})
|
||||||
|
echo "created topic: $TOPIC_CREATED_RESULT"
|
||||||
|
ANALYTICS_TOPIC_ARN=$(get_topic_arn_from_name $ANALYTICS_TOPIC_NAME)
|
||||||
|
|
||||||
|
REVISIONS_TOPIC_NAME="revisions-server-local-topic"
|
||||||
|
|
||||||
|
echo "creating topic $REVISIONS_TOPIC_NAME"
|
||||||
|
TOPIC_CREATED_RESULT=$(create_topic ${REVISIONS_TOPIC_NAME})
|
||||||
|
echo "created topic: $TOPIC_CREATED_RESULT"
|
||||||
|
REVISIONS_TOPIC_ARN=$(get_topic_arn_from_name $REVISIONS_TOPIC_NAME)
|
||||||
|
|
||||||
|
SCHEDULER_TOPIC_NAME="scheduler-local-topic"
|
||||||
|
|
||||||
|
echo "creating topic $SCHEDULER_TOPIC_NAME"
|
||||||
|
TOPIC_CREATED_RESULT=$(create_topic ${SCHEDULER_TOPIC_NAME})
|
||||||
|
echo "created topic: $TOPIC_CREATED_RESULT"
|
||||||
|
SCHEDULER_TOPIC_ARN=$(get_topic_arn_from_name $SCHEDULER_TOPIC_NAME)
|
||||||
|
|
||||||
|
WORKSPACE_TOPIC_NAME="workspace-local-topic"
|
||||||
|
|
||||||
|
echo "creating topic $WORKSPACE_TOPIC_NAME"
|
||||||
|
TOPIC_CREATED_RESULT=$(create_topic ${WORKSPACE_TOPIC_NAME})
|
||||||
|
echo "created topic: $TOPIC_CREATED_RESULT"
|
||||||
|
WORKSPACE_TOPIC_ARN=$(get_topic_arn_from_name $WORKSPACE_TOPIC_NAME)
|
||||||
|
|
||||||
|
QUEUE_NAME="analytics-local-queue"
|
||||||
|
|
||||||
|
echo "creating queue $QUEUE_NAME"
|
||||||
|
QUEUE_URL=$(create_queue ${QUEUE_NAME})
|
||||||
|
echo "created queue: $QUEUE_URL"
|
||||||
|
ANALYTICS_QUEUE_ARN=$(get_queue_arn_from_name $QUEUE_NAME)
|
||||||
|
|
||||||
|
echo "linking topic $PAYMENTS_TOPIC_ARN to queue $ANALYTICS_QUEUE_ARN"
|
||||||
|
LINKING_RESULT=$(link_queue_and_topic $PAYMENTS_TOPIC_ARN $ANALYTICS_QUEUE_ARN)
|
||||||
|
echo "linking done:"
|
||||||
|
echo "$LINKING_RESULT"
|
||||||
|
|
||||||
|
QUEUE_NAME="auth-local-queue"
|
||||||
|
|
||||||
|
echo "creating queue $QUEUE_NAME"
|
||||||
|
QUEUE_URL=$(create_queue ${QUEUE_NAME})
|
||||||
|
echo "created queue: $QUEUE_URL"
|
||||||
|
AUTH_QUEUE_ARN=$(get_queue_arn_from_name $QUEUE_NAME)
|
||||||
|
|
||||||
|
echo "linking topic $PAYMENTS_TOPIC_ARN to queue $AUTH_QUEUE_ARN"
|
||||||
|
LINKING_RESULT=$(link_queue_and_topic $PAYMENTS_TOPIC_ARN $AUTH_QUEUE_ARN)
|
||||||
|
echo "linking done:"
|
||||||
|
echo "$LINKING_RESULT"
|
||||||
|
echo "linking topic $AUTH_TOPIC_ARN to queue $AUTH_QUEUE_ARN"
|
||||||
|
LINKING_RESULT=$(link_queue_and_topic $AUTH_TOPIC_ARN $AUTH_QUEUE_ARN)
|
||||||
|
echo "linking done:"
|
||||||
|
echo "$LINKING_RESULT"
|
||||||
|
echo "linking topic $FILES_TOPIC_ARN to queue $AUTH_QUEUE_ARN"
|
||||||
|
LINKING_RESULT=$(link_queue_and_topic $FILES_TOPIC_ARN $AUTH_QUEUE_ARN)
|
||||||
|
echo "linking done:"
|
||||||
|
echo "$LINKING_RESULT"
|
||||||
|
|
||||||
|
QUEUE_NAME="files-local-queue"
|
||||||
|
|
||||||
|
echo "creating queue $QUEUE_NAME"
|
||||||
|
QUEUE_URL=$(create_queue ${QUEUE_NAME})
|
||||||
|
echo "created queue: $QUEUE_URL"
|
||||||
|
FILES_QUEUE_ARN=$(get_queue_arn_from_name $QUEUE_NAME)
|
||||||
|
|
||||||
|
echo "linking topic $AUTH_TOPIC_ARN to queue $FILES_QUEUE_ARN"
|
||||||
|
LINKING_RESULT=$(link_queue_and_topic $AUTH_TOPIC_ARN $FILES_QUEUE_ARN)
|
||||||
|
echo "linking done:"
|
||||||
|
echo "$LINKING_RESULT"
|
||||||
|
|
||||||
|
QUEUE_NAME="syncing-server-local-queue"
|
||||||
|
|
||||||
|
echo "creating queue $QUEUE_NAME"
|
||||||
|
QUEUE_URL=$(create_queue ${QUEUE_NAME})
|
||||||
|
echo "created queue: $QUEUE_URL"
|
||||||
|
SYNCING_SERVER_QUEUE_ARN=$(get_queue_arn_from_name $QUEUE_NAME)
|
||||||
|
|
||||||
|
echo "linking topic $SYNCING_SERVER_TOPIC_ARN to queue $SYNCING_SERVER_QUEUE_ARN"
|
||||||
|
LINKING_RESULT=$(link_queue_and_topic $SYNCING_SERVER_TOPIC_ARN $SYNCING_SERVER_QUEUE_ARN)
|
||||||
|
echo "linking done:"
|
||||||
|
echo "$LINKING_RESULT"
|
||||||
|
|
||||||
|
echo "linking topic $SYNCING_SERVER_TOPIC_ARN to queue $SYNCING_SERVER_QUEUE_ARN"
|
||||||
|
LINKING_RESULT=$(link_queue_and_topic $SYNCING_SERVER_TOPIC_ARN $SYNCING_SERVER_QUEUE_ARN)
|
||||||
|
echo "linking done:"
|
||||||
|
echo "$LINKING_RESULT"
|
||||||
|
echo "linking topic $AUTH_TOPIC_ARN to queue $SYNCING_SERVER_QUEUE_ARN"
|
||||||
|
LINKING_RESULT=$(link_queue_and_topic $AUTH_TOPIC_ARN $SYNCING_SERVER_QUEUE_ARN)
|
||||||
|
echo "linking done:"
|
||||||
|
echo "$LINKING_RESULT"
|
||||||
|
|
||||||
|
QUEUE_NAME="revisions-server-local-queue"
|
||||||
|
|
||||||
|
echo "creating queue $QUEUE_NAME"
|
||||||
|
QUEUE_URL=$(create_queue ${QUEUE_NAME})
|
||||||
|
echo "created queue: $QUEUE_URL"
|
||||||
|
REVISIONS_QUEUE_ARN=$(get_queue_arn_from_name $QUEUE_NAME)
|
||||||
|
|
||||||
|
echo "linking topic $SYNCING_SERVER_TOPIC_ARN to queue $REVISIONS_QUEUE_ARN"
|
||||||
|
LINKING_RESULT=$(link_queue_and_topic $SYNCING_SERVER_TOPIC_ARN $REVISIONS_QUEUE_ARN)
|
||||||
|
echo "linking done:"
|
||||||
|
echo "$LINKING_RESULT"
|
||||||
|
|
||||||
|
QUEUE_NAME="scheduler-local-queue"
|
||||||
|
|
||||||
|
echo "creating queue $QUEUE_NAME"
|
||||||
|
QUEUE_URL=$(create_queue ${QUEUE_NAME})
|
||||||
|
echo "created queue: $QUEUE_URL"
|
||||||
|
SCHEDULER_QUEUE_ARN=$(get_queue_arn_from_name $QUEUE_NAME)
|
||||||
|
|
||||||
|
QUEUE_NAME="workspace-local-queue"
|
||||||
|
|
||||||
|
echo "creating queue $QUEUE_NAME"
|
||||||
|
QUEUE_URL=$(create_queue ${QUEUE_NAME})
|
||||||
|
echo "created queue: $QUEUE_URL"
|
||||||
|
WORKSPACE_QUEUE_ARN=$(get_queue_arn_from_name $QUEUE_NAME)
|
||||||
|
|
||||||
|
echo "all topics are:"
|
||||||
|
echo "$(get_all_topics)"
|
||||||
|
|
||||||
|
echo "all queues are:"
|
||||||
|
echo "$(get_all_queues)"
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
[supervisord]
|
||||||
|
nodaemon=true
|
||||||
|
logfile=/tmp/supervisord.log
|
||||||
|
|
||||||
|
[program:syncing-server]
|
||||||
|
directory=/opt/bundled/syncing-server
|
||||||
|
command=yarn workspace @standardnotes/syncing-server supervisor:start
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
stdout_logfile=/var/lib/server/logs/syncing-server.log
|
||||||
|
stderr_logfile=/var/lib/server/logs/syncing-server.err
|
||||||
|
|
||||||
|
[program:syncing-server-worker]
|
||||||
|
directory=/opt/bundled/syncing-server
|
||||||
|
command=yarn workspace @standardnotes/syncing-server supervisor:worker
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
stdout_logfile=/var/lib/server/logs/syncing-server-worker.log
|
||||||
|
stderr_logfile=/var/lib/server/logs/syncing-server-worker.err
|
||||||
|
|
||||||
|
[program:auth]
|
||||||
|
directory=/opt/bundled/auth
|
||||||
|
command=yarn workspace @standardnotes/auth-server supervisor:start
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
stdout_logfile=/var/lib/server/logs/auth.log
|
||||||
|
stderr_logfile=/var/lib/server/logs/auth.err
|
||||||
|
|
||||||
|
[program:auth-worker]
|
||||||
|
directory=/opt/bundled/auth
|
||||||
|
command=yarn workspace @standardnotes/auth-server supervisor:worker
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
stdout_logfile=/var/lib/server/logs/auth-worker.log
|
||||||
|
stderr_logfile=/var/lib/server/logs/auth-worker.err
|
||||||
|
|
||||||
|
[program:files]
|
||||||
|
directory=/opt/bundled/files
|
||||||
|
command=yarn workspace @standardnotes/files-server supervisor:start
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
stdout_logfile=/var/lib/server/logs/files.log
|
||||||
|
stderr_logfile=/var/lib/server/logs/files.err
|
||||||
|
|
||||||
|
[program:files-worker]
|
||||||
|
directory=/opt/bundled/files
|
||||||
|
command=yarn workspace @standardnotes/files-server supervisor:worker
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
stdout_logfile=/var/lib/server/logs/files-worker.log
|
||||||
|
stderr_logfile=/var/lib/server/logs/files-worker.err
|
||||||
|
|
||||||
|
[program:revisions]
|
||||||
|
directory=/opt/bundled/revisions
|
||||||
|
command=yarn workspace @standardnotes/revisions-server supervisor:start
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
stdout_logfile=/var/lib/server/logs/revisions.log
|
||||||
|
stderr_logfile=/var/lib/server/logs/revisions.err
|
||||||
|
|
||||||
|
[program:revisions-worker]
|
||||||
|
directory=/opt/bundled/revisions
|
||||||
|
command=yarn workspace @standardnotes/revisions-server supervisor:worker
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
stdout_logfile=/var/lib/server/logs/revisions-worker.log
|
||||||
|
stderr_logfile=/var/lib/server/logs/revisions-worker.err
|
||||||
|
|
||||||
|
[program:api-gateway]
|
||||||
|
directory=/opt/bundled/api-gateway
|
||||||
|
command=yarn workspace @standardnotes/api-gateway supervisor:start
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
stdout_logfile=/var/lib/server/logs/api-gateway.log
|
||||||
|
stderr_logfile=/var/lib/server/logs/api-gateway.err
|
||||||
Executable
+13
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
WAIT_FOR_HOST="$1"
|
||||||
|
shift
|
||||||
|
WAIT_FOR_PORT="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
while ! nc -vz $WAIT_FOR_HOST $WAIT_FOR_PORT; do
|
||||||
|
echo "$WAIT_FOR_HOST:$WAIT_FOR_PORT is unavailable yet - waiting for it to start"
|
||||||
|
sleep 10
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "$WAIT_FOR_HOST:$WAIT_FOR_PORT is up. Proceeding to startup."
|
||||||
@@ -12,30 +12,8 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "yarn workspaces foreach -p -j 10 --verbose run lint",
|
"lint": "yarn workspaces foreach -p -j 10 --verbose run lint",
|
||||||
"lint:auth": "yarn workspace @standardnotes/auth-server lint",
|
|
||||||
"lint:scheduler": "yarn workspace @standardnotes/scheduler-server lint",
|
|
||||||
"lint:syncing-server-js": "yarn workspace @standardnotes/syncing-server lint",
|
|
||||||
"lint:files": "yarn workspace @standardnotes/files-server lint",
|
|
||||||
"lint:api-gateway": "yarn workspace @standardnotes/api-gateway lint",
|
|
||||||
"lint:event-store": "yarn workspace @standardnotes/event-store lint",
|
|
||||||
"lint:websockets": "yarn workspace @standardnotes/websockets-server lint",
|
|
||||||
"lint:workspace": "yarn workspace @standardnotes/workspace-server lint",
|
|
||||||
"lint:analytics": "yarn workspace @standardnotes/analytics lint",
|
|
||||||
"lint:revisions": "yarn workspace @standardnotes/revisions-server lint",
|
|
||||||
"clean": "yarn workspaces foreach -p --verbose run clean",
|
"clean": "yarn workspaces foreach -p --verbose run clean",
|
||||||
"setup:env": "cp .env.sample .env && yarn workspaces foreach -p --verbose run setup:env",
|
"setup:env": "cp .env.sample .env && yarn workspaces foreach -p --verbose run setup:env",
|
||||||
"start:auth": "yarn workspace @standardnotes/auth-server start",
|
|
||||||
"start:auth-worker": "yarn workspace @standardnotes/auth-server worker",
|
|
||||||
"start:scheduler": "yarn workspace @standardnotes/scheduler-server worker",
|
|
||||||
"start:syncing-server": "yarn workspace @standardnotes/syncing-server start",
|
|
||||||
"start:syncing-server-worker": "yarn workspace @standardnotes/syncing-server worker",
|
|
||||||
"start:files": "yarn workspace @standardnotes/files-server start",
|
|
||||||
"start:files-worker": "yarn workspace @standardnotes/files-server worker",
|
|
||||||
"start:api-gateway": "yarn workspace @standardnotes/api-gateway start",
|
|
||||||
"start:websockets": "yarn workspace @standardnotes/websockets-server start",
|
|
||||||
"start:workspace": "yarn workspace @standardnotes/workspace-server start",
|
|
||||||
"start:analytics": "yarn workspace @standardnotes/analytics worker",
|
|
||||||
"start:revisions": "yarn workspace @standardnotes/revisions-server start",
|
|
||||||
"release": "lerna version --conventional-graduate --conventional-commits --yes -m \"chore(release): publish new version\"",
|
"release": "lerna version --conventional-graduate --conventional-commits --yes -m \"chore(release): publish new version\"",
|
||||||
"publish": "lerna publish from-git --yes --no-verify-access --loglevel verbose",
|
"publish": "lerna publish from-git --yes --no-verify-access --loglevel verbose",
|
||||||
"postversion": "./scripts/push-tags-one-by-one.sh",
|
"postversion": "./scripts/push-tags-one-by-one.sh",
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ DB_MIGRATIONS_PATH=dist/migrations/*.js
|
|||||||
ADMIN_EMAILS=test@standardnotes.com
|
ADMIN_EMAILS=test@standardnotes.com
|
||||||
|
|
||||||
REDIS_URL=redis://cache
|
REDIS_URL=redis://cache
|
||||||
REDIS_EVENTS_CHANNEL=events
|
|
||||||
|
|
||||||
SNS_TOPIC_ARN=
|
SNS_TOPIC_ARN=
|
||||||
SNS_AWS_REGION=
|
SNS_AWS_REGION=
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [2.19.16](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.19.15...@standardnotes/analytics@2.19.16) (2023-02-06)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/analytics
|
||||||
|
|
||||||
## [2.19.15](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.19.14...@standardnotes/analytics@2.19.15) (2023-01-30)
|
## [2.19.15](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.19.14...@standardnotes/analytics@2.19.15) (2023-01-30)
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/analytics",
|
"name": "@standardnotes/analytics",
|
||||||
"version": "2.19.15",
|
"version": "2.19.16",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -15,9 +15,6 @@ import TYPES from './Types'
|
|||||||
import { AppDataSource } from './DataSource'
|
import { AppDataSource } from './DataSource'
|
||||||
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
|
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
|
||||||
import {
|
import {
|
||||||
RedisDomainEventPublisher,
|
|
||||||
RedisDomainEventSubscriberFactory,
|
|
||||||
RedisEventMessageHandler,
|
|
||||||
SNSDomainEventPublisher,
|
SNSDomainEventPublisher,
|
||||||
SQSDomainEventSubscriberFactory,
|
SQSDomainEventSubscriberFactory,
|
||||||
SQSEventMessageHandler,
|
SQSEventMessageHandler,
|
||||||
@@ -95,22 +92,20 @@ export class ContainerConfigLoader {
|
|||||||
})
|
})
|
||||||
container.bind<winston.Logger>(TYPES.Logger).toConstantValue(logger)
|
container.bind<winston.Logger>(TYPES.Logger).toConstantValue(logger)
|
||||||
|
|
||||||
if (env.get('SNS_TOPIC_ARN', true)) {
|
const snsConfig: SNSClientConfig = {
|
||||||
const snsConfig: SNSClientConfig = {
|
apiVersion: 'latest',
|
||||||
apiVersion: 'latest',
|
region: env.get('SNS_AWS_REGION', true),
|
||||||
region: env.get('SNS_AWS_REGION', true),
|
|
||||||
}
|
|
||||||
if (env.get('SNS_ENDPOINT', true)) {
|
|
||||||
snsConfig.endpoint = env.get('SNS_ENDPOINT', true)
|
|
||||||
}
|
|
||||||
if (env.get('SNS_ACCESS_KEY_ID', true) && env.get('SNS_SECRET_ACCESS_KEY', true)) {
|
|
||||||
snsConfig.credentials = {
|
|
||||||
accessKeyId: env.get('SNS_ACCESS_KEY_ID', true),
|
|
||||||
secretAccessKey: env.get('SNS_SECRET_ACCESS_KEY', true),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
container.bind<SNSClient>(TYPES.SNS).toConstantValue(new SNSClient(snsConfig))
|
|
||||||
}
|
}
|
||||||
|
if (env.get('SNS_ENDPOINT', true)) {
|
||||||
|
snsConfig.endpoint = env.get('SNS_ENDPOINT', true)
|
||||||
|
}
|
||||||
|
if (env.get('SNS_ACCESS_KEY_ID', true) && env.get('SNS_SECRET_ACCESS_KEY', true)) {
|
||||||
|
snsConfig.credentials = {
|
||||||
|
accessKeyId: env.get('SNS_ACCESS_KEY_ID', true),
|
||||||
|
secretAccessKey: env.get('SNS_SECRET_ACCESS_KEY', true),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
container.bind<SNSClient>(TYPES.SNS).toConstantValue(new SNSClient(snsConfig))
|
||||||
|
|
||||||
if (env.get('SQS_QUEUE_URL', true)) {
|
if (env.get('SQS_QUEUE_URL', true)) {
|
||||||
const sqsConfig: SQSClientConfig = {
|
const sqsConfig: SQSClientConfig = {
|
||||||
@@ -130,10 +125,9 @@ export class ContainerConfigLoader {
|
|||||||
|
|
||||||
// env vars
|
// env vars
|
||||||
container.bind(TYPES.REDIS_URL).toConstantValue(env.get('REDIS_URL'))
|
container.bind(TYPES.REDIS_URL).toConstantValue(env.get('REDIS_URL'))
|
||||||
container.bind(TYPES.SNS_TOPIC_ARN).toConstantValue(env.get('SNS_TOPIC_ARN', true))
|
container.bind(TYPES.SNS_TOPIC_ARN).toConstantValue(env.get('SNS_TOPIC_ARN'))
|
||||||
container.bind(TYPES.SNS_AWS_REGION).toConstantValue(env.get('SNS_AWS_REGION', true))
|
container.bind(TYPES.SNS_AWS_REGION).toConstantValue(env.get('SNS_AWS_REGION', true))
|
||||||
container.bind(TYPES.SQS_QUEUE_URL).toConstantValue(env.get('SQS_QUEUE_URL', true))
|
container.bind(TYPES.SQS_QUEUE_URL).toConstantValue(env.get('SQS_QUEUE_URL'))
|
||||||
container.bind(TYPES.REDIS_EVENTS_CHANNEL).toConstantValue(env.get('REDIS_EVENTS_CHANNEL'))
|
|
||||||
container.bind(TYPES.NEW_RELIC_ENABLED).toConstantValue(env.get('NEW_RELIC_ENABLED', true))
|
container.bind(TYPES.NEW_RELIC_ENABLED).toConstantValue(env.get('NEW_RELIC_ENABLED', true))
|
||||||
container.bind(TYPES.ADMIN_EMAILS).toConstantValue(env.get('ADMIN_EMAILS').split(','))
|
container.bind(TYPES.ADMIN_EMAILS).toConstantValue(env.get('ADMIN_EMAILS').split(','))
|
||||||
container.bind(TYPES.MIXPANEL_TOKEN).toConstantValue(env.get('MIXPANEL_TOKEN', true))
|
container.bind(TYPES.MIXPANEL_TOKEN).toConstantValue(env.get('MIXPANEL_TOKEN', true))
|
||||||
@@ -149,17 +143,9 @@ export class ContainerConfigLoader {
|
|||||||
.toConstantValue(new RedisStatisticsStore(container.get(TYPES.PeriodKeyGenerator), container.get(TYPES.Redis)))
|
.toConstantValue(new RedisStatisticsStore(container.get(TYPES.PeriodKeyGenerator), container.get(TYPES.Redis)))
|
||||||
container.bind<TimerInterface>(TYPES.Timer).toConstantValue(new Timer())
|
container.bind<TimerInterface>(TYPES.Timer).toConstantValue(new Timer())
|
||||||
|
|
||||||
if (env.get('SNS_TOPIC_ARN', true)) {
|
container
|
||||||
container
|
.bind<SNSDomainEventPublisher>(TYPES.DomainEventPublisher)
|
||||||
.bind<SNSDomainEventPublisher>(TYPES.DomainEventPublisher)
|
.toConstantValue(new SNSDomainEventPublisher(container.get(TYPES.SNS), container.get(TYPES.SNS_TOPIC_ARN)))
|
||||||
.toConstantValue(new SNSDomainEventPublisher(container.get(TYPES.SNS), container.get(TYPES.SNS_TOPIC_ARN)))
|
|
||||||
} else {
|
|
||||||
container
|
|
||||||
.bind<RedisDomainEventPublisher>(TYPES.DomainEventPublisher)
|
|
||||||
.toConstantValue(
|
|
||||||
new RedisDomainEventPublisher(container.get(TYPES.Redis), container.get(TYPES.REDIS_EVENTS_CHANNEL)),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
if (env.get('MIXPANEL_TOKEN', true)) {
|
if (env.get('MIXPANEL_TOKEN', true)) {
|
||||||
container.bind<Mixpanel>(TYPES.MixpanelClient).toConstantValue(Mixpanel.init(env.get('MIXPANEL_TOKEN', true)))
|
container.bind<Mixpanel>(TYPES.MixpanelClient).toConstantValue(Mixpanel.init(env.get('MIXPANEL_TOKEN', true)))
|
||||||
}
|
}
|
||||||
@@ -250,37 +236,22 @@ export class ContainerConfigLoader {
|
|||||||
['STATISTIC_PERSISTENCE_REQUESTED', container.get(TYPES.StatisticPersistenceRequestedEventHandler)],
|
['STATISTIC_PERSISTENCE_REQUESTED', container.get(TYPES.StatisticPersistenceRequestedEventHandler)],
|
||||||
])
|
])
|
||||||
|
|
||||||
if (env.get('SQS_QUEUE_URL', true)) {
|
container
|
||||||
container
|
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
||||||
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
.toConstantValue(
|
||||||
.toConstantValue(
|
env.get('NEW_RELIC_ENABLED', true) === 'true'
|
||||||
env.get('NEW_RELIC_ENABLED', true) === 'true'
|
? new SQSNewRelicEventMessageHandler(eventHandlers, container.get(TYPES.Logger))
|
||||||
? new SQSNewRelicEventMessageHandler(eventHandlers, container.get(TYPES.Logger))
|
: new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Logger)),
|
||||||
: new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Logger)),
|
)
|
||||||
)
|
container
|
||||||
container
|
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
||||||
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
.toConstantValue(
|
||||||
.toConstantValue(
|
new SQSDomainEventSubscriberFactory(
|
||||||
new SQSDomainEventSubscriberFactory(
|
container.get(TYPES.SQS),
|
||||||
container.get(TYPES.SQS),
|
container.get(TYPES.SQS_QUEUE_URL),
|
||||||
container.get(TYPES.SQS_QUEUE_URL),
|
container.get(TYPES.DomainEventMessageHandler),
|
||||||
container.get(TYPES.DomainEventMessageHandler),
|
),
|
||||||
),
|
)
|
||||||
)
|
|
||||||
} else {
|
|
||||||
container
|
|
||||||
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
|
||||||
.toConstantValue(new RedisEventMessageHandler(eventHandlers, container.get(TYPES.Logger)))
|
|
||||||
container
|
|
||||||
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
|
||||||
.toConstantValue(
|
|
||||||
new RedisDomainEventSubscriberFactory(
|
|
||||||
container.get(TYPES.Redis),
|
|
||||||
container.get(TYPES.DomainEventMessageHandler),
|
|
||||||
container.get(TYPES.REDIS_EVENTS_CHANNEL),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return container
|
return container
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ const TYPES = {
|
|||||||
SNS_AWS_REGION: Symbol.for('SNS_AWS_REGION'),
|
SNS_AWS_REGION: Symbol.for('SNS_AWS_REGION'),
|
||||||
SQS_QUEUE_URL: Symbol.for('SQS_QUEUE_URL'),
|
SQS_QUEUE_URL: Symbol.for('SQS_QUEUE_URL'),
|
||||||
SQS_AWS_REGION: Symbol.for('SQS_AWS_REGION'),
|
SQS_AWS_REGION: Symbol.for('SQS_AWS_REGION'),
|
||||||
REDIS_EVENTS_CHANNEL: Symbol.for('REDIS_EVENTS_CHANNEL'),
|
|
||||||
NEW_RELIC_ENABLED: Symbol.for('NEW_RELIC_ENABLED'),
|
NEW_RELIC_ENABLED: Symbol.for('NEW_RELIC_ENABLED'),
|
||||||
ADMIN_EMAILS: Symbol.for('ADMIN_EMAILS'),
|
ADMIN_EMAILS: Symbol.for('ADMIN_EMAILS'),
|
||||||
MIXPANEL_TOKEN: Symbol.for('MIXPANEL_TOKEN'),
|
MIXPANEL_TOKEN: Symbol.for('MIXPANEL_TOKEN'),
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ NEW_RELIC_LOG_ENABLED=false
|
|||||||
NEW_RELIC_LOG_LEVEL=info
|
NEW_RELIC_LOG_LEVEL=info
|
||||||
|
|
||||||
REDIS_URL=redis://cache
|
REDIS_URL=redis://cache
|
||||||
REDIS_EVENTS_CHANNEL=events
|
|
||||||
|
|
||||||
# (Optional) Caching Cross Service Tokens
|
# (Optional) Caching Cross Service Tokens
|
||||||
CROSS_SERVICE_TOKEN_CACHE_TTL=
|
CROSS_SERVICE_TOKEN_CACHE_TTL=
|
||||||
|
|||||||
@@ -3,6 +3,16 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.46.12](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.46.11...@standardnotes/api-gateway@1.46.12) (2023-02-09)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* optimize memory usage ([e96fd6d](https://github.com/standardnotes/api-gateway/commit/e96fd6d69e1252842b5c91b1bedefa36e5d4a232))
|
||||||
|
|
||||||
|
## [1.46.11](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.46.10...@standardnotes/api-gateway@1.46.11) (2023-02-06)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||||
|
|
||||||
## [1.46.10](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.46.9...@standardnotes/api-gateway@1.46.10) (2023-01-30)
|
## [1.46.10](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.46.9...@standardnotes/api-gateway@1.46.10) (2023-01-30)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/api-gateway
|
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||||
|
|||||||
Executable
+13
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
WAIT_FOR_HOST="$1"
|
||||||
|
shift
|
||||||
|
WAIT_FOR_PORT="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
while ! nc -vz $WAIT_FOR_HOST $WAIT_FOR_PORT; do
|
||||||
|
echo "$WAIT_FOR_HOST:$WAIT_FOR_PORT is unavailable yet - waiting for it to start"
|
||||||
|
sleep 10
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "$WAIT_FOR_HOST:$WAIT_FOR_PORT is up. Proceeding to startup."
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/api-gateway",
|
"name": "@standardnotes/api-gateway",
|
||||||
"version": "1.46.10",
|
"version": "1.46.12",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
@@ -16,7 +16,13 @@
|
|||||||
"build": "tsc --build",
|
"build": "tsc --build",
|
||||||
"lint": "eslint . --ext .ts",
|
"lint": "eslint . --ext .ts",
|
||||||
"setup:env": "cp .env.sample .env",
|
"setup:env": "cp .env.sample .env",
|
||||||
|
"wait-for:syncing-server": "docker/wait-for.sh localhost $SYNCING_SERVER_PORT",
|
||||||
|
"wait-for:auth": "docker/wait-for.sh localhost $AUTH_SERVER_PORT",
|
||||||
|
"wait-for:files": "docker/wait-for.sh localhost $FILES_SERVER_PORT",
|
||||||
|
"wait-for:revisions": "docker/wait-for.sh localhost $REVISIONS_SERVER_PORT",
|
||||||
|
"wait-for:services": "yarn wait-for:syncing-server && yarn wait-for:auth && yarn wait-for:files && yarn wait-for:revisions",
|
||||||
"start": "yarn node dist/bin/server.js",
|
"start": "yarn node dist/bin/server.js",
|
||||||
|
"supervisor:start": "yarn wait-for:services && yarn node dist/bin/server.js",
|
||||||
"upgrade:snjs": "yarn ncu -u '@standardnotes/*'"
|
"upgrade:snjs": "yarn ncu -u '@standardnotes/*'"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ export class ContainerConfigLoader {
|
|||||||
.bind(TYPES.HTTP_CALL_TIMEOUT)
|
.bind(TYPES.HTTP_CALL_TIMEOUT)
|
||||||
.toConstantValue(env.get('HTTP_CALL_TIMEOUT', true) ? +env.get('HTTP_CALL_TIMEOUT', true) : 60_000)
|
.toConstantValue(env.get('HTTP_CALL_TIMEOUT', true) ? +env.get('HTTP_CALL_TIMEOUT', true) : 60_000)
|
||||||
container.bind(TYPES.VERSION).toConstantValue(env.get('VERSION'))
|
container.bind(TYPES.VERSION).toConstantValue(env.get('VERSION'))
|
||||||
container.bind(TYPES.REDIS_EVENTS_CHANNEL).toConstantValue(env.get('REDIS_EVENTS_CHANNEL'))
|
|
||||||
container.bind(TYPES.CROSS_SERVICE_TOKEN_CACHE_TTL).toConstantValue(+env.get('CROSS_SERVICE_TOKEN_CACHE_TTL', true))
|
container.bind(TYPES.CROSS_SERVICE_TOKEN_CACHE_TTL).toConstantValue(+env.get('CROSS_SERVICE_TOKEN_CACHE_TTL', true))
|
||||||
|
|
||||||
// Middleware
|
// Middleware
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ const TYPES = {
|
|||||||
AUTH_JWT_SECRET: Symbol.for('AUTH_JWT_SECRET'),
|
AUTH_JWT_SECRET: Symbol.for('AUTH_JWT_SECRET'),
|
||||||
HTTP_CALL_TIMEOUT: Symbol.for('HTTP_CALL_TIMEOUT'),
|
HTTP_CALL_TIMEOUT: Symbol.for('HTTP_CALL_TIMEOUT'),
|
||||||
VERSION: Symbol.for('VERSION'),
|
VERSION: Symbol.for('VERSION'),
|
||||||
REDIS_EVENTS_CHANNEL: Symbol.for('REDIS_EVENTS_CHANNEL'),
|
|
||||||
CROSS_SERVICE_TOKEN_CACHE_TTL: Symbol.for('CROSS_SERVICE_TOKEN_CACHE_TTL'),
|
CROSS_SERVICE_TOKEN_CACHE_TTL: Symbol.for('CROSS_SERVICE_TOKEN_CACHE_TTL'),
|
||||||
// Middleware
|
// Middleware
|
||||||
AuthMiddleware: Symbol.for('AuthMiddleware'),
|
AuthMiddleware: Symbol.for('AuthMiddleware'),
|
||||||
|
|||||||
@@ -43,8 +43,6 @@ SQS_AWS_REGION=
|
|||||||
|
|
||||||
SYNCING_SERVER_URL=http://syncing-server-js:3000
|
SYNCING_SERVER_URL=http://syncing-server-js:3000
|
||||||
|
|
||||||
REDIS_EVENTS_CHANNEL=events
|
|
||||||
|
|
||||||
# (Optional) New Relic Setup
|
# (Optional) New Relic Setup
|
||||||
NEW_RELIC_ENABLED=false
|
NEW_RELIC_ENABLED=false
|
||||||
NEW_RELIC_APP_NAME=Auth
|
NEW_RELIC_APP_NAME=Auth
|
||||||
|
|||||||
@@ -3,6 +3,40 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.87.13](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.87.12...@standardnotes/auth-server@1.87.13) (2023-02-09)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* optimize memory usage ([e96fd6d](https://github.com/standardnotes/server/commit/e96fd6d69e1252842b5c91b1bedefa36e5d4a232))
|
||||||
|
|
||||||
|
## [1.87.12](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.87.11...@standardnotes/auth-server@1.87.12) (2023-02-06)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/auth-server
|
||||||
|
|
||||||
|
## [1.87.11](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.87.10...@standardnotes/auth-server@1.87.11) (2023-02-02)
|
||||||
|
|
||||||
|
### Reverts
|
||||||
|
|
||||||
|
* Revert "fix(auth): disallow adding u2f devices if a user does not have 2fa enabled" ([bf55bbc](https://github.com/standardnotes/server/commit/bf55bbccd9ab1704671fa3980ede3bd0cc909833))
|
||||||
|
|
||||||
|
## [1.87.10](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.87.9...@standardnotes/auth-server@1.87.10) (2023-02-02)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **auth:** disallow adding u2f devices if a user does not have 2fa enabled ([11bcd31](https://github.com/standardnotes/server/commit/11bcd318abc71d5a1fa80b8beda109076e3b6dad))
|
||||||
|
|
||||||
|
## [1.87.9](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.87.8...@standardnotes/auth-server@1.87.9) (2023-02-02)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **auth:** verification rpid options ([989e1ce](https://github.com/standardnotes/server/commit/989e1ce175cf70718304dd2d2463949147bcc084))
|
||||||
|
|
||||||
|
## [1.87.8](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.87.7...@standardnotes/auth-server@1.87.8) (2023-02-02)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **auth:** allow defining multiple expected origins upon u2f registration and verification ([b7967b3](https://github.com/standardnotes/server/commit/b7967b34d1118534644a3e464e9e43267455519d))
|
||||||
|
|
||||||
## [1.87.7](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.87.6...@standardnotes/auth-server@1.87.7) (2023-01-30)
|
## [1.87.7](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.87.6...@standardnotes/auth-server@1.87.7) (2023-01-30)
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|||||||
Executable
+13
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
WAIT_FOR_HOST="$1"
|
||||||
|
shift
|
||||||
|
WAIT_FOR_PORT="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
while ! nc -vz $WAIT_FOR_HOST $WAIT_FOR_PORT; do
|
||||||
|
echo "$WAIT_FOR_HOST:$WAIT_FOR_PORT is unavailable yet - waiting for it to start"
|
||||||
|
sleep 10
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "$WAIT_FOR_HOST:$WAIT_FOR_PORT is up. Proceeding to startup."
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/auth-server",
|
"name": "@standardnotes/auth-server",
|
||||||
"version": "1.87.7",
|
"version": "1.87.13",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
@@ -17,8 +17,14 @@
|
|||||||
"lint": "eslint . --ext .ts",
|
"lint": "eslint . --ext .ts",
|
||||||
"pretest": "yarn lint && yarn build",
|
"pretest": "yarn lint && yarn build",
|
||||||
"test": "jest --coverage --config=./jest.config.js --maxWorkers=50%",
|
"test": "jest --coverage --config=./jest.config.js --maxWorkers=50%",
|
||||||
|
"wait-for:db": "docker/wait-for.sh $DB_HOST $DB_PORT",
|
||||||
|
"wait-for:cache": "docker/wait-for.sh $REDIS_HOST $REDIS_PORT",
|
||||||
|
"wait-for:infra": "yarn wait-for:db && yarn wait-for:cache",
|
||||||
|
"wait-for:auth": "docker/wait-for.sh localhost $AUTH_SERVER_PORT",
|
||||||
"start": "yarn node dist/bin/server.js",
|
"start": "yarn node dist/bin/server.js",
|
||||||
|
"supervisor:start": "yarn wait-for:infra && yarn node dist/bin/server.js",
|
||||||
"worker": "yarn node dist/bin/worker.js",
|
"worker": "yarn node dist/bin/worker.js",
|
||||||
|
"supervisor:worker": "yarn wait-for:auth && yarn node dist/bin/worker.js",
|
||||||
"cleanup": "yarn node dist/bin/cleanup.js",
|
"cleanup": "yarn node dist/bin/cleanup.js",
|
||||||
"stats": "yarn node dist/bin/stats.js",
|
"stats": "yarn node dist/bin/stats.js",
|
||||||
"daily-backup:email": "yarn node dist/bin/backup.js email daily",
|
"daily-backup:email": "yarn node dist/bin/backup.js email daily",
|
||||||
|
|||||||
@@ -90,9 +90,6 @@ import { FeatureService } from '../Domain/Feature/FeatureService'
|
|||||||
import { SettingServiceInterface } from '../Domain/Setting/SettingServiceInterface'
|
import { SettingServiceInterface } from '../Domain/Setting/SettingServiceInterface'
|
||||||
import { ExtensionKeyGrantedEventHandler } from '../Domain/Handler/ExtensionKeyGrantedEventHandler'
|
import { ExtensionKeyGrantedEventHandler } from '../Domain/Handler/ExtensionKeyGrantedEventHandler'
|
||||||
import {
|
import {
|
||||||
RedisDomainEventPublisher,
|
|
||||||
RedisDomainEventSubscriberFactory,
|
|
||||||
RedisEventMessageHandler,
|
|
||||||
SNSDomainEventPublisher,
|
SNSDomainEventPublisher,
|
||||||
SQSDomainEventSubscriberFactory,
|
SQSDomainEventSubscriberFactory,
|
||||||
SQSEventMessageHandler,
|
SQSEventMessageHandler,
|
||||||
@@ -258,37 +255,33 @@ export class ContainerConfigLoader {
|
|||||||
|
|
||||||
container.bind<TimerInterface>(TYPES.Timer).toConstantValue(new Timer())
|
container.bind<TimerInterface>(TYPES.Timer).toConstantValue(new Timer())
|
||||||
|
|
||||||
if (env.get('SNS_TOPIC_ARN', true)) {
|
const snsConfig: SNSClientConfig = {
|
||||||
const snsConfig: SNSClientConfig = {
|
region: env.get('SNS_AWS_REGION', true),
|
||||||
region: env.get('SNS_AWS_REGION', true),
|
|
||||||
}
|
|
||||||
if (env.get('SNS_ENDPOINT', true)) {
|
|
||||||
snsConfig.endpoint = env.get('SNS_ENDPOINT', true)
|
|
||||||
}
|
|
||||||
if (env.get('SNS_ACCESS_KEY_ID', true) && env.get('SNS_SECRET_ACCESS_KEY', true)) {
|
|
||||||
snsConfig.credentials = {
|
|
||||||
accessKeyId: env.get('SNS_ACCESS_KEY_ID', true),
|
|
||||||
secretAccessKey: env.get('SNS_SECRET_ACCESS_KEY', true),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
container.bind<SNSClient>(TYPES.SNS).toConstantValue(new SNSClient(snsConfig))
|
|
||||||
}
|
}
|
||||||
|
if (env.get('SNS_ENDPOINT', true)) {
|
||||||
|
snsConfig.endpoint = env.get('SNS_ENDPOINT', true)
|
||||||
|
}
|
||||||
|
if (env.get('SNS_ACCESS_KEY_ID', true) && env.get('SNS_SECRET_ACCESS_KEY', true)) {
|
||||||
|
snsConfig.credentials = {
|
||||||
|
accessKeyId: env.get('SNS_ACCESS_KEY_ID', true),
|
||||||
|
secretAccessKey: env.get('SNS_SECRET_ACCESS_KEY', true),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
container.bind<SNSClient>(TYPES.SNS).toConstantValue(new SNSClient(snsConfig))
|
||||||
|
|
||||||
if (env.get('SQS_QUEUE_URL', true)) {
|
const sqsConfig: SQSClientConfig = {
|
||||||
const sqsConfig: SQSClientConfig = {
|
region: env.get('SQS_AWS_REGION', true),
|
||||||
region: env.get('SQS_AWS_REGION', true),
|
|
||||||
}
|
|
||||||
if (env.get('SQS_ENDPOINT', true)) {
|
|
||||||
sqsConfig.endpoint = env.get('SQS_ENDPOINT', true)
|
|
||||||
}
|
|
||||||
if (env.get('SQS_ACCESS_KEY_ID', true) && env.get('SQS_SECRET_ACCESS_KEY', true)) {
|
|
||||||
sqsConfig.credentials = {
|
|
||||||
accessKeyId: env.get('SQS_ACCESS_KEY_ID', true),
|
|
||||||
secretAccessKey: env.get('SQS_SECRET_ACCESS_KEY', true),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
container.bind<SQSClient>(TYPES.SQS).toConstantValue(new SQSClient(sqsConfig))
|
|
||||||
}
|
}
|
||||||
|
if (env.get('SQS_ENDPOINT', true)) {
|
||||||
|
sqsConfig.endpoint = env.get('SQS_ENDPOINT', true)
|
||||||
|
}
|
||||||
|
if (env.get('SQS_ACCESS_KEY_ID', true) && env.get('SQS_SECRET_ACCESS_KEY', true)) {
|
||||||
|
sqsConfig.credentials = {
|
||||||
|
accessKeyId: env.get('SQS_ACCESS_KEY_ID', true),
|
||||||
|
secretAccessKey: env.get('SQS_SECRET_ACCESS_KEY', true),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
container.bind<SQSClient>(TYPES.SQS).toConstantValue(new SQSClient(sqsConfig))
|
||||||
|
|
||||||
// Mapping
|
// Mapping
|
||||||
container
|
container
|
||||||
@@ -441,13 +434,12 @@ export class ContainerConfigLoader {
|
|||||||
container
|
container
|
||||||
.bind(TYPES.DISABLE_USER_REGISTRATION)
|
.bind(TYPES.DISABLE_USER_REGISTRATION)
|
||||||
.toConstantValue(env.get('DISABLE_USER_REGISTRATION', true) === 'true')
|
.toConstantValue(env.get('DISABLE_USER_REGISTRATION', true) === 'true')
|
||||||
container.bind(TYPES.SNS_TOPIC_ARN).toConstantValue(env.get('SNS_TOPIC_ARN', true))
|
container.bind(TYPES.SNS_TOPIC_ARN).toConstantValue(env.get('SNS_TOPIC_ARN'))
|
||||||
container.bind(TYPES.SNS_AWS_REGION).toConstantValue(env.get('SNS_AWS_REGION', true))
|
container.bind(TYPES.SNS_AWS_REGION).toConstantValue(env.get('SNS_AWS_REGION', true))
|
||||||
container.bind(TYPES.SQS_QUEUE_URL).toConstantValue(env.get('SQS_QUEUE_URL', true))
|
container.bind(TYPES.SQS_QUEUE_URL).toConstantValue(env.get('SQS_QUEUE_URL'))
|
||||||
container.bind(TYPES.USER_SERVER_REGISTRATION_URL).toConstantValue(env.get('USER_SERVER_REGISTRATION_URL', true))
|
container.bind(TYPES.USER_SERVER_REGISTRATION_URL).toConstantValue(env.get('USER_SERVER_REGISTRATION_URL', true))
|
||||||
container.bind(TYPES.USER_SERVER_AUTH_KEY).toConstantValue(env.get('USER_SERVER_AUTH_KEY', true))
|
container.bind(TYPES.USER_SERVER_AUTH_KEY).toConstantValue(env.get('USER_SERVER_AUTH_KEY', true))
|
||||||
container.bind(TYPES.USER_SERVER_CHANGE_EMAIL_URL).toConstantValue(env.get('USER_SERVER_CHANGE_EMAIL_URL', true))
|
container.bind(TYPES.USER_SERVER_CHANGE_EMAIL_URL).toConstantValue(env.get('USER_SERVER_CHANGE_EMAIL_URL', true))
|
||||||
container.bind(TYPES.REDIS_EVENTS_CHANNEL).toConstantValue(env.get('REDIS_EVENTS_CHANNEL'))
|
|
||||||
container.bind(TYPES.NEW_RELIC_ENABLED).toConstantValue(env.get('NEW_RELIC_ENABLED', true))
|
container.bind(TYPES.NEW_RELIC_ENABLED).toConstantValue(env.get('NEW_RELIC_ENABLED', true))
|
||||||
container.bind(TYPES.SYNCING_SERVER_URL).toConstantValue(env.get('SYNCING_SERVER_URL'))
|
container.bind(TYPES.SYNCING_SERVER_URL).toConstantValue(env.get('SYNCING_SERVER_URL'))
|
||||||
container.bind(TYPES.VERSION).toConstantValue(env.get('VERSION'))
|
container.bind(TYPES.VERSION).toConstantValue(env.get('VERSION'))
|
||||||
@@ -463,7 +455,11 @@ export class ContainerConfigLoader {
|
|||||||
.toConstantValue(env.get('U2F_RELYING_PARTY_ID', true) ?? 'standardnotes.com')
|
.toConstantValue(env.get('U2F_RELYING_PARTY_ID', true) ?? 'standardnotes.com')
|
||||||
container
|
container
|
||||||
.bind(TYPES.U2F_EXPECTED_ORIGIN)
|
.bind(TYPES.U2F_EXPECTED_ORIGIN)
|
||||||
.toConstantValue(env.get('U2F_EXPECTED_ORIGIN', true) ?? 'https://app.standardnotes.com')
|
.toConstantValue(
|
||||||
|
env.get('U2F_EXPECTED_ORIGIN', true)
|
||||||
|
? env.get('U2F_EXPECTED_ORIGIN', true).split(',')
|
||||||
|
: ['https://app.standardnotes.com'],
|
||||||
|
)
|
||||||
container
|
container
|
||||||
.bind(TYPES.U2F_REQUIRE_USER_VERIFICATION)
|
.bind(TYPES.U2F_REQUIRE_USER_VERIFICATION)
|
||||||
.toConstantValue(env.get('U2F_REQUIRE_USER_VERIFICATION', true) === 'true')
|
.toConstantValue(env.get('U2F_REQUIRE_USER_VERIFICATION', true) === 'true')
|
||||||
@@ -531,17 +527,9 @@ export class ContainerConfigLoader {
|
|||||||
.toConstantValue(new DeterministicSelector<boolean>())
|
.toConstantValue(new DeterministicSelector<boolean>())
|
||||||
container.bind<UserSubscriptionServiceInterface>(TYPES.UserSubscriptionService).to(UserSubscriptionService)
|
container.bind<UserSubscriptionServiceInterface>(TYPES.UserSubscriptionService).to(UserSubscriptionService)
|
||||||
|
|
||||||
if (env.get('SNS_TOPIC_ARN', true)) {
|
container
|
||||||
container
|
.bind<SNSDomainEventPublisher>(TYPES.DomainEventPublisher)
|
||||||
.bind<SNSDomainEventPublisher>(TYPES.DomainEventPublisher)
|
.toConstantValue(new SNSDomainEventPublisher(container.get(TYPES.SNS), container.get(TYPES.SNS_TOPIC_ARN)))
|
||||||
.toConstantValue(new SNSDomainEventPublisher(container.get(TYPES.SNS), container.get(TYPES.SNS_TOPIC_ARN)))
|
|
||||||
} else {
|
|
||||||
container
|
|
||||||
.bind<RedisDomainEventPublisher>(TYPES.DomainEventPublisher)
|
|
||||||
.toConstantValue(
|
|
||||||
new RedisDomainEventPublisher(container.get(TYPES.Redis), container.get(TYPES.REDIS_EVENTS_CHANNEL)),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
// use cases
|
// use cases
|
||||||
container
|
container
|
||||||
@@ -799,37 +787,22 @@ export class ContainerConfigLoader {
|
|||||||
['EMAIL_SUBSCRIPTION_UNSUBSCRIBED', container.get(TYPES.EmailSubscriptionUnsubscribedEventHandler)],
|
['EMAIL_SUBSCRIPTION_UNSUBSCRIBED', container.get(TYPES.EmailSubscriptionUnsubscribedEventHandler)],
|
||||||
])
|
])
|
||||||
|
|
||||||
if (env.get('SQS_QUEUE_URL', true)) {
|
container
|
||||||
container
|
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
||||||
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
.toConstantValue(
|
||||||
.toConstantValue(
|
env.get('NEW_RELIC_ENABLED', true) === 'true'
|
||||||
env.get('NEW_RELIC_ENABLED', true) === 'true'
|
? new SQSNewRelicEventMessageHandler(eventHandlers, container.get(TYPES.Logger))
|
||||||
? new SQSNewRelicEventMessageHandler(eventHandlers, container.get(TYPES.Logger))
|
: new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Logger)),
|
||||||
: new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Logger)),
|
)
|
||||||
)
|
container
|
||||||
container
|
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
||||||
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
.toConstantValue(
|
||||||
.toConstantValue(
|
new SQSDomainEventSubscriberFactory(
|
||||||
new SQSDomainEventSubscriberFactory(
|
container.get(TYPES.SQS),
|
||||||
container.get(TYPES.SQS),
|
container.get(TYPES.SQS_QUEUE_URL),
|
||||||
container.get(TYPES.SQS_QUEUE_URL),
|
container.get(TYPES.DomainEventMessageHandler),
|
||||||
container.get(TYPES.DomainEventMessageHandler),
|
),
|
||||||
),
|
)
|
||||||
)
|
|
||||||
} else {
|
|
||||||
container
|
|
||||||
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
|
||||||
.toConstantValue(new RedisEventMessageHandler(eventHandlers, container.get(TYPES.Logger)))
|
|
||||||
container
|
|
||||||
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
|
||||||
.toConstantValue(
|
|
||||||
new RedisDomainEventSubscriberFactory(
|
|
||||||
container.get(TYPES.Redis),
|
|
||||||
container.get(TYPES.DomainEventMessageHandler),
|
|
||||||
container.get(TYPES.REDIS_EVENTS_CHANNEL),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return container
|
return container
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,6 @@ const TYPES = {
|
|||||||
USER_SERVER_REGISTRATION_URL: Symbol.for('USER_SERVER_REGISTRATION_URL'),
|
USER_SERVER_REGISTRATION_URL: Symbol.for('USER_SERVER_REGISTRATION_URL'),
|
||||||
USER_SERVER_AUTH_KEY: Symbol.for('USER_SERVER_AUTH_KEY'),
|
USER_SERVER_AUTH_KEY: Symbol.for('USER_SERVER_AUTH_KEY'),
|
||||||
USER_SERVER_CHANGE_EMAIL_URL: Symbol.for('USER_SERVER_CHANGE_EMAIL_URL'),
|
USER_SERVER_CHANGE_EMAIL_URL: Symbol.for('USER_SERVER_CHANGE_EMAIL_URL'),
|
||||||
REDIS_EVENTS_CHANNEL: Symbol.for('REDIS_EVENTS_CHANNEL'),
|
|
||||||
NEW_RELIC_ENABLED: Symbol.for('NEW_RELIC_ENABLED'),
|
NEW_RELIC_ENABLED: Symbol.for('NEW_RELIC_ENABLED'),
|
||||||
SYNCING_SERVER_URL: Symbol.for('SYNCING_SERVER_URL'),
|
SYNCING_SERVER_URL: Symbol.for('SYNCING_SERVER_URL'),
|
||||||
VERSION: Symbol.for('VERSION'),
|
VERSION: Symbol.for('VERSION'),
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ describe('VerifyAuthenticatorAuthenticationResponse', () => {
|
|||||||
authenticatorRepository,
|
authenticatorRepository,
|
||||||
authenticatorChallengeRepository,
|
authenticatorChallengeRepository,
|
||||||
'standardnotes.com',
|
'standardnotes.com',
|
||||||
'https://app.standardnotes.com',
|
['localhost', 'https://app.standardnotes.com'],
|
||||||
true,
|
true,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ export class VerifyAuthenticatorAuthenticationResponse implements UseCaseInterfa
|
|||||||
private authenticatorRepository: AuthenticatorRepositoryInterface,
|
private authenticatorRepository: AuthenticatorRepositoryInterface,
|
||||||
private authenticatorChallengeRepository: AuthenticatorChallengeRepositoryInterface,
|
private authenticatorChallengeRepository: AuthenticatorChallengeRepositoryInterface,
|
||||||
private relyingPartyId: string,
|
private relyingPartyId: string,
|
||||||
private expectedOrigin: string,
|
private expectedOrigin: string[],
|
||||||
private requireUserVerification: boolean,
|
private requireUserVerification: boolean,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ describe('VerifyAuthenticatorRegistrationResponse', () => {
|
|||||||
authenticatorRepository,
|
authenticatorRepository,
|
||||||
authenticatorChallengeRepository,
|
authenticatorChallengeRepository,
|
||||||
'standardnotes.com',
|
'standardnotes.com',
|
||||||
'https://app.standardnotes.com',
|
['localhost', 'https://app.standardnotes.com'],
|
||||||
true,
|
true,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ export class VerifyAuthenticatorRegistrationResponse implements UseCaseInterface
|
|||||||
private authenticatorRepository: AuthenticatorRepositoryInterface,
|
private authenticatorRepository: AuthenticatorRepositoryInterface,
|
||||||
private authenticatorChallengeRepository: AuthenticatorChallengeRepositoryInterface,
|
private authenticatorChallengeRepository: AuthenticatorChallengeRepositoryInterface,
|
||||||
private relyingPartyId: string,
|
private relyingPartyId: string,
|
||||||
private expectedOrigin: string,
|
private expectedOrigin: string[],
|
||||||
private requireUserVerification: boolean,
|
private requireUserVerification: boolean,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ VERSION=development
|
|||||||
PORT=3000
|
PORT=3000
|
||||||
|
|
||||||
REDIS_URL=redis://cache
|
REDIS_URL=redis://cache
|
||||||
REDIS_EVENTS_CHANNEL=events
|
|
||||||
|
|
||||||
VALET_TOKEN_SECRET=change-me-!
|
VALET_TOKEN_SECRET=change-me-!
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,16 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.9.16](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.9.15...@standardnotes/files-server@1.9.16) (2023-02-09)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* optimize memory usage ([e96fd6d](https://github.com/standardnotes/files/commit/e96fd6d69e1252842b5c91b1bedefa36e5d4a232))
|
||||||
|
|
||||||
|
## [1.9.15](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.9.14...@standardnotes/files-server@1.9.15) (2023-02-06)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/files-server
|
||||||
|
|
||||||
## [1.9.14](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.9.13...@standardnotes/files-server@1.9.14) (2023-01-30)
|
## [1.9.14](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.9.13...@standardnotes/files-server@1.9.14) (2023-01-30)
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|||||||
Executable
+13
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
WAIT_FOR_HOST="$1"
|
||||||
|
shift
|
||||||
|
WAIT_FOR_PORT="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
while ! nc -vz $WAIT_FOR_HOST $WAIT_FOR_PORT; do
|
||||||
|
echo "$WAIT_FOR_HOST:$WAIT_FOR_PORT is unavailable yet - waiting for it to start"
|
||||||
|
sleep 10
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "$WAIT_FOR_HOST:$WAIT_FOR_PORT is up. Proceeding to startup."
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/files-server",
|
"name": "@standardnotes/files-server",
|
||||||
"version": "1.9.14",
|
"version": "1.9.16",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
@@ -20,8 +20,14 @@
|
|||||||
"lint": "eslint . --ext .ts",
|
"lint": "eslint . --ext .ts",
|
||||||
"pretest": "yarn lint && yarn build",
|
"pretest": "yarn lint && yarn build",
|
||||||
"test": "jest --coverage --config=./jest.config.js --maxWorkers=50%",
|
"test": "jest --coverage --config=./jest.config.js --maxWorkers=50%",
|
||||||
|
"wait-for:db": "docker/wait-for.sh $DB_HOST $DB_PORT",
|
||||||
|
"wait-for:cache": "docker/wait-for.sh $REDIS_HOST $REDIS_PORT",
|
||||||
|
"wait-for:infra": "yarn wait-for:db && yarn wait-for:cache",
|
||||||
|
"wait-for:files": "docker/wait-for.sh localhost $FILES_SERVER_PORT",
|
||||||
"start": "yarn node dist/bin/server.js",
|
"start": "yarn node dist/bin/server.js",
|
||||||
|
"supervisor:start": "yarn wait-for:infra && yarn node dist/bin/server.js",
|
||||||
"worker": "yarn node dist/bin/worker.js",
|
"worker": "yarn node dist/bin/worker.js",
|
||||||
|
"supervisor:worker": "yarn wait-for:files && yarn node dist/bin/worker.js",
|
||||||
"upgrade:snjs": "yarn ncu -u '@standardnotes/*'"
|
"upgrade:snjs": "yarn ncu -u '@standardnotes/*'"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -14,9 +14,6 @@ import { Timer, TimerInterface } from '@standardnotes/time'
|
|||||||
import { DomainEventFactoryInterface } from '../Domain/Event/DomainEventFactoryInterface'
|
import { DomainEventFactoryInterface } from '../Domain/Event/DomainEventFactoryInterface'
|
||||||
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
|
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
|
||||||
import {
|
import {
|
||||||
RedisDomainEventPublisher,
|
|
||||||
RedisDomainEventSubscriberFactory,
|
|
||||||
RedisEventMessageHandler,
|
|
||||||
SNSDomainEventPublisher,
|
SNSDomainEventPublisher,
|
||||||
SQSDomainEventSubscriberFactory,
|
SQSDomainEventSubscriberFactory,
|
||||||
SQSEventMessageHandler,
|
SQSEventMessageHandler,
|
||||||
@@ -61,13 +58,12 @@ export class ContainerConfigLoader {
|
|||||||
container.bind(TYPES.S3_BUCKET_NAME).toConstantValue(env.get('S3_BUCKET_NAME', true))
|
container.bind(TYPES.S3_BUCKET_NAME).toConstantValue(env.get('S3_BUCKET_NAME', true))
|
||||||
container.bind(TYPES.S3_AWS_REGION).toConstantValue(env.get('S3_AWS_REGION', true))
|
container.bind(TYPES.S3_AWS_REGION).toConstantValue(env.get('S3_AWS_REGION', true))
|
||||||
container.bind(TYPES.VALET_TOKEN_SECRET).toConstantValue(env.get('VALET_TOKEN_SECRET'))
|
container.bind(TYPES.VALET_TOKEN_SECRET).toConstantValue(env.get('VALET_TOKEN_SECRET'))
|
||||||
container.bind(TYPES.SNS_TOPIC_ARN).toConstantValue(env.get('SNS_TOPIC_ARN', true))
|
container.bind(TYPES.SNS_TOPIC_ARN).toConstantValue(env.get('SNS_TOPIC_ARN'))
|
||||||
container.bind(TYPES.SNS_AWS_REGION).toConstantValue(env.get('SNS_AWS_REGION', true))
|
container.bind(TYPES.SNS_AWS_REGION).toConstantValue(env.get('SNS_AWS_REGION', true))
|
||||||
container.bind(TYPES.REDIS_URL).toConstantValue(env.get('REDIS_URL'))
|
container.bind(TYPES.REDIS_URL).toConstantValue(env.get('REDIS_URL'))
|
||||||
container.bind(TYPES.REDIS_EVENTS_CHANNEL).toConstantValue(env.get('REDIS_EVENTS_CHANNEL'))
|
|
||||||
container.bind(TYPES.MAX_CHUNK_BYTES).toConstantValue(+env.get('MAX_CHUNK_BYTES'))
|
container.bind(TYPES.MAX_CHUNK_BYTES).toConstantValue(+env.get('MAX_CHUNK_BYTES'))
|
||||||
container.bind(TYPES.VERSION).toConstantValue(env.get('VERSION'))
|
container.bind(TYPES.VERSION).toConstantValue(env.get('VERSION'))
|
||||||
container.bind(TYPES.SQS_QUEUE_URL).toConstantValue(env.get('SQS_QUEUE_URL', true))
|
container.bind(TYPES.SQS_QUEUE_URL).toConstantValue(env.get('SQS_QUEUE_URL'))
|
||||||
container
|
container
|
||||||
.bind(TYPES.FILE_UPLOAD_PATH)
|
.bind(TYPES.FILE_UPLOAD_PATH)
|
||||||
.toConstantValue(env.get('FILE_UPLOAD_PATH', true) ?? `${__dirname}/../../uploads`)
|
.toConstantValue(env.get('FILE_UPLOAD_PATH', true) ?? `${__dirname}/../../uploads`)
|
||||||
@@ -161,17 +157,9 @@ export class ContainerConfigLoader {
|
|||||||
// repositories
|
// repositories
|
||||||
container.bind<UploadRepositoryInterface>(TYPES.UploadRepository).to(RedisUploadRepository)
|
container.bind<UploadRepositoryInterface>(TYPES.UploadRepository).to(RedisUploadRepository)
|
||||||
|
|
||||||
if (env.get('SNS_TOPIC_ARN', true)) {
|
container
|
||||||
container
|
.bind<SNSDomainEventPublisher>(TYPES.DomainEventPublisher)
|
||||||
.bind<SNSDomainEventPublisher>(TYPES.DomainEventPublisher)
|
.toConstantValue(new SNSDomainEventPublisher(container.get(TYPES.SNS), container.get(TYPES.SNS_TOPIC_ARN)))
|
||||||
.toConstantValue(new SNSDomainEventPublisher(container.get(TYPES.SNS), container.get(TYPES.SNS_TOPIC_ARN)))
|
|
||||||
} else {
|
|
||||||
container
|
|
||||||
.bind<RedisDomainEventPublisher>(TYPES.DomainEventPublisher)
|
|
||||||
.toConstantValue(
|
|
||||||
new RedisDomainEventPublisher(container.get(TYPES.Redis), container.get(TYPES.REDIS_EVENTS_CHANNEL)),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
container
|
container
|
||||||
@@ -189,37 +177,22 @@ export class ContainerConfigLoader {
|
|||||||
],
|
],
|
||||||
])
|
])
|
||||||
|
|
||||||
if (env.get('SQS_QUEUE_URL', true)) {
|
container
|
||||||
container
|
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
||||||
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
.toConstantValue(
|
||||||
.toConstantValue(
|
env.get('NEW_RELIC_ENABLED', true) === 'true'
|
||||||
env.get('NEW_RELIC_ENABLED', true) === 'true'
|
? new SQSNewRelicEventMessageHandler(eventHandlers, container.get(TYPES.Logger))
|
||||||
? new SQSNewRelicEventMessageHandler(eventHandlers, container.get(TYPES.Logger))
|
: new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Logger)),
|
||||||
: new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Logger)),
|
)
|
||||||
)
|
container
|
||||||
container
|
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
||||||
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
.toConstantValue(
|
||||||
.toConstantValue(
|
new SQSDomainEventSubscriberFactory(
|
||||||
new SQSDomainEventSubscriberFactory(
|
container.get(TYPES.SQS),
|
||||||
container.get(TYPES.SQS),
|
container.get(TYPES.SQS_QUEUE_URL),
|
||||||
container.get(TYPES.SQS_QUEUE_URL),
|
container.get(TYPES.DomainEventMessageHandler),
|
||||||
container.get(TYPES.DomainEventMessageHandler),
|
),
|
||||||
),
|
)
|
||||||
)
|
|
||||||
} else {
|
|
||||||
container
|
|
||||||
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
|
||||||
.toConstantValue(new RedisEventMessageHandler(eventHandlers, container.get(TYPES.Logger)))
|
|
||||||
container
|
|
||||||
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
|
||||||
.toConstantValue(
|
|
||||||
new RedisDomainEventSubscriberFactory(
|
|
||||||
container.get(TYPES.Redis),
|
|
||||||
container.get(TYPES.DomainEventMessageHandler),
|
|
||||||
container.get(TYPES.REDIS_EVENTS_CHANNEL),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return container
|
return container
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ const TYPES = {
|
|||||||
SQS_AWS_REGION: Symbol.for('SQS_AWS_REGION'),
|
SQS_AWS_REGION: Symbol.for('SQS_AWS_REGION'),
|
||||||
VALET_TOKEN_SECRET: Symbol.for('VALET_TOKEN_SECRET'),
|
VALET_TOKEN_SECRET: Symbol.for('VALET_TOKEN_SECRET'),
|
||||||
REDIS_URL: Symbol.for('REDIS_URL'),
|
REDIS_URL: Symbol.for('REDIS_URL'),
|
||||||
REDIS_EVENTS_CHANNEL: Symbol.for('REDIS_EVENTS_CHANNEL'),
|
|
||||||
MAX_CHUNK_BYTES: Symbol.for('MAX_CHUNK_BYTES'),
|
MAX_CHUNK_BYTES: Symbol.for('MAX_CHUNK_BYTES'),
|
||||||
VERSION: Symbol.for('VERSION'),
|
VERSION: Symbol.for('VERSION'),
|
||||||
NEW_RELIC_ENABLED: Symbol.for('NEW_RELIC_ENABLED'),
|
NEW_RELIC_ENABLED: Symbol.for('NEW_RELIC_ENABLED'),
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ SQS_AWS_REGION=
|
|||||||
S3_AWS_REGION=
|
S3_AWS_REGION=
|
||||||
S3_BACKUP_BUCKET_NAME=
|
S3_BACKUP_BUCKET_NAME=
|
||||||
|
|
||||||
REDIS_EVENTS_CHANNEL=revisions
|
|
||||||
|
|
||||||
# (Optional) New Relic Setup
|
# (Optional) New Relic Setup
|
||||||
NEW_RELIC_ENABLED=false
|
NEW_RELIC_ENABLED=false
|
||||||
NEW_RELIC_APP_NAME="Revisions Server"
|
NEW_RELIC_APP_NAME="Revisions Server"
|
||||||
|
|||||||
@@ -3,6 +3,16 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.10.29](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.10.28...@standardnotes/revisions-server@1.10.29) (2023-02-09)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* optimize memory usage ([e96fd6d](https://github.com/standardnotes/server/commit/e96fd6d69e1252842b5c91b1bedefa36e5d4a232))
|
||||||
|
|
||||||
|
## [1.10.28](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.10.27...@standardnotes/revisions-server@1.10.28) (2023-02-06)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/revisions-server
|
||||||
|
|
||||||
## [1.10.27](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.10.26...@standardnotes/revisions-server@1.10.27) (2023-01-30)
|
## [1.10.27](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.10.26...@standardnotes/revisions-server@1.10.27) (2023-01-30)
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|||||||
Executable
+13
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
WAIT_FOR_HOST="$1"
|
||||||
|
shift
|
||||||
|
WAIT_FOR_PORT="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
while ! nc -vz $WAIT_FOR_HOST $WAIT_FOR_PORT; do
|
||||||
|
echo "$WAIT_FOR_HOST:$WAIT_FOR_PORT is unavailable yet - waiting for it to start"
|
||||||
|
sleep 10
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "$WAIT_FOR_HOST:$WAIT_FOR_PORT is up. Proceeding to startup."
|
||||||
@@ -4,8 +4,10 @@ export class init1669113322388 implements MigrationInterface {
|
|||||||
name = 'init1669113322388'
|
name = 'init1669113322388'
|
||||||
|
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await this.syncSchemaBetweenLegacyRevisions(queryRunner)
|
||||||
|
|
||||||
await queryRunner.query(
|
await queryRunner.query(
|
||||||
'CREATE TABLE `revisions` (`uuid` varchar(36) NOT NULL, `item_uuid` varchar(36) NOT NULL, `user_uuid` varchar(36) NOT NULL, `content` mediumtext NULL, `content_type` varchar(255) NULL, `items_key_id` varchar(255) NULL, `enc_item_key` text NULL, `auth_hash` varchar(255) NULL, `creation_date` date NULL, `created_at` datetime(6) NULL, `updated_at` datetime(6) NULL, INDEX `item_uuid` (`item_uuid`), INDEX `user_uuid` (`user_uuid`), INDEX `creation_date` (`creation_date`), INDEX `created_at` (`created_at`), PRIMARY KEY (`uuid`)) ENGINE=InnoDB',
|
'CREATE TABLE IF NOT EXISTS `revisions` (`uuid` varchar(36) NOT NULL, `item_uuid` varchar(36) NOT NULL, `user_uuid` varchar(36) NOT NULL, `content` mediumtext NULL, `content_type` varchar(255) NULL, `items_key_id` varchar(255) NULL, `enc_item_key` text NULL, `auth_hash` varchar(255) NULL, `creation_date` date NULL, `created_at` datetime(6) NULL, `updated_at` datetime(6) NULL, INDEX `item_uuid` (`item_uuid`), INDEX `user_uuid` (`user_uuid`), INDEX `creation_date` (`creation_date`), INDEX `created_at` (`created_at`), PRIMARY KEY (`uuid`)) ENGINE=InnoDB',
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -16,4 +18,16 @@ export class init1669113322388 implements MigrationInterface {
|
|||||||
await queryRunner.query('DROP INDEX `item_uuid` ON `revisions`')
|
await queryRunner.query('DROP INDEX `item_uuid` ON `revisions`')
|
||||||
await queryRunner.query('DROP TABLE `revisions`')
|
await queryRunner.query('DROP TABLE `revisions`')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async syncSchemaBetweenLegacyRevisions(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
const revisionsTableExistsQueryResult = await queryRunner.manager.query(
|
||||||
|
'SELECT COUNT(*) as count FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = "revisions"',
|
||||||
|
)
|
||||||
|
const revisionsTableExists = revisionsTableExistsQueryResult[0].count === 1
|
||||||
|
if (!revisionsTableExists) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
await queryRunner.query('ALTER TABLE `revisions` ADD COLUMN `user_uuid` varchar(36) NULL')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,21 @@ export class removeDateIndexes1669636497932 implements MigrationInterface {
|
|||||||
name = 'removeDateIndexes1669636497932'
|
name = 'removeDateIndexes1669636497932'
|
||||||
|
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
await queryRunner.query('DROP INDEX `created_at` ON `revisions`')
|
const indexRevisionsOnCreatedAt = await queryRunner.manager.query(
|
||||||
await queryRunner.query('DROP INDEX `creation_date` ON `revisions`')
|
'SHOW INDEX FROM `revisions` where `key_name` = "created_at"',
|
||||||
|
)
|
||||||
|
const indexRevisionsOnCreatedAtExist = indexRevisionsOnCreatedAt && indexRevisionsOnCreatedAt.length > 0
|
||||||
|
if (indexRevisionsOnCreatedAtExist) {
|
||||||
|
await queryRunner.query('DROP INDEX `created_at` ON `revisions`')
|
||||||
|
}
|
||||||
|
|
||||||
|
const indexRevisionsOnCreationDate = await queryRunner.manager.query(
|
||||||
|
'SHOW INDEX FROM `revisions` where `key_name` = "creation_date"',
|
||||||
|
)
|
||||||
|
const indexRevisionsOnCreationDateAtExist = indexRevisionsOnCreationDate && indexRevisionsOnCreationDate.length > 0
|
||||||
|
if (indexRevisionsOnCreationDateAtExist) {
|
||||||
|
await queryRunner.query('DROP INDEX `creation_date` ON `revisions`')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/revisions-server",
|
"name": "@standardnotes/revisions-server",
|
||||||
"version": "1.10.27",
|
"version": "1.10.29",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
@@ -19,7 +19,13 @@
|
|||||||
"lint:fix": "eslint . --ext .ts --fix",
|
"lint:fix": "eslint . --ext .ts --fix",
|
||||||
"pretest": "yarn lint && yarn build",
|
"pretest": "yarn lint && yarn build",
|
||||||
"test": "jest --coverage --config=./jest.config.js --maxWorkers=50%",
|
"test": "jest --coverage --config=./jest.config.js --maxWorkers=50%",
|
||||||
|
"wait-for:db": "docker/wait-for.sh $DB_HOST $DB_PORT",
|
||||||
|
"wait-for:cache": "docker/wait-for.sh $REDIS_HOST $REDIS_PORT",
|
||||||
|
"wait-for:infra": "yarn wait-for:db && yarn wait-for:cache",
|
||||||
|
"wait-for:revisions": "docker/wait-for.sh localhost $REVISIONS_SERVER_PORT",
|
||||||
"start": "yarn node dist/bin/server.js",
|
"start": "yarn node dist/bin/server.js",
|
||||||
|
"supervisor:start": "yarn wait-for:infra && yarn node dist/bin/server.js",
|
||||||
|
"supervisor:worker": "yarn wait-for:revisions && yarn node dist/bin/worker.js",
|
||||||
"worker": "yarn node dist/bin/worker.js"
|
"worker": "yarn node dist/bin/worker.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ import {
|
|||||||
} from '@standardnotes/domain-events'
|
} from '@standardnotes/domain-events'
|
||||||
import { TokenDecoderInterface, CrossServiceTokenData, TokenDecoder } from '@standardnotes/security'
|
import { TokenDecoderInterface, CrossServiceTokenData, TokenDecoder } from '@standardnotes/security'
|
||||||
import {
|
import {
|
||||||
RedisDomainEventSubscriberFactory,
|
|
||||||
RedisEventMessageHandler,
|
|
||||||
SQSDomainEventSubscriberFactory,
|
SQSDomainEventSubscriberFactory,
|
||||||
SQSEventMessageHandler,
|
SQSEventMessageHandler,
|
||||||
SQSNewRelicEventMessageHandler,
|
SQSNewRelicEventMessageHandler,
|
||||||
@@ -164,8 +162,7 @@ export class ContainerConfigLoader {
|
|||||||
|
|
||||||
// env vars
|
// env vars
|
||||||
container.bind(TYPES.REDIS_URL).toConstantValue(env.get('REDIS_URL'))
|
container.bind(TYPES.REDIS_URL).toConstantValue(env.get('REDIS_URL'))
|
||||||
container.bind(TYPES.SQS_QUEUE_URL).toConstantValue(env.get('SQS_QUEUE_URL', true))
|
container.bind(TYPES.SQS_QUEUE_URL).toConstantValue(env.get('SQS_QUEUE_URL'))
|
||||||
container.bind(TYPES.REDIS_EVENTS_CHANNEL).toConstantValue(env.get('REDIS_EVENTS_CHANNEL'))
|
|
||||||
container.bind(TYPES.AUTH_JWT_SECRET).toConstantValue(env.get('AUTH_JWT_SECRET'))
|
container.bind(TYPES.AUTH_JWT_SECRET).toConstantValue(env.get('AUTH_JWT_SECRET'))
|
||||||
container.bind(TYPES.S3_AWS_REGION).toConstantValue(env.get('S3_AWS_REGION', true))
|
container.bind(TYPES.S3_AWS_REGION).toConstantValue(env.get('S3_AWS_REGION', true))
|
||||||
container.bind(TYPES.S3_BACKUP_BUCKET_NAME).toConstantValue(env.get('S3_BACKUP_BUCKET_NAME', true))
|
container.bind(TYPES.S3_BACKUP_BUCKET_NAME).toConstantValue(env.get('S3_BACKUP_BUCKET_NAME', true))
|
||||||
@@ -264,37 +261,22 @@ export class ContainerConfigLoader {
|
|||||||
['REVISIONS_OWNERSHIP_UPDATE_REQUESTED', container.get(TYPES.RevisionsOwnershipUpdateRequestedEventHandler)],
|
['REVISIONS_OWNERSHIP_UPDATE_REQUESTED', container.get(TYPES.RevisionsOwnershipUpdateRequestedEventHandler)],
|
||||||
])
|
])
|
||||||
|
|
||||||
if (env.get('SQS_QUEUE_URL', true)) {
|
container
|
||||||
container
|
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
||||||
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
.toConstantValue(
|
||||||
.toConstantValue(
|
env.get('NEW_RELIC_ENABLED', true) === 'true'
|
||||||
env.get('NEW_RELIC_ENABLED', true) === 'true'
|
? new SQSNewRelicEventMessageHandler(eventHandlers, container.get(TYPES.Logger))
|
||||||
? new SQSNewRelicEventMessageHandler(eventHandlers, container.get(TYPES.Logger))
|
: new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Logger)),
|
||||||
: new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Logger)),
|
)
|
||||||
)
|
container
|
||||||
container
|
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
||||||
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
.toConstantValue(
|
||||||
.toConstantValue(
|
new SQSDomainEventSubscriberFactory(
|
||||||
new SQSDomainEventSubscriberFactory(
|
container.get(TYPES.SQS),
|
||||||
container.get(TYPES.SQS),
|
container.get(TYPES.SQS_QUEUE_URL),
|
||||||
container.get(TYPES.SQS_QUEUE_URL),
|
container.get(TYPES.DomainEventMessageHandler),
|
||||||
container.get(TYPES.DomainEventMessageHandler),
|
),
|
||||||
),
|
)
|
||||||
)
|
|
||||||
} else {
|
|
||||||
container
|
|
||||||
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
|
||||||
.toConstantValue(new RedisEventMessageHandler(eventHandlers, container.get(TYPES.Logger)))
|
|
||||||
container
|
|
||||||
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
|
||||||
.toConstantValue(
|
|
||||||
new RedisDomainEventSubscriberFactory(
|
|
||||||
container.get(TYPES.Redis),
|
|
||||||
container.get(TYPES.DomainEventMessageHandler),
|
|
||||||
container.get(TYPES.REDIS_EVENTS_CHANNEL),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return container
|
return container
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ const TYPES = {
|
|||||||
REDIS_URL: Symbol.for('REDIS_URL'),
|
REDIS_URL: Symbol.for('REDIS_URL'),
|
||||||
SQS_QUEUE_URL: Symbol.for('SQS_QUEUE_URL'),
|
SQS_QUEUE_URL: Symbol.for('SQS_QUEUE_URL'),
|
||||||
SQS_AWS_REGION: Symbol.for('SQS_AWS_REGION'),
|
SQS_AWS_REGION: Symbol.for('SQS_AWS_REGION'),
|
||||||
REDIS_EVENTS_CHANNEL: Symbol.for('REDIS_EVENTS_CHANNEL'),
|
|
||||||
AUTH_JWT_SECRET: Symbol.for('AUTH_JWT_SECRET'),
|
AUTH_JWT_SECRET: Symbol.for('AUTH_JWT_SECRET'),
|
||||||
S3_AWS_REGION: Symbol.for('S3_AWS_REGION'),
|
S3_AWS_REGION: Symbol.for('S3_AWS_REGION'),
|
||||||
S3_BACKUP_BUCKET_NAME: Symbol.for('S3_BACKUP_BUCKET_NAME'),
|
S3_BACKUP_BUCKET_NAME: Symbol.for('S3_BACKUP_BUCKET_NAME'),
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ DB_DEBUG_LEVEL=all # "all" | "query" | "schema" | "error" | "warn" | "info" | "l
|
|||||||
DB_MIGRATIONS_PATH=dist/migrations/*.js
|
DB_MIGRATIONS_PATH=dist/migrations/*.js
|
||||||
|
|
||||||
REDIS_URL=redis://cache
|
REDIS_URL=redis://cache
|
||||||
REDIS_EVENTS_CHANNEL=events
|
|
||||||
|
|
||||||
SNS_TOPIC_ARN=
|
SNS_TOPIC_ARN=
|
||||||
SNS_AWS_REGION=
|
SNS_AWS_REGION=
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.16.19](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.16.18...@standardnotes/scheduler-server@1.16.19) (2023-02-06)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/scheduler-server
|
||||||
|
|
||||||
## [1.16.18](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.16.17...@standardnotes/scheduler-server@1.16.18) (2023-01-30)
|
## [1.16.18](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.16.17...@standardnotes/scheduler-server@1.16.18) (2023-01-30)
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/scheduler-server",
|
"name": "@standardnotes/scheduler-server",
|
||||||
"version": "1.16.18",
|
"version": "1.16.19",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -14,9 +14,6 @@ import TYPES from './Types'
|
|||||||
import { AppDataSource } from './DataSource'
|
import { AppDataSource } from './DataSource'
|
||||||
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
|
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
|
||||||
import {
|
import {
|
||||||
RedisDomainEventPublisher,
|
|
||||||
RedisDomainEventSubscriberFactory,
|
|
||||||
RedisEventMessageHandler,
|
|
||||||
SNSDomainEventPublisher,
|
SNSDomainEventPublisher,
|
||||||
SQSDomainEventSubscriberFactory,
|
SQSDomainEventSubscriberFactory,
|
||||||
SQSEventMessageHandler,
|
SQSEventMessageHandler,
|
||||||
@@ -110,10 +107,9 @@ export class ContainerConfigLoader {
|
|||||||
|
|
||||||
// env vars
|
// env vars
|
||||||
container.bind(TYPES.REDIS_URL).toConstantValue(env.get('REDIS_URL'))
|
container.bind(TYPES.REDIS_URL).toConstantValue(env.get('REDIS_URL'))
|
||||||
container.bind(TYPES.SNS_TOPIC_ARN).toConstantValue(env.get('SNS_TOPIC_ARN', true))
|
container.bind(TYPES.SNS_TOPIC_ARN).toConstantValue(env.get('SNS_TOPIC_ARN'))
|
||||||
container.bind(TYPES.SNS_AWS_REGION).toConstantValue(env.get('SNS_AWS_REGION', true))
|
container.bind(TYPES.SNS_AWS_REGION).toConstantValue(env.get('SNS_AWS_REGION', true))
|
||||||
container.bind(TYPES.SQS_QUEUE_URL).toConstantValue(env.get('SQS_QUEUE_URL', true))
|
container.bind(TYPES.SQS_QUEUE_URL).toConstantValue(env.get('SQS_QUEUE_URL'))
|
||||||
container.bind(TYPES.REDIS_EVENTS_CHANNEL).toConstantValue(env.get('REDIS_EVENTS_CHANNEL'))
|
|
||||||
container.bind(TYPES.NEW_RELIC_ENABLED).toConstantValue(env.get('NEW_RELIC_ENABLED', true))
|
container.bind(TYPES.NEW_RELIC_ENABLED).toConstantValue(env.get('NEW_RELIC_ENABLED', true))
|
||||||
|
|
||||||
// Repositories
|
// Repositories
|
||||||
@@ -145,17 +141,9 @@ export class ContainerConfigLoader {
|
|||||||
container.bind<TimerInterface>(TYPES.Timer).toConstantValue(new Timer())
|
container.bind<TimerInterface>(TYPES.Timer).toConstantValue(new Timer())
|
||||||
container.bind<JobDoneInterpreterInterface>(TYPES.JobDoneInterpreter).to(JobDoneInterpreter)
|
container.bind<JobDoneInterpreterInterface>(TYPES.JobDoneInterpreter).to(JobDoneInterpreter)
|
||||||
|
|
||||||
if (env.get('SNS_TOPIC_ARN', true)) {
|
container
|
||||||
container
|
.bind<SNSDomainEventPublisher>(TYPES.DomainEventPublisher)
|
||||||
.bind<SNSDomainEventPublisher>(TYPES.DomainEventPublisher)
|
.toConstantValue(new SNSDomainEventPublisher(container.get(TYPES.SNS), container.get(TYPES.SNS_TOPIC_ARN)))
|
||||||
.toConstantValue(new SNSDomainEventPublisher(container.get(TYPES.SNS), container.get(TYPES.SNS_TOPIC_ARN)))
|
|
||||||
} else {
|
|
||||||
container
|
|
||||||
.bind<RedisDomainEventPublisher>(TYPES.DomainEventPublisher)
|
|
||||||
.toConstantValue(
|
|
||||||
new RedisDomainEventPublisher(container.get(TYPES.Redis), container.get(TYPES.REDIS_EVENTS_CHANNEL)),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const eventHandlers: Map<string, DomainEventHandlerInterface> = new Map([
|
const eventHandlers: Map<string, DomainEventHandlerInterface> = new Map([
|
||||||
['PREDICATE_VERIFIED', container.get(TYPES.PredicateVerifiedEventHandler)],
|
['PREDICATE_VERIFIED', container.get(TYPES.PredicateVerifiedEventHandler)],
|
||||||
@@ -164,37 +152,22 @@ export class ContainerConfigLoader {
|
|||||||
['EXIT_DISCOUNT_APPLIED', container.get(TYPES.ExitDiscountAppliedEventHandler)],
|
['EXIT_DISCOUNT_APPLIED', container.get(TYPES.ExitDiscountAppliedEventHandler)],
|
||||||
])
|
])
|
||||||
|
|
||||||
if (env.get('SQS_QUEUE_URL', true)) {
|
container
|
||||||
container
|
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
||||||
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
.toConstantValue(
|
||||||
.toConstantValue(
|
env.get('NEW_RELIC_ENABLED', true) === 'true'
|
||||||
env.get('NEW_RELIC_ENABLED', true) === 'true'
|
? new SQSNewRelicEventMessageHandler(eventHandlers, container.get(TYPES.Logger))
|
||||||
? new SQSNewRelicEventMessageHandler(eventHandlers, container.get(TYPES.Logger))
|
: new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Logger)),
|
||||||
: new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Logger)),
|
)
|
||||||
)
|
container
|
||||||
container
|
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
||||||
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
.toConstantValue(
|
||||||
.toConstantValue(
|
new SQSDomainEventSubscriberFactory(
|
||||||
new SQSDomainEventSubscriberFactory(
|
container.get(TYPES.SQS),
|
||||||
container.get(TYPES.SQS),
|
container.get(TYPES.SQS_QUEUE_URL),
|
||||||
container.get(TYPES.SQS_QUEUE_URL),
|
container.get(TYPES.DomainEventMessageHandler),
|
||||||
container.get(TYPES.DomainEventMessageHandler),
|
),
|
||||||
),
|
)
|
||||||
)
|
|
||||||
} else {
|
|
||||||
container
|
|
||||||
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
|
||||||
.toConstantValue(new RedisEventMessageHandler(eventHandlers, container.get(TYPES.Logger)))
|
|
||||||
container
|
|
||||||
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
|
||||||
.toConstantValue(
|
|
||||||
new RedisDomainEventSubscriberFactory(
|
|
||||||
container.get(TYPES.Redis),
|
|
||||||
container.get(TYPES.DomainEventMessageHandler),
|
|
||||||
container.get(TYPES.REDIS_EVENTS_CHANNEL),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return container
|
return container
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ const TYPES = {
|
|||||||
SNS_AWS_REGION: Symbol.for('SNS_AWS_REGION'),
|
SNS_AWS_REGION: Symbol.for('SNS_AWS_REGION'),
|
||||||
SQS_QUEUE_URL: Symbol.for('SQS_QUEUE_URL'),
|
SQS_QUEUE_URL: Symbol.for('SQS_QUEUE_URL'),
|
||||||
SQS_AWS_REGION: Symbol.for('SQS_AWS_REGION'),
|
SQS_AWS_REGION: Symbol.for('SQS_AWS_REGION'),
|
||||||
REDIS_EVENTS_CHANNEL: Symbol.for('REDIS_EVENTS_CHANNEL'),
|
|
||||||
NEW_RELIC_ENABLED: Symbol.for('NEW_RELIC_ENABLED'),
|
NEW_RELIC_ENABLED: Symbol.for('NEW_RELIC_ENABLED'),
|
||||||
// Repositories
|
// Repositories
|
||||||
PredicateRepository: Symbol.for('PredicateRepository'),
|
PredicateRepository: Symbol.for('PredicateRepository'),
|
||||||
|
|||||||
@@ -24,8 +24,6 @@ SQS_AWS_REGION=
|
|||||||
S3_AWS_REGION=
|
S3_AWS_REGION=
|
||||||
S3_BACKUP_BUCKET_NAME=
|
S3_BACKUP_BUCKET_NAME=
|
||||||
|
|
||||||
REDIS_EVENTS_CHANNEL=events
|
|
||||||
|
|
||||||
INTERNAL_DNS_REROUTE_ENABLED=false
|
INTERNAL_DNS_REROUTE_ENABLED=false
|
||||||
EXTENSIONS_SERVER_URL=http://extensions-server:3004
|
EXTENSIONS_SERVER_URL=http://extensions-server:3004
|
||||||
AUTH_SERVER_URL=http://auth:3000
|
AUTH_SERVER_URL=http://auth:3000
|
||||||
|
|||||||
@@ -3,6 +3,16 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.29.15](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.29.14...@standardnotes/syncing-server@1.29.15) (2023-02-09)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* optimize memory usage ([e96fd6d](https://github.com/standardnotes/syncing-server-js/commit/e96fd6d69e1252842b5c91b1bedefa36e5d4a232))
|
||||||
|
|
||||||
|
## [1.29.14](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.29.13...@standardnotes/syncing-server@1.29.14) (2023-02-06)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/syncing-server
|
||||||
|
|
||||||
## [1.29.13](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.29.12...@standardnotes/syncing-server@1.29.13) (2023-01-30)
|
## [1.29.13](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.29.12...@standardnotes/syncing-server@1.29.13) (2023-01-30)
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|||||||
Executable
+13
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
WAIT_FOR_HOST="$1"
|
||||||
|
shift
|
||||||
|
WAIT_FOR_PORT="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
while ! nc -vz $WAIT_FOR_HOST $WAIT_FOR_PORT; do
|
||||||
|
echo "$WAIT_FOR_HOST:$WAIT_FOR_PORT is unavailable yet - waiting for it to start"
|
||||||
|
sleep 10
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "$WAIT_FOR_HOST:$WAIT_FOR_PORT is up. Proceeding to startup."
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/syncing-server",
|
"name": "@standardnotes/syncing-server",
|
||||||
"version": "1.29.13",
|
"version": "1.29.15",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
@@ -19,8 +19,14 @@
|
|||||||
"lint:fix": "eslint . --ext .ts --fix",
|
"lint:fix": "eslint . --ext .ts --fix",
|
||||||
"pretest": "yarn lint && yarn build",
|
"pretest": "yarn lint && yarn build",
|
||||||
"test": "jest --coverage --config=./jest.config.js --maxWorkers=50%",
|
"test": "jest --coverage --config=./jest.config.js --maxWorkers=50%",
|
||||||
|
"wait-for:db": "docker/wait-for.sh $DB_HOST $DB_PORT",
|
||||||
|
"wait-for:cache": "docker/wait-for.sh $REDIS_HOST $REDIS_PORT",
|
||||||
|
"wait-for:infra": "yarn wait-for:db && yarn wait-for:cache",
|
||||||
|
"wait-for:syncing-server": "docker/wait-for.sh localhost $SYNCING_SERVER_PORT",
|
||||||
"start": "yarn node dist/bin/server.js",
|
"start": "yarn node dist/bin/server.js",
|
||||||
|
"supervisor:start": "yarn wait-for:infra && yarn node dist/bin/server.js",
|
||||||
"worker": "yarn node dist/bin/worker.js",
|
"worker": "yarn node dist/bin/worker.js",
|
||||||
|
"supervisor:worker": "yarn wait-for:syncing-server && yarn node dist/bin/worker.js",
|
||||||
"content-size": "yarn node dist/bin/content.js",
|
"content-size": "yarn node dist/bin/content.js",
|
||||||
"revisions-ownership": "yarn node dist/bin/revisions.js",
|
"revisions-ownership": "yarn node dist/bin/revisions.js",
|
||||||
"upgrade:snjs": "yarn ncu -u '@standardnotes/*'"
|
"upgrade:snjs": "yarn ncu -u '@standardnotes/*'"
|
||||||
|
|||||||
@@ -54,9 +54,6 @@ import { UuidFilter } from '../Domain/Item/SaveRule/UuidFilter'
|
|||||||
import { ContentTypeFilter } from '../Domain/Item/SaveRule/ContentTypeFilter'
|
import { ContentTypeFilter } from '../Domain/Item/SaveRule/ContentTypeFilter'
|
||||||
import { ContentFilter } from '../Domain/Item/SaveRule/ContentFilter'
|
import { ContentFilter } from '../Domain/Item/SaveRule/ContentFilter'
|
||||||
import {
|
import {
|
||||||
RedisDomainEventPublisher,
|
|
||||||
RedisDomainEventSubscriberFactory,
|
|
||||||
RedisEventMessageHandler,
|
|
||||||
SNSDomainEventPublisher,
|
SNSDomainEventPublisher,
|
||||||
SQSDomainEventSubscriberFactory,
|
SQSDomainEventSubscriberFactory,
|
||||||
SQSEventMessageHandler,
|
SQSEventMessageHandler,
|
||||||
@@ -192,10 +189,9 @@ export class ContainerConfigLoader {
|
|||||||
|
|
||||||
// env vars
|
// env vars
|
||||||
container.bind(TYPES.REDIS_URL).toConstantValue(env.get('REDIS_URL'))
|
container.bind(TYPES.REDIS_URL).toConstantValue(env.get('REDIS_URL'))
|
||||||
container.bind(TYPES.SNS_TOPIC_ARN).toConstantValue(env.get('SNS_TOPIC_ARN', true))
|
container.bind(TYPES.SNS_TOPIC_ARN).toConstantValue(env.get('SNS_TOPIC_ARN'))
|
||||||
container.bind(TYPES.SNS_AWS_REGION).toConstantValue(env.get('SNS_AWS_REGION', true))
|
container.bind(TYPES.SNS_AWS_REGION).toConstantValue(env.get('SNS_AWS_REGION', true))
|
||||||
container.bind(TYPES.SQS_QUEUE_URL).toConstantValue(env.get('SQS_QUEUE_URL', true))
|
container.bind(TYPES.SQS_QUEUE_URL).toConstantValue(env.get('SQS_QUEUE_URL'))
|
||||||
container.bind(TYPES.REDIS_EVENTS_CHANNEL).toConstantValue(env.get('REDIS_EVENTS_CHANNEL'))
|
|
||||||
container.bind(TYPES.AUTH_JWT_SECRET).toConstantValue(env.get('AUTH_JWT_SECRET'))
|
container.bind(TYPES.AUTH_JWT_SECRET).toConstantValue(env.get('AUTH_JWT_SECRET'))
|
||||||
container
|
container
|
||||||
.bind(TYPES.INTERNAL_DNS_REROUTE_ENABLED)
|
.bind(TYPES.INTERNAL_DNS_REROUTE_ENABLED)
|
||||||
@@ -277,17 +273,9 @@ export class ContainerConfigLoader {
|
|||||||
}
|
}
|
||||||
container.bind<RevisionServiceInterface>(TYPES.RevisionService).to(RevisionService)
|
container.bind<RevisionServiceInterface>(TYPES.RevisionService).to(RevisionService)
|
||||||
|
|
||||||
if (env.get('SNS_TOPIC_ARN', true)) {
|
container
|
||||||
container
|
.bind<SNSDomainEventPublisher>(TYPES.DomainEventPublisher)
|
||||||
.bind<SNSDomainEventPublisher>(TYPES.DomainEventPublisher)
|
.toConstantValue(new SNSDomainEventPublisher(container.get(TYPES.SNS), container.get(TYPES.SNS_TOPIC_ARN)))
|
||||||
.toConstantValue(new SNSDomainEventPublisher(container.get(TYPES.SNS), container.get(TYPES.SNS_TOPIC_ARN)))
|
|
||||||
} else {
|
|
||||||
container
|
|
||||||
.bind<RedisDomainEventPublisher>(TYPES.DomainEventPublisher)
|
|
||||||
.toConstantValue(
|
|
||||||
new RedisDomainEventPublisher(container.get(TYPES.Redis), container.get(TYPES.REDIS_EVENTS_CHANNEL)),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const eventHandlers: Map<string, DomainEventHandlerInterface> = new Map([
|
const eventHandlers: Map<string, DomainEventHandlerInterface> = new Map([
|
||||||
['DUPLICATE_ITEM_SYNCED', container.get(TYPES.DuplicateItemSyncedEventHandler)],
|
['DUPLICATE_ITEM_SYNCED', container.get(TYPES.DuplicateItemSyncedEventHandler)],
|
||||||
@@ -301,37 +289,22 @@ export class ContainerConfigLoader {
|
|||||||
['ITEM_REVISION_CREATION_REQUESTED', container.get(TYPES.ItemRevisionCreationRequestedEventHandler)],
|
['ITEM_REVISION_CREATION_REQUESTED', container.get(TYPES.ItemRevisionCreationRequestedEventHandler)],
|
||||||
])
|
])
|
||||||
|
|
||||||
if (env.get('SQS_QUEUE_URL', true)) {
|
container
|
||||||
container
|
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
||||||
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
.toConstantValue(
|
||||||
.toConstantValue(
|
env.get('NEW_RELIC_ENABLED', true) === 'true'
|
||||||
env.get('NEW_RELIC_ENABLED', true) === 'true'
|
? new SQSNewRelicEventMessageHandler(eventHandlers, container.get(TYPES.Logger))
|
||||||
? new SQSNewRelicEventMessageHandler(eventHandlers, container.get(TYPES.Logger))
|
: new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Logger)),
|
||||||
: new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Logger)),
|
)
|
||||||
)
|
container
|
||||||
container
|
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
||||||
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
.toConstantValue(
|
||||||
.toConstantValue(
|
new SQSDomainEventSubscriberFactory(
|
||||||
new SQSDomainEventSubscriberFactory(
|
container.get(TYPES.SQS),
|
||||||
container.get(TYPES.SQS),
|
container.get(TYPES.SQS_QUEUE_URL),
|
||||||
container.get(TYPES.SQS_QUEUE_URL),
|
container.get(TYPES.DomainEventMessageHandler),
|
||||||
container.get(TYPES.DomainEventMessageHandler),
|
),
|
||||||
),
|
)
|
||||||
)
|
|
||||||
} else {
|
|
||||||
container
|
|
||||||
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
|
||||||
.toConstantValue(new RedisEventMessageHandler(eventHandlers, container.get(TYPES.Logger)))
|
|
||||||
container
|
|
||||||
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
|
||||||
.toConstantValue(
|
|
||||||
new RedisDomainEventSubscriberFactory(
|
|
||||||
container.get(TYPES.Redis),
|
|
||||||
container.get(TYPES.DomainEventMessageHandler),
|
|
||||||
container.get(TYPES.REDIS_EVENTS_CHANNEL),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
container.bind<ItemFactoryInterface>(TYPES.ItemFactory).to(ItemFactory)
|
container.bind<ItemFactoryInterface>(TYPES.ItemFactory).to(ItemFactory)
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ const TYPES = {
|
|||||||
SNS_AWS_REGION: Symbol.for('SNS_AWS_REGION'),
|
SNS_AWS_REGION: Symbol.for('SNS_AWS_REGION'),
|
||||||
SQS_QUEUE_URL: Symbol.for('SQS_QUEUE_URL'),
|
SQS_QUEUE_URL: Symbol.for('SQS_QUEUE_URL'),
|
||||||
SQS_AWS_REGION: Symbol.for('SQS_AWS_REGION'),
|
SQS_AWS_REGION: Symbol.for('SQS_AWS_REGION'),
|
||||||
REDIS_EVENTS_CHANNEL: Symbol.for('REDIS_EVENTS_CHANNEL'),
|
|
||||||
AUTH_JWT_SECRET: Symbol.for('AUTH_JWT_SECRET'),
|
AUTH_JWT_SECRET: Symbol.for('AUTH_JWT_SECRET'),
|
||||||
INTERNAL_DNS_REROUTE_ENABLED: Symbol.for('INTERNAL_DNS_REROUTE_ENABLED'),
|
INTERNAL_DNS_REROUTE_ENABLED: Symbol.for('INTERNAL_DNS_REROUTE_ENABLED'),
|
||||||
EXTENSIONS_SERVER_URL: Symbol.for('EXTENSIONS_SERVER_URL'),
|
EXTENSIONS_SERVER_URL: Symbol.for('EXTENSIONS_SERVER_URL'),
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ SNS_AWS_REGION=
|
|||||||
SQS_QUEUE_URL=
|
SQS_QUEUE_URL=
|
||||||
SQS_AWS_REGION=
|
SQS_AWS_REGION=
|
||||||
|
|
||||||
REDIS_EVENTS_CHANNEL=events
|
|
||||||
|
|
||||||
WEB_SOCKET_CONNECTION_TOKEN_SECRET=
|
WEB_SOCKET_CONNECTION_TOKEN_SECRET=
|
||||||
WEB_SOCKET_CONNECTION_TOKEN_TTL=
|
WEB_SOCKET_CONNECTION_TOKEN_TTL=
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.5.20](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.5.19...@standardnotes/websockets-server@1.5.20) (2023-02-06)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/websockets-server
|
||||||
|
|
||||||
## [1.5.19](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.5.18...@standardnotes/websockets-server@1.5.19) (2023-01-30)
|
## [1.5.19](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.5.18...@standardnotes/websockets-server@1.5.19) (2023-01-30)
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/websockets-server",
|
"name": "@standardnotes/websockets-server",
|
||||||
"version": "1.5.19",
|
"version": "1.5.20",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ import { AddWebSocketsConnection } from '../Domain/UseCase/AddWebSocketsConnecti
|
|||||||
import { RemoveWebSocketsConnection } from '../Domain/UseCase/RemoveWebSocketsConnection/RemoveWebSocketsConnection'
|
import { RemoveWebSocketsConnection } from '../Domain/UseCase/RemoveWebSocketsConnection/RemoveWebSocketsConnection'
|
||||||
import { WebSocketsClientMessenger } from '../Infra/WebSockets/WebSocketsClientMessenger'
|
import { WebSocketsClientMessenger } from '../Infra/WebSockets/WebSocketsClientMessenger'
|
||||||
import {
|
import {
|
||||||
RedisDomainEventSubscriberFactory,
|
|
||||||
RedisEventMessageHandler,
|
|
||||||
SQSDomainEventSubscriberFactory,
|
SQSDomainEventSubscriberFactory,
|
||||||
SQSEventMessageHandler,
|
SQSEventMessageHandler,
|
||||||
SQSNewRelicEventMessageHandler,
|
SQSNewRelicEventMessageHandler,
|
||||||
@@ -110,8 +108,7 @@ export class ContainerConfigLoader {
|
|||||||
.bind(TYPES.WEB_SOCKET_CONNECTION_TOKEN_TTL)
|
.bind(TYPES.WEB_SOCKET_CONNECTION_TOKEN_TTL)
|
||||||
.toConstantValue(+env.get('WEB_SOCKET_CONNECTION_TOKEN_TTL', true))
|
.toConstantValue(+env.get('WEB_SOCKET_CONNECTION_TOKEN_TTL', true))
|
||||||
container.bind(TYPES.REDIS_URL).toConstantValue(env.get('REDIS_URL'))
|
container.bind(TYPES.REDIS_URL).toConstantValue(env.get('REDIS_URL'))
|
||||||
container.bind(TYPES.SQS_QUEUE_URL).toConstantValue(env.get('SQS_QUEUE_URL', true))
|
container.bind(TYPES.SQS_QUEUE_URL).toConstantValue(env.get('SQS_QUEUE_URL'))
|
||||||
container.bind(TYPES.REDIS_EVENTS_CHANNEL).toConstantValue(env.get('REDIS_EVENTS_CHANNEL'))
|
|
||||||
container.bind(TYPES.NEW_RELIC_ENABLED).toConstantValue(env.get('NEW_RELIC_ENABLED', true))
|
container.bind(TYPES.NEW_RELIC_ENABLED).toConstantValue(env.get('NEW_RELIC_ENABLED', true))
|
||||||
container.bind(TYPES.WEBSOCKETS_API_URL).toConstantValue(env.get('WEBSOCKETS_API_URL', true))
|
container.bind(TYPES.WEBSOCKETS_API_URL).toConstantValue(env.get('WEBSOCKETS_API_URL', true))
|
||||||
container.bind(TYPES.VERSION).toConstantValue(env.get('VERSION'))
|
container.bind(TYPES.VERSION).toConstantValue(env.get('VERSION'))
|
||||||
@@ -144,37 +141,22 @@ export class ContainerConfigLoader {
|
|||||||
['WEB_SOCKET_MESSAGE_REQUESTED', container.get(TYPES.WebSocketMessageRequestedEventHandler)],
|
['WEB_SOCKET_MESSAGE_REQUESTED', container.get(TYPES.WebSocketMessageRequestedEventHandler)],
|
||||||
])
|
])
|
||||||
|
|
||||||
if (env.get('SQS_QUEUE_URL', true)) {
|
container
|
||||||
container
|
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
||||||
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
.toConstantValue(
|
||||||
.toConstantValue(
|
env.get('NEW_RELIC_ENABLED', true) === 'true'
|
||||||
env.get('NEW_RELIC_ENABLED', true) === 'true'
|
? new SQSNewRelicEventMessageHandler(eventHandlers, container.get(TYPES.Logger))
|
||||||
? new SQSNewRelicEventMessageHandler(eventHandlers, container.get(TYPES.Logger))
|
: new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Logger)),
|
||||||
: new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Logger)),
|
)
|
||||||
)
|
container
|
||||||
container
|
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
||||||
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
.toConstantValue(
|
||||||
.toConstantValue(
|
new SQSDomainEventSubscriberFactory(
|
||||||
new SQSDomainEventSubscriberFactory(
|
container.get(TYPES.SQS),
|
||||||
container.get(TYPES.SQS),
|
container.get(TYPES.SQS_QUEUE_URL),
|
||||||
container.get(TYPES.SQS_QUEUE_URL),
|
container.get(TYPES.DomainEventMessageHandler),
|
||||||
container.get(TYPES.DomainEventMessageHandler),
|
),
|
||||||
),
|
)
|
||||||
)
|
|
||||||
} else {
|
|
||||||
container
|
|
||||||
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
|
||||||
.toConstantValue(new RedisEventMessageHandler(eventHandlers, container.get(TYPES.Logger)))
|
|
||||||
container
|
|
||||||
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
|
||||||
.toConstantValue(
|
|
||||||
new RedisDomainEventSubscriberFactory(
|
|
||||||
container.get(TYPES.Redis),
|
|
||||||
container.get(TYPES.DomainEventMessageHandler),
|
|
||||||
container.get(TYPES.REDIS_EVENTS_CHANNEL),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return container
|
return container
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ const TYPES = {
|
|||||||
REDIS_URL: Symbol.for('REDIS_URL'),
|
REDIS_URL: Symbol.for('REDIS_URL'),
|
||||||
SQS_QUEUE_URL: Symbol.for('SQS_QUEUE_URL'),
|
SQS_QUEUE_URL: Symbol.for('SQS_QUEUE_URL'),
|
||||||
SQS_AWS_REGION: Symbol.for('SQS_AWS_REGION'),
|
SQS_AWS_REGION: Symbol.for('SQS_AWS_REGION'),
|
||||||
REDIS_EVENTS_CHANNEL: Symbol.for('REDIS_EVENTS_CHANNEL'),
|
|
||||||
NEW_RELIC_ENABLED: Symbol.for('NEW_RELIC_ENABLED'),
|
NEW_RELIC_ENABLED: Symbol.for('NEW_RELIC_ENABLED'),
|
||||||
WEBSOCKETS_API_URL: Symbol.for('WEBSOCKETS_API_URL'),
|
WEBSOCKETS_API_URL: Symbol.for('WEBSOCKETS_API_URL'),
|
||||||
VERSION: Symbol.for('VERSION'),
|
VERSION: Symbol.for('VERSION'),
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ SNS_AWS_REGION=
|
|||||||
SQS_QUEUE_URL=
|
SQS_QUEUE_URL=
|
||||||
SQS_AWS_REGION=
|
SQS_AWS_REGION=
|
||||||
|
|
||||||
REDIS_EVENTS_CHANNEL=events
|
|
||||||
|
|
||||||
# (Optional) New Relic Setup
|
# (Optional) New Relic Setup
|
||||||
NEW_RELIC_ENABLED=false
|
NEW_RELIC_ENABLED=false
|
||||||
NEW_RELIC_APP_NAME=Workspace
|
NEW_RELIC_APP_NAME=Workspace
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.19.23](https://github.com/standardnotes/server/compare/@standardnotes/workspace-server@1.19.22...@standardnotes/workspace-server@1.19.23) (2023-02-06)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/workspace-server
|
||||||
|
|
||||||
## [1.19.22](https://github.com/standardnotes/server/compare/@standardnotes/workspace-server@1.19.21...@standardnotes/workspace-server@1.19.22) (2023-01-30)
|
## [1.19.22](https://github.com/standardnotes/server/compare/@standardnotes/workspace-server@1.19.21...@standardnotes/workspace-server@1.19.22) (2023-01-30)
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/workspace-server",
|
"name": "@standardnotes/workspace-server",
|
||||||
"version": "1.19.22",
|
"version": "1.19.23",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,9 +13,6 @@ import { Env } from './Env'
|
|||||||
import TYPES from './Types'
|
import TYPES from './Types'
|
||||||
import { AppDataSource } from './DataSource'
|
import { AppDataSource } from './DataSource'
|
||||||
import {
|
import {
|
||||||
RedisDomainEventPublisher,
|
|
||||||
RedisDomainEventSubscriberFactory,
|
|
||||||
RedisEventMessageHandler,
|
|
||||||
SNSDomainEventPublisher,
|
SNSDomainEventPublisher,
|
||||||
SQSDomainEventSubscriberFactory,
|
SQSDomainEventSubscriberFactory,
|
||||||
SQSEventMessageHandler,
|
SQSEventMessageHandler,
|
||||||
@@ -141,10 +138,9 @@ export class ContainerConfigLoader {
|
|||||||
// env vars
|
// env vars
|
||||||
container.bind(TYPES.AUTH_JWT_SECRET).toConstantValue(env.get('AUTH_JWT_SECRET'))
|
container.bind(TYPES.AUTH_JWT_SECRET).toConstantValue(env.get('AUTH_JWT_SECRET'))
|
||||||
container.bind(TYPES.REDIS_URL).toConstantValue(env.get('REDIS_URL'))
|
container.bind(TYPES.REDIS_URL).toConstantValue(env.get('REDIS_URL'))
|
||||||
container.bind(TYPES.SNS_TOPIC_ARN).toConstantValue(env.get('SNS_TOPIC_ARN', true))
|
container.bind(TYPES.SNS_TOPIC_ARN).toConstantValue(env.get('SNS_TOPIC_ARN'))
|
||||||
container.bind(TYPES.SNS_AWS_REGION).toConstantValue(env.get('SNS_AWS_REGION', true))
|
container.bind(TYPES.SNS_AWS_REGION).toConstantValue(env.get('SNS_AWS_REGION', true))
|
||||||
container.bind(TYPES.SQS_QUEUE_URL).toConstantValue(env.get('SQS_QUEUE_URL', true))
|
container.bind(TYPES.SQS_QUEUE_URL).toConstantValue(env.get('SQS_QUEUE_URL'))
|
||||||
container.bind(TYPES.REDIS_EVENTS_CHANNEL).toConstantValue(env.get('REDIS_EVENTS_CHANNEL'))
|
|
||||||
container.bind(TYPES.NEW_RELIC_ENABLED).toConstantValue(env.get('NEW_RELIC_ENABLED', true))
|
container.bind(TYPES.NEW_RELIC_ENABLED).toConstantValue(env.get('NEW_RELIC_ENABLED', true))
|
||||||
container.bind(TYPES.VERSION).toConstantValue(env.get('VERSION'))
|
container.bind(TYPES.VERSION).toConstantValue(env.get('VERSION'))
|
||||||
|
|
||||||
@@ -169,53 +165,30 @@ export class ContainerConfigLoader {
|
|||||||
.bind<TokenDecoderInterface<CrossServiceTokenData>>(TYPES.CrossServiceTokenDecoder)
|
.bind<TokenDecoderInterface<CrossServiceTokenData>>(TYPES.CrossServiceTokenDecoder)
|
||||||
.toConstantValue(new TokenDecoder<CrossServiceTokenData>(container.get(TYPES.AUTH_JWT_SECRET)))
|
.toConstantValue(new TokenDecoder<CrossServiceTokenData>(container.get(TYPES.AUTH_JWT_SECRET)))
|
||||||
|
|
||||||
if (env.get('SNS_TOPIC_ARN', true)) {
|
container
|
||||||
container
|
.bind<SNSDomainEventPublisher>(TYPES.DomainEventPublisher)
|
||||||
.bind<SNSDomainEventPublisher>(TYPES.DomainEventPublisher)
|
.toConstantValue(new SNSDomainEventPublisher(container.get(TYPES.SNS), container.get(TYPES.SNS_TOPIC_ARN)))
|
||||||
.toConstantValue(new SNSDomainEventPublisher(container.get(TYPES.SNS), container.get(TYPES.SNS_TOPIC_ARN)))
|
|
||||||
} else {
|
|
||||||
container
|
|
||||||
.bind<RedisDomainEventPublisher>(TYPES.DomainEventPublisher)
|
|
||||||
.toConstantValue(
|
|
||||||
new RedisDomainEventPublisher(container.get(TYPES.Redis), container.get(TYPES.REDIS_EVENTS_CHANNEL)),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const eventHandlers: Map<string, DomainEventHandlerInterface> = new Map([
|
const eventHandlers: Map<string, DomainEventHandlerInterface> = new Map([
|
||||||
['USER_REGISTERED', container.get(TYPES.UserRegisteredEventHandler)],
|
['USER_REGISTERED', container.get(TYPES.UserRegisteredEventHandler)],
|
||||||
])
|
])
|
||||||
|
|
||||||
if (env.get('SQS_QUEUE_URL', true)) {
|
container
|
||||||
container
|
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
||||||
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
.toConstantValue(
|
||||||
.toConstantValue(
|
env.get('NEW_RELIC_ENABLED', true) === 'true'
|
||||||
env.get('NEW_RELIC_ENABLED', true) === 'true'
|
? new SQSNewRelicEventMessageHandler(eventHandlers, container.get(TYPES.Logger))
|
||||||
? new SQSNewRelicEventMessageHandler(eventHandlers, container.get(TYPES.Logger))
|
: new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Logger)),
|
||||||
: new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Logger)),
|
)
|
||||||
)
|
container
|
||||||
container
|
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
||||||
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
.toConstantValue(
|
||||||
.toConstantValue(
|
new SQSDomainEventSubscriberFactory(
|
||||||
new SQSDomainEventSubscriberFactory(
|
container.get(TYPES.SQS),
|
||||||
container.get(TYPES.SQS),
|
container.get(TYPES.SQS_QUEUE_URL),
|
||||||
container.get(TYPES.SQS_QUEUE_URL),
|
container.get(TYPES.DomainEventMessageHandler),
|
||||||
container.get(TYPES.DomainEventMessageHandler),
|
),
|
||||||
),
|
)
|
||||||
)
|
|
||||||
} else {
|
|
||||||
container
|
|
||||||
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
|
||||||
.toConstantValue(new RedisEventMessageHandler(eventHandlers, container.get(TYPES.Logger)))
|
|
||||||
container
|
|
||||||
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
|
|
||||||
.toConstantValue(
|
|
||||||
new RedisDomainEventSubscriberFactory(
|
|
||||||
container.get(TYPES.Redis),
|
|
||||||
container.get(TYPES.DomainEventMessageHandler),
|
|
||||||
container.get(TYPES.REDIS_EVENTS_CHANNEL),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return container
|
return container
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ const TYPES = {
|
|||||||
SNS_AWS_REGION: Symbol.for('SNS_AWS_REGION'),
|
SNS_AWS_REGION: Symbol.for('SNS_AWS_REGION'),
|
||||||
SQS_QUEUE_URL: Symbol.for('SQS_QUEUE_URL'),
|
SQS_QUEUE_URL: Symbol.for('SQS_QUEUE_URL'),
|
||||||
SQS_AWS_REGION: Symbol.for('SQS_AWS_REGION'),
|
SQS_AWS_REGION: Symbol.for('SQS_AWS_REGION'),
|
||||||
REDIS_EVENTS_CHANNEL: Symbol.for('REDIS_EVENTS_CHANNEL'),
|
|
||||||
NEW_RELIC_ENABLED: Symbol.for('NEW_RELIC_ENABLED'),
|
NEW_RELIC_ENABLED: Symbol.for('NEW_RELIC_ENABLED'),
|
||||||
VERSION: Symbol.for('VERSION'),
|
VERSION: Symbol.for('VERSION'),
|
||||||
// use cases
|
// use cases
|
||||||
|
|||||||
Reference in New Issue
Block a user