diff --git a/Dockerfile b/Dockerfile index 45eae1c..5d79643 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,6 @@ RUN pnpm install --prod --frozen-lockfile FROM base AS build RUN pnpm install --frozen-lockfile RUN pnpm run tailwind:build -RUN pnpm run generate RUN pnpm run build FROM base diff --git a/README.md b/README.md index 7ac4c1c..2269533 100644 --- a/README.md +++ b/README.md @@ -12,26 +12,20 @@ Skymoth is an open source service which allows you to share the content you post - Reposting text (and handle threads) - Reposting (multiple) images with alt descriptions -## Things to do +## Migrating from <= v0.3.2 to > v0.4.0 -- Control which toots get reposted (currently only public "root" toots are reposted) -- More media reposting options -- Taking Bluesky posts over to Mastodon (this is quite rough thanks to rate limits) -- A better frontend (I know, I usually do UI/UX myself but this was not the priority here) -- Per instance polling intervals +With v0.4.0 Drizzle will be the new ORM of choice. Thus Prisma and its migration tracking table +will be dropped accordingly. To make the upgrading process go smoothly, Skymoth checks if all migrations +from Prisma have been applied before migrating. If you have an instance running on a version below v0.3.2 +upgrade to v0.3.2 first before upgrading to v0.4.0 and above. + +Additionally, Drizzle will execute its migrations automatically on app startup, so there is no need to run `pnpm migrate` +after an update. ## Development For development using [Cachix Devenv](https://devenv.sh/) is strongly advised. -After setting up, you can just enter this projects shell. - -Before starting the project you need to copy the `.env.local` over to `.env`: - -```bash -cp .env.local .env -``` - -and modify it to to your needs. Then install all javascript dependencies by executing +After setting up, you can just enter this projects shell just run: ```bash pnpm install @@ -43,15 +37,6 @@ Don't worry, if set up correctly the development shell you are in should contain devenv up ``` -after starting you may need to run - -```bash -pnpm migrate -pnpm generate -``` - -to apply all migrations. - ## FAQ ### Is this free to use? diff --git a/example.compose.yml b/example.compose.yml index b6b4ef3..2c87311 100644 --- a/example.compose.yml +++ b/example.compose.yml @@ -12,10 +12,19 @@ services: - "3000:3000" links: - db + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:3000/health"] + interval: 1m + timeout: 5s + start_period: 2m + start_interval: 5s + retries: 60 skymoth-scheduler: depends_on: db: condition: service_healthy + skymoth: + condition: service_healthy build: . restart: always env_file: .env diff --git a/lib/migration.ts b/lib/migration.ts index 24834ea..4ce6952 100644 --- a/lib/migration.ts +++ b/lib/migration.ts @@ -1,11 +1,11 @@ import { resolve } from "node:path"; import { migrate } from "drizzle-orm/node-postgres/migrator"; import { sql } from "drizzle-orm"; -import { db, client } from "./db"; +import { db } from "./db"; const runPrismaToDrizzleMigrationScript = async (db: any) => { return db.execute(sql` - CREATE SCHEMA drizzle AUTHORIZATION ${client.user || "skymoth"}; + CREATE SCHEMA drizzle; CREATE SEQUENCE drizzle."__drizzle_migrations_id_seq" INCREMENT BY 1 diff --git a/package.json b/package.json index 6e8a758..e38af00 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "skymoth", "scripts": { - "build": "tsc -p tsconfig.json && cp -r public dist/public && cp -r views dist/views", + "build": "tsc -p tsconfig.json && cp -r public dist/public && cp -r views dist/views && cp -r drizzle/*.sql dist/drizzle && cp -r drizzle/meta dist/drizzle/meta", "start": "node dist/index.js", "start:scheduler": "node dist/lib/tasks/scheduler.js", "dev": "pnpm run dev:server",