Skip to content

Commit

Permalink
feat: use libsql (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
pradel authored May 19, 2024
1 parent c81e7e5 commit c251613
Show file tree
Hide file tree
Showing 10 changed files with 318 additions and 36 deletions.
5 changes: 5 additions & 0 deletions .changeset/famous-shirts-vanish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"stackspulse": minor
---

Migrate to libsql.
2 changes: 1 addition & 1 deletion .env.development
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
NEXT_TELEMETRY_DISABLED=1
CHAINHOOKS_API_TOKEN=dev-api-token
CRON_API_TOKEN=dev-api-token
DATABASE_PATH=./sqlite.db
DATABASE_PATH=file:sqlite.db
TWITTER_API_KEY=dev
TWITTER_API_SECRET_KEY=dev
TWITTER_ACCESS_TOKEN=dev
Expand Down
2 changes: 1 addition & 1 deletion .env.production.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
NEXT_TELEMETRY_DISABLED=1
CHAINHOOKS_API_TOKEN=dev-api-token
CRON_API_TOKEN=dev-api-token
DATABASE_PATH=./sqlite.db
DATABASE_PATH=file:sqlite.db
TWITTER_API_KEY=dev
TWITTER_API_SECRET_KEY=dev
TWITTER_ACCESS_TOKEN=dev
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ COPY --link . .

# Add fake environment file for build to succeed
COPY --link .env.production.build .env.production.local
RUN pnpm db:migrate
RUN pnpm db:push

# Build application
RUN pnpm run build
Expand All @@ -54,10 +54,10 @@ COPY --from=build /app/public ./public
COPY --from=build /app/.next/standalone ./
COPY --from=build /app/.next/static ./.next/static

# Setup sqlite3 on a separate volume
# Setup sqlite on a separate volume
RUN mkdir -p /data
VOLUME /data
ENV DATABASE_PATH="/data/sqlite.db"
ENV DATABASE_PATH="file:/data/sqlite.db"

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
Expand Down
2 changes: 1 addition & 1 deletion drizzle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ export default {
out: "./drizzle",
dialect: "sqlite",
dbCredentials: {
url: "./sqlite.db",
url: "file:./sqlite.db",
},
} satisfies Config;
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
},
"dependencies": {
"@dotenvx/dotenvx": "0.40.0",
"@libsql/client": "0.4.3",
"@radix-ui/themes": "3.0.5",
"@sentry/nextjs": "8.2.1",
"@stacks/transactions": "6.15.0",
"@t3-oss/env-core": "0.10.1",
"@t3-oss/env-nextjs": "0.10.1",
"@tabler/icons-react": "3.4.0",
"better-sqlite3": "10.0.0",
"class-variance-authority": "0.7.0",
"clsx": "2.1.1",
"drizzle-orm": "0.30.10",
Expand All @@ -47,7 +47,6 @@
"@biomejs/biome": "1.7.3",
"@changesets/cli": "2.27.2",
"@flydotio/dockerfile": "0.5.7",
"@types/better-sqlite3": "7.6.10",
"@types/node": "20.12.12",
"@types/react": "18.3.2",
"@types/react-dom": "18.3.0",
Expand Down
Loading

0 comments on commit c251613

Please sign in to comment.