Update QMS docker-compose.yaml so it can view and download PDF files (#6507)

Signed-off-by: Jasmin <jasmin@hardcoreeng.com>
Co-authored-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
This commit is contained in:
JasminMus 2024-09-11 19:21:29 +02:00 committed by GitHub
parent f87b0e264e
commit 49113d8cd8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 156 additions and 45 deletions

View File

@ -407,6 +407,9 @@ jobs:
run: node common/scripts/install-run-rush.js docker:build -p 20
env:
DOCKER_CLI_HINTS: false
- name: Configure /etc/hosts
run: |
sudo echo "127.0.0.1 host.docker.internal" | sudo tee -a /etc/hosts
- name: Prepare server
run: |
cd ./qms-tests

View File

@ -127,12 +127,17 @@ Alternatively, you can just execute:
sh ./scripts/create-workspace.sh
```
Accessing the URL http://localhost:8087 will lead you to the app in production mode.
Add the following line to your /etc/hosts file
```
127.0.0.1 host.docker.internal
```
Accessing the URL http://host.docker.internal:8087 will lead you to the app in development mode.
Limitations:
- Local installation does not support sending emails, thus disabling functionalities such as password recovery and email notifications.
- Integrations with Telegram, Gmail, and other content sources are exclusively available as Docker containers, sourced from private repositories. However, these integrations are fully functional and can be utilized with the platform.
## Run in development mode

View File

@ -13,6 +13,13 @@
"language": "en",
"lastNameFirst": "true"
},
"host.docker.internal:8087": {
"key": "huly-docker",
"title": "Huly",
"protocol": "http",
"language": "en",
"lastNameFirst": "true"
},
"localhost:8081": {
"key": "tracex-dev",
"title": "TraceX",
@ -25,6 +32,13 @@
"protocol": "http",
"language": "en"
},
"host.docker.internal:8088": {
"key": "tracex-docker",
"title": "Huly",
"protocol": "http",
"language": "en",
"lastNameFirst": "true"
},
"example.localhost": {
"key": "example",
"title": "Example",

View File

@ -74,14 +74,14 @@ services:
- ACCOUNT_PORT=3000
- SERVER_SECRET=secret
- MONGO_URL=${MONGO_URL}
- TRANSACTOR_URL=ws://host.docker.internal:3333;ws://localhost:3333
- TRANSACTOR_URL=ws://host.docker.internal:3333
- SES_URL=
- STORAGE_CONFIG=${STORAGE_CONFIG}
- FRONT_URL=http://host.docker.internal:8087
- RESERVED_DB_NAMES=telegram,gmail,github
- MODEL_ENABLED=*
- LAST_NAME_FIRST=true
- ACCOUNTS_URL=http://localhost:3000
- ACCOUNTS_URL=http://host.docker.internal:3000
- BRANDING_PATH=/var/cfg/branding.json
# - INIT_SCRIPT_URL=https://raw.githubusercontent.com/hcengineering/init/main/script.yaml
# - INIT_WORKSPACE=onboarding
@ -102,10 +102,10 @@ services:
# - WS_OPERATION=create
- SERVER_SECRET=secret
- MONGO_URL=mongodb://mongodb:27017?compressors=snappy
- TRANSACTOR_URL=ws://transactor:3333;ws://localhost:3333
- TRANSACTOR_URL=ws://transactor:3333;ws://host.docker.internal:3333
- SES_URL=
- STORAGE_CONFIG=${STORAGE_CONFIG}
- FRONT_URL=http://localhost:8087
- FRONT_URL=http://host.docker.internal:8087
- RESERVED_DB_NAMES=telegram,gmail,github
- MODEL_ENABLED=*
- ACCOUNTS_URL=http://host.docker.internal:3000
@ -151,22 +151,22 @@ services:
- SERVER_SECRET=secret
- MONGO_URL=${MONGO_URL}
- 'MONGO_OPTIONS={"appName":"front","maxPoolSize":1}'
- ACCOUNTS_URL=http://localhost:3000
- ACCOUNTS_URL=http://host.docker.internal:3000
- UPLOAD_URL=/files
- ELASTIC_URL=http://host.docker.internal:9200
- GMAIL_URL=http://localhost:8088
- CALENDAR_URL=http://localhost:8095
- TELEGRAM_URL=http://localhost:8086
- REKONI_URL=http://localhost:4004
- COLLABORATOR_URL=ws://localhost:3078
- GMAIL_URL=http://host.docker.internal:8088
- CALENDAR_URL=http://host.docker.internal:8095
- TELEGRAM_URL=http://host.docker.internal:8086
- REKONI_URL=http://host.docker.internal:4004
- COLLABORATOR_URL=ws://host.docker.internal:3078
- STORAGE_CONFIG=${STORAGE_CONFIG}
- GITHUB_URL=http://localhost:3500
- PRINT_URL=http://localhost:4005
- SIGN_URL=http://localhost:4006
- ANALYTICS_COLLECTOR_URL=http://localhost:4017
- GITHUB_URL=http://host.docker.internal:3500
- PRINT_URL=http://host.docker.internal:4005
- SIGN_URL=http://host.docker.internal:4006
- ANALYTICS_COLLECTOR_URL=http://host.docker.internal:4017
- DESKTOP_UPDATES_URL=https://dist.huly.io
- DESKTOP_UPDATES_CHANNEL=dev
- BRANDING_URL=http://localhost:8087/branding.json
- BRANDING_URL=http://host.docker.internal:8087/branding.json
restart: unless-stopped
transactor:
image: hardcoreeng/transactor
@ -197,7 +197,7 @@ services:
- METRICS_FILE=metrics.txt
- STORAGE_CONFIG=${STORAGE_CONFIG}
- REKONI_URL=http://host.docker.internal:4004
- FRONT_URL=http://localhost:8087
- FRONT_URL=http://host.docker.internal:8087
# - APM_SERVER_URL=http://apm-server:8200
- SES_URL=''
- ACCOUNTS_URL=http://host.docker.internal:3000

View File

@ -1 +1,2 @@
STORAGE_CONFIG="minio|minio?accessKey=minioadmin&secretKey=minioadmin"
STORAGE_CONFIG="minio|minio?accessKey=minioadmin&secretKey=minioadmin"
MONGO_URL=mongodb://mongodb:27018?compressors=snappy

View File

@ -42,6 +42,49 @@
}
]
},
"host.docker.internal:8083": {
"key": "tracex-docker",
"title": "TraceX",
"protocol": "http",
"languages": "en",
"defaultLanguage": "en",
"defaultApplication": "documents",
"defaultSpace": "documents:space:QualityDocuments",
"defaultSpecial": "",
"lastNameFirst": "true",
"initWorkspace": "init-ws-qms",
"links": [
{
"rel": "shortcut icon",
"type": "image/x-icon",
"href": "/tracex/favicon.ico"
},
{
"rel": "icon",
"type": "image/svg+xml",
"sizes": "any",
"href": "/tracex/favicon.svg"
},
{
"rel": "icon",
"type": "image/png",
"sizes": "16x16",
"href": "/tracex/favicon_16.png"
},
{
"rel": "icon",
"type": "image/png",
"sizes": "32x32",
"href": "/tracex/favicon_32.png"
},
{
"rel": "icon",
"type": "image/png",
"sizes": "192x192",
"href": "/tracex/favicon_192.png"
}
]
},
"localhost:8080": {
"key": "tracex-dev",
"title": "TraceX",

View File

@ -50,7 +50,7 @@ services:
- ACCOUNT_PORT=3003
- SERVER_SECRET=secret
- MONGO_URL=mongodb://mongodb:27018
- TRANSACTOR_URL=ws://transactor:3334;ws://localhost:3334
- TRANSACTOR_URL=ws://transactor:3334;ws://host.docker.internal:3334
- STORAGE_CONFIG=${STORAGE_CONFIG}
- MODEL_ENABLED=*
- BRANDING_PATH=/var/cfg/branding-test.json
@ -64,7 +64,7 @@ services:
environment:
- SERVER_SECRET=secret
- MONGO_URL=mongodb://mongodb:27018
- TRANSACTOR_URL=ws://transactor:3334;ws://localhost:3334
- TRANSACTOR_URL=ws://transactor:3334;ws://host.docker.internal:3334
- STORAGE_CONFIG=${STORAGE_CONFIG}
- MODEL_ENABLED=*
- ACCOUNTS_URL=http://account:3003
@ -88,17 +88,19 @@ services:
environment:
- SERVER_PORT=8083
- SERVER_SECRET=secret
- ACCOUNTS_URL=http://localhost:3003
- ACCOUNTS_URL=http://host.docker.internal:3003
- MONGO_URL=mongodb://mongodb:27018
- UPLOAD_URL=/files
- ELASTIC_URL=http://elastic:9200
- GMAIL_URL=http://localhost:8088
- CALENDAR_URL=http://localhost:8095
- GMAIL_URL=http://host.docker.internal:8088
- CALENDAR_URL=http://host.docker.internal:8095
- REKONI_URL=http://rekoni:4005
- TELEGRAM_URL=http://localhost:8086
- COLLABORATOR_URL=ws://localhost:3079
- TELEGRAM_URL=http://host.docker.internal:8086
- COLLABORATOR_URL=ws://host.docker.internal:3079
- STORAGE_CONFIG=${STORAGE_CONFIG}
- BRANDING_URL=http://localhost:8083/branding-test.json
- BRANDING_URL=http://host.docker.internal:8083/branding-test.json
- PRINT_URL=http://host.docker.internal:4005
- SIGN_URL=http://host.docker.internal:4006
transactor:
image: hardcoreeng/transactor
pull_policy: never
@ -122,8 +124,8 @@ services:
- METRICS_FILE=metrics.txt
- STORAGE_CONFIG=${STORAGE_CONFIG}
- REKONI_URL=http://rekoni:4005
- FRONT_URL=http://localhost:8083
- UPLOAD_URL=http://localhost:8083/files
- FRONT_URL=http://host.docker.internal:8083
- UPLOAD_URL=http://host.docker.internal:8083/files
- ACCOUNTS_URL=http://account:3003
- LAST_NAME_FIRST=true
- ELASTIC_INDEX_NAME=local_storage_index
@ -147,11 +149,42 @@ services:
rekoni:
image: hardcoreeng/rekoni-service
restart: on-failure
print:
image: hardcoreeng/print
restart: unless-stopped
ports:
- 4005:4004
- 4005:4005
environment:
- SECRET=secret
- MONGO_URL=${MONGO_URL}
- MONGO_OPTIONS={"appName":"print","maxPoolSize":1}
- STORAGE_CONFIG=${STORAGE_CONFIG}
deploy:
resources:
limits:
memory: 1024M
memory: 300M
sign:
image: hardcoreeng/sign
restart: unless-stopped
ports:
- 4006:4006
volumes:
- ../services/sign/pod-sign/debug/certificate.p12:/var/cfg/certificate.p12
- ../services/sign/pod-sign/debug/branding.json:/var/cfg/branding.json
environment:
- SECRET=secret
- MONGO_URL=${MONGO_URL}
- MONGO_OPTIONS={"appName":"sign","maxPoolSize":1}
- MINIO_ENDPOINT=minio
- MINIO_ACCESS_KEY=minioadmin
- ACCOUNTS_URL=http://host.docker.internal:3000
- MINIO_SECRET_KEY=minioadmin
- CERTIFICATE_PATH=/var/cfg/certificate.p12
- SERVICE_ID=sign-service
- BRANDING_PATH=/var/cfg/branding.json
deploy:
resources:
limits:
memory: 300M
volumes:
files:

View File

@ -1,5 +1,5 @@
PLATFORM_URI='http://localhost:8083'
PLATFORM_TRANSACTOR='ws://localhost:3334'
PLATFORM_URI='http://host.docker.internal:8083'
PLATFORM_TRANSACTOR='ws://host.docker.internal:3334'
PLATFORM_USER='user1'
PLATFORM_USER_SECOND='user2'
REGULAR_USER='user3'

View File

@ -19,12 +19,12 @@
"format": "format tests",
"ci": "playwright install --with-deps chromium",
"test": "",
"uitest": "cross-env LOCAL_URL=http://localhost:3003/ DEV_URL= playwright test -c ./tests/playwright.config.ts",
"uitest": "cross-env LOCAL_URL=http://host.docker.internal:3003/ DEV_URL= playwright test -c ./tests/playwright.config.ts",
"staging-uitest": "cross-env PLATFORM_URI=https://front.hc.engineering/ playwright test -c ./tests/playwright.config.ts --grep @staging",
"dev-uitest": "cross-env PLATFORM_URI=http://localhost:8080 PLATFORM_TRANSACTOR=ws://localhost:3333 SETTING=storage-dev.json SETTING_SECOND=storageSecond-dev.json DEV_URL=http://localhost:8080/account playwright test -c ./tests/playwright.config.ts",
"dev-uitest": "cross-env PLATFORM_URI=http://localhost:8080 PLATFORM_TRANSACTOR=ws://host.docker.internal:3333 SETTING=storage-dev.json SETTING_SECOND=storageSecond-dev.json DEV_URL=http://localhost:8080/account playwright test -c ./tests/playwright.config.ts",
"debug": "playwright test -c ./tests/playwright.config.ts --debug --headed",
"dev-debug": "cross-env PLATFORM_URI=http://localhost:8080 PLATFORM_TRANSACTOR=ws://localhost:3333 SETTING=storage-dev.json SETTING_SECOND=storageSecond-dev.json playwright test -c ./tests/playwright.config.ts --debug --headed",
"codegen": "playwright codegen --load-storage storage.json http://localhost:8083/workbench/sanity-ws/",
"dev-debug": "cross-env PLATFORM_URI=http://localhost:8080 PLATFORM_TRANSACTOR=ws://host.docker.internal:3333 SETTING=storage-dev.json SETTING_SECOND=storageSecond-dev.json playwright test -c ./tests/playwright.config.ts --debug --headed",
"codegen": "playwright codegen --load-storage storage.json http://host.docker.internal:8083/workbench/sanity-ws/",
"dev-codegen": "cross-env playwright codegen --load-storage storage-dev.json http://localhost:8080/workbench/sanity-ws/",
"allure:generate": "allure generate allure-results -o allure-report --clean"
},

View File

@ -2,7 +2,7 @@
"cookies": [],
"origins": [
{
"origin": "http://localhost:8083",
"origin": "http://host.docker.internal:8083",
"localStorage": [
{
"name": "login:metadata:LoginEmail",
@ -14,7 +14,7 @@
},
{
"name": "login:metadata:LoginEndpoint",
"value": "ws://localhost:3334"
"value": "ws://host.docker.internal:3334"
},
{
"name": "#platform.notification.logging",

View File

@ -2,7 +2,7 @@
"cookies": [],
"origins": [
{
"origin": "http://localhost:8083",
"origin": "http://host.docker.internal:8083",
"localStorage": [
{
"name": "login:metadata:LoginEmail",
@ -14,7 +14,7 @@
},
{
"name": "login:metadata:LoginEndpoint",
"value": "ws://localhost:3334"
"value": "ws://host.docker.internal:3334"
},
{
"name": "#platform.notification.logging",

View File

@ -2,7 +2,7 @@
"cookies": [],
"origins": [
{
"origin": "http://localhost:8083",
"origin": "http://host.docker.internal:8083",
"localStorage": [
{
"name": "login:metadata:LoginEmail",
@ -14,7 +14,7 @@
},
{
"name": "login:metadata:LoginEndpoint",
"value": "ws://localhost:3334"
"value": "ws://host.docker.internal:3334"
},
{
"name": "#platform.notification.logging",

View File

@ -2,7 +2,7 @@
"cookies": [],
"origins": [
{
"origin": "http://localhost:8083",
"origin": "http://host.docker.internal:8083",
"localStorage": [
{
"name": "login:metadata:LoginEmail",
@ -14,7 +14,7 @@
},
{
"name": "login:metadata:LoginEndpoint",
"value": "ws://localhost:3334"
"value": "ws://host.docker.internal:3334"
},
{
"name": "#platform.notification.logging",

View File

@ -23,6 +23,8 @@ export async function print (url: string, options?: PrintOptions): Promise<Buffe
const kind = options?.kind ?? 'pdf'
const viewport = options?.viewport ?? { width: 1440, height: 900 }
console.log(`Printing ${url} to ${kind} with viewport ${JSON.stringify(viewport)}`)
// TODO: think of having a "hot" browser instance to avoid the overhead of launching a new one every time
const browser = await puppeteer.launch({
headless: true,
@ -36,6 +38,14 @@ export async function print (url: string, options?: PrintOptions): Promise<Buffe
})
const page = await browser.newPage()
page
.on('pageerror', ({ message }) => {
console.log(message)
})
.on('requestfailed', (request) => {
console.log(`${request.failure()?.errorText} ${request.url()}`)
})
await page.setViewport(viewport)
// NOTE: Issues opened with a guest link worked fine only with networkidle0 here and

View File

@ -4,6 +4,8 @@ FROM node:20
RUN apt-get update && apt-get install dumb-init
WORKDIR /usr/src/app
RUN npm install --ignore-scripts=false --verbose bufferutil utf-8-validate @mongodb-js/zstd snappy --unsafe-perm
COPY bundle/bundle.js ./
CMD [ "dumb-init", "node", "bundle.js" ]