Skip to content

Commit

Permalink
refactor: adapt readme and build process
Browse files Browse the repository at this point in the history
  • Loading branch information
thilobillerbeck committed Jan 27, 2025
1 parent af87705 commit 4cf4344
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 28 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 9 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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?
Expand Down
9 changes: 9 additions & 0 deletions example.compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/migration.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 4cf4344

Please sign in to comment.