{"id":13584273,"url":"https://github.com/dustinlacewell/logseq-guide","last_synced_at":"2025-06-11T04:43:34.309Z","repository":{"id":46536503,"uuid":"331541559","full_name":"dustinlacewell/logseq-guide","owner":"dustinlacewell","description":"A guide to deploy logseq.com","archived":false,"fork":false,"pushed_at":"2021-05-20T05:58:33.000Z","size":18,"stargazers_count":139,"open_issues_count":4,"forks_count":12,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-07T01:35:06.049Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dustinlacewell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-21T06:54:19.000Z","updated_at":"2025-03-06T04:26:13.000Z","dependencies_parsed_at":"2022-09-07T05:30:29.578Z","dependency_job_id":null,"html_url":"https://github.com/dustinlacewell/logseq-guide","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dustinlacewell%2Flogseq-guide","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dustinlacewell%2Flogseq-guide/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dustinlacewell%2Flogseq-guide/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dustinlacewell%2Flogseq-guide/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dustinlacewell","download_url":"https://codeload.github.com/dustinlacewell/logseq-guide/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dustinlacewell%2Flogseq-guide/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259202158,"owners_count":22820980,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T15:04:08.089Z","updated_at":"2025-06-11T04:43:34.282Z","avatar_url":"https://github.com/dustinlacewell.png","language":null,"funding_links":[],"categories":["Others","💡 Workflows and Innovations"],"sub_categories":[],"readme":"Reference: https://github.com/logseq/logseq/tree/defclass/electron#set-up-development-environment\r\n\r\n## Prerequisites\r\n1. Make sure all requirements listed at https://github.com/logseq/logseq/tree/defclass/electron#1-requirements are met\r\n\r\n2. Install PostgreSQL create a DB called \"logseq\" and a user with SUPERUSER permissions \r\n\r\n4. Install nginx \u0026 Certbot on your sever \r\n\r\n5. Create GitHub application as discribed in https://docs.github.com/en/free-pro-team@latest/developers/apps/creating-a-github-app\r\n  in the App set the Homepage URL to https://yourdomain.com - call back URL to https://yourdomain.com/auth/github\r\n  Create a \"client secret\" \u0026 a \"Private Key\" for your app\r\n  in app permissions set \"Contents\" access to \"read and Write\"\r\n  Copy from your app\r\n    * App ID\r\n    * Client ID\r\n    * Client Secret\r\n  upload the pem file that was automatically downloaded when you created your app \"Private Key\" to your sever\r\n\r\n\r\n## Running LogSeq \r\n1. Clone the logseq repo git clone `https://github.com/logseq/logseq`\r\n2. Download backend.jar from https://github.com/logseq/logseq/releases/tag/0.0.1-100 and place it in `~/logsec/resources`\r\n3. In [~/logseq/src/main/frontend/config.cljs](https://github.com/logseq/logseq/blob/master/src/main/frontend/config.cljs)\r\n   line 18 replace\r\n```clojure\r\n(def website\r\n  (if dev?\r\n    \"http://localhost:3000\"\r\n    (util/format \"https://%s.com\" app-name)))\r\n```\r\nby\r\n```clojure\r\n(def website\r\n  (if dev?\r\n    \"http://localhost:3000\"\r\n    \"https://yourdomain.com\"))\r\n```\r\n   line 38 replace \r\n```clojure\r\n(def github-app-name (if dev? GITHUB_APP_NAME \"logseq\"))\r\n```\r\nby\r\n```clojure\r\n(def github-app-name (if dev? GITHUB_APP_NAME \"yourappname\"))\r\n```\r\n\r\n4. Set the envrionment variables\r\n```shell\r\nexport GITHUB_REDIRECT_URI=\"https://yourdomain.com/auth/github\"\r\nexport ENVIRONMENT=\"production\"\r\nexport JWT_SECRET=\"somepass\"\r\nexport COOKIE_SECRET=\"54676c2c5324279480a6ee1af0792588\"\r\nexport GITHUB_APP2_NAME=\"yourappname\"\r\nexport GITHUB_APP2_ID=\"appID\"\r\nexport GITHUB_APP2_KEY=\"AppClientID\"\r\nexport GITHUB_APP2_SECRET=\"AppClientSecret\"\r\nexport GITHUB_APP_PEM=\"/path/to/github/pem/file/yourappname.2021-01-19.private-key.pem\"\r\nexport LOG_PATH=\"/tmp/logseq\"\r\nexport DATABASE_URL=\"postgres://localhost:5432/logseq\"\r\nexport PG_USERNAME=\"username\"\r\nexport PG_PASSWORD=\"password\"\r\nexport WEBSITE_URL=\"https://yourdomain.com/\"\r\nexport COOKIE_DOMAIN=\"yourdomain.com\"\r\n```\r\n\r\n5. switch to `~/logsec` and run `yarn` then, compile using `yarn release`\r\n6. run from `~/logsec` using `java -Duser.timezone=UTC -jar ./static/logseq.jar`\r\n\r\n## Publishing LogSeq\r\nNow we need to \"server\" your self hosted logseq to the internet to do that\r\n\r\n1. Create 2 DNS records  `domain.com`  \u0026 `asset.domain.com` \u0026 get a certificate for each using [[Certbot]]\r\n2. configure Nginx to \r\n- rewrite 'asset.logseq.com' to 'asset.domain.com';\r\n- rewrite 'logseq.com' to 'domain.com';\r\n- reverse proxy requests to  'domain.com' to 'logseq.jar' (http://localhost:3000)\r\n- serve 'asset.domain.com' to `/path/to/logseq/public/`\r\n\r\nA dummy copy of the ngix.conf file can be found [here](./ngnix.conf)\r\n\r\n## Hardcoded values\r\n\r\n`shadow-cljs.edn`: line 16\r\n\r\n```clojure\r\n    :release {:asset-path \"https://asset.logseq.com/static/js\"}\r\n```\r\n \r\n`src/main/frontend/config.cljs`: line 17\r\n\r\n```clojure\r\n  (def app-name \"logseq\")\r\n```  \r\n\r\n\r\n`src/main/frontend/config.cljs`: line 18-21\r\n\r\n```clojure\r\n(def website\r\n(if dev?\r\n  \"http://localhost:3000\"\r\n  (util/format \"https://%s.com\" app-name)))\r\n```  \r\n\r\n`src/main/frontend/config.cljs`: line 28\r\n\r\n```clojure\r\n(def asset-domain (util/format \"https://asset.%s.com\"\r\n app-name))\r\n```  \r\n\r\n`logseq.jar/static/js/publishing/cljs-runtime`: line 34\r\n\r\n```clojure\r\nfrontend.config.app_name = \"logseq\";\r\n```\r\n\r\n`logseq.jar/static/js/publishing/cljs-runtime`: line 34\r\n\r\n```clojure\r\nfrontend.config.website = (cljs.core.truth_(frontend.config.dev_QMARK_)?\"http://localhost:3000\":frontend.util.format.cljs$core$IFn$_invoke$arity$variadic(\"https://%s.com\",cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([frontend.config.app_name], 0)));\r\n```\r\n\r\n`logseq.jar/static/js/publishing/cljs-runtime`: line 36\r\n\r\n```clojure\r\nfrontend.config.asset_domain = frontend.util.format.cljs$core$IFn$_invoke$arity$variadic(\"https://asset.%s.com\",cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([frontend.config.app_name], 0));\r\n```\r\n\r\n`logseq.jar/static/js/cljs-runtime/frontend.config.js`: line 34\r\n\r\n```clojure\r\nfrontend.config.app_name = \"logseq\";\r\n```\r\n\r\n`logseq.jar/static/js/cljs-runtime/frontend.config.js`: line 34\r\n\r\n```clojure\r\nfrontend.config.website = (cljs.core.truth_(frontend.config.dev_QMARK_)?\"http://localhost:3000\":frontend.util.format.cljs$core$IFn$_invoke$arity$variadic(\"https://%s.com\",cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([frontend.config.app_name], 0)));\r\n```\r\n\r\n`logseq.jar/static/js/cljs-runtime/frontend.config.js`: line 36\r\n\r\n```clojure\r\nfrontend.config.asset_domain = frontend.util.format.cljs$core$IFn$_invoke$arity$variadic(\"https://asset.%s.com\",cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([frontend.config.app_name], 0));\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdustinlacewell%2Flogseq-guide","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdustinlacewell%2Flogseq-guide","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdustinlacewell%2Flogseq-guide/lists"}