vault backup: 2025-01-17 20:23:34
This commit is contained in:
parent
6633d7a2eb
commit
5c2597498d
2 changed files with 24 additions and 33 deletions
|
@ -14,34 +14,28 @@ This project runs **Quartz 4.4.0**, a fast, batteries-included static site gener
|
||||||
|
|
||||||
While Quartz provides [Docker support](https://quartz.jzhao.xyz/features/Docker-Support), it is not as self contained as this project.
|
While Quartz provides [Docker support](https://quartz.jzhao.xyz/features/Docker-Support), it is not as self contained as this project.
|
||||||
|
|
||||||
|
|
||||||
## 🐳 Docker Compose Setup
|
## 🐳 Docker Compose Setup
|
||||||
|
|
||||||
Create a data directory and pull your existing content
|
Create a data directory
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# create directories
|
mkdir -p /srv/quartz
|
||||||
mkdir -p /srv/quartz/config
|
|
||||||
cd /srv/quartz
|
|
||||||
# clone your content
|
|
||||||
git clone https://code.modernleft.org/gravityfargo/modernleft-docs.git content
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Compose File
|
|
||||||
|
|
||||||
Create a `docker-compose.yml` file:
|
Create a `docker-compose.yml` file:
|
||||||
|
|
||||||
![[docker-compose]]
|
![[docker-compose]]
|
||||||
|
|
||||||
### First Run
|
**First Run**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
docker stop quartz-wiki
|
docker stop quartz-wiki
|
||||||
```
|
```
|
||||||
|
|
||||||
On first run, the container will download the necessary dependencies and build the site.
|
On first run, the container will download the necessary dependencies, build the site, and download the content repository.
|
||||||
|
You will also need to
|
||||||
In `/srv/quartz/config/config.json`, you need to change the `baseUrl` to your domain.
|
|
||||||
|
|
||||||
## ⚙️ Configuration
|
## ⚙️ Configuration
|
||||||
|
|
||||||
|
@ -54,10 +48,12 @@ To keep the image small, `node_modules` are not included. When the container is
|
||||||
This is the command run by cron
|
This is the command run by cron
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd /usr/share/nginx/html/content && \
|
cd /quartz/content
|
||||||
git pull >/dev/null 2>&1 && \
|
git restore .
|
||||||
cd /usr/share/nginx/html && \
|
git pull
|
||||||
npx quartz build >/dev/null 2>&1
|
cd /quartz/src &
|
||||||
|
npx quartz build
|
||||||
|
echo 'Content Updated.'
|
||||||
```
|
```
|
||||||
|
|
||||||
Setting `ENABLE_CRON` to `true` and defining `BUILD_SCHEDULE` performs these actions.
|
Setting `ENABLE_CRON` to `true` and defining `BUILD_SCHEDULE` performs these actions.
|
||||||
|
@ -67,22 +63,18 @@ Example:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
environment:
|
environment:
|
||||||
ENABLE_CRON: true
|
ENABLE_CRON: "true"
|
||||||
BUILD_SCHEDULE: "*/1 * * * *" # Runs every minute
|
BUILD_SCHEDULE: "*/1 * * * *" # Runs every minute
|
||||||
```
|
```
|
||||||
|
|
||||||
### Environment Variables
|
### Environment Variables
|
||||||
|
|
||||||
See a list of all environment variables [here](#environment-variables).
|
|
||||||
|
|
||||||
| Variable | Description | Default Value |
|
| Variable | Description | Default Value |
|
||||||
| -------------------- | ----------------------------------------------------- | ----------------------------- |
|
| ---------------- | ----------------------------------------------------- | ----------------------------- |
|
||||||
|
| `USER_ID` | UID that` /content` and` /config` will be chown'd to. | `1000` |
|
||||||
|
| `GROUP_ID` | GID that` /content` and` /config` will be chown'd to. | `1000` |
|
||||||
| `NGINX_PORT` | Port for the Nginx server | `80` |
|
| `NGINX_PORT` | Port for the Nginx server | `80` |
|
||||||
| `SERVER_NAME` | NGINX server name | `quartz.zhao.xyz` |
|
| `SERVER_NAME` | NGINX server name | `quartz.zhao.xyz` |
|
||||||
| `ENABLE_CRON` | Enables scheduled builds (`true` or `false`) | `false` |
|
| `ENABLE_CRON` | Enables scheduled builds (`true` or `false`) | `false` |
|
||||||
| `BUILD_SCHEDULE` | Cron expression for scheduling site builds | `"*/10 * * * *"` every 10 min |
|
| `BUILD_SCHEDULE` | Cron expression for scheduling site builds | `"*/10 * * * *"` every 10 min |
|
||||||
| `QUARTZ_CONFIG_PATH` | Path to the Quartz configuration file | `/config/quartz.json` |
|
| `CONTENT_REPO` | URL of the content repository | |
|
||||||
| `USER_ID` | UID that` /content` and` /config` will be chown'd to. | `1000` |
|
|
||||||
| `GROUP_ID` | GID that` /content` and` /config` will be chown'd to. | `1000` |
|
|
||||||
|
|
||||||
You shouldn't need to change `QUARTZ_CONFIG_PATH`
|
|
||||||
|
|
|
@ -4,15 +4,14 @@ services:
|
||||||
container_name: quartz-docker
|
container_name: quartz-docker
|
||||||
image: code.modernleft.org/gravityfargo/quartz-docker:dev
|
image: code.modernleft.org/gravityfargo/quartz-docker:dev
|
||||||
ports:
|
ports:
|
||||||
- 80:8080
|
- 80:80
|
||||||
environment:
|
environment:
|
||||||
USER_ID: 1000
|
USER_ID: 1000
|
||||||
GROUP_ID: 1001
|
GROUP_ID: 1001
|
||||||
NGINX_PORT: 8080
|
|
||||||
SERVER_NAME: "docs.modernleft.org"
|
SERVER_NAME: "docs.modernleft.org"
|
||||||
ENABLE_CRON: "true"
|
ENABLE_CRON: "true"
|
||||||
BUILD_SCHEDULE: "*/30 * * * *"
|
BUILD_SCHEDULE: "*/30 * * * *"
|
||||||
CONTENT_REPO: "https://code.modernleft.org/gravityfargo/modernleft-docs.git"
|
CONTENT_REPO: "https://code.modernleft.org/gravityfargo/modernleft-docs.git"
|
||||||
volumes:
|
volumes:
|
||||||
- ./quartz:/quartz
|
- /srv/quartz:/quartz
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in a new issue