vault backup: 2025-01-17 16:55:45

This commit is contained in:
Nathan Price 2025-01-17 16:55:45 -05:00
parent 39d2fde6e1
commit 81963c43a9
Signed by: gravityfargo
SSH key fingerprint: SHA256:bjq+uA1U+9bFMd70q2wdNtwaYxGv84IBXalnYvZDKmg
5 changed files with 59 additions and 119 deletions

View file

@ -16,84 +16,77 @@ While Quartz provides [Docker support](https://quartz.jzhao.xyz/features/Docker-
## 🚀 Features
- **Easy Configuration** Customize settings using environment variables
- **Easy Configuration** Customize settings using a json file
- **Automated Site Updates** Configurable cron job to fetch and rebuild content
## 🛠️ Getting Started
## 🐳 Docker Compose Setup
### 🐳 Docker Compose
### Prepare Data Directories
1. Create a data directory and pull your existing content:
Create a data directory and pull your existing content
```bash
git clone https://code.modernleft.org/gravityfargo/modernleft-docs.git quartz
```
```bash
# create directories
mkdir -p /srv/quartz/config
cd /srv/quartz
# clone your content
git clone https://code.modernleft.org/gravityfargo/modernleft-docs.git content
```
2. Create a `docker-compose.yml` file:
### Compose File
#### Minimal Example
Create a `docker-compose.yml` file:
![[docker-compose]]
```yaml
version: "3"
services:
quartz:
image: code.modernleft.org/gravityfargo/quartz-docker:v4.4.0
environment:
- BASE_URL=https://example.com
volumes:
- ./quartz:/usr/share/nginx/html
ports:
- "80:80"
```
### First Run
##### `BASE_URL`
```bash
docker-compose up -d
docker stop quartz-wiki
```
The only required variable is `BASE_URL`. This sets both Quartz's `baseUrl` and Nginx's `server_name`.
On first run, the container will download the necessary dependencies and build the site.
#### Recommended Setup
In `/srv/quartz/config/config.json`, you need to change the `baseUrl` to your domain.
```yaml
version: "3"
services:
quartz:
image: code.modernleft.org/gravityfargo/quartz-docker:v4.4.0
environment:
- BASE_URL=https://example.com
- ENABLE_CRON=true
- BUILD_SCHEDULE="0 * * * *"
volumes:
- ./quartz:/usr/share/nginx/html
- node_modules:/usr/share/nginx/html/node_modules
ports:
- "80:80"
volumes:
node_modules:
```
## ⚙️ Configuration
##### Persistent `node_modules` Volume
### Optional `node_modules` volume
To keep the image small, `node_modules` are not included. When the container is run, they are downloaded to `/usr/share/nginx/html/node_modules`. Mounting this as a volume ensures they persist between container runs, reducing setup time.
To keep the image small, `node_modules` are not included. When the container is run, they are downloaded to `/usr/share/nginx/html/node_modules`. Mounting this as a volume ensures they persist between container runs, reducing setup time.
##### Enabling Cron Jobs
### cron
Setting `ENABLE_CRON` to `true` and defining `BUILD_SCHEDULE` as a cron expression allows `npx quartz build` to run on a schedule. That command pulls the latest content and rebuilds the site.
This is the command run by cron
Example:
```bash
cd /usr/share/nginx/html/content && \
git pull >/dev/null 2>&1 && \
cd /usr/share/nginx/html && \
npx quartz build >/dev/null 2>&1
```
```yaml
environment:
- ENABLE_CRON=true
- BUILD_SCHEDULE=" * * * *" # Runs every hour
```
Setting `ENABLE_CRON` to `true` and defining `BUILD_SCHEDULE` performs these actions.
If you need help configuring [Crontab.guru - The cron schedule expression generator](https://crontab.guru/) is a useful tool for that
## 📌 Environment Variables
Example:
```yaml
environment:
ENABLE_CRON: true
BUILD_SCHEDULE: "*/1 * * * *" # Runs every minute
```
### Environment Variables
See a list of all environment variables [here](#environment-variables).
| Variable | Description | Default Value |
| ---------------- | -------------------------------------------- | ------------------------------- |
| `BASE_URL` | The base URL for the site (Required) | None |
| `ENABLE_CRON` | Enables scheduled builds (`true` or `false`) | `false` |
| `BUILD_SCHEDULE` | Cron expression for scheduling site builds | `0 0 * * *` (Daily at midnight) |
| Variable | Description | Default Value |
| -------------------- | -------------------------------------------- | ----------------------------- |
| `NGINX_PORT` | Port for the Nginx server | `80` |
| `SERVER_NAME` | NGINX server name | `quartz.zhao.xyz` |
| `ENABLE_CRON` | Enables scheduled builds (`true` or `false`) | `false` |
| `BUILD_SCHEDULE` | Cron expression for scheduling site builds | `"*/10 * * * *"` every 10 min |
| `QUARTZ_CONFIG_PATH` | Path to the Quartz configuration file | `/config/quartz.json` |
This setup ensures a fully automated Quartz deployment with minimal configuration.
You shouldn't need to change `QUARTZ_CONFIG_PATH`

View file

@ -5,5 +5,3 @@ date: 2025-01-16
tags:
- test
---
If you need help configuring cron: [Crontab.guru - The cron schedule expression generator](https://crontab.guru/)

View file

@ -1,18 +1,19 @@
```yaml
services:
quartz-docker:
container_name: quartz-docker
quartz-wiki:
container_name: quartz-wiki
hostname: quartz-wiki
image: code.modernleft.org/gravityfargo/quartz-docker:v4.4.0
ports:
- 8080:80
- 80:80
environment:
SERVER_NAME: "docs.modernleft.org"
ENABLE_CRON: "true"
BUILD_SCHEDULE: "*/30 * * * *"
PAGE_TITLE: "ModernLeft Wiki"
BASE_URL: "docs.modernleft.org"
BUILD_SCHEDULE: "*/10 * * * *"
volumes:
- ./quartz:/content
- quartz-deps:/usr/share/nginx/html/node_modules
- /srv/quartz/content:/content
- /srv/quartz/config:/config
volumes:
quartz-deps:

View file

@ -1,40 +0,0 @@
---
title: Environment Variables
draft: false
date: 2025-01-16
---
[Configuration](https://quartz.jzhao.xyz/configuration) options from the typescript file that are configurable via environment variable.
| **Variable** | **Default** | **Purpose** |
| --------------------- | -------------------------- | ----------------------------------------------------- |
| `NGINX_PORT` | `8080` | Port on which the NGINX server runs |
| `ENABLE_CRON` | `false` | Enable or disable the cron job |
| `BUILD_SCHEDULE` | `*/10 * * * *` | Cron schedule for running `git pull` and Quartz build |
| `PAGE_TITLE` | `"Quartz Docker"` | Title of the Quartz-generated website |
| `ENABLE_SPA` | `"true"` | Enable Single Page Application (SPA) mode |
| `ENABLE_POPOVERS` | `"true"` | Enable popovers for additional UI interactions |
| `ANALYTICS_PROVIDER` | `"plausible"` | Analytics provider for tracking usage |
| `BASE_URL` | `"localhost"` | Base URL for the Quartz site |
| `IGNORE_PATTERNS` | `"private,templates"` | Files or directories to ignore in the Quartz build |
| `TYPOGRAPHY_HEADER` | `"Schibsted Grotesk"` | Font for headers |
| `TYPOGRAPHY_BODY` | `"Source Sans Pro"` | Font for body text |
| `TYPOGRAPHY_CODE` | `"IBM-Plex Mono"` | Font for code blocks |
| **Light Mode Colors** | | |
| `LIGHTMODE_LIGHT` | `"#faf8f8"` | Background color for light mode |
| `LIGHTMODE_LIGHTGRAY` | `"#e5e5e5"` | Light gray color for light mode |
| `LIGHTMODE_GRAY` | `"#bbbbbb"` | Gray color for light mode |
| `LIGHTMODE_DARKGRAY` | `"#4e4e4e"` | Dark gray color for light mode |
| `LIGHTMODE_DARK` | `"#2b2b2b"` | Darkest color for light mode |
| `LIGHTMODE_SECONDARY` | `"#284b63"` | Secondary accent color for light mode |
| `LIGHTMODE_TERTIARY` | `"#84a59d"` | Tertiary accent color for light mode |
| `LIGHTMODE_HIGHLIGHT` | `"rgba(143,159,169,0.15)"` | Highlight color for light mode |
| **Dark Mode Colors** | | |
| `DARKMODE_LIGHT` | `"#161618"` | Background color for dark mode |
| `DARKMODE_LIGHTGRAY` | `"#393639"` | Light gray color for dark mode |
| `DARKMODE_GRAY` | `"#646464"` | Gray color for dark mode |
| `DARKMODE_DARKGRAY` | `"#4d4d4d"` | Dark gray color for dark mode |
| `DARKMODE_DARK` | `"#ebebec"` | Lightest color for dark mode |
| `DARKMODE_SECONDARY` | `"#7b97aa"` | Secondary accent color for dark mode |
| `DARKMODE_TERTIARY` | `"#84a59d"` | Tertiary accent color for dark mode |
| `DARKMODE_HIGHLIGHT` | `"rgba(143,159,169,0.15)"` | Highlight color for dark mode |

View file

@ -1,12 +0,0 @@
```yaml
services:
quartz-docker:
container_name: quartz-docker
image: code.modernleft.org/gravityfargo/quartz-docker:v4.4.0
ports:
- 80:80
environment:
BASE_URL: "docs.modernleft.org"
volumes:
- ./quartz:/content
```