Compare commits

..

5 Commits

35 changed files with 152 additions and 20 deletions

View File

@@ -40,7 +40,7 @@ jobs:
- name: Fill in the new package version in the Amazon ECS task definition
run: |
jq '(.containerDefinitions[] | select(.name=="${{ inputs.service_name }}-prod") | .environment[] | select(.name=="NPM_PACKAGE_VERSION")).value = "${{ github.sha }}"' task-definition.json > tmp.json && mv tmp.json task-definition.json
jq '(.containerDefinitions[] | select(.name=="${{ inputs.service_name }}-prod") | .environment[] | select(.name=="npm_package_version")).value = "${{ github.sha }}"' task-definition.json > tmp.json && mv tmp.json task-definition.json
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def-prod

1
.pnp.cjs generated
View File

@@ -6188,6 +6188,7 @@ const RAW_RUNTIME_STATE =
["@types/node", "npm:20.5.7"],\
["@typescript-eslint/eslint-plugin", "virtual:fd909b174d079e30b336c4ce72c38a88c1e447767b1a8dd7655e07719a1e31b97807f0931368724fc78897ff15e6a6d00b83316c0f76d11f85111f342e08bb79#npm:6.5.0"],\
["@typescript-eslint/parser", "virtual:fd909b174d079e30b336c4ce72c38a88c1e447767b1a8dd7655e07719a1e31b97807f0931368724fc78897ff15e6a6d00b83316c0f76d11f85111f342e08bb79#npm:6.5.0"],\
["aws-xray-sdk", "npm:3.5.2"],\
["cors", "npm:2.8.5"],\
["dotenv", "npm:16.1.3"],\
["eslint", "npm:8.41.0"],\

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.27.8](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.27.7...@standardnotes/analytics@2.27.8) (2023-10-04)
**Note:** Version bump only for package @standardnotes/analytics
## [2.27.7](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.27.6...@standardnotes/analytics@2.27.7) (2023-10-04)
**Note:** Version bump only for package @standardnotes/analytics

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/analytics",
"version": "2.27.7",
"version": "2.27.8",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.75.13](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.75.12...@standardnotes/api-gateway@1.75.13) (2023-10-04)
**Note:** Version bump only for package @standardnotes/api-gateway
## [1.75.12](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.75.11...@standardnotes/api-gateway@1.75.12) (2023-10-04)
**Note:** Version bump only for package @standardnotes/api-gateway

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/api-gateway",
"version": "1.75.12",
"version": "1.75.13",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.150.7](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.150.6...@standardnotes/auth-server@1.150.7) (2023-10-04)
### Bug Fixes
* identifying services in workers ([eab78b3](https://github.com/standardnotes/server/commit/eab78b3a95ec82cb779d069d172169bfa92368c9))
## [1.150.6](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.150.5...@standardnotes/auth-server@1.150.6) (2023-10-04)
### Bug Fixes

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/auth-server",
"version": "1.150.6",
"version": "1.150.7",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -190,6 +190,7 @@ import {
ControllerContainer,
ControllerContainerInterface,
MapperInterface,
ServiceIdentifier,
SharedVaultUser,
} from '@standardnotes/domain-core'
import { SessionTracePersistenceMapper } from '../Mapping/SessionTracePersistenceMapper'
@@ -1237,7 +1238,11 @@ export class ContainerConfigLoader {
.bind<DomainEventMessageHandlerInterface>(TYPES.Auth_DomainEventMessageHandler)
.toConstantValue(
isConfiguredForAWSProduction
? new SQSXRayEventMessageHandler(eventHandlers, container.get(TYPES.Auth_Logger))
? new SQSXRayEventMessageHandler(
ServiceIdentifier.NAMES.AuthWorker,
eventHandlers,
container.get(TYPES.Auth_Logger),
)
: new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Auth_Logger)),
)

View File

@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.34.2](https://github.com/standardnotes/server/compare/@standardnotes/domain-core@1.34.1...@standardnotes/domain-core@1.34.2) (2023-10-04)
### Bug Fixes
* identifying services in workers ([eab78b3](https://github.com/standardnotes/server/commit/eab78b3a95ec82cb779d069d172169bfa92368c9))
## [1.34.1](https://github.com/standardnotes/server/compare/@standardnotes/domain-core@1.34.0...@standardnotes/domain-core@1.34.1) (2023-09-27)
### Bug Fixes

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/domain-core",
"version": "1.34.1",
"version": "1.34.2",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -6,9 +6,13 @@ export class ServiceIdentifier extends ValueObject<ServiceIdentifierProps> {
static readonly NAMES = {
ApiGateway: 'ApiGateway',
Auth: 'Auth',
AuthWorker: 'AuthWorker',
SyncingServer: 'SyncingServer',
SyncingServerWorker: 'SyncingServerWorker',
Revisions: 'Revisions',
RevisionsWorker: 'RevisionsWorker',
Files: 'Files',
FilesWorker: 'FilesWorker',
}
get value(): string {

View File

@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.14.5](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.14.4...@standardnotes/domain-events-infra@1.14.5) (2023-10-04)
### Bug Fixes
* identifying services in workers ([eab78b3](https://github.com/standardnotes/server/commit/eab78b3a95ec82cb779d069d172169bfa92368c9))
## [1.14.4](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.14.3...@standardnotes/domain-events-infra@1.14.4) (2023-10-04)
### Bug Fixes

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/domain-events-infra",
"version": "1.14.4",
"version": "1.14.5",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -10,6 +10,7 @@ import {
export class SQSXRayEventMessageHandler implements DomainEventMessageHandlerInterface {
constructor(
private serviceName: string,
private handlers: Map<string, DomainEventHandlerInterface>,
private logger: Logger,
) {}
@@ -32,14 +33,14 @@ export class SQSXRayEventMessageHandler implements DomainEventMessageHandlerInte
this.logger.debug(`Received event: ${domainEvent.type}`)
const xRaySegment = new Segment(domainEvent.type)
const xRaySegment = new Segment(this.serviceName)
if (domainEvent.meta.correlation.userIdentifierType === 'uuid') {
xRaySegment.setUser(domainEvent.meta.correlation.userIdentifier)
}
await captureAsyncFunc(
`${handler.constructor.name}.handle`,
domainEvent.type,
async (subsegment?: Subsegment) => {
await handler.handle(domainEvent)

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.12.8](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.12.7...@standardnotes/event-store@1.12.8) (2023-10-04)
**Note:** Version bump only for package @standardnotes/event-store
## [1.12.7](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.12.6...@standardnotes/event-store@1.12.7) (2023-10-04)
**Note:** Version bump only for package @standardnotes/event-store

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/event-store",
"version": "1.12.7",
"version": "1.12.8",
"description": "Event Store Service",
"private": true,
"main": "dist/src/index.js",

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.25.6](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.25.5...@standardnotes/files-server@1.25.6) (2023-10-04)
**Note:** Version bump only for package @standardnotes/files-server
## [1.25.5](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.25.4...@standardnotes/files-server@1.25.5) (2023-10-04)
**Note:** Version bump only for package @standardnotes/files-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/files-server",
"version": "1.25.5",
"version": "1.25.6",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.16.23](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.16.22...@standardnotes/home-server@1.16.23) (2023-10-04)
**Note:** Version bump only for package @standardnotes/home-server
## [1.16.22](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.16.21...@standardnotes/home-server@1.16.22) (2023-10-04)
**Note:** Version bump only for package @standardnotes/home-server
## [1.16.21](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.16.20...@standardnotes/home-server@1.16.21) (2023-10-04)
**Note:** Version bump only for package @standardnotes/home-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/home-server",
"version": "1.16.21",
"version": "1.16.23",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.39.1](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.39.0...@standardnotes/revisions-server@1.39.1) (2023-10-04)
### Bug Fixes
* identifying services in workers ([eab78b3](https://github.com/standardnotes/server/commit/eab78b3a95ec82cb779d069d172169bfa92368c9))
# [1.39.0](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.38.10...@standardnotes/revisions-server@1.39.0) (2023-10-04)
### Features
* **revisions:** add aws-xray-sdk ([126989d](https://github.com/standardnotes/server/commit/126989df82391ba2f29034d41897f437596269b7))
## [1.38.10](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.38.9...@standardnotes/revisions-server@1.38.10) (2023-10-04)
**Note:** Version bump only for package @standardnotes/revisions-server

View File

@@ -3,6 +3,7 @@ import 'reflect-metadata'
import * as cors from 'cors'
import { urlencoded, json, Request, Response, NextFunction } from 'express'
import * as winston from 'winston'
import * as AWSXRay from 'aws-xray-sdk'
import { InversifyExpressServer } from 'inversify-express-utils'
import TYPES from '../src/Bootstrap/Types'
@@ -11,14 +12,26 @@ import { ContainerConfigLoader } from '../src/Bootstrap/Container'
import '../src/Infra/InversifyExpress/AnnotatedRevisionsController'
import '../src/Infra/InversifyExpress/AnnotatedHealthCheckController'
import { ServiceIdentifier } from '@standardnotes/domain-core'
const container = new ContainerConfigLoader()
void container.load().then((container) => {
const env: Env = container.get(TYPES.Revisions_Env)
const isConfiguredForAWSProduction =
env.get('MODE', true) !== 'home-server' && env.get('MODE', true) !== 'self-hosted'
if (isConfiguredForAWSProduction) {
AWSXRay.config([AWSXRay.plugins.ECSPlugin])
}
const server = new InversifyExpressServer(container)
server.setConfig((app) => {
if (isConfiguredForAWSProduction) {
app.use(AWSXRay.express.openSegment(ServiceIdentifier.NAMES.Revisions))
}
app.use((_request: Request, response: Response, next: NextFunction) => {
response.setHeader('X-Revisions-Version', container.get(TYPES.Revisions_VERSION))
next()
@@ -45,6 +58,10 @@ void container.load().then((container) => {
const serverInstance = server.build()
if (isConfiguredForAWSProduction) {
serverInstance.use(AWSXRay.express.closeSegment())
}
serverInstance.listen(env.get('PORT'))
logger.info(`Server started on port ${process.env.PORT}`)

View File

@@ -1,6 +1,7 @@
import 'reflect-metadata'
import { Logger } from 'winston'
import * as AWSXRay from 'aws-xray-sdk'
import TYPES from '../src/Bootstrap/Types'
import { Env } from '../src/Bootstrap/Env'
@@ -12,6 +13,14 @@ void container.load().then((container) => {
const env: Env = new Env()
env.load()
const isConfiguredForAWSProduction =
env.get('MODE', true) !== 'home-server' && env.get('MODE', true) !== 'self-hosted'
if (isConfiguredForAWSProduction) {
AWSXRay.enableManualMode()
AWSXRay.config([AWSXRay.plugins.ECSPlugin])
}
const logger: Logger = container.get(TYPES.Revisions_Logger)
logger.info('Starting worker...')

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/revisions-server",
"version": "1.38.10",
"version": "1.39.1",
"engines": {
"node": ">=18.0.0 <21.0.0"
},
@@ -36,6 +36,7 @@
"@standardnotes/responses": "^1.13.27",
"@standardnotes/security": "workspace:^",
"@standardnotes/time": "workspace:^",
"aws-xray-sdk": "^3.5.2",
"cors": "2.8.5",
"dotenv": "^16.0.1",
"express": "^4.18.2",

View File

@@ -1,8 +1,14 @@
import { ControllerContainer, ControllerContainerInterface, MapperInterface } from '@standardnotes/domain-core'
import {
ControllerContainer,
ControllerContainerInterface,
MapperInterface,
ServiceIdentifier,
} from '@standardnotes/domain-core'
import Redis from 'ioredis'
import { Container, interfaces } from 'inversify'
import { MongoRepository, Repository } from 'typeorm'
import * as winston from 'winston'
import { captureAWSv3Client } from 'aws-xray-sdk'
import { SNSClient, SNSClientConfig } from '@aws-sdk/client-sns'
import { Revision } from '../Domain/Revision/Revision'
@@ -30,12 +36,12 @@ import {
DomainEventPublisherInterface,
} from '@standardnotes/domain-events'
import {
SQSNewRelicEventMessageHandler,
SQSEventMessageHandler,
SQSDomainEventSubscriberFactory,
DirectCallEventMessageHandler,
DirectCallDomainEventPublisher,
SNSDomainEventPublisher,
SQSXRayEventMessageHandler,
} from '@standardnotes/domain-events-infra'
import { DumpRepositoryInterface } from '../Domain/Dump/DumpRepositoryInterface'
import { AccountDeletionRequestedEventHandler } from '../Domain/Handler/AccountDeletionRequestedEventHandler'
@@ -90,6 +96,7 @@ export class ContainerConfigLoader {
const isConfiguredForHomeServer = env.get('MODE', true) === 'home-server'
const isConfiguredForSelfHosting = env.get('MODE', true) === 'self-hosted'
const isConfiguredForAWSProduction = !isConfiguredForHomeServer && !isConfiguredForSelfHosting
const isConfiguredForHomeServerOrSelfHosting = isConfiguredForHomeServer || isConfiguredForSelfHosting
const isSecondaryDatabaseEnabled = env.get('SECONDARY_DB_ENABLED', true) === 'true'
const isConfiguredForInMemoryCache = env.get('CACHE_TYPE', true) === 'memory'
@@ -173,6 +180,10 @@ export class ContainerConfigLoader {
}
}
if (isConfiguredForAWSProduction) {
return captureAWSv3Client(new SNSClient(snsConfig))
}
return new SNSClient(snsConfig)
})
@@ -201,6 +212,10 @@ export class ContainerConfigLoader {
}
}
if (isConfiguredForAWSProduction) {
return captureAWSv3Client(new SQSClient(sqsConfig))
}
return new SQSClient(sqsConfig)
})
@@ -213,6 +228,10 @@ export class ContainerConfigLoader {
apiVersion: 'latest',
region: env.get('S3_AWS_REGION', true),
})
if (isConfiguredForAWSProduction) {
return captureAWSv3Client(s3Client)
}
}
return s3Client
@@ -511,7 +530,11 @@ export class ContainerConfigLoader {
.bind<DomainEventMessageHandlerInterface>(TYPES.Revisions_DomainEventMessageHandler)
.toConstantValue(
env.get('NEW_RELIC_ENABLED', true) === 'true'
? new SQSNewRelicEventMessageHandler(eventHandlers, container.get(TYPES.Revisions_Logger))
? new SQSXRayEventMessageHandler(
ServiceIdentifier.NAMES.RevisionsWorker,
eventHandlers,
container.get(TYPES.Revisions_Logger),
)
: new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Revisions_Logger)),
)

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.21.8](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.21.7...@standardnotes/scheduler-server@1.21.8) (2023-10-04)
**Note:** Version bump only for package @standardnotes/scheduler-server
## [1.21.7](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.21.6...@standardnotes/scheduler-server@1.21.7) (2023-10-04)
**Note:** Version bump only for package @standardnotes/scheduler-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/scheduler-server",
"version": "1.21.7",
"version": "1.21.8",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.21.42](https://github.com/standardnotes/server/compare/@standardnotes/settings@1.21.41...@standardnotes/settings@1.21.42) (2023-10-04)
**Note:** Version bump only for package @standardnotes/settings
## [1.21.41](https://github.com/standardnotes/server/compare/@standardnotes/settings@1.21.40...@standardnotes/settings@1.21.41) (2023-09-27)
**Note:** Version bump only for package @standardnotes/settings

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/settings",
"version": "1.21.41",
"version": "1.21.42",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.110.8](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.110.7...@standardnotes/syncing-server@1.110.8) (2023-10-04)
**Note:** Version bump only for package @standardnotes/syncing-server
## [1.110.7](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.110.6...@standardnotes/syncing-server@1.110.7) (2023-10-04)
**Note:** Version bump only for package @standardnotes/syncing-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/syncing-server",
"version": "1.110.7",
"version": "1.110.8",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.11.8](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.11.7...@standardnotes/websockets-server@1.11.8) (2023-10-04)
**Note:** Version bump only for package @standardnotes/websockets-server
## [1.11.7](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.11.6...@standardnotes/websockets-server@1.11.7) (2023-10-04)
**Note:** Version bump only for package @standardnotes/websockets-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/websockets-server",
"version": "1.11.7",
"version": "1.11.8",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -5079,6 +5079,7 @@ __metadata:
"@types/node": "npm:^20.5.7"
"@typescript-eslint/eslint-plugin": "npm:^6.5.0"
"@typescript-eslint/parser": "npm:^6.5.0"
aws-xray-sdk: "npm:^3.5.2"
cors: "npm:2.8.5"
dotenv: "npm:^16.0.1"
eslint: "npm:^8.39.0"