Host this site on server with docker ~ Obsidian+Quartz

Host this site on server with docker ~ Obsidian+Quartz


# Obsidian

obsidian-git

automatically push to the remote repository.

# Remote server

## Quartz

  • arm64v8/alpine:3.16
  • RUN git config --global --add safe.directory /quartz
1
2
3
4
5
6
7
8
9
FROM arm64v8/alpine:3.16

RUN apk add --no-cache go hugo git make perl
RUN go install github.com/jackyzha0/hugo-obsidian@latest
ENV PATH="/root/go/bin:$PATH"
RUN git config --global --add safe.directory /quartz
WORKDIR /quartz

CMD ["make", "serve"]

## build docker image

1
docker build -t quartz .

## generate static site(in the Makefile)

1
2
3
generate: ## Serve Quartz locally
	hugo-obsidian -input=content -output=assets/indices -index -root=.
	hugo --baseURL=$(or $(HUGO_BASEURL),https://notes.hanklu.tw)

## deploy.sh

  • git pull
  • make generate with docker
1
2
3
4
5
#!/bin/bash
cd /home/ubuntu/app/digital-garden
git pull
docker run -i -v /home/ubuntu/app/digital-garden:/quartz -p 1313:1313 quartz make generate
echo `date`

## crontab(auto generate static site)

1
* */3 * * * ./deploy.sh >> /var/log/myjob.log 2>&1

## Nginx

1
2
3
location /notes {
	alias /path/to/digital-garden/public/;
}

# Hugo settings

  • markdowns: contents
  • styles: assets/
  • config:
    • config.yaml:
      • ignored data
    • data/

Backlinks