Skip to content

Commit

Permalink
Bun to Node.js
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlia committed Dec 17, 2024
1 parent 32b0aea commit af092d7
Show file tree
Hide file tree
Showing 25 changed files with 5,194 additions and 113 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ Version 0.4.0

To be released.

- Hollo is now powered by Node.js 23+ instead of Bun for more efficient
memory usage.

- Now you can import and export your data from the administration dashboard
in CSV format: follows, lists, accounts you muted, accounts you blocked,
and bookmarks.
Expand Down
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM docker.io/oven/bun:1.1.38-alpine
FROM docker.io/node:23.4-alpine

LABEL org.opencontainers.image.title="Hollo"
LABEL org.opencontainers.image.description="Federated single-user \
Expand All @@ -7,11 +7,11 @@ LABEL org.opencontainers.image.url="https://docs.hollo.social/"
LABEL org.opencontainers.image.source="https://github.com/dahlia/hollo"
LABEL org.opencontainers.image.licenses="AGPL-3.0-only"

RUN apk add --no-cache ffmpeg jq libstdc++
RUN apk add --no-cache ffmpeg jq libstdc++ pnpm

COPY bun.lockb package.json /app/
COPY pnpm-lock.yaml package.json /app/
WORKDIR /app/
RUN bun install --frozen-lockfile --no-cache
RUN pnpm install --frozen-lockfile --prod

COPY . /app/

Expand All @@ -24,4 +24,4 @@ RUN \
fi

EXPOSE 3000
CMD ["bun", "run", "prod"]
CMD ["pnpm", "run", "prod"]
Binary file removed bun.lockb
Binary file not shown.
5 changes: 1 addition & 4 deletions docs/src/content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,9 @@ import { Card, CardGrid } from "@astrojs/starlight/components";
[Misskey]: https://misskey-hub.net/
[Akkoma]: https://akkoma.social/
</Card>
<Card title="Powered by Fedify &amp; Bun" icon="bun">
<Card title="Powered by Fedify" icon="deno">
Hollo is powered by [Fedify], an ActivityPub server framework for TypeScript.
It's built on top of [Bun], an alternative super-fast JavaScript runtime
to Node.js.

[Fedify]: https://fedify.dev/
[Bun]: https://bun.sh/
</Card>
</CardGrid>
16 changes: 9 additions & 7 deletions docs/src/content/docs/install/manual.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ Before you start, make sure you have the following software installed on your
server:

- [Git]
- [Bun]
- [Node.js]
- [pnpm]
- [ffmpeg]
- [PostgreSQL]
- L7 load balancer (e.g., [nginx], [Caddy])
- A domain name pointing to your server

[Git]: https://git-scm.com/
[Bun]: https://bun.sh/
[Node.js]: https://nodejs.org/
[pnpm]: https://pnpm.io/
[ffmpeg]: https://www.ffmpeg.org/
[PostgreSQL]: https://www.postgresql.org/
[nginx]: https://nginx.org/
Expand All @@ -53,10 +55,10 @@ import { Steps } from "@astrojs/starlight/components";
cd hollo/
~~~~

2. Install the dependencies using Bun:
2. Install the dependencies using pnpm:

~~~~ sh frame="none"
bun install
pnpm install
~~~~

3. Create a PostgreSQL user and database for Hollo:
Expand Down Expand Up @@ -92,7 +94,7 @@ Starting the server
To start the server, run the following command:

~~~~ sh frame="none"
bun prod
pnpm run prod
~~~~


Expand All @@ -112,12 +114,12 @@ dependencies:
2. Reinstall the dependencies:

~~~~ sh frame="none"
bun install
pnpm install
~~~~

3. Restart the server:

~~~~ sh frame="none"
bun prod
pnpm run prod
~~~~
</Steps>
6 changes: 2 additions & 4 deletions docs/src/content/docs/ja/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,9 @@ import { Card, CardGrid } from "@astrojs/starlight/components";
[Misskey]: https://misskey-hub.net/ja/
[Akkoma]: https://akkoma.social/
</Card>
<Card title="FedifyとBunベース" icon="bun">
HolloはTypeScript向けのActivityPubサーバーフレームワークである[Fedify]で作られており、
Node.jsの代替となる超高速JavaScriptランタイムである[Bun]上で動作します。
<Card title="Fedifyベース" icon="deno">
HolloはTypeScript向けのActivityPubサーバーフレームワークである[Fedify]で作られています。

[Fedify]: https://fedify.dev/
[Bun]: https://bun.sh/
</Card>
</CardGrid>
18 changes: 10 additions & 8 deletions docs/src/content/docs/ja/install/manual.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ Holloは手動でインストールすることもできます。
始める前に、サーバーに以下のソフトウェアがインストールされていることを確認してください:

- [Git]
- [Bun]
- [Node.js]
- [pnpm]
- [ffmpeg]
- [PostgreSQL]
- L7ロードバランサー(例:[nginx][Caddy]
- あなたのサーバーを指しているドメイン名

[Git]: https://git-scm.com/
[Bun]: https://bun.sh/
[Node.js]: https://nodejs.org/
[pnpm]: https://pnpm.io/
[ffmpeg]: https://www.ffmpeg.org/
[PostgreSQL]: https://www.postgresql.org/
[nginx]: https://nginx.org/
Expand All @@ -51,10 +53,10 @@ import { Steps } from "@astrojs/starlight/components";
cd hollo/
~~~~

2. Bunで依存関係をインストールします
2. pnpmで依存関係をインストールします

~~~~ sh frame="none"
bun install
pnpm install
~~~~

3. HolloのためにPostgreSQLユーザーとデータベースを作成します:
Expand Down Expand Up @@ -89,7 +91,7 @@ Holloをインストールしたら、設定を行う必要があります。
サーバーを起動する準備が整ったら、以下のコマンドを実行します:

~~~~ sh frame="none"
bun prod
pnpm run prod
~~~~


Expand All @@ -106,15 +108,15 @@ GitHubリポジトリから最新のコードを取得し、依存関係を再
git pull
~~~~

2. Bunで依存関係を再インストールします
2. pnpmで依存関係を再インストールします

~~~~ sh frame="none"
bun install
pnpm install
~~~~

3. サーバーを再起動します:

~~~~ sh frame="none"
bun prod
pnpm run prod
~~~~
</Steps>
6 changes: 2 additions & 4 deletions docs/src/content/docs/ko/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,9 @@ import { Card, CardGrid } from "@astrojs/starlight/components";
[Misskey]: https://misskey-hub.net/
[Akkoma]: https://akkoma.social/
</Card>
<Card title="Fedify 및 Bun으로 제작됨" icon="bun">
Hollo는 TypeScript를 위한 ActivityPub 서버 프레임워크인 [Fedify]로 제작되었으며,
Node.js의 대안인 초고속 JavaScript 런타임인 [Bun] 위에서 돌아갑니다.
<Card title="Fedify로 제작됨" icon="deno">
Hollo는 TypeScript를 위한 ActivityPub 서버 프레임워크인 [Fedify]로 제작되었습니다.

[Fedify]: https://fedify.dev/
[Bun]: https://bun.sh/
</Card>
</CardGrid>
16 changes: 9 additions & 7 deletions docs/src/content/docs/ko/install/manual.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ Hollo는 수동으로도 설치할 수 있습니다.
시작하기에 앞서, 서버에 다음 소프트웨어가 설치되어 있는지 확인하세요:

- [Git]
- [Bun]
- [Node.js]
- [pnpm]
- [ffmpeg]
- [PostgreSQL]
- L7 로드 밸런서 (e.g., [nginx], [Caddy])
- 여러분의 서버를 가리키고 있는 도메인 이름

[Git]: https://git-scm.com/
[Bun]: https://bun.sh/
[Node.js]: https://nodejs.org/
[pnpm]: https://pnpm.io/
[ffmpeg]: https://www.ffmpeg.org/
[PostgreSQL]: https://www.postgresql.org/
[nginx]: https://nginx.org/
Expand All @@ -52,10 +54,10 @@ import { Steps } from "@astrojs/starlight/components";
cd hollo/
~~~~

2. Bun으로 의존성을 설치합니다:
2. pnpm으로 의존성을 설치합니다:

~~~~ sh frame="none"
bun install
pnpm install
~~~~

3. Hollo에서 쓸 PostgreSQL 사용자와 데이터베이스를 만듭니다:
Expand Down Expand Up @@ -90,7 +92,7 @@ Hollo가 설치되었다면, 설정을 해야 합니다.
서버를 시작하려면 다음 명령을 실행하세요:

~~~~ sh frame="none"
bun prod
pnpm run prod
~~~~


Expand All @@ -110,12 +112,12 @@ GitHub 저장소에서 최신 코드를 받고 의존성을 다시 설치하면
2. 의존성을 재설치합니다:

~~~~ sh frame="none"
bun install
pnpm install
~~~~

3. 서버를 다시 시작합니다:

~~~~ sh frame="none"
bun prod
pnpm run prod
~~~~
</Steps>
4 changes: 1 addition & 3 deletions docs/src/content/docs/zh-cn/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,9 @@ import { Card, CardGrid } from "@astrojs/starlight/components";
[Misskey]: https://misskey-hub.net/cn/
[Akkoma]: https://akkoma.social/
</Card>
<Card title="由 Fedify 和 Bun 提供支持" icon="bun">
<Card title="由 Fedify 提供支持" icon="deno">
Hollo 由 [Fedify] 提供支持,这是一个用于 TypeScript 的 ActivityPub 服务端框架。
它构建在 [Bun] 之上,这是 Node.js 的超快速 JavaScript 运行时替代方案。

[Fedify]: https://fedify.dev/
[Bun]: https://bun.sh/
</Card>
</CardGrid>
16 changes: 9 additions & 7 deletions docs/src/content/docs/zh-cn/install/manual.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ Hollo 可以手动安装在您的服务器上。本指南将引导您完成在
开始之前,请确保您的服务器上安装了以下软件:

- [Git]
- [Bun]
- [Node.js]
- [pnpm]
- [ffmpeg]
- [PostgreSQL]
- L7 负载均衡器(例如,[nginx][Caddy]
- 指向您服务器的域名

[Git]: https://git-scm.com/
[Bun]: https://bun.sh/
[Node.js]: https://nodejs.org/
[pnpm]: https://pnpm.io/
[ffmpeg]: https://www.ffmpeg.org/
[PostgreSQL]: https://www.postgresql.org/
[nginx]: https://nginx.org/
Expand All @@ -47,10 +49,10 @@ import { Steps } from "@astrojs/starlight/components";
cd hollo/
~~~~

2. 使用 Bun 安装依赖项:
2. 使用 pnpm 安装依赖项:

~~~~ sh frame="none"
bun install
pnpm install
~~~~

3. 为 Hollo 创建 PostgreSQL 用户和数据库:
Expand Down Expand Up @@ -84,7 +86,7 @@ import { Steps } from "@astrojs/starlight/components";
要启动服务端,请运行以下命令:

~~~~ sh frame="none"
bun prod
pnpm run prod
~~~~


Expand All @@ -103,12 +105,12 @@ bun prod
2. 重新安装依赖项:

~~~~ sh frame="none"
bun install
pnpm install
~~~~

3. 重启服务端:

~~~~ sh frame="none"
bun prod
pnpm run prod
~~~~
</Steps>
3 changes: 2 additions & 1 deletion mise.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[tools]
bun = "latest"
node = "23"
"npm:pnpm" = "latest"
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
"description": "Federated single-user microblogging software",
"version": "0.4.0",
"private": true,
"type": "module",
"scripts": {
"prod": "bun run migrate && bun run src/index.tsx",
"dev": "bun run migrate && bun run --hot src/index.tsx",
"check": "bunx tsc && bunx biome check .",
"migrate": "bunx drizzle-kit migrate",
"migrate:generate": "bunx drizzle-kit generate"
"prod": "pnpm run migrate && tsx --env-file-if-exists=.env src/index.tsx",
"dev": "pnpm run migrate && tsx watch --env-file-if-exists=.env src/index.tsx",
"check": "tsc && biome check .",
"migrate": "drizzle-kit migrate",
"migrate:generate": "drizzle-kit generate"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.577.0",
Expand All @@ -19,15 +20,18 @@
"@fedify/markdown-it-mention": "^0.1.1",
"@fedify/postgres": "^0.2.1",
"@hexagon/base64": "^2.0.4",
"@hono/node-server": "^1.13.7",
"@hono/zod-validator": "^0.2.1",
"@js-temporal/polyfill": "^0.4.4",
"@logtape/logtape": "^0.8.0",
"@logtape/sentry": "^0.1.0",
"@sentry/bun": "^8.41.0",
"@sentry/core": "^8.41.0",
"@sentry/node": "^8.46.0",
"@supercharge/promise-pool": "^3.2.0",
"argon2": "^0.41.1",
"cheerio": "^1.0.0",
"csv-writer-portable": "^1.7.6",
"drizzle-kit": "^0.21.0",
"drizzle-orm": "^0.30.10",
"es-toolkit": "^1.25.2",
"fluent-ffmpeg": "^2.1.3",
Expand All @@ -45,22 +49,18 @@
"semver": "^7.6.3",
"sharp": "^0.33.4",
"ssrfcheck": "^1.1.1",
"tsx": "^4.19.2",
"uuidv7-js": "^1.1.4",
"x-forwarded-fetch": "^0.2.0",
"xss": "^1.0.15",
"zod": "^3.23.8"
},
"devDependencies": {
"@biomejs/biome": "^1.9.3",
"@types/bun": "latest",
"@types/fluent-ffmpeg": "^2.1.26",
"@types/markdown-it": "^14.1.1",
"@types/qrcode": "^1.5.5",
"@types/semver": "^7.5.8",
"drizzle-kit": "^0.21.0"
},
"engines": {
"bun": "^1.1.38"
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
"typescript": "^5.7.2"
}
}
Loading

0 comments on commit af092d7

Please sign in to comment.