Merge branch 'master' of github.com:logseq/logseq-internal into master

pull/645/head
Tienson Qin 2020-11-10 18:37:42 +08:00
commit b4827bce06
2 changed files with 54 additions and 31 deletions

View File

@ -1,28 +1,34 @@
* Logseq * Logseq
Logseq is A privacy-first, open-source platform for knowledge sharing and management. A privacy-first, open-source platform for knowledge sharing and management.
** Website ** Website
https://logseq.com https://logseq.com
** Set up development environment ** Set up development environment
If you're on Windows, use the [[#windows-setup][Windows setup]]. If you are on Windows, use the [[#windows-setup][Windows setup]].
*** 1. Requirements *** 1. Requirements
**** [[https://clojure.org/guides/getting_started][Java && Clojure]] - [[https://clojure.org/guides/getting_started][Java & Clojure]]
**** [[https://www.postgresql.org/download/][PostgreSQL]] - [[https://www.postgresql.org/download/][PostgreSQL]]
**** [[https://nodejs.org/en/][Node.js]] - [[https://nodejs.org/en/][Node.js]]
*** 2. Creating a GitHub app: *** 2. Create a GitHub app:
Follow this step: https://docs.github.com/en/free-pro-team@latest/developers/apps/creating-a-github-app. Follow the guide at https://docs.github.com/en/free-pro-team@latest/developers/apps/creating-a-github-app,
The ~User authorization callback URL~ should be: where the user authorization "Callback URL" should be
http://localhost:3000/auth/github =http://localhost:3000/auth/github=.
Remember to download the ~private-key.pem~ which will be used for the next step. Remember to download the ~private-key.pem~ which will be used for the next step.
*** 3. Add environment variables *** 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
#+BEGIN_SRC sh #+BEGIN_SRC sh
export ENVIRONMENT="dev" export ENVIRONMENT="dev"
export JWT_SECRET="4fa183cf1d28460498b13330835e80ab" export JWT_SECRET="4fa183cf1d28460498b13330835e80ab"
@ -31,48 +37,49 @@ If you're on Windows, use the [[#windows-setup][Windows setup]].
export GITHUB_APP2_ID="78728" export GITHUB_APP2_ID="78728"
export GITHUB_APP2_KEY="xxxxxxxxxxxxxxxxxxxx" export GITHUB_APP2_KEY="xxxxxxxxxxxxxxxxxxxx"
export GITHUB_APP2_SECRET="xxxxxxxxxxxxxxxxxxxx" export GITHUB_APP2_SECRET="xxxxxxxxxxxxxxxxxxxx"
# Replace your-code-directory with yours # Replace your-code-directory and your-app.private-key.pem with yours
export GITHUB_APP_PEM="/your-code-directory/your-app.private-key.pem" export GITHUB_APP_PEM="/your-code-directory/your-app.private-key.pem"
export LOG_PATH="/tmp/logseq" export LOG_PATH="/tmp/logseq"
#+END_SRC #+END_SRC
*** 4. Compile javascript *** 5. Compile to JavaScript
#+BEGIN_SRC sh #+BEGIN_SRC sh
cd web cd web
yarn yarn
yarn watch yarn watch
#+END_SRC #+END_SRC
*** 5. Start the clojure server *** 6. Start the Clojure server
1. Download jar
Go to https://github.com/logseq/logseq-internal/releases, download the =logseq.jar= and move it to the =resources= directory.
2. Run jar
#+BEGIN_SRC sh #+BEGIN_SRC sh
cd resources cd resources
# 1. Download jar
Go to https://github.com/logseq/logseq-internal/releases, download the logseq.jar and move it to the "resources" directory.
# 2. run jar
java -Duser.timezone=UTC -jar logseq.jar java -Duser.timezone=UTC -jar logseq.jar
#+END_SRC #+END_SRC
*** 6. Open the browser *** 7. Open the browser
Open http://localhost:3000. Open [[http://localhost:3000]].
** Windows setup ** Windows setup
*** 1. Required software *** 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. 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. Creating a GitHub app *** 2. Create a GitHub app
Follow [[step #2][#2-creating-a-github-app]] above if you want Logseq to connect to GitHub. If not, skip this section. Follow [[#2-create-a-github-app][Step 2]] above if you want Logseq to connect to GitHub. If not, skip this section.
The ~GITHUB_APP_PEM~ variable in the ~run-windows.bat~ needs to be set with the correct directory for your system. The ~GITHUB_APP_PEM~ variable in the ~run-windows.bat~ needs to be set with the correct directory for your system.
*** 3. Set up PostgreSQL *** 3. Set up 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. 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~. You'll also need to make a Logseq DB in PostgreSQL. Do that with ~createdb logseq~.
*** 4. Download the clojure server *** 4. Download the Clojure server
Go to https://github.com/logseq/logseq-internal/releases, download the logseq.jar and move into the root directory of repo. Go to https://github.com/logseq/logseq-internal/releases, download the =logseq.jar= and move into the root directory of repo.
*** 5. Start Logseq *** 5. Start Logseq
Run ~start-windows.bat~ which is located in the repo. This will open a second terminal that runs Logseq's backend server. Run ~start-windows.bat~ which is located in the repo. This will open a second terminal that runs Logseq's backend server.

View File

@ -15,10 +15,26 @@
;; set to false to enable HistoryAPI ;; set to false to enable HistoryAPI
{:use-fragment false})) {:use-fragment false}))
(defn display-welcome-message
[]
(js/console.log
"
Welcome to Logseq!
If you encounter any problem, feel free to file an issue on GitHub (https://github.com/logseq/logseq)
or join our Discord server (https://discord.gg/KpN4eHY).
.____
| | ____ ____ ______ ____ ______
| | / _ \\ / ___\\/ ___// __ \\/ ____/
| |__( <_> ) /_/ >___ \\\\ ___< <_| |
|_______ \\____/\\___ /____ >\\___ >__ |
\\/ /_____/ \\/ \\/ |__|
" ))
(defn start [] (defn start []
(when-let [node (.getElementById js/document "root")] (when-let [node (.getElementById js/document "root")]
(set-router!) (set-router!)
(rum/mount (page/current-page) node))) (rum/mount (page/current-page) node)
(display-welcome-message)))
(defn ^:export init [] (defn ^:export init []
;; init is called ONCE when the page loads ;; init is called ONCE when the page loads