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

refactor(idp): migrate to Deno #429

Merged
merged 17 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
16 changes: 6 additions & 10 deletions .github/workflows/check-on-pr-idp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,17 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set Up Bun
uses: oven-sh/setup-bun@v2
- name: Set Up Deno
uses: denoland/setup-deno@v2
with:
bun-version: latest

- name: Install Packages
run: bun i
- name: Run Check
run: deno task check
working-directory: idp

- name: Run TypeScript Compiler
run: bun run tsc
working-directory: idp

- name: Run ESLint
run: bun run lint
- name: Run Lint
run: deno lint .
working-directory: idp
permissions:
contents: read
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
.idea
.vscode
.DS_Store
28 changes: 10 additions & 18 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@

## Prerequisites

Install [Deno](https://deno.com).

Install [Bun](https://bun.sh).

Install [Go](https://go.dev) for your platform.
Install [Node.js](https://nodejs.org).

Install [Go](https://go.dev).

Install [Rust](https://www.rust-lang.org) for your platform.
Install [Rust](https://www.rust-lang.org).

Install [Poetry](https://python-poetry.org/docs/#installation).

Install [Python](https://www.python.org) 3.12 with [pyenv](https://github.com/pyenv/pyenv).
Install [Python](https://www.python.org) 3.11 with [pyenv](https://github.com/pyenv/pyenv).

## Run Infrastructure Services

Expand Down Expand Up @@ -99,26 +103,14 @@ MailHog

## Install Command Line Tools

### macOS 14.5 Sonoma and later
### macOS 15 Sequoia and Later

```shell
npm i -g gltf-pipeline
```

```shell
npm i -g @koupr/screenshot-glb
```

Install browser dependencies:

```shell
npx playwright install-deps
```

Install browsers:

```shell
npx playwright install
brew install --cask blender
```

```shell
Expand All @@ -135,7 +127,7 @@ brew install \
ffmpeg
```

### Debian 12 bookworm and later
### Debian 12 Bookworm and Later

Run [Voltaserve Conversion](conversion/README.md) with the environment variable `ENABLE_INSTALLER` set to `true`.
This will install the dependencies in the background. Incoming requests will be queued and be waiting until the installation is complete.
Expand Down
3 changes: 0 additions & 3 deletions api/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
/.env.local
/voltaserve
/__debug_bin*
/.air
4 changes: 2 additions & 2 deletions api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ FROM golang:1.22-alpine AS builder

WORKDIR /build

COPY go.mod go.sum .
COPY go.mod go.sum ./

RUN go mod download

COPY . .

RUN go build -o voltaserve-api

FROM golang:1.22-alpine AS runner
FROM alpine:3.21 AS runner

WORKDIR /app

Expand Down
6 changes: 0 additions & 6 deletions api/package-lock.json

This file was deleted.

29 changes: 0 additions & 29 deletions api/qodana.yaml

This file was deleted.

29 changes: 0 additions & 29 deletions console/qodana.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions conversion/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
/.env.local
/voltaserve
__debug_bin*
/*.tsv
/.air
2 changes: 1 addition & 1 deletion conversion/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ FROM golang:1.22-bookworm AS builder

WORKDIR /build

COPY go.mod go.sum .
COPY go.mod go.sum ./

RUN go mod download

Expand Down
29 changes: 0 additions & 29 deletions conversion/qodana.yaml

This file was deleted.

6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ services:
healthcheck:
test: pg_isready -U postgres || exit 1
minio:
image: minio/minio:RELEASE.2024-09-09T16-59-28Z
image: minio/minio:RELEASE.2024-11-07T00-52-20Z
ports:
- ${VOLTASERVE_MINIO_PORT}:9000
- ${VOLTASERVE_MINIO_CONSOLE_PORT}:9001
Expand All @@ -50,15 +50,15 @@ services:
healthcheck:
test: curl --fail http://127.0.0.1:7700/health || exit 1
redis:
image: redis:7.4
image: redis:7.4.1
ports:
- ${VOLTASERVE_REDIS_PORT}:6379
volumes:
- redis:/data
healthcheck:
test: redis-cli ping || exit 1
maildev:
image: maildev/maildev:2.1.0
image: maildev/maildev:2.2.1
ports:
- ${VOLTASERVE_MAILDEV_SMTP_PORT}:1025
- ${VOLTASERVE_MAILDEV_WEB_PORT}:1080
Expand Down
1 change: 0 additions & 1 deletion idp/.dockerignore

This file was deleted.

3 changes: 0 additions & 3 deletions idp/.prettierignore

This file was deleted.

13 changes: 0 additions & 13 deletions idp/.prettierrc.json

This file was deleted.

3 changes: 3 additions & 0 deletions idp/.vscode/.settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"deno.enable": true
}
21 changes: 14 additions & 7 deletions idp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,26 @@
# by the GNU Affero General Public License v3.0 only, included in the file
# AGPL-3.0-only in the root of this repository.

FROM oven/bun:1-alpine
FROM denoland/deno:debian-2.1.4 AS builder

WORKDIR /app
WORKDIR /build

COPY src ./src
COPY templates ./templates
COPY .env .
COPY package.json .
COPY bun.lockb .
COPY tsconfig.json .
COPY deno.json .
COPY deno.lock .

RUN deno task compile

FROM debian:bookworm-slim AS runner

WORKDIR /app

RUN bun install --frozen-lockfile --production
COPY --from=builder /build/voltaserve-idp ./voltaserve-idp
COPY --from=builder /build/.env ./.env
COPY --from=builder /build/templates ./templates

ENTRYPOINT ["bun", "run", "start"]
ENTRYPOINT ["./voltaserve-idp"]

EXPOSE 8081
26 changes: 6 additions & 20 deletions idp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,28 @@

## Getting Started

Install dependencies:

```shell
bun i
```

Run for development:

```shell
bun run dev
deno task dev
```

Run for production:

```shell
bun run start
deno task start
```

Lint code:

```shell
bun run lint
deno lint .
```

Format code:

```shell
bun run format
deno fmt .
```

Build Docker image:
Expand All @@ -38,22 +32,14 @@ Build Docker image:
docker build -t voltaserve/idp .
```

## Generate Documentation

Generate `swagger.json`:

```shell
bun run swagger-autogen && mv ./swagger.json ./docs
```

Preview (will be served at [http://localhost:7777](http://localhost:7777)):

```shell
bunx @redocly/cli preview-docs --port 7777 ./docs/swagger.json
deno -A npm:@redocly/cli preview-docs --port 7777 ./docs/swagger.json
```

Generate the final static HTML documentation:

```shell
bunx @redocly/cli build-docs ./docs/swagger.json --output ./docs/index.html
deno -A npm:@redocly/cli build-docs ./docs/swagger.json --output ./docs/index.html
```
Binary file removed idp/bun.lockb
Binary file not shown.
Loading
Loading