secure-77 / Perlite

A web-based markdown viewer optimized for Obsidian
https://perlite.secure77.de/
MIT License
968 stars 81 forks source link

Merge perlite and perlite_web into one Image #100

Open secure-77 opened 11 months ago

secure-77 commented 11 months ago

I want to check to build only one docker image for perlite, which includes the php and nginx engine. Maybe using this repository as template: https://github.com/TrafeX/docker-php-nginx

I will leave this Issue open as poll, please give it a 👍 if you wish to have Perlite in only one Image.

jerivl commented 11 months ago

Hi! I've been using the current version of perlite over the past week and I've been loving it so far.

While I agree that some users may benefit from having the combined docker image, I ask that the current php engine image also continue to be maintained as it allows greater flexibility for custom nginx configurations. Perhaps two different images could be hosted on Docker Hub, a combined nginx+fpm image and an image only containing the fpm engine.

secure-77 commented 11 months ago

Thanks for you feedback!

Hi! I've been using the current version of perlite over the past week and I've been loving it so far.

While I agree that some users may benefit from having the combined docker image, I ask that the current php engine image also continue to be maintained as it allows greater flexibility for custom nginx configurations. Perhaps two different images could be hosted on Docker Hub, a combined nginx+fpm image and an image only containing the fpm engine.

This was my initial point why to separate it, but there are some reasons why you want to have only one image, like hosting it on a NAS os etc., but I will leave this Issue open and see how many really need this, then I will decide if I will provide a single image (as addition to the current setup)

voltbit commented 10 months ago

I agree with the merge into a single image, however right now the perlite_web was removed from the docker hub as far as I see, so the change was already made?

secure-77 commented 10 months ago

no, perlite_web was never on docker hub and always build with the first run (via docker compose)

rsubr commented 8 months ago

Thanks for this great project. I have been using Perlite without building any local docker images at all, I only use the official PHP Apache Debian docker image. Here is my simple setup:

My deployment folder contains one docker-compose and two git repos.

$ 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>

Content of my docker-compose.yaml, please change the published domain notes.example.com and your Obisidan vault git directory name.

# 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-encrypt

Use .htaccess to prevent direct browsing of the obsidian directory. The Obisidian folder content (other than images and documents) 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
Deny from all

<filesMatch "\.(?i:gif|png|jpg|jpeg|pdf|excalidraw)$">
  Allow from all
</filesMatch>
$ cat ./my-obsidian-vault/.obsidian/themes/.htaccess
Allow from all

Updating Perlite and Obsidian repo is trivial.

(cd Perlite && git pull)
(cd my-obsidian-vault && git pull)

Thanks again @secure-77 for your great work!