Skip to content

Database subsystem #189

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

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
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
19 changes: 11 additions & 8 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,21 @@
##########
## SERVER:
##########
## Set log verbosity [3]:integer
#? (0=none <- 1=error <- 2=warn <- 3=info <- 4=debug)
#LOGLEVEL=3
## Set log verbosity [3]:integer<0-4>
#? (0=none; 1=error; 2=warn; 3=info; 4=debug)
#JSPB_LOGLEVEL=3

## Port for the server [4000]:integer
#PORT=4000
#JSPB_PORT=4000

## Is website served over HTTPS? [true]:boolean
#TLS=true
## Is website served over HTTPS? [false]:boolean
#JSPB_TLS=false

############
## DOCUMENT:
############
## Maximum document size in kilobytes [1024]:integer
#DOCUMENT_MAXSIZE=1024
## Maximum uploaded size in kilobytes [1024]:integer
#JSPB_DOCUMENT_MAXSIZE=1024

## Set document compression level [1]:integer<0-22>
#JSPB_DOCUMENT_COMPRESSION_LEVEL=1
54 changes: 23 additions & 31 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,37 +85,29 @@ jobs:

- name: Build artifact
run: |
bun run build:server

bun run build:standalone:darwin-arm64
chmod 755 ./dist/server
tar -c --owner=0 --group=0 --mtime='now' --utc .env.example LICENSE README.md -C ./dist/ server | xz -z -6 >./dist/backend_${{ steps.tags.outputs.tag }}_darwin-arm64.tar.xz
tar -tJf ./dist/backend_${{ steps.tags.outputs.tag }}_darwin-arm64.tar.xz >/dev/null

bun run build:standalone:linux-amd64-glibc
chmod 755 ./dist/server
tar -c --owner=0 --group=0 --mtime='now' --utc .env.example LICENSE README.md -C ./dist/ server | xz -z -6 >./dist/backend_${{ steps.tags.outputs.tag }}_linux-amd64-glibc.tar.xz
tar -tJf ./dist/backend_${{ steps.tags.outputs.tag }}_linux-amd64-glibc.tar.xz >/dev/null

bun run build:standalone:linux-amd64-musl
chmod 755 ./dist/server
tar -c --owner=0 --group=0 --mtime='now' --utc .env.example LICENSE README.md -C ./dist/ server | xz -z -6 >./dist/backend_${{ steps.tags.outputs.tag }}_linux-amd64-musl.tar.xz
tar -tJf ./dist/backend_${{ steps.tags.outputs.tag }}_linux-amd64-musl.tar.xz >/dev/null

bun run build:standalone:linux-arm64-glibc
chmod 755 ./dist/server
tar -c --owner=0 --group=0 --mtime='now' --utc .env.example LICENSE README.md -C ./dist/ server | xz -z -6 >./dist/backend_${{ steps.tags.outputs.tag }}_linux-arm64-glibc.tar.xz
tar -tJf ./dist/backend_${{ steps.tags.outputs.tag }}_linux-arm64-glibc.tar.xz >/dev/null

bun run build:standalone:linux-arm64-musl
chmod 755 ./dist/server
tar -c --owner=0 --group=0 --mtime='now' --utc .env.example LICENSE README.md -C ./dist/ server | xz -z -6 >./dist/backend_${{ steps.tags.outputs.tag }}_linux-arm64-musl.tar.xz
tar -tJf ./dist/backend_${{ steps.tags.outputs.tag }}_linux-arm64-musl.tar.xz >/dev/null

bun run build:standalone:windows-amd64
chmod 755 ./dist/server.exe
zip -j -X -9 -l -o ./dist/backend_${{ steps.tags.outputs.tag }}_windows-amd64.zip .env.example LICENSE README.md ./dist/server.exe
zip -T ./dist/backend_${{ steps.tags.outputs.tag }}_windows-amd64.zip
bun run build:standalone:darwin-arm64 --outfile=./dist/backend
chmod 755 ./dist/backend
tar -c --owner=0 --group=0 --mtime='now' --utc .env.example LICENSE README.md -C ./dist/ backend | xz -z -6 >./dist/backend-${{ steps.tags.outputs.tag }}_darwin-arm64.tar.xz
tar -tJf ./dist/backend-${{ steps.tags.outputs.tag }}_darwin-arm64.tar.xz >/dev/null

bun run build:standalone:linux-amd64-glibc --outfile=./dist/backend.glibc
chmod 755 ./dist/backend.glibc
bun run build:standalone:linux-amd64-musl --outfile=./dist/backend.musl
chmod 755 ./dist/backend.musl
tar -c --owner=0 --group=0 --mtime='now' --utc .env.example LICENSE README.md -C ./dist/ backend.glibc backend.musl | xz -z -6 >./dist/backend-${{ steps.tags.outputs.tag }}_linux-amd64.tar.xz
tar -tJf ./dist/backend-${{ steps.tags.outputs.tag }}_linux-amd64.tar.xz >/dev/null

bun run build:standalone:linux-arm64-glibc --outfile=./dist/backend.glibc
chmod 755 ./dist/backend.glibc
bun run build:standalone:linux-arm64-musl --outfile=./dist/backend.musl
chmod 755 ./dist/backend.musl
tar -c --owner=0 --group=0 --mtime='now' --utc .env.example LICENSE README.md -C ./dist/ backend.glibc backend.musl | xz -z -6 >./dist/backend-${{ steps.tags.outputs.tag }}_linux-arm64.tar.xz
tar -tJf ./dist/backend-${{ steps.tags.outputs.tag }}_linux-arm64.tar.xz >/dev/null

bun run build:standalone:windows-amd64 --outfile=./dist/backend.exe
chmod 755 ./dist/backend.exe
zip -j -X -9 -l -o ./dist/backend_${{ steps.tags.outputs.tag }}_windows-amd64.zip .env.example LICENSE README.md ./dist/backend.exe
zip -T ./dist/backend-${{ steps.tags.outputs.tag }}_windows-amd64.zip

- if: inputs.artifact-action == 'build-release'
name: Release artifact
Expand Down
16 changes: 8 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM --platform=$BUILDPLATFORM docker.io/oven/bun:1-alpine AS builder-standalone
FROM --platform=$BUILDPLATFORM docker.io/oven/bun:1-alpine AS builder

WORKDIR /build/

COPY . ./

RUN bun install --frozen-lockfile \
Expand All @@ -15,16 +16,17 @@ ARG TARGETARCH

RUN bun run build:standalone

FROM --platform=$BUILDPLATFORM docker.io/library/alpine:3.21
FROM --platform=$BUILDPLATFORM docker.io/library/alpine:3.22 AS dist

RUN apk add --no-cache libstdc++

COPY --from=builder-standalone /tmp/.backend.passwd /etc/passwd
COPY --from=builder-standalone /etc/group /etc/group
COPY --from=builder /tmp/.backend.passwd /etc/passwd
COPY --from=builder /etc/group /etc/group

WORKDIR /backend/
COPY --chown=jspaste:jspaste --from=builder-standalone /build/dist/server ./
COPY --chown=jspaste:jspaste --from=builder-standalone /build/LICENSE ./

COPY --chown=jspaste:jspaste --from=builder /build/dist/server ./
COPY --chown=jspaste:jspaste --from=builder /build/LICENSE ./

LABEL org.opencontainers.image.created="0001-01-01T00:00:00Z" \
org.opencontainers.image.description="JSPaste Backend" \
Expand All @@ -39,6 +41,4 @@ EXPOSE 4000

VOLUME /backend/storage/

USER jspaste:jspaste

ENTRYPOINT ["/backend/server"]
38 changes: 15 additions & 23 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"$schema": "https://biomejs.dev/schemas/2.0.0-beta.6/schema.json",
"files": {
"ignore": ["./dist/**", "./storage/**", "*.spec.ts"],
"includes": ["**", "!dist/**", "!node_modules/**", "!storage/**", "!**/*.spec.ts"],
"ignoreUnknown": true
},
"assist": {
"enabled": true,
"actions": {
"recommended": true
}
},
"formatter": {
"enabled": true,
"formatWithErrors": false,
Expand All @@ -16,41 +22,27 @@
"enabled": true,
"rules": {
"recommended": true,
"complexity": {
"noStaticOnlyClass": "off"
},
"style": {
"noParameterAssign": "off"
},
"suspicious": {
"noConsoleLog": "error"
"noConsole": {
"fix": "none",
"level": "error",
"options": {
"allow": []
}
}
}
}
},
"css": {
"formatter": {
"enabled": true
}
},
"javascript": {
"formatter": {
"arrowParentheses": "always",
"bracketSameLine": false,
"bracketSpacing": true,
"enabled": true,
"jsxQuoteStyle": "single",
"quoteProperties": "asNeeded",
"quoteStyle": "single",
"semicolons": "always",
"trailingCommas": "none"
}
},
"json": {
"formatter": {
"enabled": true
}
},
"organizeImports": {
"enabled": true
}
}
Loading