SiYuan is an absolutely wonderful note-taking and Personal Knowledge Management (PKM) tool. I started using Siyuan after development of my previous PKM tool, Dendron, was stopped.

Siyuan can sync notes across devices using a built-in syncing mechanism, with the possibliity of using a number of cloud storage services for saving the encrypted data to be synced. I use BackBlaze B2 via Siyuan’s support for S3 storage.

Siyuan also has apps for all common desktop and mobile OSes. It can also be installed it on a VPS, so that it is possible to access it from any computer, via just a browser. The details of installing it on a VPS are in this note.

Install docker

See Docker install.

Create docker-compose.yaml

Create a file docker-compose.yaml​ in a folder and add in the following content

 1version: "3.9"
 2services:
 3  main:
 4    image: b3log/siyuan
 5    command: ['--workspace=/siyuan/workspace/', '--accessAuthCode=${AUTHCODE}']
 6    user: '1000:1000'
 7    ports:
 8      - ip_address:6806:6806
 9      - 127.0.0.1:6806:6806
10    volumes:
11      - ./siyuan/workspace:/siyuan/workspace
12    restart: unless-stopped
13    environment:
14      # A list of time zone identifiers can be found at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
15      - TZ=${TIMEZONE}

Notes

  1. The ports are bound explicitly to ip_address​ and 127.0.0.1​. The former is the ip address given to the machine by tailscale. The latter is localhost. The ports are bound explicitly to these IP addresses so that Siyuan can not be accessed from the general internet. (No binding to the IPv4 public IP).
  2. Create folder mkdir -p siyuan/workspace​ in the same folder as the docker-compose.yaml​ file.
  3. Run the command chown -R 1000:1000 siyuan​, else siyuan will not work.
  4. Create a file dot-env-template​ and the file .env​ and in those files, add the following (add the actual values to the .env​ file with no space around the = )
AUTHCODE=
TIMEZONE=

Timezone can be e.g. America/Los_Angeles and the AUTHCODE is a numeric code e.g. 123456​ (obviously, use something better) that is needed as a basic security precaution. When you access Siyuan through the browser, it will ask you to enter the authcode first.

Then docker compose up -d​.

See also