siyuan-note/siyuan: A privacy-first, self-hosted, fully open source personal knowledge management software, written in typescript and golang.
December 26, 2024

siyuan-note/siyuan: A privacy-first, self-hosted, fully open source personal knowledge management software, written in typescript and golang.



Rebuild your thinking















Chinese | Japanese



Siyuan is a privacy-first personal knowledge management system that supports fine-grained block-level references and Markdown WYSIWYG.

welcome to Siyuan English Forum learn more.

Most features are free, even for commercial use.

  • content block
    • Block-level references and bidirectional links
    • Custom properties
    • SQL query embedding
    • protocol siyuan://
  • edit
    • block type
    • Markdown WYSIWYG
    • Checklist outline
    • block zoom
    • Editing of million-word large documents
    • Mathematical formulas, charts, flow charts, Gantt charts, timing diagrams, staffs, etc.
    • Web clipping
    • PDF annotation link
  • exit
    • Block Quotes and Embedding
    • Standard Markdown and assets
    • PDF, Word and HTML
    • Copy to WeChat MP, Zhihu, Yuque
  • database
  • Flashcards spaced repetition
  • AI writing and Q&A chat through OpenAI API
  • Hypercube OCR
  • Multiple tabs, drag-and-drop split screen
  • template fragment
  • JavaScript/CSS snippets
  • Android/iOS/Hongmeng App
  • Docker deployment
  • API
  • community market

Some functions are only available to paid members. For more details, please see Pricing.

🏗️Architecture and Ecosystem

It is recommended that desktop and mobile devices be installed through the application market first to facilitate one-click upgrade in the future.

Mobile:

desktop:

Docker deployment

The easiest way to provide Siyuan services on the server is to deploy via Docker.

The overall program is located at /opt/siyuan/basically the structure under the resources folder of the Electron installation package:

  • Appearance: Illustrations, Themes, Languages
  • Guide: User guide document
  • stage: interface and static resources
  • kernel: kernel program

The entry point is set when building the Docker image: ENTRYPOINT ["/opt/siyuan/entrypoint.sh"]. This script allows changes PUID and PGID The name of the consumer that will run inside the container. This is especially important for troubleshooting permission issues when mounting directories from the host. this PUID (User ID) and PGID (Group ID) can be passed as an environment variable, making it easier to ensure correct permissions when accessing directories where the host is installed.

Use the following parameters when running the container docker run b3log/siyuan:

  • --workspace: Specify the workspace folder path and mount it to the container -v on host
  • --accessAuthCode:Specify access authorization code

More parameters can be found using --help. The following is an example of a startup command using the new environment variables:

docker run -d \
  -v workspace_dir_host:workspace_dir_container \
  -p 6806:6806 \
  -e PUID=1001 -e PGID=1002 \
  b3log/siyuan \
  --workspace=workspace_dir_container \
  --accessAuthCode=xxx
  • PUID: Custom user ID (optional, default is 1000 if not provided)
  • PGID: Custom group ID (optional, default is 1000 if not provided)
  • workspace_dir_host: The path to the workspace folder on the host machine
  • workspace_dir_container: The path to the workspace folder in the container, as specified in --workspace
  • accessAuthCode: Access authorization code (please Must be modifiedotherwise anyone can access your data)

To simplify things, it is recommended to configure the workspace folder path to be consistent on the host and container, e.g. both have workspace_dir_host and workspace_dir_container configured as /siyuan/workspace. The corresponding startup command is:

docker run -d \
  -v /siyuan/workspace:/siyuan/workspace \
  -p 6806:6806 \
  -e PUID=1001 -e PGID=1002 \
  b3log/siyuan \
  --workspace=/siyuan/workspace/ \
  --accessAuthCode=xxx

For users running Siyuan using Docker Compose, the environment variables PUID and PGID Custom user and group IDs can be passed. The following is an example Docker Compose configuration:

version: "3.9"
services:
  main:
    image: b3log/siyuan
    command: ['--workspace=/siyuan/workspace/', '--accessAuthCode=${AuthCode}']
    ports:
      - 6806:6806
    volumes:
      - /siyuan/workspace:/siyuan/workspace
    restart: unless-stopped
    environment:
      # A list of time zone identifiers can be found at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
      - TZ=${YOUR_TIME_ZONE}
      - PUID=${YOUR_USER_PUID}  # Customize user ID
      - PGID=${YOUR_USER_PGID}  # Customize group ID

In this setting:

  • PUID and PGID Dynamically set and passed to the container
  • If these variables are not provided, the default 1000 will be used

by specifying PUID and PGID In the environment you don’t need to explicitly set user instruction(user: '1000:1000') in the compose file. The container will dynamically adjust users and groups based on these environment variables when it starts.

In the image, entrypoint.sh Script ensures creation siyuan With specified users and groups PUID and PGID. Therefore, when creating a workspace folder, the host should pay attention to setting the user and group ownership of the folder to match PUID and PGID you intend to use. For example:

chown -R 1001:1002 /siyuan/workspace

If you use custom PUID and PGID value, the entry point script will ensure that the correct user and group are created within the container, and the ownership of the mounted volume will be adjusted accordingly. No need to pass manually -u exist docker run or docker-compose Because environment variables will handle customization.

Use NGINX reverse proxy to hide port 6806, please note:

  • Configure WebSocket reverse proxy /ws
  • Be sure to confirm the correctness of the mounted disk volume, otherwise the data will be lost after deleting the container.
  • Do not use URL rewriting for redirection, otherwise authentication problems may occur. It is recommended to configure a reverse proxy
  • If you have permission issues, please verify PUID and PGID Environment variables match the ownership of the installed directory on the host system
  • Desktop and mobile app connections are not supported, only supported on browsers
  • Export to PDF, HTML and Word formats is not supported
  • Importing Markdown files is not supported
Cancel raid deployment

Note: First time running chown -R 1000:1000 /mnt/user/appdata/siyuan In the terminal

Template reference:

Web UI: 6806
Container Port: 6806
Container Path: /home/siyuan
Host path: /mnt/user/appdata/siyuan
PUID: 1000
PGID: 1000
Publish parameters: --accessAuthCode=******(Access authorization code)

We release internal previews ahead of major updates, please visit https://github.com/siyuan-note/insider.

🛠️Development Guide

look Development Guide.

How does Siyuan store data?

Data is saved in the workspace folder. In the workspace folder:

  • assets Used to save all inserted resources
  • emojis For saving emoji images
  • snippets Used to save code snippets
  • storage Used to save query conditions, layouts, flashcards, etc.
  • templates Used to save template fragments
  • widgets for saving widgets
  • plugins Used to save plugins
  • public Used to save public data
  • The remaining folders are notebook folders created by users, with the suffix .sy The Notebook folder is used to save file data. The data format is JSON.

Is data synchronization supported through third-party synchronization disks?

Data synchronization through third-party synchronization disks is not supported, otherwise data corruption may occur.

Although third-party synchronization disks are not supported, connection to third-party cloud storage is supported (member privilege).

In addition, you can also consider manually exporting and importing data to achieve data synchronization:

  • desktop: settingsexitExport data / Import data
  • Mobile: right columnaboutExport data / Import data

Siyuan is completely open source, and contributions are welcome:

For more details, see Development Guide.

How to upgrade to the new version?

  • If installed via app store, please update via app store
  • If you are installing through the desktop installation package, you can enable the option settingsaboutAutomatically download update installation packagesSiyuan will automatically download the latest version of the installation package and prompt for installation.
  • If it is a manual installation kit installation, please download the installation kit again and install it.

you can Check for updates exist settingsaboutCurrent versionor follow Official download or GitHub releases Get the new version.

What if the block icon cannot be found for some blocks, such as the paragraph block in a checklist item?

The first sub-block under the list item is the omitted block icon. You can move the cursor to this block and trigger its block menu using the following command Ctrl+/ .

What should I do if I lose my data storage key?

  • If the repository key was previously initialized correctly on multiple devices, the key will be the same on all devices and can be settingsaboutData repository keyCopy key string retrieve

  • If it was not configured correctly before (for example, the keys on multiple devices are inconsistent) or all devices are unavailable and the key string cannot be obtained, you can follow the steps below to reset the key:

    1. To manually back up data, you can use Export data Or copy directly workspace/information/ Folder on the file system
    2. settingsaboutData represents the keyReset data repository
    3. Reinitialize the repository key. After initializing the key on one device, import the key to other devices
    4. The cloud uses the new synchronization directory. The old synchronization directory is no longer available and can be deleted.
    5. Existing cloud snapshots are no longer available and can be deleted

Most features are free, even for commercial use.

Membership benefits require payment before use, please refer to Pricing.

The birth of Siyuan is inseparable from many open source projects and contributors. Please refer to the project source code kernel/go.mod, app/package.json and the project homepage.

The growth of Siyuan cannot be separated from the feedback and promotion of users. Thank you for your help to Siyuan❤️

Welcome to join us and contribute code to Siyuan.



2024-12-26 02:26:39

Leave a Reply

Your email address will not be published. Required fields are marked *