* Logseq Logseq is a local-first, non-linear, outliner notebook for organizing and sharing your personal knowledge base. ** Website https://logseq.com ** Setup development environment If you're on Windows, use the [[#windows-setup][Windows setup]]. *** 1. Requirements **** [[https://clojure.org/guides/getting_started][Java && Clojure]] **** [[https://www.postgresql.org/download/][PostgreSQL]] **** [[https://nodejs.org/en/][Node.js]] *** 2. Add environment variables #+BEGIN_SRC sh export ENVIRONMENT="dev" export GITHUB_APP_KEY="ecaceddfdb7158c4e384" export GITHUB_APP_SECRET="3e337d07f61585576362c95dcb8cd98756e43f65" export GITHUB_REDIRECT_URI="http://localhost:3000/auth/github" export JWT_SECRET="4fa183cf1d28460498b13330835e80ad" export COOKIE_SECRET="10a42ca724e34f4db6086a772d787034" export DATABASE_URL="postgres://localhost:5432/logseq" export GITHUB_APP2_ID="78728" export GITHUB_APP2_KEY="Iv1.5454f11e63f811bc" export GITHUB_APP2_SECRET="3b952aa1c2f821a957ea1296039df6527fda5b6e" # Replace your-code-directory with yours export GITHUB_APP_PEM="/your-code-directory/logseq/pem/logseq-test.2020-08-27.private-key.pem" #+END_SRC *** 3. Start the clojure server **** Using in Emacs #+BEGIN_EXAMPLE 1. C-c M-j and select "clojure-cli" 2. input "(go)" in the clojure repl #+END_EXAMPLE (Note: to specify an alias from within emacs you can follow either option suggested [[https://github.com/clojure-emacs/cider/issues/2396][here]]) **** Using in Cli #+BEGIN_EXAMPLE 1. clj -A:dev 2. input "(go)" in the clojure repl #+END_EXAMPLE **** Using in Calva (Visual Studio Code) #+BEGIN_EXAMPLE 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 #+END_EXAMPLE *** 4. Compile javascript #+BEGIN_SRC sh cd web yarn yarn watch open http://localhost:3000 #+END_SRC ** Windows setup *** 1. Required software Install clojure through scoop-clojure: https://github.com/littleli/scoop-clojure. You can also install [[https://nodejs.org/en/][Node.js]], [[https://yarnpkg.com/][Yarn]] and [[https://www.postgresql.org/download/][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 [[https://gist.github.com/samfundev/98088dd76f67085f114c75493261aa3d][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: #+BEGIN_SRC batch cd web yarn yarn watch #+END_SRC 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