Skip to content

Commit

Permalink
Release/v1.5.0 [main] (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaconC authored Nov 21, 2024
2 parents aa12cfc + 6e0fb58 commit f396e75
Show file tree
Hide file tree
Showing 16 changed files with 2,847 additions and 2,312 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16.20.2
v20
22 changes: 11 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
FROM node:16-alpine3.18
FROM node:20-alpine3.20

WORKDIR /app

RUN apk add --no-cache \
# healthcheck
curl \
# MuhammaraJS deps
g++ make py3-pip \
# PUPPETEER deps
chromium msttcorefonts-installer font-noto fontconfig freetype ttf-dejavu ttf-droid ttf-freefont ttf-liberation \
# healthcheck
curl \
# MuhammaraJS deps
g++ make py3-pip \
# PUPPETEER deps
chromium msttcorefonts-installer font-noto fontconfig freetype ttf-dejavu ttf-droid ttf-freefont ttf-liberation \
&& rm -rf /var/cache/apk/* /tmp/*

RUN update-ms-fonts && fc-cache -f

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser

COPY package*.json /app/
Expand All @@ -25,9 +25,9 @@ COPY ./ /app/
RUN npm run build

RUN addgroup webuser \
&& adduser webuser -D -G webuser \
&& mkdir -p /home/webuser/Downloads \
&& chown -R webuser:webuser /home/webuser
&& adduser webuser -D -G webuser \
&& mkdir -p /home/webuser/Downloads \
&& chown -R webuser:webuser /home/webuser

USER webuser

Expand Down
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,87 @@
# mindlogger-report-server

Server for MindLogger PDF reports

## Requirements
- Node >= 16

- Node >= 20

## Installation

### Install dependencies

```
npm install
```

fontconfig

```
sudo apt-get install libfontconfig
sudo yum install fontconfig
```

### Configure environment variables and folders

```
cp env.example .env
mkdir keys
mkdir outputs
```

| Key | Default value | Description |
| -------------- | ------------- | ------------------------------------------------------------------------------------------------------- |
| PORT | 3000 | Port server will listen to requests |
| KEYS_FOLDER | keys | Folder in local storage with keys |
| OUTPUTS_FOLDER | os.tmpdir() | Folder in local storage to temporary store generated PDF |
| BUILD_VERSION | null | Version of report server |
| AWS_KMS_KEY_ID | null | AWS KMS Key id used to crypt applet password in database, if null password will be stored as plain text |
| AWS_REGION | us-east-1 | AWS region of KMS Key |

### AWS KMS

The report server utilizes an AWS KMS key to encrypt and decrypt applet passwords in the database. If the AWS_KMS_KEY_ID environment variable is missing, this feature will be disabled.

Additionally, backward compatibility with existing plaintext passwords is maintained, so only new applet passwords will be encrypted. To ensure this compatibility, all encrypted passwords stored in the database will be prefixed with 'ENC\_'.

### Generate keys and create database

```
cd keys
openssl genpkey -algorithm rsa -pkeyopt rsa_keygen_bits:4096 -out private.pem
openssl rsa -in private.pem -pubout -out public
sqlite3 passwords "VACUUM;"
```

After running those commands you will have 3 files:

```
ls
passwords private.pem public
```

The server public key will be in keys/public

### Start the app

```
npm run start
```

open http://localhost:3000

## Docker instruction

### Build the image first

```
docker build -t mindlogger-report-server:latest -f ./Dockerfile .
```

### Run the image

This requires Generating keys and creating database in keys folder.

```
docker run -d \
-v "./keys:/app/keys" \
Expand Down
Loading

0 comments on commit f396e75

Please sign in to comment.