build: use pnpm for the deploy
This commit is contained in:
parent
64e358f61c
commit
bac8813a8d
36 changed files with 19068 additions and 29560 deletions
58
.github/workflows/build.yml
vendored
58
.github/workflows/build.yml
vendored
|
|
@ -4,42 +4,48 @@ on: [ workflow_dispatch ]
|
|||
|
||||
jobs:
|
||||
everything:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Cache Docker layers
|
||||
- name: Setup Turbo cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-updatetar
|
||||
path: .turbo
|
||||
key: ${{ runner.os }}-turbo-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-updatetar
|
||||
- name: Build Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: build/ci.Dockerfile
|
||||
load: true
|
||||
tags: ci_image:latest
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache-new
|
||||
${{ runner.os }}-turbo-
|
||||
|
||||
- name: Extract artifact from Docker image
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10.11.0
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Build packages with Turbo
|
||||
run: pnpm run build
|
||||
|
||||
- name: Package production build
|
||||
run: |
|
||||
docker create --name extract_artifact ci_image:latest
|
||||
docker cp extract_artifact:/lamassu-server.tar.gz ./lamassu-server.tar.gz
|
||||
docker rm extract_artifact
|
||||
# Create production-ready server package using pnpm deploy
|
||||
pnpm deploy --filter=./packages/server --prod lamassu-server --legacy
|
||||
|
||||
# Copy built admin UI to public directory
|
||||
cp -r packages/admin-ui/build lamassu-server/public
|
||||
|
||||
# Create tarball
|
||||
tar -zcf lamassu-server.tar.gz lamassu-server/
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: lamassu-server.tar.gz
|
||||
path: lamassu-server.tar.gz
|
||||
|
||||
- name: Move cache
|
||||
run: |
|
||||
rm -rf /tmp/.buildx-cache
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
59
.github/workflows/docker-build.yml
vendored
59
.github/workflows/docker-build.yml
vendored
|
|
@ -17,16 +17,48 @@ jobs:
|
|||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Cache Docker layers
|
||||
- name: Setup Turbo cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-updatetar
|
||||
path: .turbo
|
||||
key: ${{ runner.os }}-turbo-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-updatetar
|
||||
${{ runner.os }}-turbo-
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10.11.0
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Build packages with Turbo
|
||||
run: pnpm run build
|
||||
|
||||
- name: Verify build artifacts
|
||||
run: |
|
||||
echo "=== Verifying typesafe-db build ==="
|
||||
ls -la packages/typesafe-db/lib/
|
||||
echo "=== Verifying admin-ui build ==="
|
||||
ls -la packages/admin-ui/build/
|
||||
|
||||
- name: Package production build
|
||||
run: |
|
||||
# Create production-ready server package using pnpm deploy
|
||||
pnpm deploy --filter=./packages/server --prod lamassu-server --legacy
|
||||
|
||||
# Copy built admin UI to public directory
|
||||
cp -r packages/admin-ui/build lamassu-server/public
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v3
|
||||
|
|
@ -34,7 +66,7 @@ jobs:
|
|||
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
- name: Build and push server image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
|
|
@ -42,10 +74,8 @@ jobs:
|
|||
target: l-s
|
||||
file: ./build/server.Dockerfile
|
||||
tags: ${{ env.DOCKERHUB_SERVER_REPO }}:latest
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache-new
|
||||
|
||||
- name: Build and push
|
||||
- name: Build and push admin server image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
|
|
@ -53,10 +83,3 @@ jobs:
|
|||
target: l-a-s
|
||||
file: ./build/server.Dockerfile
|
||||
tags: ${{ env.DOCKERHUB_ADMIN_REPO }}:latest
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache-new
|
||||
|
||||
- name: Move cache
|
||||
run: |
|
||||
rm -rf /tmp/.buildx-cache
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
|
|
|
|||
26
.github/workflows/test.yml
vendored
26
.github/workflows/test.yml
vendored
|
|
@ -3,24 +3,38 @@ name: Tests
|
|||
on:
|
||||
pull_request:
|
||||
branches: [ dev ]
|
||||
push:
|
||||
branches: [ dev ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Turbo cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .turbo
|
||||
key: ${{ runner.os }}-turbo-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-turbo-
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10.11.0
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: 'npm'
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
run: pnpm install
|
||||
|
||||
- name: Run admin-ui tests
|
||||
working-directory: packages/admin-ui
|
||||
run: npm run test:run
|
||||
- name: Run tests
|
||||
run: pnpm run test
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,9 +1,12 @@
|
|||
**/node_modules
|
||||
**/.env
|
||||
.pnpm-store/
|
||||
|
||||
.idea/
|
||||
.settings/
|
||||
.turbo/
|
||||
|
||||
packages/server/.lamassu
|
||||
packages/server/certs/
|
||||
packages/server/tests/stress/machines
|
||||
packages/server/tests/stress/config.json
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
# Run tests first
|
||||
echo "Running tests..."
|
||||
npm run test:run --workspace=packages/admin-ui
|
||||
|
||||
# Run linting
|
||||
npx lint-staged
|
||||
|
|
|
|||
114
INSTALL-NIX.md
114
INSTALL-NIX.md
|
|
@ -1,114 +0,0 @@
|
|||
# Install - nix
|
||||
|
||||
## Preliminaries for using nix
|
||||
|
||||
For a dev environment with nix package manager a postgres install on the base system is required, this guide does not cover a postgresql server running with nix-shell.
|
||||
|
||||
### Set up PostgreSQL
|
||||
|
||||
```
|
||||
sudo -u postgres createdb lamassu
|
||||
sudo -u postgres psql postgres
|
||||
```
|
||||
|
||||
In ``psql``, run the following and set password to ``postgres123``:
|
||||
|
||||
```
|
||||
\password postgres
|
||||
ctrl-d
|
||||
```
|
||||
|
||||
### Starting up environment
|
||||
|
||||
shell.nix script provided, all you need to do to setup the environment is to run `nix-shell` on the folder.
|
||||
|
||||
## Installation
|
||||
|
||||
### Install node modules
|
||||
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
### Generate certificates
|
||||
|
||||
```
|
||||
bash packages/server/tools/cert-gen.sh
|
||||
```
|
||||
|
||||
Notes:
|
||||
- This will create a ``.lamassu`` directory in your home directory.
|
||||
|
||||
### Set up database
|
||||
|
||||
Important: lamassu-migrate currently gripes about a QueryResultError. Ignore this, it works anyway.
|
||||
|
||||
```
|
||||
node packages/server/bin/lamassu-migrate
|
||||
```
|
||||
|
||||
### Run new-lamassu-admin
|
||||
|
||||
```
|
||||
cd packages/admin-ui/
|
||||
npm run start
|
||||
```
|
||||
|
||||
### Run lamassu-admin-server
|
||||
|
||||
In a second terminal window:
|
||||
|
||||
```
|
||||
node packages/server/bin/lamassu-admin-server --dev
|
||||
```
|
||||
|
||||
### Register admin user
|
||||
|
||||
In a third terminal window:
|
||||
|
||||
```
|
||||
node packages/server/bin/lamassu-register admin@example.com superuser
|
||||
```
|
||||
|
||||
You'll use this generated URL in the brower in a moment.
|
||||
|
||||
### Complete configuration
|
||||
|
||||
Paste the URL from lamassu-register exactly as output, into a browser (chrome or firefox).
|
||||
|
||||
**Important**: the host must be localhost. Tell your browser to trust the certificate even though it's not signed by a recognized CA. If you get an "expired" error, try opening https://localhost:8070/graphql in another tab and trust the certificate.
|
||||
|
||||
Go to all the required, unconfigured red fields and choose some values. Choose mock services whenever available.
|
||||
|
||||
### Run lamassu-server
|
||||
|
||||
```
|
||||
node packages/server/bin/lamassu-server --mockScoring
|
||||
```
|
||||
|
||||
### Add a lamassu-machine
|
||||
|
||||
Click on ``+ Add Machine`` in the sidebar. Type in a name for your machine and click **Pair**. Open up development tools to show the JavaScript console and copy the totem. You will use this to run lamassu-machine. This pairing totem expires after an hour.
|
||||
|
||||
Now continue with lamassu-machine instructions from the ``INSTALL.md`` file in [lamassu-machine repository](https://github.com/lamassu/lamassu-machine).
|
||||
|
||||
## Subsequent runs
|
||||
|
||||
To start the Lamassu server run:
|
||||
|
||||
```
|
||||
node packages/server/bin/lamassu-server --mockScoring
|
||||
```
|
||||
|
||||
To start the Lamassu Admin run:
|
||||
|
||||
```
|
||||
node packages/server/bin/lamassu-admin-server --dev
|
||||
```
|
||||
|
||||
and
|
||||
|
||||
```
|
||||
cd packages/admin-ui/
|
||||
npm run start
|
||||
```
|
||||
126
INSTALL.md
126
INSTALL.md
|
|
@ -1,126 +0,0 @@
|
|||
# Install
|
||||
|
||||
## Preliminaries for Ubuntu 16.04
|
||||
|
||||
Installation for other distros may be slightly different. This assumes NodeJS 22 or higher is already installed. All of this is done in the lamassu-server directory.
|
||||
|
||||
### Packages
|
||||
|
||||
```
|
||||
sudo apt-get update
|
||||
sudo apt-get install postgresql postgresql-contrib postgresql-server-dev-9.5 libpq-dev git
|
||||
```
|
||||
|
||||
### Set up PostgreSQL
|
||||
|
||||
```
|
||||
sudo -u postgres createdb lamassu
|
||||
sudo -u postgres psql postgres
|
||||
```
|
||||
|
||||
In ``psql``, run the following and set password to ``postgres123``:
|
||||
|
||||
```
|
||||
\password postgres
|
||||
ctrl-d
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
### Install node modules
|
||||
|
||||
Make sure you're running NodeJS 22 or higher. Ignore any warnings.
|
||||
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
### Generate certificates
|
||||
|
||||
```
|
||||
bash packages/server/tools/cert-gen.sh
|
||||
```
|
||||
|
||||
Notes:
|
||||
- This will create a ``.lamassu`` directory in your home directory.
|
||||
|
||||
### Set up database
|
||||
|
||||
Important: lamassu-migrate currently gripes about a QueryResultError. Ignore this, it works anyway.
|
||||
|
||||
```
|
||||
node packages/server/bin/lamassu-migrate
|
||||
```
|
||||
|
||||
### Run new-lamassu-admin
|
||||
|
||||
```
|
||||
cd packages/admin-ui/
|
||||
npm run start
|
||||
```
|
||||
|
||||
### Run lamassu-admin-server
|
||||
|
||||
In a second terminal window:
|
||||
|
||||
```
|
||||
node packages/server/bin/lamassu-admin-server --dev
|
||||
```
|
||||
|
||||
### Register admin user
|
||||
|
||||
In a third terminal window:
|
||||
|
||||
```
|
||||
node packages/server/bin/lamassu-register admin@example.com superuser
|
||||
```
|
||||
|
||||
You'll use this generated URL in the brower in a moment.
|
||||
|
||||
### Complete configuration
|
||||
|
||||
Paste the URL from lamassu-register exactly as output, into a browser (chrome or firefox).
|
||||
|
||||
**Important**: the host must be localhost. Tell your browser to trust the certificate even though it's not signed by a recognized CA. If you get an "expired" error, try opening https://localhost:8070/graphql in another tab and trust the certificate.
|
||||
|
||||
Go to all the required, unconfigured red fields and choose some values. Choose mock services whenever available.
|
||||
|
||||
### Run lamassu-server
|
||||
|
||||
```
|
||||
node packages/server/bin/lamassu-server --mockScoring
|
||||
```
|
||||
|
||||
### Add a lamassu-machine
|
||||
|
||||
Click on ``+ Add Machine`` in the sidebar. Type in a name for your machine and click **Pair**. Open up development tools to show the JavaScript console and copy the totem. You will use this to run lamassu-machine. This pairing totem expires after an hour.
|
||||
|
||||
Now continue with lamassu-machine instructions from the ``INSTALL.md`` file in [lamassu-machine repository](https://github.com/lamassu/lamassu-machine).
|
||||
|
||||
### Run a local coin node (BTC supported)
|
||||
|
||||
Run `node packages/server/bin/lamassu-coins` in the project root and select `Bitcoin`. This process will require the existence of certain environment variables that the setup will warn about.
|
||||
|
||||
Once that is done, the node needs to be run in a terminal with the following command `<YOUR_BLOCKCHAIN_DIR_ENV_VAR>/bin/bitcoind -datadir=<YOUR_BLOCKCHAIN_DIR_ENV_VAR>/bitcoin`
|
||||
|
||||
|
||||
## Subsequent runs
|
||||
|
||||
To start the Lamassu server run:
|
||||
|
||||
```
|
||||
node packages/server/bin/lamassu-server --mockScoring
|
||||
```
|
||||
|
||||
To start the Lamassu Admin run:
|
||||
|
||||
```
|
||||
node packages/server/bin/lamassu-admin-server --dev
|
||||
```
|
||||
|
||||
and
|
||||
|
||||
```
|
||||
cd packages/admin-ui/
|
||||
npm run start
|
||||
```
|
||||
55
README.md
55
README.md
|
|
@ -6,14 +6,57 @@ Lamassu remote server.
|
|||
|
||||
We do not generally accept outside pull requests for new features. Please consult with us before putting a lot of work into a pull request.
|
||||
|
||||
## Installation
|
||||
## Development
|
||||
|
||||
See [INSTALL.md](INSTALL.md), or [INSTALL-NIX.md](INSTALL-NIX.md) for nix environment.
|
||||
### Requirements
|
||||
|
||||
## Installation on remote server (only for production)
|
||||
See [lamassu-remote-install/README.md](lamassu-remote-install/README.md).
|
||||
- Nodejs 22
|
||||
- PNPM 10+
|
||||
- Postgres Database
|
||||
- Python 3 (to be deprecated, required by a single dependency installation)
|
||||
- OpenSSL (for cert-gen.sh, it will set up the server self-signed certificates)
|
||||
|
||||
There's a shell.nix file that you can use to set up your env in case you're a nix user.
|
||||
There's also a .tool-versions for asdf and mise users.
|
||||
|
||||
This project uses Turbo for monorepo management. Install dependencies:
|
||||
|
||||
## Running
|
||||
```bash
|
||||
node bin/lamassu-server --mockScoring
|
||||
pnpm install
|
||||
```
|
||||
|
||||
Prepare environment files:
|
||||
|
||||
```bash
|
||||
bash packages/server/tools/cert-gen.sh
|
||||
```
|
||||
|
||||
On packages/server/.env you can alter variables such as the postgres connection info.
|
||||
|
||||
After configuring the postgres connection, run:
|
||||
|
||||
```bash
|
||||
node packages/server/bin/lamassu-migrate
|
||||
```
|
||||
|
||||
### Start development environment:
|
||||
|
||||
If you've already done the setup, you can run:
|
||||
|
||||
```bash
|
||||
pnpm run dev
|
||||
```
|
||||
|
||||
### Creating a user
|
||||
|
||||
```bash
|
||||
node packages/server/bin/lamassu-register admin@example.com superuser
|
||||
```
|
||||
|
||||
### Pairing a machine
|
||||
|
||||
To get the pairing token from the QRCode open the browser console before picking the name of the machine, the token should appear on the terminal.
|
||||
It's also possible to inspect the qrCode, the token is on the data-cy="" attr.
|
||||
Lastly, you can always scan it with a phone and copy the contents over.
|
||||
|
||||
Now continue with lamassu-machine instructions from the `INSTALL.md` file in [lamassu-machine repository](https://github.com/lamassu/lamassu-machine).
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
FROM node:22-alpine AS build-ui
|
||||
RUN apk add --no-cache npm git curl build-base python3
|
||||
|
||||
COPY ["packages/admin-ui/package.json", "package-lock.json", "./"]
|
||||
|
||||
RUN npm version --allow-same-version --git-tag-version false --commit-hooks false 1.0.0
|
||||
RUN npm install
|
||||
|
||||
COPY packages/admin-ui/ ./
|
||||
RUN npm run build
|
||||
|
||||
FROM ubuntu:20.04 as base
|
||||
|
||||
ARG VERSION
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
ENV TZ=Europe/Lisbon
|
||||
|
||||
RUN apt-get update
|
||||
|
||||
RUN apt-get install -y -q curl \
|
||||
sudo \
|
||||
git \
|
||||
python2-minimal \
|
||||
build-essential \
|
||||
libpq-dev \
|
||||
net-tools \
|
||||
tar
|
||||
|
||||
RUN curl -sL https://deb.nodesource.com/setup_22.x | sudo -E bash -
|
||||
RUN apt-get install nodejs -y -q
|
||||
|
||||
WORKDIR lamassu-server
|
||||
|
||||
COPY ["packages/server/package.json", "package-lock.json", "./"]
|
||||
RUN npm version --allow-same-version --git-tag-version false --commit-hooks false 1.0.0
|
||||
RUN npm install --production
|
||||
|
||||
COPY ./packages/server/ ./
|
||||
COPY --from=build-ui /build /lamassu-server/public
|
||||
|
||||
RUN cd .. && tar -zcvf lamassu-server.tar.gz ./lamassu-server
|
||||
|
|
@ -2,20 +2,16 @@ version: "3.8"
|
|||
|
||||
services:
|
||||
lamassu-server:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: build/server.Dockerfile
|
||||
target: l-s
|
||||
image: lamassu/lamassu-server:latest
|
||||
restart: on-failure
|
||||
ports:
|
||||
- 3000:3000
|
||||
network_mode: host
|
||||
volumes:
|
||||
- ./lamassu-data:/lamassu-data
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
- POSTGRES_USER=postgres
|
||||
- POSTGRES_PASSWORD=postgres123
|
||||
- POSTGRES_HOST=host.docker.internal
|
||||
- POSTGRES_HOST=localhost
|
||||
- POSTGRES_PORT=5432
|
||||
- POSTGRES_DB=lamassu
|
||||
- CA_PATH=/lamassu-data/certs/Lamassu_OP_Root_CA.pem
|
||||
|
|
@ -31,20 +27,16 @@ services:
|
|||
- LOG_LEVEL=info
|
||||
|
||||
lamassu-admin-server:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: build/server.Dockerfile
|
||||
target: l-a-s
|
||||
image: lamassu/lamassu-admin-server:latest
|
||||
restart: on-failure
|
||||
ports:
|
||||
- 443:443
|
||||
network_mode: host
|
||||
volumes:
|
||||
- ./lamassu-data:/lamassu-data
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
- POSTGRES_USER=postgres
|
||||
- POSTGRES_PASSWORD=postgres123
|
||||
- POSTGRES_HOST=host.docker.internal
|
||||
- POSTGRES_HOST=localhost
|
||||
- POSTGRES_PORT=5432
|
||||
- POSTGRES_DB=lamassu
|
||||
- CA_PATH=/lamassu-data/certs/Lamassu_OP_Root_CA.pem
|
||||
|
|
@ -1,49 +1,20 @@
|
|||
FROM node:22-alpine AS build
|
||||
RUN apk add --no-cache npm git curl build-base net-tools python3 postgresql-dev
|
||||
FROM node:22-alpine AS base
|
||||
RUN apk add --no-cache bash libpq openssl ca-certificates
|
||||
|
||||
WORKDIR /lamassu-server
|
||||
|
||||
COPY ["packages/server/package.json", "package-lock.json", "./"]
|
||||
RUN npm version --allow-same-version --git-tag-version false --commit-hooks false 1.0.0
|
||||
RUN npm install --production
|
||||
# Copy the pre-built production package from CI (with node_modules)
|
||||
COPY lamassu-server/ ./
|
||||
|
||||
COPY packages/server/ ./
|
||||
|
||||
|
||||
FROM node:22-alpine AS l-s-base
|
||||
RUN apk add --no-cache npm git curl bash libpq openssl ca-certificates
|
||||
|
||||
COPY --from=build /lamassu-server /lamassu-server
|
||||
|
||||
|
||||
FROM l-s-base AS l-s
|
||||
# Install production dependencies in the container
|
||||
RUN npm install --omit=dev --ignore-scripts
|
||||
|
||||
FROM base AS l-s
|
||||
RUN chmod +x /lamassu-server/bin/lamassu-server-entrypoint.sh
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
ENTRYPOINT [ "/lamassu-server/bin/lamassu-server-entrypoint.sh" ]
|
||||
|
||||
|
||||
FROM node:22-alpine AS build-ui
|
||||
RUN apk add --no-cache npm git curl build-base python3
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ["packages/admin-ui/package.json", "package-lock.json", "./"]
|
||||
|
||||
RUN npm version --allow-same-version --git-tag-version false --commit-hooks false 1.0.0
|
||||
RUN npm install
|
||||
|
||||
COPY packages/admin-ui/ ./
|
||||
RUN npm run build
|
||||
|
||||
|
||||
FROM l-s-base AS l-a-s
|
||||
COPY --from=build-ui /app/build /lamassu-server/public
|
||||
|
||||
FROM base AS l-a-s
|
||||
RUN chmod +x /lamassu-server/bin/lamassu-admin-server-entrypoint.sh
|
||||
|
||||
EXPOSE 443
|
||||
|
||||
ENTRYPOINT [ "/lamassu-server/bin/lamassu-admin-server-entrypoint.sh" ]
|
||||
|
|
@ -9,6 +9,7 @@ import pluginJest from 'eslint-plugin-jest'
|
|||
|
||||
export default defineConfig([
|
||||
globalIgnores([
|
||||
'**/.lamassu',
|
||||
'**/build',
|
||||
'**/package.json',
|
||||
'**/package-lock.json',
|
||||
|
|
|
|||
29092
package-lock.json
generated
29092
package-lock.json
generated
File diff suppressed because it is too large
Load diff
24
package.json
24
package.json
|
|
@ -4,15 +4,15 @@
|
|||
"version": "11.0.0-beta.1",
|
||||
"license": "./LICENSE",
|
||||
"author": "Lamassu (https://lamassu.is)",
|
||||
"packageManager": "pnpm@10.11.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/lamassu/lamassu-server.git"
|
||||
},
|
||||
"workspaces": [
|
||||
"packages/server",
|
||||
"packages/admin-ui",
|
||||
"packages/typesafe-db"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=22.0.0"
|
||||
},
|
||||
"workspaces": [],
|
||||
"devDependencies": {
|
||||
"@eslint/css": "^0.7.0",
|
||||
"@eslint/js": "^9.26.0",
|
||||
|
|
@ -25,10 +25,20 @@
|
|||
"globals": "^16.1.0",
|
||||
"husky": "^8.0.0",
|
||||
"lint-staged": "^16.0.0",
|
||||
"prettier": "^3.5.3"
|
||||
"prettier": "^3.5.3",
|
||||
"turbo": "^2.5.3"
|
||||
},
|
||||
"scripts": {
|
||||
"prepare": "husky install"
|
||||
"prepare": "husky install",
|
||||
"build": "turbo build",
|
||||
"dev": "turbo dev",
|
||||
"start": "turbo start",
|
||||
"test": "turbo test",
|
||||
"clean": "turbo clean",
|
||||
"server:dev": "turbo dev --filter=lamassu-server",
|
||||
"admin:dev": "turbo dev --filter=lamassu-admin",
|
||||
"typesafe-db:build": "turbo build --filter=typesafe-db",
|
||||
"typesafe-db:dev": "turbo dev --filter=typesafe-db"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
|
|
|
|||
|
|
@ -10,31 +10,27 @@ To take advantage of that make sure to run `git commit` from within this folder.
|
|||
|
||||
## Available Scripts
|
||||
|
||||
In the project directory, you can run:
|
||||
From the root directory (recommended with Turbo):
|
||||
|
||||
### `npm start`
|
||||
- `pnpm run dev` - Start development environment
|
||||
- `pnpm run build` - Build for production
|
||||
- `pnpm run admin:dev` - Start only admin UI development
|
||||
|
||||
Runs the app in the development mode.<br>
|
||||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
||||
In the admin-ui package directory, you can run:
|
||||
|
||||
The page will reload if you make edits.<br>
|
||||
### `pnpm start` or `pnpm run dev`
|
||||
|
||||
Runs the app in development mode with Vite.
|
||||
Open [http://localhost:5173](http://localhost:5173) to view it in the browser.
|
||||
|
||||
The page will reload if you make edits.
|
||||
You will also see any lint errors in the console.
|
||||
|
||||
### `npm fix`
|
||||
### `pnpm test`
|
||||
|
||||
Runs eslint --fix on the src folder
|
||||
Launches the test runner with vitest.
|
||||
|
||||
### `npm test`
|
||||
### `pnpm run build`
|
||||
|
||||
Launches the test runner in the interactive watch mode.<br>
|
||||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
||||
|
||||
### `npm run build`
|
||||
|
||||
Builds the app for production to the `build` folder.<br>
|
||||
Builds the app for production to the `build` folder.
|
||||
It correctly bundles React in production mode and optimizes the build for the best performance.
|
||||
|
||||
The build is minified and the filenames include the hashes.<br>
|
||||
Your app is ready to be deployed!
|
||||
|
||||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@
|
|||
},
|
||||
"scripts": {
|
||||
"start": "vite",
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"test": "vitest",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import PropTypes from 'prop-types'
|
||||
import React from 'react'
|
||||
|
||||
import Paper from '@mui/material/Paper'
|
||||
|
|
@ -18,9 +17,5 @@ const CollapsibleCard = ({ className, state, shrunkComponent, children }) => {
|
|||
)
|
||||
}
|
||||
|
||||
CollapsibleCard.propTypes = {
|
||||
shrunkComponent: PropTypes.node.isRequired,
|
||||
}
|
||||
|
||||
export default CollapsibleCard
|
||||
export { cardState }
|
||||
|
|
|
|||
52
packages/server/certs/Lamassu_OP.key
Normal file
52
packages/server/certs/Lamassu_OP.key
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
-----BEGIN PRIVATE KEY-----
|
||||
MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQCwyTzTYjzn1un9
|
||||
tfiATtdVGTfnRQjTPTC8388fvhQKhF3ymdsxql7b5UPaRN3GD1V/AVTeKRlj2he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
8rx+yI6QEFyC7V4dw9vMJzSYbOnLvPjAqIrMfblbOhe7jf2m1OkqzKO/eIC4W0L3
|
||||
FMgzEYeX0l+6C9iJufa/MKhajPUtXg==
|
||||
-----END PRIVATE KEY-----
|
||||
30
packages/server/certs/Lamassu_OP.pem
Normal file
30
packages/server/certs/Lamassu_OP.pem
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
-----BEGIN CERTIFICATE-----
|
||||
MIIFNDCCAxwCFGweNB6EP0jxoN18cP4xsaQ8TfYJMA0GCSqGSIb3DQEBCwUAMF0x
|
||||
CzAJBgNVBAYTAklTMRIwEAYDVQQHDAlSZXlramF2aWsxHDAaBgNVBAoME0xhbWFz
|
||||
c3UgT3BlcmF0b3IgQ0ExHDAaBgNVBAMME2xhbWFzc3Utb3BlcmF0b3IuaXMwHhcN
|
||||
MjUwNTEzMTIyMDE2WhcNMzUwNTExMTIyMDE2WjBQMQswCQYDVQQGEwJJUzESMBAG
|
||||
A1UEBwwJUmV5a2phdmlrMRkwFwYDVQQKDBBMYW1hc3N1IE9wZXJhdG9yMRIwEAYD
|
||||
VQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCw
|
||||
yTzTYjzn1un9tfiATtdVGTfnRQjTPTC8388fvhQKhF3ymdsxql7b5UPaRN3GD1V/
|
||||
AVTeKRlj2heQ6Ffyi278T16moV9N11hU1I1e5TRSMKzqPwbZfyoCaSXBG9i5SnhZ
|
||||
uUJz6g2JzCRB5JiXV8b1fKxRsfwJgdEp+/BZRqS1yJNMfnK3b39flFWgR375k/4L
|
||||
XdGrWHQmqkCn5Mcu7RFn0/V2MbU9GdPNRDPtRdqfh9khMs1o7EBPKY9P5EyMZob0
|
||||
MJ0ODA4nRFqjRvpm/I+8x0ePMOehcm612qmYc5lvZIiayonRfrt1NsUChEaGmN2a
|
||||
p5UEHMll7iVXtEUdiBQYAcy36WWONzvx3NcMi+6FZ98DJ/NI4z3NwvYnbJdh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8p6Sg4qF759qRGq+wpySCDeManZBtMqlkuipWhQ==
|
||||
-----END CERTIFICATE-----
|
||||
52
packages/server/certs/Lamassu_OP_Root_CA.key
Normal file
52
packages/server/certs/Lamassu_OP_Root_CA.key
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
-----BEGIN PRIVATE KEY-----
|
||||
MIIJQQIBADANBgkqhkiG9w0BAQEFAASCCSswggknAgEAAoICAQC0cf1TwumFeQ25
|
||||
BmyTUW1sEMmPUdBh4tLKnJ/iL9uOvLICA0qYUGQ/YHtOfGxmB4jlstWE18Ep8Oib
|
||||
wv3UjpDrjJuSeqPBemljNK044gWehNkReUjQOvFuYMwX77geAyzKor8o2UsOoRMO
|
||||
LjINh/CNS+b+xfbP1puMw2cmjJMk5V0Qd2ZlcYkTycuqbGwNOYwAssQn3zxXE6Ym
|
||||
qwhLB+xWpprs/tmnyctIixOlQW9C7y4ID4Sm+LKAUt8HMO+1qGwtesSvdVNaBf7Q
|
||||
g6Mf7L8im18zVWkDvYEdtYn09iaJgan/JLdPqZdp2nWUP3cFeohXPqpVdcjx+wrR
|
||||
Lv9BzBlw3c2U/FyfHy0vHTPx0n0GAe5GtACPdCmJlOfCmOmzQhjmf8/Sr0RlHB3E
|
||||
NekFelsKmKmko8l+P5XJEY02fOuuKttEd+KuY7VWJf14N0OZLUoKZ7ihhT6Rywqq
|
||||
UbVp6gtLAFR46li7L5ETecA/eA27azB6+A3IytObt4Le1DCFpVJ0BRLEVO46PKHL
|
||||
uXt8Ia9dk75++e8cYzmtpYz5E147z4w5ubDJG6zlUQhudMXv/078p4rGuSxBF/k/
|
||||
bwOCVPdUFjWIFJZiNwWuHQNMJswpphX8TNphV4fyJLCGcZcbrVwbNyNN2TV+2Xke
|
||||
zlKFIGmbz5CQuHJSAZdU0phWgjyeDQIDAQABAoICAAJiwXEykgjYPWS1X4khGfvE
|
||||
Sw3wjHtG1vej039Xl6UO/KGHLpzN701hNrAmd/5vWhGDaExN1/l4fHLWxKljSyo6
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avlf9h+ZyBqh8Na
|
||||
qQKCAQA2nbNFD9CDTek4MyfgKj8wuCfRheqfUqoEPLl7b8qIuBPWFnEZFsdogmcK
|
||||
j2M2UOHFUf0KELc9/7LN8nQIb/uAyAZc1O1R+1BxBURmpXlDGX3FYAbLx2KdZxPs
|
||||
+iPtVL74NQmT/MCMvEEa2k92dusuN00bRssUUnAwqdWKEB+LjAO7/67lB0j+Sl+5
|
||||
yzkfWxyulie5NXDlxRCet3bR9DbbF3MBZ79dRw8sKtGSC/SJdxrPQLw6JV97QlCz
|
||||
MeTUIV1x5ZZCfLOwmx1rGCRCMThgjeoNWlr9gd62+v5E9hFYon8ZTqXyltnOunZs
|
||||
LfwveRB3xlGoXUUiTxU6XT8m/5Xa
|
||||
-----END PRIVATE KEY-----
|
||||
32
packages/server/certs/Lamassu_OP_Root_CA.pem
Normal file
32
packages/server/certs/Lamassu_OP_Root_CA.pem
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
-----BEGIN CERTIFICATE-----
|
||||
MIIFmzCCA4OgAwIBAgIUHNAr9OGMPZJMa4o02pAYw1Vh9WUwDQYJKoZIhvcNAQEL
|
||||
BQAwXTELMAkGA1UEBhMCSVMxEjAQBgNVBAcMCVJleWtqYXZpazEcMBoGA1UECgwT
|
||||
TGFtYXNzdSBPcGVyYXRvciBDQTEcMBoGA1UEAwwTbGFtYXNzdS1vcGVyYXRvci5p
|
||||
czAeFw0yNTA1MTMxMjIwMTVaFw0zNTAyMTAxMjIwMTVaMF0xCzAJBgNVBAYTAklT
|
||||
MRIwEAYDVQQHDAlSZXlramF2aWsxHDAaBgNVBAoME0xhbWFzc3UgT3BlcmF0b3Ig
|
||||
Q0ExHDAaBgNVBAMME2xhbWFzc3Utb3BlcmF0b3IuaXMwggIiMA0GCSqGSIb3DQEB
|
||||
AQUAA4ICDwAwggIKAoICAQC0cf1TwumFeQ25BmyTUW1sEMmPUdBh4tLKnJ/iL9uO
|
||||
vLICA0qYUGQ/YHtOfGxmB4jlstW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/yOlHOy4mv
|
||||
cU/PaiUQSZILVOd8pzzUKH81XqBK9QQIlABuQeFwljuTKcmC6wM6ABDJRkER3Msr
|
||||
7RwvZWg/ARhF3ROIqNokQRtBoNLOSM/vaLNMZ85mRBMRnmiTAXoeRPC+2UcjWGnD
|
||||
WIpP12YvX5G1xQ8pAXjAinBPCTvAUgnV3RWx69XJliOn9W5kPhpTCC1ejK+ARiyl
|
||||
CwOuvrI6N5xcVJ76ZvsNOgCr2d+H6nvhyKWSaQITZuZkq1DaMWKTV8PW/w44oMpm
|
||||
RJAHDeIBn99IJrTMLREflfJqlbcr3u6td+dFLqMPzKi/K3UyQdUhXdUL0mznJiEN
|
||||
N9mkrjoD4gc1VxedcMKRP5voWXq6jKT3g2ho2H1/TcDAMDgI/k4iEAXX18Tjdudx
|
||||
0qMsFqfQfdS1oswWr8gpw9OnWmIN1jXtkjWIYguBAJYs5p27NZwGgism6jz0Xw8=
|
||||
-----END CERTIFICATE-----
|
||||
1
packages/server/certs/Lamassu_OP_Root_CA.srl
Normal file
1
packages/server/certs/Lamassu_OP_Root_CA.srl
Normal file
|
|
@ -0,0 +1 @@
|
|||
6C1E341E843F48F1A0DD7C70FE31B1A43C4DF609
|
||||
|
|
@ -16,7 +16,9 @@ const sms = require('./sms')
|
|||
const settingsLoader = require('./new-settings-loader')
|
||||
const logger = require('./logger')
|
||||
const externalCompliance = require('./compliance-external')
|
||||
const { getCustomerList } = require('typesafe-db/lib/customers')
|
||||
const {
|
||||
customers: { getCustomerList },
|
||||
} = require('typesafe-db')
|
||||
|
||||
const { APPROVED, RETRY } = require('./plugins/compliance/consts')
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ const eventBus = require('./event-bus')
|
|||
const DATABASE_NOT_REACHABLE = 'Database not reachable.'
|
||||
|
||||
const pgp = Pgp({
|
||||
pgNative: true,
|
||||
schema: 'public',
|
||||
error: (err, e) => {
|
||||
if (e.cn) logger.error(DATABASE_NOT_REACHABLE)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
const db = require('./db')
|
||||
|
||||
exports.up = next =>
|
||||
db.multi(
|
||||
[
|
||||
`CREATE INDEX cash_in_txs_customer_id_idx ON cash_in_txs (customer_id);`,
|
||||
`CREATE INDEX cash_out_txs_customer_id_idx ON cash_out_txs (customer_id);`,
|
||||
],
|
||||
next,
|
||||
)
|
||||
|
||||
exports.down = next => next()
|
||||
|
|
@ -76,7 +76,6 @@
|
|||
"p-each-series": "^1.0.0",
|
||||
"p-queue": "^6.6.2",
|
||||
"p-retry": "^4.4.0",
|
||||
"pg-native": "^3.0.0",
|
||||
"pg-promise": "^10.10.2",
|
||||
"pify": "^3.0.0",
|
||||
"pretty-ms": "^2.1.0",
|
||||
|
|
@ -87,6 +86,7 @@
|
|||
"serve-static": "^1.12.4",
|
||||
"talisman": "^0.20.0",
|
||||
"telnyx": "^1.25.5",
|
||||
"typesafe-db": "workspace:*",
|
||||
"tronweb": "^5.3.0",
|
||||
"twilio": "^3.6.1",
|
||||
"uuid": "8.3.2",
|
||||
|
|
@ -126,7 +126,9 @@
|
|||
"lamassu-clean-parsed-id": "./bin/lamassu-clean-parsed-id"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "echo 'Server requires no build step'",
|
||||
"start": "node bin/lamassu-server",
|
||||
"dev": "concurrently \"npm:server\" \"npm:admin-server\"",
|
||||
"test": "mocha --recursive tests",
|
||||
"jtest": "jest --detectOpenHandles",
|
||||
"build-admin": "npm run build-admin:css && npm run build-admin:main && npm run build-admin:lamassu",
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
const fs = require('fs')
|
||||
const os = require('os')
|
||||
const path = require('path')
|
||||
|
||||
const setEnvVariable = require('./set-env-var')
|
||||
|
||||
fs.copyFileSync(path.resolve(__dirname, '../.sample.env'), path.resolve(__dirname, '../.env'))
|
||||
fs.copyFileSync(
|
||||
path.resolve(__dirname, '../.sample.env'),
|
||||
path.resolve(__dirname, '../.env'),
|
||||
)
|
||||
|
||||
setEnvVariable('NODE_ENV', 'development')
|
||||
|
||||
|
|
@ -18,13 +20,16 @@ setEnvVariable('CA_PATH', `${process.env.PWD}/certs/Lamassu_OP_Root_CA.pem`)
|
|||
setEnvVariable('CERT_PATH', `${process.env.PWD}/certs/Lamassu_OP.pem`)
|
||||
setEnvVariable('KEY_PATH', `${process.env.PWD}/certs/Lamassu_OP.key`)
|
||||
|
||||
setEnvVariable('MNEMONIC_PATH', `${process.env.HOME}/.lamassu/mnemonics/mnemonic.txt`)
|
||||
setEnvVariable(
|
||||
'MNEMONIC_PATH',
|
||||
`${process.env.PWD}/.lamassu/mnemonics/mnemonic.txt`,
|
||||
)
|
||||
|
||||
setEnvVariable('BLOCKCHAIN_DIR', `${process.env.PWD}/blockchains`)
|
||||
setEnvVariable('OFAC_DATA_DIR', `${process.env.HOME}/.lamassu/ofac`)
|
||||
setEnvVariable('ID_PHOTO_CARD_DIR', `${process.env.HOME}/.lamassu/idphotocard`)
|
||||
setEnvVariable('FRONT_CAMERA_DIR', `${process.env.HOME}/.lamassu/frontcamera`)
|
||||
setEnvVariable('OPERATOR_DATA_DIR', `${process.env.HOME}/.lamassu/operatordata`)
|
||||
setEnvVariable('OFAC_DATA_DIR', `${process.env.PWD}/.lamassu/ofac`)
|
||||
setEnvVariable('ID_PHOTO_CARD_DIR', `${process.env.PWD}/.lamassu/idphotocard`)
|
||||
setEnvVariable('FRONT_CAMERA_DIR', `${process.env.PWD}/.lamassu/frontcamera`)
|
||||
setEnvVariable('OPERATOR_DATA_DIR', `${process.env.PWD}/.lamassu/operatordata`)
|
||||
|
||||
setEnvVariable('BTC_NODE_LOCATION', 'remote')
|
||||
setEnvVariable('BTC_WALLET_LOCATION', 'local')
|
||||
|
|
|
|||
|
|
@ -5,11 +5,13 @@ set -e
|
|||
DOMAIN=localhost
|
||||
[ ! -z "$1" ] && DOMAIN=$1
|
||||
|
||||
CONFIG_DIR=$HOME/.lamassu
|
||||
SERVER_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
|
||||
CONFIG_DIR=$SERVER_DIR/.lamassu
|
||||
LOG_FILE=/tmp/cert-gen.log
|
||||
CERT_DIR=$PWD/certs
|
||||
KEY_DIR=$PWD/certs
|
||||
LAMASSU_CA_PATH=$PWD/Lamassu_CA.pem
|
||||
CERT_DIR=$SERVER_DIR/certs
|
||||
KEY_DIR=$SERVER_DIR/certs
|
||||
LAMASSU_CA_PATH=$SERVER_DIR/Lamassu_CA.pem
|
||||
POSTGRES_PASS=postgres123
|
||||
OFAC_DATA_DIR=$CONFIG_DIR/ofac
|
||||
IDPHOTOCARD_DIR=$CONFIG_DIR/idphotocard
|
||||
|
|
@ -24,7 +26,7 @@ MNEMONIC_DIR=$CONFIG_DIR/mnemonics
|
|||
MNEMONIC_FILE=$MNEMONIC_DIR/mnemonic.txt
|
||||
mkdir -p $MNEMONIC_DIR >> $LOG_FILE 2>&1
|
||||
SEED=$(openssl rand -hex 32)
|
||||
MNEMONIC=$($PWD/bin/bip39 $SEED)
|
||||
MNEMONIC=$($SERVER_DIR/bin/bip39 $SEED)
|
||||
echo "$MNEMONIC" > $MNEMONIC_FILE
|
||||
|
||||
echo "Generating SSL certificates..."
|
||||
|
|
@ -90,6 +92,6 @@ rm /tmp/Lamassu_OP.csr.pem
|
|||
mkdir -p $OFAC_DATA_DIR/sources
|
||||
touch $OFAC_DATA_DIR/etags.json
|
||||
|
||||
node tools/build-dev-env.js
|
||||
(cd $SERVER_DIR && node tools/build-dev-env.js)
|
||||
|
||||
echo "Done."
|
||||
|
|
|
|||
|
|
@ -4,14 +4,23 @@
|
|||
"license": "../LICENSE",
|
||||
"type": "module",
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.0.0",
|
||||
"@types/pg": "^8.11.10",
|
||||
"kysely-codegen": "^0.18.5",
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./src/index.ts",
|
||||
"default": "./lib/index.js"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build": "tsc --build",
|
||||
"start": "tsc --watch",
|
||||
"clean": "rm -rf lib",
|
||||
"generate-types": "kysely-codegen --camel-case --out-file ./src/types/types.d.ts"
|
||||
"dev": "tsc --watch",
|
||||
"generate-types": "kysely-codegen --camel-case --out-file ./src/types/types.d.ts",
|
||||
"postinstall": "npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
"kysely": "^0.28.2",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,14 @@
|
|||
import { DB } from './types/types.js'
|
||||
import { Pool } from 'pg'
|
||||
import { Kysely, PostgresDialect, CamelCasePlugin } from 'kysely'
|
||||
import { PSQL_URL } from 'lamassu-server/lib/constants.js'
|
||||
|
||||
const POSTGRES_USER = process.env.POSTGRES_USER
|
||||
const POSTGRES_PASSWORD = process.env.POSTGRES_PASSWORD
|
||||
const POSTGRES_HOST = process.env.POSTGRES_HOST
|
||||
const POSTGRES_PORT = process.env.POSTGRES_PORT
|
||||
const POSTGRES_DB = process.env.POSTGRES_DB
|
||||
|
||||
const PSQL_URL = `postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}`
|
||||
|
||||
const dialect = new PostgresDialect({
|
||||
pool: new Pool({
|
||||
|
|
@ -13,12 +20,4 @@ const dialect = new PostgresDialect({
|
|||
export default new Kysely<DB>({
|
||||
dialect,
|
||||
plugins: [new CamelCasePlugin()],
|
||||
log(event) {
|
||||
if (event.level === 'query') {
|
||||
console.log('Query:', event.query.sql)
|
||||
console.log('Parameters:', event.query.parameters)
|
||||
console.log('Duration:', event.queryDurationMillis + 'ms')
|
||||
console.log('---')
|
||||
}
|
||||
},
|
||||
})
|
||||
|
|
|
|||
1
packages/typesafe-db/src/index.ts
Normal file
1
packages/typesafe-db/src/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * as customers from './customers.js'
|
||||
|
|
@ -2,18 +2,17 @@
|
|||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"display": "Node 22",
|
||||
"_version": "22.0.0",
|
||||
|
||||
"compilerOptions": {
|
||||
"lib": ["es2023"],
|
||||
"types": ["node"],
|
||||
"module": "nodenext",
|
||||
"target": "es2022",
|
||||
|
||||
"allowJs": true,
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"moduleResolution": "node16",
|
||||
|
||||
"noEmit": false,
|
||||
"outDir": "./lib",
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
|
|
|
|||
18581
pnpm-lock.yaml
generated
Normal file
18581
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load diff
4
pnpm-workspace.yaml
Normal file
4
pnpm-workspace.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
packages:
|
||||
- 'packages/server'
|
||||
- 'packages/admin-ui'
|
||||
- 'packages/typesafe-db'
|
||||
28
shell.nix
28
shell.nix
|
|
@ -1,18 +1,18 @@
|
|||
with import (fetchTarball {
|
||||
name = "nixpkgs-194846768975b7ad2c4988bdb82572c00222c0d7";
|
||||
url = https://github.com/NixOS/nixpkgs/archive/194846768975b7ad2c4988bdb82572c00222c0d7.tar.gz;
|
||||
sha256 = "0snj72i9dm99jlnnmk8id8ffjnfg1k81lr7aw8d01kz3hdiraqil";
|
||||
name = "nixpkgs-21808d22b1cda1898b71cf1a1beb524a97add2c4";
|
||||
url = "https://github.com/NixOS/nixpkgs/archive/21808d22b1cda1898b71cf1a1beb524a97add2c4.tar.gz";
|
||||
sha256 = "0v2z6jphhbk1ik7fqhlfnihcyff5np9wb3pv19j9qb9mpildx0cg";
|
||||
}) {};
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "node";
|
||||
buildInputs = [
|
||||
nodejs_22
|
||||
python3
|
||||
openssl
|
||||
postgresql
|
||||
];
|
||||
shellHook = ''
|
||||
export PATH="$PWD/node_modules/.bin/:$PATH"
|
||||
'';
|
||||
}
|
||||
name = "node";
|
||||
buildInputs = [
|
||||
nodejs_22
|
||||
python3
|
||||
openssl
|
||||
pnpm_10
|
||||
];
|
||||
shellHook = ''
|
||||
export PATH="$PWD/node_modules/.bin/:$PATH"
|
||||
'';
|
||||
}
|
||||
48
turbo.json
Normal file
48
turbo.json
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
"$schema": "https://turbo.build/schema.json",
|
||||
"remoteCache": {
|
||||
"enabled": true
|
||||
},
|
||||
"tasks": {
|
||||
"build": {
|
||||
"dependsOn": ["^build"],
|
||||
"inputs": [
|
||||
"src/**",
|
||||
"lib/**",
|
||||
"public/**",
|
||||
"index.html",
|
||||
"vite.config.js",
|
||||
"tsconfig.json",
|
||||
"package.json"
|
||||
],
|
||||
"outputs": ["lib/**", "dist/**", "build/**"]
|
||||
},
|
||||
"start": {
|
||||
"dependsOn": ["^build"],
|
||||
"cache": false,
|
||||
"persistent": true
|
||||
},
|
||||
"dev": {
|
||||
"dependsOn": ["^build"],
|
||||
"cache": false,
|
||||
"persistent": true
|
||||
},
|
||||
"watch": {
|
||||
"dependsOn": ["^build"],
|
||||
"cache": false,
|
||||
"persistent": true
|
||||
},
|
||||
"test": {
|
||||
"dependsOn": ["^build"],
|
||||
"inputs": ["src/**", "tests/**", "lib/**", "package.json"],
|
||||
"outputs": []
|
||||
},
|
||||
"clean": {
|
||||
"cache": false
|
||||
},
|
||||
"generate-types": {
|
||||
"inputs": ["src/**", "package.json"],
|
||||
"outputs": ["src/types/**"]
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue