llun / activities.next

A Next.JS ActivityPub server.
https://llun.social
MIT License
54 stars 4 forks source link

Unable to run the initial migration instructions under "running locally" #49

Closed theogravity closed 10 months ago

theogravity commented 10 months ago
yarn migrate
yarn run v1.22.19
$ knex migrate:latest
No configuration file found and no commandline connection parameters passed
Error: No configuration file found and no commandline connection parameters passed
    at checkConfigurationOptions (/Users/theo/projects/activities.next/node_modules/knex/bin/utils/cli-config-utils.js:104:11)
    at initKnex (/Users/theo/projects/activities.next/node_modules/knex/bin/cli.js:57:5)
    at Command.<anonymous> (/Users/theo/projects/activities.next/node_modules/knex/bin/cli.js:249:32)
    at Command.listener [as _actionHandler] (/Users/theo/projects/activities.next/node_modules/commander/lib/command.js:482:17)

Also what would be the path to use when registering the callback URL? (eg https://domain.tld/<callback path>) for the OAuth app?

llun commented 10 months ago

Hey @theogravity ,

Do you have part of your config for the database? Currently I limit to the sqlite because it's the database I use locally now but this can change to any sql server that knex supports.

My config locally is like this

{
  "database": {
    "type": "sqlite3",
    "client": "better-sqlite3",
    "useNullAsDefault": true,
    "connection": {
      "filename": "./dev.sqlite3"
    }
  },
}

For the oAuth callback, it's https://domain.tld/api/auth/callback/github

theogravity commented 10 months ago

It's the config from the readme except where it notes to fill in secret values

llun commented 10 months ago

oh okay, I haven't update the document for sometime. Let me update that and also change the type name.

theogravity commented 10 months ago

Thanks for the update, but it unfortunately still doesn't work. I pulled down the update you've made and ran yarn, then yarn migrate with the following:

config.json in the project root:

{
  "host": "domain.tld",
  "database": {
    "type": "sql", // I also tried with a value of sqlite3 like your config had in your response
    "client": "better-sqlite3",
    "useNullAsDefault": true,
    "connection": {
      "filename": "./dev.sqlite3"
    }
  },
  "allowMediaDomains": [],
  "allowEmails": [],
  "secretPhase": "...",
  "auth": {
    "github": {
      "id": "...",
      "secret": "..."
    }
  }
}

I also tried with just:

{
  "database": {
    "type": "sqlite3",
    "client": "better-sqlite3",
    "useNullAsDefault": true,
    "connection": {
      "filename": "./dev.sqlite3"
    }
  },
}

I get:

yarn migrate
yarn run v1.22.19
$ knex migrate:latest
No configuration file found and no commandline connection parameters passed
Error: No configuration file found and no commandline connection parameters passed
    at checkConfigurationOptions (/Users/theo/projects/activities.next/node_modules/knex/bin/utils/cli-config-utils.js:104:11)
    at initKnex (/Users/theo/projects/activities.next/node_modules/knex/bin/cli.js:57:5)
    at Command.<anonymous> (/Users/theo/projects/activities.next/node_modules/knex/bin/cli.js:249:32)
    at Command.listener [as _actionHandler] (/Users/theo/projects/activities.next/node_modules/commander/lib/command.js:482:17)

Can you try it out by cloning your repo to a fresh directory, yarn installing then migrating after copying over the config.json file from the readme?

llun commented 10 months ago

I miss the knexfile.ts that get exclude from my local dev. https://github.com/llun/activities.next/blob/main/knexfile.ts This is required for the knex to load configuration from the knex script. The script should work now with latest commit.

theogravity commented 10 months ago

That worked, thanks!