Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(fileimport service): Part 1 - port to typescript as-is #3962

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
chore(fileimport service): improve error handling
  • Loading branch information
iainsproat committed Feb 11, 2025
commit 85fa5b603a8fcfaed758cab25565a25bdf85403b
6 changes: 6 additions & 0 deletions packages/fileimport-service/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FILE_IMPORT_TIME_LIMIT_MIN='10'
MAX_OBJECT_SIZE_MB='10'
POSTGRES_MAX_CONNECTIONS_FILE_IMPORT_SERVICE='1'
POSTGRES_CONNECTION_ACQUIRE_TIMEOUT_MILLIS='16000'
POSTGRES_CONNECTION_CREATE_TIMEOUT_MILLIS='5000'
FF_WORKSPACES_MULTI_REGION_ENABLED=false
18 changes: 0 additions & 18 deletions packages/fileimport-service/.vscode/launch.json

This file was deleted.

6 changes: 3 additions & 3 deletions packages/fileimport-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG NODE_ENV=production

FROM mcr.microsoft.com/dotnet/sdk:8.0-noble AS dotnet-build-stage
WORKDIR /app
COPY packages/fileimport-service/ifc-dotnet .
COPY packages/fileimport-service/src/ifc-dotnet .
RUN dotnet publish ifc-converter.csproj -c Release -o output/


Expand Down Expand Up @@ -69,8 +69,8 @@ ENV PYTHON_BINARY_PATH=${PYTHON_BINARY_PATH}
ARG DOTNET_BINARY_PATH=/usr/bin/dotnet
ENV DOTNET_BINARY_PATH=${DOTNET_BINARY_PATH}

COPY --link --from=dotnet-build-stage /app/output packages/fileimport-service/ifc-dotnet
COPY --link --from=dotnet-build-stage /app/output packages/fileimport-service/src/ifc-dotnet

WORKDIR /speckle-server/packages/fileimport-service

ENTRYPOINT [ "tini", "--", "node", "--no-experimental-fetch", "src/daemon.js"]
ENTRYPOINT [ "tini", "--", "/nodejs/bin/node", "--loader=./dist/src/aliasLoader.js", "bin/www.js" ]
22 changes: 17 additions & 5 deletions packages/fileimport-service/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
# `ifc-parser`
# Database Monitor

> TODO: description
Responsible for querying all databases and generating metrics.

## Usage
Metrics are available at `/metrics` endpoint and are in Prometheus format.

## Development

```bash
yarn dev
```
const ifcParser = require('ifc-parser');

// TODO: DEMONSTRATE API
## Databases with self-signed certificates

Add the self-signed CA certificate to a file at `packages/monitor-deployment/ca-certificate.crt`

Run `NODE_EXTRA_CA_CERTS=./ca-certificate.crt yarn dev` or `NODE_EXTRA_CA_CERTS=./ca-certificate.crt yarn start`

## Production

```bash
yarn start
```
53 changes: 47 additions & 6 deletions packages/fileimport-service/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,20 +1,61 @@
import { baseConfigs, globals } from '../../eslint.config.mjs'
import tseslint from 'typescript-eslint'
import {
baseConfigs,
getESMDirname,
globals,
prettierConfig
} from '../../eslint.config.mjs'

/**
* @type {Array<import('eslint').Linter.FlatConfig>}
*/
const configs = [
...baseConfigs,
{
ignores: ['**/ifc/**', '**/obj/**', '**/stl/**']
ignores: ['dist', 'public', 'docs']
},
{
files: ['**/*.js'],
ignores: ['**/*.mjs'],
languageOptions: {
sourceType: 'module',
globals: {
...globals.node
}
}
}
},
{
files: ['bin/www'],
languageOptions: {
sourceType: 'module',
globals: {
...globals.node
}
}
},
...tseslint.configs.recommendedTypeChecked.map((c) => ({
...c,
files: [...(c.files || []), '**/*.ts', '**/*.d.ts']
})),
{
files: ['**/*.ts', '**/*.d.ts'],
languageOptions: {
parserOptions: {
tsconfigRootDir: getESMDirname(import.meta.url),
project: './tsconfig.json'
}
},
rules: {
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-unsafe-return': 'error'
}
},
{
files: ['**/*.spec.{js,ts}'],
languageOptions: {
globals: {
...globals.node
}
}
},
prettierConfig
]

export default configs
4 changes: 0 additions & 4 deletions packages/fileimport-service/jsconfig.json

This file was deleted.

34 changes: 34 additions & 0 deletions packages/fileimport-service/multiregion.example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"main": {
"postgres": {
"connectionUri": "postgresql://speckle:speckle@127.0.0.1:5432/speckle",
"privateConnectionUri": "postgresql://speckle:speckle@postgres:5432/speckle",
"databaseName": "speckle"
},
"blobStorage": {
"accessKey": "minioadmin",
"secretKey": "minioadmin",
"bucket": "speckle-server",
"createBucketIfNotExists": true,
"endpoint": "http://127.0.0.1:9000",
"s3Region": "us-east-1"
}
},
"regions": {
"region1": {
"postgres": {
"connectionUri": "postgresql://speckle:speckle@127.0.0.1:5401/speckle",
"privateConnectionUri": "postgresql://speckle:speckle@postgres-region1:5432/speckle",
"databaseName": "speckle"
},
"blobStorage": {
"accessKey": "minioadmin",
"secretKey": "minioadmin",
"bucket": "speckle-server",
"createBucketIfNotExists": true,
"endpoint": "http://127.0.0.1:9020",
"s3Region": "us-east-1"
}
}
}
}
178 changes: 0 additions & 178 deletions packages/fileimport-service/obj/import_file.py

This file was deleted.

Loading