Compare commits

...

3 Commits

Author SHA1 Message Date
standardci
8dea171115 chore(release): publish new version
- @standardnotes/api-gateway@1.72.1
 - @standardnotes/auth-server@1.135.2
 - @standardnotes/files-server@1.22.2
 - @standardnotes/home-server@1.15.5
 - @standardnotes/revisions-server@1.26.12
 - @standardnotes/syncing-server@1.85.1
2023-08-28 14:09:12 +00:00
Karol Sójko
aef9254713 fix: allow self hosted to use new model of items (#714)
* fix: allow self hosted to use new model of items

* fix: env sample

* fix: binding
2023-08-28 15:34:07 +02:00
Karol Sójko
31b7396006 fix: enable vault tests for all suites (#713)
* fix: enable vault tests for all suites

* fix: rename test suite
2023-08-28 14:29:01 +02:00
22 changed files with 61 additions and 40 deletions

View File

@@ -19,7 +19,7 @@ on:
jobs:
e2e:
name: (Docker) E2E Test Suite
name: (Self Hosting) E2E Test Suite
strategy:
fail-fast: false
matrix:
@@ -56,17 +56,8 @@ jobs:
- name: Wait for server to start
run: docker/is-available.sh http://localhost:3123 $(pwd)/logs
- name: Define if vault tests are enabled
id: vaults
run: |
if [ "${{ matrix.secondary_db_enabled }}" = "true" ] && [ "${{ matrix.transition_mode_enabled }}" = "true" ]; then
echo "vault-tests=enabled" >> $GITHUB_OUTPUT
else
echo "vault-tests=disabled" >> $GITHUB_OUTPUT
fi
- name: Run E2E Test Suite
run: yarn dlx mocha-headless-chrome --timeout 1800000 -f http://localhost:9001/mocha/test.html?vaults=${{ steps.vaults.outputs.vault-tests }}
run: yarn dlx mocha-headless-chrome --timeout 1800000 -f http://localhost:9001/mocha/test.html?vaults=enabled
- name: Show logs on failure
if: ${{ failure() }}
@@ -170,17 +161,8 @@ jobs:
- name: Wait for server to start
run: for i in {1..30}; do curl -s http://localhost:3123/healthcheck && break || sleep 1; done
- name: Define if vault tests are enabled
id: vaults
run: |
if [ "${{ matrix.secondary_db_enabled }}" = "true" ] && [ "${{ matrix.transition_mode_enabled }}" = "true" ]; then
echo "vault-tests=enabled" >> $GITHUB_OUTPUT
else
echo "vault-tests=disabled" >> $GITHUB_OUTPUT
fi
- name: Run E2E Test Suite
run: yarn dlx mocha-headless-chrome --timeout 1800000 -f http://localhost:9001/mocha/test.html?vaults=${{ steps.vaults.outputs.vault-tests }}
run: yarn dlx mocha-headless-chrome --timeout 1800000 -f http://localhost:9001/mocha/test.html?vaults=enabled
- name: Show logs on failure
if: ${{ failure() }}

View File

@@ -2,6 +2,8 @@
# Setup environment variables
export MODE="self-hosted"
#########
# PORTS #
#########

View File

@@ -1,4 +1,4 @@
MODE=microservice # microservice | home-server
MODE=microservice # microservice | home-server | self-hosted
LOG_LEVEL=debug
NODE_ENV=development
VERSION=development

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.72.1](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.72.0...@standardnotes/api-gateway@1.72.1) (2023-08-28)
### Bug Fixes
* allow self hosted to use new model of items ([#714](https://github.com/standardnotes/api-gateway/issues/714)) ([aef9254](https://github.com/standardnotes/api-gateway/commit/aef9254713560c00a90a3e84e3cd94417e8f30d2))
# [1.72.0](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.71.1...@standardnotes/api-gateway@1.72.0) (2023-08-24)
### Features

View File

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

View File

@@ -1,4 +1,4 @@
MODE=microservice # microservice | home-server
MODE=microservice # microservice | home-server | self-hosted
LOG_LEVEL=debug
NODE_ENV=development
VERSION=development

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.135.2](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.135.1...@standardnotes/auth-server@1.135.2) (2023-08-28)
### Bug Fixes
* allow self hosted to use new model of items ([#714](https://github.com/standardnotes/server/issues/714)) ([aef9254](https://github.com/standardnotes/server/commit/aef9254713560c00a90a3e84e3cd94417e8f30d2))
## [1.135.1](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.135.0...@standardnotes/auth-server@1.135.1) (2023-08-25)
### Bug Fixes

View File

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

View File

@@ -1,4 +1,4 @@
MODE=microservice # microservice | home-server
MODE=microservice # microservice | home-server | self-hosted
LOG_LEVEL=debug
NODE_ENV=development
VERSION=development

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.22.2](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.22.1...@standardnotes/files-server@1.22.2) (2023-08-28)
### Bug Fixes
* allow self hosted to use new model of items ([#714](https://github.com/standardnotes/files/issues/714)) ([aef9254](https://github.com/standardnotes/files/commit/aef9254713560c00a90a3e84e3cd94417e8f30d2))
## [1.22.1](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.22.0...@standardnotes/files-server@1.22.1) (2023-08-24)
**Note:** Version bump only for package @standardnotes/files-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/files-server",
"version": "1.22.1",
"version": "1.22.2",
"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.15.5](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.15.4...@standardnotes/home-server@1.15.5) (2023-08-28)
**Note:** Version bump only for package @standardnotes/home-server
## [1.15.4](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.15.3...@standardnotes/home-server@1.15.4) (2023-08-28)
**Note:** Version bump only for package @standardnotes/home-server

View File

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

View File

@@ -1,4 +1,4 @@
MODE=microservice # microservice | home-server
MODE=microservice # microservice | home-server | self-hosted
LOG_LEVEL=info
NODE_ENV=development
VERSION=development

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.26.12](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.26.11...@standardnotes/revisions-server@1.26.12) (2023-08-28)
### Bug Fixes
* allow self hosted to use new model of items ([#714](https://github.com/standardnotes/server/issues/714)) ([aef9254](https://github.com/standardnotes/server/commit/aef9254713560c00a90a3e84e3cd94417e8f30d2))
## [1.26.11](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.26.10...@standardnotes/revisions-server@1.26.11) (2023-08-24)
**Note:** Version bump only for package @standardnotes/revisions-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/revisions-server",
"version": "1.26.11",
"version": "1.26.12",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -1,4 +1,4 @@
MODE=microservice # microservice | home-server
MODE=microservice # microservice | home-server | self-hosted
LOG_LEVEL=info
NODE_ENV=development
VERSION=development

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.85.1](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.85.0...@standardnotes/syncing-server@1.85.1) (2023-08-28)
### Bug Fixes
* allow self hosted to use new model of items ([#714](https://github.com/standardnotes/syncing-server-js/issues/714)) ([aef9254](https://github.com/standardnotes/syncing-server-js/commit/aef9254713560c00a90a3e84e3cd94417e8f30d2))
# [1.85.0](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.84.2...@standardnotes/syncing-server@1.85.0) (2023-08-28)
### Features

View File

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

View File

@@ -213,6 +213,8 @@ export class ContainerConfigLoader {
container.bind<TimerInterface>(TYPES.Sync_Timer).toConstantValue(new Timer())
const isConfiguredForHomeServer = env.get('MODE', true) === 'home-server'
const isConfiguredForSelfHosting = env.get('MODE', true) === 'self-hosted'
const isConfiguredForHomeServerOrSelfHosting = isConfiguredForHomeServer || isConfiguredForSelfHosting
const isSecondaryDatabaseEnabled = env.get('SECONDARY_DB_ENABLED', true) === 'true'
container.bind<Env>(TYPES.Sync_Env).toConstantValue(env)
@@ -412,7 +414,7 @@ export class ContainerConfigLoader {
container
.bind<ItemRepositoryInterface>(TYPES.Sync_SQLItemRepository)
.toConstantValue(
isConfiguredForHomeServer
isConfiguredForHomeServerOrSelfHosting
? new SQLItemRepository(
container.get<Repository<SQLItem>>(TYPES.Sync_ORMItemRepository),
container.get<MapperInterface<Item, SQLItem>>(TYPES.Sync_SQLItemPersistenceMapper),

View File

@@ -68,14 +68,15 @@ export class AppDataSource {
this.env.load()
const isConfiguredForMySQL = this.env.get('DB_TYPE') === 'mysql'
const isConfiguredForHomeServer = this.env.get('MODE', true) === 'home-server'
const isConfiguredForHomeServerOrSelfHosting =
this.env.get('MODE', true) === 'home-server' || this.env.get('MODE', true) === 'self-hosted'
const maxQueryExecutionTime = this.env.get('DB_MAX_QUERY_EXECUTION_TIME', true)
? +this.env.get('DB_MAX_QUERY_EXECUTION_TIME', true)
: 45_000
const migrationsSourceDirectoryName = isConfiguredForMySQL
? isConfiguredForHomeServer
? isConfiguredForHomeServerOrSelfHosting
? 'mysql'
: 'mysql-legacy'
: 'sqlite'
@@ -83,7 +84,7 @@ export class AppDataSource {
const commonDataSourceOptions = {
maxQueryExecutionTime,
entities: [
isConfiguredForHomeServer ? SQLItem : SQLLegacyItem,
isConfiguredForHomeServerOrSelfHosting ? SQLItem : SQLLegacyItem,
TypeORMNotification,
TypeORMSharedVault,
TypeORMSharedVaultUser,

View File

@@ -3,20 +3,20 @@ import { MapperInterface } from '@standardnotes/domain-core'
import { Logger } from 'winston'
import { Item } from '../../Domain/Item/Item'
import { SQLLegacyItem } from './SQLLegacyItem'
import { SQLItem } from './SQLItem'
import { SQLLegacyItemRepository } from './SQLLegacyItemRepository'
import { ItemQuery } from '../../Domain/Item/ItemQuery'
export class SQLItemRepository extends SQLLegacyItemRepository {
constructor(
protected override ormRepository: Repository<SQLLegacyItem>,
protected override mapper: MapperInterface<Item, SQLLegacyItem>,
protected override ormRepository: Repository<SQLItem>,
protected override mapper: MapperInterface<Item, SQLItem>,
protected override logger: Logger,
) {
super(ormRepository, mapper, logger)
}
protected override createFindAllQueryBuilder(query: ItemQuery): SelectQueryBuilder<SQLLegacyItem> {
protected override createFindAllQueryBuilder(query: ItemQuery): SelectQueryBuilder<SQLItem> {
const queryBuilder = this.ormRepository.createQueryBuilder('item')
if (query.sortBy !== undefined && query.sortOrder !== undefined) {