logseq / deprecated-github-backend

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Logseq

Logseq is A privacy-first, open-source platform for knowledge sharing and management.

Warning:

The GitHub integration is deprecated, we’re not going to accept any PRs.

Website

https://logseq.com

Setup development environment

If you’re on Windows, use the Windows setup.

1. Requirements

2. Create a GitHub app

Follow the guide at https://docs.github.com/en/free-pro-team@latest/developers/apps/creating-a-github-app, where the user authorization “Callback URL” should be http://localhost:3000/auth/github.

Remember to download the private-key.pem which will be used for the next step. Also take note of your App ID, Client ID, and your newly generated Client Secret for use in step 4.

https://user-images.githubusercontent.com/479169/100460276-e0bad100-3101-11eb-8fed-1f7c85824b62.png

Add contents permission: https://user-images.githubusercontent.com/479169/100460271-def10d80-3101-11eb-91bb-f2339a52d4f8.png

3. Set up PostgreSQL

Make sure you have PostgreSQL running. You can check if it’s running with pg_ctl -D /usr/local/var/postgres status and use pg_ctl -D /usr/local/var/postgres start to start it up. You’ll also need to make a Logseq DB in PostgreSQL. Do that with createdb logseq.

4. Add environment variables

export ENVIRONMENT="dev"
export JWT_SECRET="xxx"
export COOKIE_SECRET="xxx"
export DATABASE_URL="postgresql://your-user:your-password@localhost:5432/logseq"
export GITHUB_APP2_NAME="your github app name"
export GITHUB_APP2_ID="your app id"
export GITHUB_APP2_KEY="you client id"
export GITHUB_APP2_SECRET="your secret"
export GITHUB_REDIRECT_URI="http://localhost:3000/auth/github"
# Replace your-code-directory with yours
export GITHUB_APP_PEM="/your-code-directory/logseq/pem/logseq-test.2020-08-27.private-key.pem"
export GOOGLE_APP_KEY="your key"
export GOOGLE_APP_SECRET="your secret"
export GOOGLE_REDIRECT_URI="http://localhost:3000/auth/google"
export LOG_PATH="/tmp/logseq"
export WEBSITE_URL="http://localhost:3000"
export COOKIE_DOMAIN="localhost"

export AWS_ACCESS_KEY_ID="your key id"
export AWS_SECRET_ACCESS_KEY="your secret"
export AWS_PK_PATH="/your/pk.pem"
export AWS_KEY_PAIR_ID="your key pair id"
export AWS_REGION="us-west-1"

3. Start the clojure server

Using in Emacs

1. C-c M-j and select "clojure-cli"
2. input "(go)" in the clojure repl

(Note: to specify an alias from within emacs you can follow either option suggested here)

Using in Cli

1. clj -A:dev
2. input "(go)" in the clojure repl

Using in Calva (Visual Studio Code)

1. Issue the command Start a REPL server and Connect: ctrl+alt+c ctrl+alt+j
2. Select clojure-cli
3. input "(go)" in the clojure repl

4. Compile javascript

cd web
yarn
yarn watch
open http://localhost:3000

Windows setup

1. Required software

Install clojure through scoop-clojure: https://github.com/littleli/scoop-clojure. You can also install Node.js, Yarn and PostgreSQL through scoop if you want to.

2. Setup PostgreSQL

Make sure you have PostgreSQL running. You can check if it’s running with pg_ctl status and use pg_ctl start to start it up. You’ll also need to make a logseq DB in PostgreSQL. Do that with createdb logseq.

3. Setup the server

Download this little script that sets up the environment variables and runs cmd-clj -A:dev. The GITHUB_APP_PEM variable in the script needs to be set with the correct directory for your system. Run that script in the repo and enter (go) into the interpreter.

4. Setup the website

Either run cmd-clojure -A:cljs watch app instead of yarn watch in the next step or modify web/package.json to use cmd-clojure instead of clojure in the scripts section.

Open command prompt in the repo and do:

cd web
yarn
yarn watch

Wait for it to compile and open localhost:3000.

Notes

  1. The clojure deps should be synced between the two files: project.clj and deps.edn. We need the project.clj because it’s used for dokku deployment.
  2. To use github push, comment this line https://github.com/tiensonqin/logseq/blob/master/web/src/main/frontend/handler.cljs#L751

About

License:GNU Affero General Public License v3.0


Languages

Language:Clojure 95.0%Language:JavaScript 5.0%