Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
orztv committed Oct 11, 2024
1 parent 276975c commit 890905d
Show file tree
Hide file tree
Showing 10 changed files with 2,788 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# compiled output
/dist
/node_modules
nc

# Logs
logs
*.log
npm-debug.log*
pnpm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# OS
.DS_Store

# Tests
/coverage
/.nyc_output

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
/noco.db

# export
export/**

# test dbs
test_sakila_?.db

# ignoring to avoid commiting those files
# nc-gui dir is copied for building local docker.
/docker/main.js
/docker/nc-gui/
/docker/public/

/tests/unit/.env
47 changes: 47 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
FROM nocodb/nocodb:latest

ARG NC_S3_REGION
ARG NC_S3_ENDPOINT
ARG NC_S3_ACCESS_KEY

RUN apk add --no-cache git \
&& git clone https://github.com/aigem/hf-nocodb.git /usr/src


COPY setup.sh s3_setup.sh /tmp/
COPY docker/startup.sh /usr/src/appEntry/startup.sh

RUN --mount=type=secret,id=NC_S3_BUCKET_NAME,mode=0444,required=true \
--mount=type=secret,id=NC_S3_ACCESS_SECRET,mode=0444,required=true \
/tmp/setup.sh && \
chmod +x /usr/src/appEntry/startup.sh && \
/tmp/s3_setup.sh && \
rm /tmp/setup.sh /tmp/s3_setup.sh

USER nocodb

WORKDIR /usr/src/app

# 设置环境变量
ENV LITESTREAM_S3_SKIP_VERIFY=false \
LITESTREAM_RETENTION=1440h \
LITESTREAM_RETENTION_CHECK_INTERVAL=72h \
LITESTREAM_SNAPSHOT_INTERVAL=24h \
LITESTREAM_SYNC_INTERVAL=60s \
NC_DOCKER=0.6 \
NC_TOOL_DIR=/usr/app/data/ \
NODE_ENV=production \
PORT=7860 \
NC_ALLOW_LOCAL_HOOKS=true \
NC_REDIS_URL="redis://:redis_password@localhost:6379/4" \
NC_S3_REGION=${NC_S3_REGION} \
NC_S3_ENDPOINT=${NC_S3_ENDPOINT} \
NC_S3_ACCESS_KEY=${NC_S3_ACCESS_KEY} \
LITESTREAM_S3_REGION=${NC_S3_REGION} \
LITESTREAM_S3_ENDPOINT=${NC_S3_ENDPOINT} \
LITESTREAM_S3_ACCESS_KEY_ID=${NC_S3_ACCESS_KEY}

ENV $(source /etc/profile.d/s3_env.sh && env | grep '^S3_' | xargs)

ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["/usr/src/appEntry/startup.sh"]
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
---
title: Supabase
emoji: 📚
colorFrom: gray
colorTo: red
sdk: docker
pinned: false
app_port: 8080
---

# hf-nocodb
在HuggingFace上部署NocoDB,开源版本的airtable
22 changes: 22 additions & 0 deletions docker/litestream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Docs: https://litestream.io/reference/config/

dbs:
- path: ${NC_TOOL_DIR}noco.db
replicas:
- type: s3
endpoint: ${LITESTREAM_S3_ENDPOINT}
region: ${LITESTREAM_S3_REGION}
skip-verify: ${LITESTREAM_S3_SKIP_VERIFY}
bucket: ${LITESTREAM_S3_BUCKET}
path: ${LITESTREAM_S3_PATH}
access-key-id: ${LITESTREAM_S3_ACCESS_KEY_ID}
secret-access-key: ${LITESTREAM_S3_SECRET_ACCESS_KEY}
retention: ${LITESTREAM_RETENTION}
retention-check-interval: ${LITESTREAM_RETENTION_CHECK_INTERVAL}
snapshot-interval: ${LITESTREAM_SNAPSHOT_INTERVAL}
sync-interval: ${LITESTREAM_SYNC_INTERVAL}
# age:
# identities:
# - ${LITESTREAM_AGE_SECRET_KEY}
# recipients:
# - ${LITESTREAM_AGE_PUBLIC_KEY}
200 changes: 200 additions & 0 deletions docker/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
{
"name": "nocodb",
"version": "0.257.0",
"description": "NocoDB Backend",
"main": "dist/bundle.js",
"author": {
"name": "NocoDB Inc",
"url": "https://nocodb.com/"
},
"homepage": "https://github.com/nocodb/nocodb",
"repository": {
"type": "git",
"url": "https://github.com/nocodb/nocodb.git"
},
"bugs": {
"url": "https://github.com/nocodb/nocodb/issues"
},
"engines": {
"node": ">=18.19.1"
},
"license": "AGPL-3.0-or-later",
"scripts": {
"build": "pnpm run docker:build",
"build:obfuscate": "EE=true webpack --config webpack.config.js",
"build:cli:module": "EE=true webpack --config webpack.cli.config.js",
"obfuscate:build:publish": "pnpm run build:obfuscate && pnpm publish .",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "pnpm run watch:run",
"start:prod": "node docker/main",
"lint": "eslint \"src/**/*.ts\" --fix",
"test": "jest --runInBand --forceExit",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json",
"watch:run": "cross-env NC_DISABLE_TELE=true NODE_ENV=development EE=true nodemon -e ts,js -w ./src -x \"ts-node src/run/docker --log-error --project tsconfig.json\"",
"watch:run:mysql": "cross-env NC_DISABLE_TELE=true NODE_ENV=development EE=true nodemon -e ts,js -w ./src -x \"ts-node src/run/dockerRunMysql --log-error --project tsconfig.json\"",
"watch:run:pg": "cross-env NC_DISABLE_TELE=true NODE_ENV=development EE=true nodemon -e ts,js -w ./src -x \"ts-node src/run/dockerRunPG --log-error --project tsconfig.json\"",
"watch:run:playwright:mysql": "rm -f ./test_noco.db; cross-env DB_TYPE=mysql NC_DB=\"mysql2://localhost:3306?u=root&p=password&d=pw_ncdb\" PLAYWRIGHT_TEST=true NODE_ENV=test NC_DISABLE_TELE=true EE=true nodemon -e ts,js -w ./src -x \"ts-node src/run/testDocker --log-error --project tsconfig.json\"",
"watch:run:playwright:pg": "rm -f ./test_noco.db; cross-env DB_TYPE=pg NC_DB=\"pg://localhost:5432?u=postgres&p=password&d=pw_ncdb\" PLAYWRIGHT_TEST=true NODE_ENV=test NC_DISABLE_TELE=true EE=true nodemon -e ts,js -w ./src -x \"ts-node src/run/testDocker --log-error --project tsconfig.json\"",
"watch:run:playwright": "rm -f ./test_*.db; cross-env DB_TYPE=sqlite DATABASE_URL=sqlite:./test_noco.db PLAYWRIGHT_TEST=true NODE_ENV=test NC_DISABLE_TELE=true EE=true NC_SNAPSHOT_WINDOW_SEC=3 nodemon -e ts,js -w ./src -x \"ts-node src/run/testDocker --log-error --project tsconfig.json\"",
"watch:run:playwright:quick": "rm -f ./test_noco.db; cp ../../tests/playwright/fixtures/noco_0_91_7.db ./test_noco.db; cross-env NODE_ENV=test DATABASE_URL=sqlite:./test_noco.db NC_DISABLE_TELE=true EE=true nodemon -e ts,js -w ./src -x \"ts-node src/run/docker --log-error --project tsconfig.json\"",
"watch:run:playwright:pg:cyquick": "rm -f ./test_noco.db; cp ../../tests/playwright/fixtures/noco_0_91_7.db ./test_noco.db; cross-env NODE_ENV=test NC_DISABLE_TELE=true EE=true nodemon -e ts,js -w ./src -x \"ts-node src/run/dockerRunPG_CyQuick.ts --log-error --project tsconfig.json\"",
"test:unit": "cross-env EE=false NODE_ENV=test TS_NODE_PROJECT=./tests/unit/tsconfig.json mocha -r ts-node/register tests/unit/index.test.ts --recursive --timeout 300000 --exit --delay",
"test:unit:pg": "cp tests/unit/.pg.env tests/unit/.env; cross-env NODE_ENV=test EE=false TS_NODE_PROJECT=./tests/unit/tsconfig.json mocha -r ts-node/register tests/unit/index.test.ts --recursive --timeout 300000 --exit --delay",
"docker:build": "EE=\"true-xc-test\" webpack --config docker/webpack.config.js"
},
"dependencies": {
"@aws-sdk/client-kafka": "^3.620.0",
"@aws-sdk/client-kinesis": "^3.620.0",
"@aws-sdk/client-s3": "^3.620.0",
"@aws-sdk/client-ses": "^3.620.0",
"@aws-sdk/client-sns": "^3.620.0",
"@aws-sdk/lib-storage": "^3.620.0",
"@aws-sdk/s3-request-presigner": "^3.620.0",
"@google-cloud/storage": "^7.7.0",
"@jm18457/kafkajs-msk-iam-authentication-mechanism": "^3.1.2",
"@nestjs/bull": "^10.0.1",
"@nestjs/common": "^10.3.8",
"@nestjs/config": "^3.1.1",
"@nestjs/core": "^10.3.8",
"@nestjs/event-emitter": "^2.0.4",
"@nestjs/passport": "^10.0.3",
"@nestjs/platform-express": "^10.3.8",
"@nestjs/platform-socket.io": "^10.3.8",
"@nestjs/throttler": "^5.1.2",
"@nestjs/websockets": "^10.3.8",
"@ntegral/nestjs-sentry": "^4.0.1",
"@sentry/node": "^6.19.7",
"@techpass/passport-openidconnect": "^0.3.3",
"@types/chai": "^4.3.16",
"airtable": "^0.12.2",
"ajv": "^8.12.0",
"ajv-formats": "^2.1.1",
"auto-bind": "^4.0.0",
"aws-sdk": "^2.1550.0",
"axios": "^1.6.8",
"bcryptjs": "^2.4.3",
"boxen": "^5.1.2",
"bull": "^4.12.5",
"bullmq": "^1.91.1",
"clear": "^0.1.0",
"clickhouse": "^2.6.0",
"clickhouse-migrations": "^0.1.14",
"colors": "^1.4.0",
"compare-versions": "^6.1.0",
"content-disposition": "^0.5.4",
"cookie-parser": "^1.4.6",
"cors": "^2.8.5",
"cron": "^1.8.2",
"crypto-js": "^4.2.0",
"dataloader": "^2.2.2",
"dayjs": "^1.11.11",
"debug": "^4.3.4",
"dotenv": "^8.6.0",
"ejs": "^3.1.10",
"emittery": "^0.13.1",
"express": "^4.18.3",
"fast-levenshtein": "^2.0.6",
"fs-extra": "^9.1.0",
"glob": "^10.4.5",
"handlebars": "^4.7.8",
"html-to-json-parser": "^2.0.1",
"import-fresh": "^3.3.0",
"inflection": "^1.13.4",
"ioredis": "^5.4.1",
"ioredis-mock": "^8.9.0",
"is-docker": "^2.2.1",
"isomorphic-dompurify": "^1.13.0",
"jsep": "^1.3.8",
"json5": "^2.2.3",
"jsonfile": "^6.1.0",
"jsonwebtoken": "^9.0.2",
"kafkajs": "^2.2.4",
"knex": "2.4.2",
"list-github-dir-content": "^3.0.0",
"lodash": "^4.17.21",
"mailersend": "^1.5.0",
"marked": "^4.3.0",
"mime": "^2.6.0",
"minio": "^8.0.1",
"mkdirp": "^2.1.6",
"mssql": "^10.0.2",
"multer": "^1.4.5-lts.1",
"mysql2": "^3.9.7",
"nanoid": "^3.3.7",
"nc-lib-gui": "0.257.0",
"nestjs-throttler-storage-redis": "^0.4.4",
"nocodb-sdk": "workspace:^",
"nodemailer": "^6.9.13",
"object-hash": "^3.0.0",
"object-sizeof": "^2.6.4",
"os-locale": "^6.0.2",
"p-queue": "^6.6.2",
"papaparse": "^5.4.1",
"parse-database-url": "^0.3.0",
"passport": "^0.7.0",
"passport-custom": "^1.1.1",
"passport-google-oauth20": "^2.0.0",
"passport-http": "^0.3.0",
"passport-jwt": "^4.0.1",
"passport-local": "^1.0.0",
"pg": "^8.11.5",
"redlock": "^5.0.0-beta.2",
"reflect-metadata": "^0.2.1",
"request-filtering-agent": "^1.1.2",
"request-ip": "^3.3.0",
"rxjs": "^7.8.1",
"sharp": "^0.33.4",
"slash": "^3.0.0",
"slug": "^8.2.3",
"socket.io": "^4.7.5",
"sqlite3": "^5.1.7",
"tedious": "^16.6.1",
"tinycolor2": "^1.6.0",
"twilio": "^4.23.0",
"uuid": "^9.0.1",
"validator": "^13.11.0",
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz"
},
"devDependencies": {
"@nestjs/cli": "^10.3.2",
"@nestjs/schematics": "^10.1.1",
"@nestjs/testing": "^10.3.8",
"@nestjsplus/dyn-schematics": "^1.0.12",
"@types/content-disposition": "^0.5.8",
"@types/ejs": "^3.1.5",
"@types/express": "^4.17.21",
"@types/jest": "^29.5.12",
"@types/mocha": "^10.0.6",
"@types/multer": "^1.4.11",
"@types/node": "20.11.30",
"@types/passport-google-oauth20": "^2.0.16",
"@types/passport-jwt": "^3.0.13",
"@types/supertest": "^2.0.16",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"chai": "^4.4.1",
"copy-webpack-plugin": "^11.0.0",
"cross-env": "^7.0.3",
"eslint": "^8.56.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-functional": "^5.0.8",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^4.2.1",
"jest": "29.7.0",
"mocha": "^10.3.0",
"nodemon": "^3.0.3",
"prettier": "^2.8.8",
"source-map-support": "^0.5.21",
"supertest": "^6.3.4",
"ts-jest": "29.1.2",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.3.3",
"webpack-cli": "^5.1.4"
}
}
Loading

0 comments on commit 890905d

Please sign in to comment.