Perlite - Obsidian Publishing
Archived deployment notes. This vault is now built as static HTML in
public/and no longer uses Perlite or Obsidian-specific publishing.
Publishing your Obsidian vault online using Perlite.
The Perlite installation documentation uses an unnecessarily complex method for publishing Obsidian notes online. Here is a simplified version that does not uses any locally built docker containers, it uses only the official PHP Apache Debian docker image from docker hub.
Storing the Obsidian vault in Git will further enhance the publishing workflow.
Step 1: Folder Layout
$ ls -1
docker-compose.yaml
Perlite/ # created by: git clone https://github.com/secure-77/Perlite.git
my-obsidian-vault/ # created by: git clone <my obsidian repo>Step 2: Preparing the Docker Image
# docker-compose for perlite
# change notes.example.com with your FQDN where you want to host
# change "my-obsidian-vault" with the folder name of your obsidian git repo
# this example uses traefik.io to publish this website online
name: notes-example-com
services:
notes:
image: php:8-apache
restart: always
container_name: notes.example.com
environment:
- NOTES_PATH=notes
- HIDE_FOLDERS=private,internal
- LINE_BREAKS=true
- ALLOWED_FILE_LINK_TYPES=pdf
- DISABLE_POP_HOVER=false
- SHOW_TOC=false
- HOME_FILE=README
- FONT_SIZE=15
- HTML_SAFE_MODE=true
volumes:
- ./Perlite/perlite:/var/www/html
# replace "my-obsidian-vault" with your obsidian git repo
- ./my-obsidian-vault:/var/www/html/notes:ro
labels:
- com.centurylinklabs.watchtower.enable=true
- traefik.enable=true
- traefik.http.routers.notes.rule=Host(`notes.example.com`)
- traefik.http.routers.notes.tls=true
- traefik.http.routers.notes.tls.certresolver=lets-encryptStep 3: Securing Repo Access
Use .htaccess to prevent direct browsing of the obsidian directory. The Obisidian folder content must be accessed only via Perlite and never served directly. Note that the two .htaccess files need to be committed to your obsidian repo.
$ cat ./my-obsidian-vault/.htaccess
# Filename: .htaccess
# Permit media files to be accessed directly. Perlite
# will serve other content so prevent direct access.
Deny from all
<filesMatch "\.(?i:gif|png|jpg|jpeg|pdf|excalidraw)$">
Allow from all
</filesMatch>$ cat ./my-obsidian-vault/.obsidian/themes/.htaccess
Allow from allStep 4: Updating Content
Updating Perlite and Obsidian repo is trivial.
(cd Perlite && git pull)
(cd my-obsidian-vault && git pull)
```