-
-
Notifications
You must be signed in to change notification settings - Fork 351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Instructions on self hosting #96
Comments
@adyanth Thanks, this was on my to-do list. I've added the guide, please let me know if you have any questions.
By following the guide, you'll create a new GitHub App, which will automatically be used by the serverless functions to act as the bot (in this case, your app). |
Thanks for the very detailed guide, appreciate it! I will let you know here once I've hosted it myself. |
Could you please elaborate a bit on deploying the next.js app? I tried to build it, but got the below: coder@0098aae7806e:~/workspace$ git clone https://github.com/laymonage/giscus.git
Cloning into 'giscus'...
remote: Enumerating objects: 2467, done.
remote: Counting objects: 100% (424/424), done.
remote: Compressing objects: 100% (239/239), done.
remote: Total 2467 (delta 188), reused 185 (delta 185), pack-reused 2043
Receiving objects: 100% (2467/2467), 596.81 KiB | 1.14 MiB/s, done.
Resolving deltas: 100% (1528/1528), done.
coder@0098aae7806e:~/workspace$ cd giscus/
coder@0098aae7806e:~/workspace/giscus$ yarn install
yarn install v1.22.5
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@2.3.2: The platform "linux" is incompatible with this module.
info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > @primer/octicons-react@12.1.0" has incorrect peer dependency "react@>=15".
warning " > next@10.2.0" has incorrect peer dependency "react@^16.6.0 || ^17".
warning " > next@10.2.0" has incorrect peer dependency "react-dom@^16.6.0 || ^17".
warning "next > @next/react-dev-overlay@10.2.0" has incorrect peer dependency "react@^16.9.0 || ^17".
warning "next > @next/react-dev-overlay@10.2.0" has incorrect peer dependency "react-dom@^16.9.0 || ^17".
warning "next > styled-jsx@3.3.2" has incorrect peer dependency "react@15.x.x || 16.x.x || 17.x.x".
warning "next > use-subscription@1.5.1" has incorrect peer dependency "react@^16.8.0 || ^17.0.0".
warning " > next-plugin-preact@3.0.4" has unmet peer dependency "preact-ssr-prepass@>=1".
warning "next-plugin-preact > @prefresh/next@1.4.6" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning "next-plugin-preact > @prefresh/next > @prefresh/webpack@3.2.2" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning " > swr@0.5.5" has incorrect peer dependency "react@^16.11.0 || ^17.0.0".
[4/4] Building fresh packages...
Done in 7.02s. Added the .env.local. coder@0098aae7806e:~/workspace/giscus$ yarn build
yarn run v1.22.5
$ yarn cscript && yarn cthemes && next build
$ tsc client.ts --outDir public
$ postcss styles/themes/*.css --dir public/themes --config styles/themes
warn - React 17.0.1 or newer will be required to leverage all of the upcoming features in Next.js 11. Read more: https://nextjs.org/docs/messages/react-version
info - Loaded env from /home/coder/workspace/giscus/.env.local
info - Using webpack 4. Reason: custom webpack configuration in next.config.js https://nextjs.org/docs/messages/webpack5
info - Checking validity of types
info - Using external babel configuration from /home/coder/workspace/giscus/babel.config.js
@babel/preset-env: `DEBUG` option
Using targets:
{
"chrome": "87",
"edge": "88",
"firefox": "86",
"ios": "12.2",
"opera": "73",
"safari": "13.1",
"samsung": "13"
}
Using modules transform: auto
Using plugins:
proposal-numeric-separator { "ios":"12.2" }
proposal-logical-assignment-operators { "edge":"88", "ios":"12.2", "opera":"73", "safari":"13.1", "samsung":"13" }
proposal-nullish-coalescing-operator { "ios":"12.2" }
proposal-optional-chaining { "ios":"12.2" }
syntax-json-strings { "chrome":"87", "edge":"88", "firefox":"86", "ios":"12.2", "opera":"73", "safari":"13.1", "samsung":"13" }
syntax-optional-catch-binding { "chrome":"87", "edge":"88", "firefox":"86", "ios":"12.2", "opera":"73", "safari":"13.1", "samsung":"13" }
syntax-async-generators { "chrome":"87", "edge":"88", "firefox":"86", "ios":"12.2", "opera":"73", "safari":"13.1", "samsung":"13" }
syntax-object-rest-spread { "chrome":"87", "edge":"88", "firefox":"86", "ios":"12.2", "opera":"73", "safari":"13.1", "samsung":"13" }
transform-template-literals { "ios":"12.2" }
proposal-export-namespace-from { "ios":"12.2", "safari":"13.1" }
syntax-dynamic-import { "chrome":"87", "edge":"88", "firefox":"86", "ios":"12.2", "opera":"73", "safari":"13.1", "samsung":"13" }
syntax-top-level-await { "chrome":"87", "edge":"88", "firefox":"86", "ios":"12.2", "opera":"73", "safari":"13.1", "samsung":"13" }
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
@babel/preset-env: `DEBUG` option
Using targets:
{
"node": "14.15"
}
Using modules transform: auto
Using plugins:
syntax-numeric-separator { "node":"14.15" }
proposal-logical-assignment-operators { "node":"14.15" }
proposal-nullish-coalescing-operator {}
proposal-optional-chaining {}
syntax-json-strings { "node":"14.15" }
syntax-optional-catch-binding { "node":"14.15" }
syntax-async-generators { "node":"14.15" }
syntax-object-rest-spread { "node":"14.15" }
syntax-dynamic-import { "node":"14.15" }
proposal-export-namespace-from {}
syntax-top-level-await { "node":"14.15" }
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
warn - You have enabled the JIT engine which is currently in preview.
warn - Preview features are not covered by semver, may introduce breaking changes, and can change at any time.
info - Creating an optimized production build
info - Compiled successfully
info - Collecting page data
[=== ] info - Generating static pages (3/4)
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
undefined
info - Generating static pages (4/4)
> Build error occurred
Error: Export encountered errors on following paths:
/
at /home/coder/workspace/giscus/node_modules/next/dist/export/index.js:31:1106
at async Span.traceAsyncFn (/home/coder/workspace/giscus/node_modules/next/dist/telemetry/trace/trace.js:6:584)
at async /home/coder/workspace/giscus/node_modules/next/dist/build/index.js:43:49
at async Span.traceAsyncFn (/home/coder/workspace/giscus/node_modules/next/dist/telemetry/trace/trace.js:6:584)
at async /home/coder/workspace/giscus/node_modules/next/dist/build/index.js:25:1475
at async Span.traceAsyncFn (/home/coder/workspace/giscus/node_modules/next/dist/telemetry/trace/trace.js:6:584)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
coder@0098aae7806e:~/workspace/giscus$ Although since I don't exactly need the static site, I'll probably check the pages/api to host it serverless, but would like to have a reference copy working to generate the initial config. |
Also, could you point me to resources on converting nextapi to service workers? Would something like this work?https://github.com/hanford/next-offline |
@adyanth That's weird, the error doesn't seem to come from giscus' code. Does
Those are two unrelated things. Sorry if the instructions were unclear, what I meant is that you should adapt the Next.js' serverless functions from the For example, if you use Cloudflare Workers, you can follow their serverless functions format as shown in this example. If you look at their format, you'll need to use addEventListener("fetch", ...);
async function handleRequest(request) { ... } While Next.js uses something like export default async (req: NextApiRequest, res: NextApiResponse) And then what I meant by modifying the "service functions", is literally the files in the Where you need to change Does this help? |
Understood, I was trying to adapt the Next JS with a wrapper of addEventListener which clearly would not work. My bad :) Regarding the build. no, coder@0098aae7806e:~/workspace/giscus-clone$ yarn build
yarn run v1.22.5
$ yarn cscript && yarn cthemes && next build
$ tsc client.ts --outDir public
$ postcss styles/themes/*.css --dir public/themes --config styles/themes
warn - React 17.0.1 or newer will be required to leverage all of the upcoming features in Next.js 11. Read more: https://nextjs.org/docs/messages/react-version
info - Loaded env from /home/coder/workspace/giscus-clone/.env.local
info - Using webpack 4. Reason: custom webpack configuration in next.config.js https://nextjs.org/docs/messages/webpack5
info - Checking validity of types
info - Using external babel configuration from /home/coder/workspace/giscus-clone/babel.config.js
@babel/preset-env: `DEBUG` option
Using targets:
{
"chrome": "87",
"edge": "88",
"firefox": "86",
"ios": "12.2",
"opera": "73",
"safari": "13.1",
"samsung": "13"
}
Using modules transform: auto
Using plugins:
proposal-numeric-separator { "ios":"12.2" }
proposal-logical-assignment-operators { "edge":"88", "ios":"12.2", "opera":"73", "safari":"13.1", "samsung":"13" }
proposal-nullish-coalescing-operator { "ios":"12.2" }
proposal-optional-chaining { "ios":"12.2" }
syntax-json-strings { "chrome":"87", "edge":"88", "firefox":"86", "ios":"12.2", "opera":"73", "safari":"13.1", "samsung":"13" }
syntax-optional-catch-binding { "chrome":"87", "edge":"88", "firefox":"86", "ios":"12.2", "opera":"73", "safari":"13.1", "samsung":"13" }
syntax-async-generators { "chrome":"87", "edge":"88", "firefox":"86", "ios":"12.2", "opera":"73", "safari":"13.1", "samsung":"13" }
syntax-object-rest-spread { "chrome":"87", "edge":"88", "firefox":"86", "ios":"12.2", "opera":"73", "safari":"13.1", "samsung":"13" }
transform-template-literals { "ios":"12.2" }
proposal-export-namespace-from { "ios":"12.2", "safari":"13.1" }
syntax-dynamic-import { "chrome":"87", "edge":"88", "firefox":"86", "ios":"12.2", "opera":"73", "safari":"13.1", "samsung":"13" }
syntax-top-level-await { "chrome":"87", "edge":"88", "firefox":"86", "ios":"12.2", "opera":"73", "safari":"13.1", "samsung":"13" }
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
@babel/preset-env: `DEBUG` option
Using targets:
{
"node": "14.15"
}
Using modules transform: auto
Using plugins:
syntax-numeric-separator { "node":"14.15" }
proposal-logical-assignment-operators { "node":"14.15" }
proposal-nullish-coalescing-operator {}
proposal-optional-chaining {}
syntax-json-strings { "node":"14.15" }
syntax-optional-catch-binding { "node":"14.15" }
syntax-async-generators { "node":"14.15" }
syntax-object-rest-spread { "node":"14.15" }
syntax-dynamic-import { "node":"14.15" }
proposal-export-namespace-from {}
syntax-top-level-await { "node":"14.15" }
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
warn - You have enabled the JIT engine which is currently in preview.
warn - Preview features are not covered by semver, may introduce breaking changes, and can change at any time.
info - Creating an optimized production build
info - Compiled successfully
info - Collecting page data
[=== ] info - Generating static pages (3/4)
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
undefined
info - Generating static pages (4/4)
> Build error occurred
Error: Export encountered errors on following paths:
/
at /home/coder/workspace/giscus-clone/node_modules/next/dist/export/index.js:31:1106
at async Span.traceAsyncFn (/home/coder/workspace/giscus-clone/node_modules/next/dist/telemetry/trace/trace.js:6:584)
at async /home/coder/workspace/giscus-clone/node_modules/next/dist/build/index.js:43:49
at async Span.traceAsyncFn (/home/coder/workspace/giscus-clone/node_modules/next/dist/telemetry/trace/trace.js:6:584)
at async /home/coder/workspace/giscus-clone/node_modules/next/dist/build/index.js:25:1475
at async Span.traceAsyncFn (/home/coder/workspace/giscus-clone/node_modules/next/dist/telemetry/trace/trace.js:6:584)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
coder@0098aae7806e:~/workspace/giscus-clone$ yarn start
yarn run v1.22.5
$ next start
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Loaded env from /home/coder/workspace/giscus-clone/.env.local
info - Using webpack 4. Reason: custom webpack configuration in next.config.js https://nextjs.org/docs/messages/webpack5
Error: Cannot find module '/home/coder/workspace/giscus-clone/.next/prerender-manifest.json'
Require stack:
- /home/coder/workspace/giscus-clone/node_modules/next/dist/next-server/server/next-server.js
- /home/coder/workspace/giscus-clone/node_modules/next/dist/server/next.js
- /home/coder/workspace/giscus-clone/node_modules/next/dist/server/lib/start-server.js
- /home/coder/workspace/giscus-clone/node_modules/next/dist/cli/next-start.js
- /home/coder/workspace/giscus-clone/node_modules/next/dist/bin/next
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.mod._resolveFilename (/home/coder/workspace/giscus-clone/node_modules/next/dist/build/webpack/require-hook.js:4:1784)
at Function.Module._resolveFilename (/home/coder/workspace/giscus-clone/node_modules/module-alias/index.js:49:29)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Server.getPrerenderManifest (/home/coder/workspace/giscus-clone/node_modules/next/dist/next-server/server/next-server.js:37:304)
at Server.getPreviewProps (/home/coder/workspace/giscus-clone/node_modules/next/dist/next-server/server/next-server.js:37:447)
at new Server (/home/coder/workspace/giscus-clone/node_modules/next/dist/next-server/server/next-server.js:3:329)
at NextServer.createServer (/home/coder/workspace/giscus-clone/node_modules/next/dist/server/next.js:1:2935) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/coder/workspace/giscus-clone/node_modules/next/dist/next-server/server/next-server.js',
'/home/coder/workspace/giscus-clone/node_modules/next/dist/server/next.js',
'/home/coder/workspace/giscus-clone/node_modules/next/dist/server/lib/start-server.js',
'/home/coder/workspace/giscus-clone/node_modules/next/dist/cli/next-start.js',
'/home/coder/workspace/giscus-clone/node_modules/next/dist/bin/next'
]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
coder@0098aae7806e:~/workspace/giscus-clone$ |
That works now, thanks! |
The README says the below:
Could you please provide instructions on how to do so? I myself am thinking of hosting it on cloudflare where my website already lives along with the same domain.
Also, can we self host the bot too? That would be helpful.
The text was updated successfully, but these errors were encountered: