Skip to content
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
15 changes: 15 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# flyctl launch added from .gitignore
**/node_modules
**/dist
**/.env
**/.env.*
**/data/*.db
**/data/*.db-shm
**/data/*.db-wal
**/models
**/*.tsbuildinfo
**/.claude/settings.local.json
**/*.draft.*.md
**/.claude/agent-memory
**/docs/launch
fly.toml
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ models/
.claude/settings.local.json
*.draft.*.md
.claude/agent-memory/
docs/launch
1 change: 1 addition & 0 deletions Dockerfile.demo
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store \

COPY --from=builder /app/packages/server/dist ./packages/server/dist
COPY --from=builder /app/packages/web/dist ./public
COPY --from=builder /app/packages/server/drizzle ./packages/server/drizzle

RUN mkdir -p /app/data
VOLUME ["/app/data"]
Expand Down
2 changes: 1 addition & 1 deletion README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ https://github.com/user-attachments/assets/f1423bed-72e4-48d6-916a-8123d4bdfe38

## ライブデモ

**インストール不要で試せます:** [personal-context.onrender.com](https://personal-context.onrender.com/)
**インストール不要で試せます:** [personal-context-demo.fly.dev/](https://personal-context-demo.fly.dev/)

> **注意:** デモはRenderの無料プランで動いています。しばらくアクセスがなかった場合、初回表示まで **約30秒** かかることがあります。これは正常な動作です。
>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ https://github.com/user-attachments/assets/9ab712f0-1af2-4b5f-9ca0-df786cd25fdb

## Live Demo

**Try it without installing anything:** [personal-context.onrender.com](https://personal-context.onrender.com/)
**Try it without installing anything:** [personal-context-demo.fly.dev/](https://personal-context-demo.fly.dev/)

> **Note:** The demo runs on Render's free tier. If the service has been idle, it will take **~30 seconds to wake up** on first visit — this is normal. Just wait for the app to load.
>
Expand Down
31 changes: 31 additions & 0 deletions fly.demo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# fly.toml app configuration file generated for personal-context on 2026-06-02T08:42:44+09:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'personal-context-demo'
primary_region = 'sjc'

[build]
dockerfile = "Dockerfile.demo"

[env]
NODE_ENV = "production"
DEMO_MODE = "true"

[mounts]
source = "context_data"
destination = "/app/data" # SQLiteファイルが保存されるパス

[http_service]
internal_port = 3001
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ['app']

[[vm]]
memory = '1gb'
cpu_kind = 'shared'
cpus = 1
7 changes: 6 additions & 1 deletion packages/server/src/db/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as schema from './schema.js'
import type { Db } from '../types.js'
import path from 'path'
import fs from 'fs'
import { fileURLToPath } from 'url'
import { migrate } from 'drizzle-orm/libsql/migrator'

const DB_PATH = process.env.DB_PATH ?? path.join(process.cwd(), 'data', 'personal_context.db')
Expand All @@ -18,7 +19,11 @@ const simulateClient = createClient({ url: `file:${SIMULATE_DB_PATH}` })
export const db = drizzle(client, { schema })
export const simulateDb = drizzle(simulateClient, { schema })

const DRIZZLE_FOLDER = new URL('../../drizzle', import.meta.url).pathname
// dev (tsx): import.meta.url = src/db/client.ts → ../../drizzle = packages/server/drizzle ✓
// prod (tsup bundle): import.meta.url = dist/index.js → ../drizzle = packages/server/drizzle ✓
const DRIZZLE_FOLDER = process.env.NODE_ENV === 'production'
? fileURLToPath(new URL('../drizzle', import.meta.url))
: fileURLToPath(new URL('../../drizzle', import.meta.url))

export async function initDatabase() {
await migrate(db, { migrationsFolder: DRIZZLE_FOLDER })
Expand Down
Loading