From 3245231730e41cf81e5e027e49cdca6abc9d48d4 Mon Sep 17 00:00:00 2001 From: Matthew Binning Date: Sat, 4 Apr 2026 16:32:51 -0700 Subject: [PATCH] feat: Move media assets outside of the git repository Images and media referenced by the private Copper Chronicle section are no longer tracked by git. They live at /assets/copper-chronicle/ on the server (/srv/www/binning.net/assets/) and are managed independently. Updated all image links in src/private/copper-chronicle to use absolute paths rooted at /assets/. Added --filter='protect assets/' to all deploy rsync commands to prevent accidental deletion during deploys. --- .forgejo/workflows/cd.yml | 2 +- .forgejo/workflows/ci.yml | 2 +- .forgejo/workflows/nightly.yml | 2 +- .gitignore | 3 +- README.md | 78 ++++++++++++++++++++++++++++++---- deploy.sh | 2 +- src/README.md | 2 +- src/private | 2 +- todo.txt | 2 +- 9 files changed, 78 insertions(+), 17 deletions(-) diff --git a/.forgejo/workflows/cd.yml b/.forgejo/workflows/cd.yml index 2aa3626..8e92ebc 100644 --- a/.forgejo/workflows/cd.yml +++ b/.forgejo/workflows/cd.yml @@ -22,5 +22,5 @@ jobs: path: book/ - name: Deploy run: | - nix shell nixpkgs#rsync --command rsync -av --delete book/ /srv/www/binning.net/ + nix shell nixpkgs#rsync --command rsync -av --delete --filter='protect assets/' book/ /srv/www/binning.net/ printf "✓ Local deployment complete!\n" \ No newline at end of file diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index 2610ffa..fffced4 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -31,5 +31,5 @@ jobs: path: book/ - name: Deploy run: | - nix shell nixpkgs#rsync --command rsync -av --delete book/ /srv/www/binning.net/ + nix shell nixpkgs#rsync --command rsync -av --delete --filter='protect assets/' book/ /srv/www/binning.net/ printf "✓ Local deployment complete!\n" \ No newline at end of file diff --git a/.forgejo/workflows/nightly.yml b/.forgejo/workflows/nightly.yml index 90477da..827108b 100644 --- a/.forgejo/workflows/nightly.yml +++ b/.forgejo/workflows/nightly.yml @@ -36,5 +36,5 @@ jobs: path: book/ - name: Deploy run: | - nix shell nixpkgs#rsync --command rsync -av --delete book/ /srv/www/binning.net/ + nix shell nixpkgs#rsync --command rsync -av --delete --filter='protect assets/' book/ /srv/www/binning.net/ printf "✓ Local deployment complete!\n" diff --git a/.gitignore b/.gitignore index d8fcb3e..e1eee3f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ # the build directory of mdbook book/ *.jpg -*.png \ No newline at end of file +*.png +src/drafts/journal \ No newline at end of file diff --git a/README.md b/README.md index d56df88..e3d9a0c 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,77 @@ # The Bin -This is my personal website, blog project, and portfolio page. -It should be available at https://wwww.binning.dev +My personal website, blog, and portfolio. Available at https://binning.net. -# History +## Architecture -- 2025-02-28: I restarted this in [Rocket](https://rocket.rs) after yet another data loss event. -- 2024-06-21: I migrated from cgit to forgejo and from kuberentes to simply nginx. -- 2023-10-07: I merged the deployment repository into this one and moved to self-hosting. -- 2022-01-05: I moved hosting to Vultr and moved to a Cobalt. -- 2018-12-16: I started this blog with [Namecheap][Namecheap], [Ruby][Ruby], [Jekyll][Jekyll], and [Github-Pages][Github-Pages]. +This is an [mdbook](https://rust-lang.github.io/mdBook/) project. Source content lives in `src/`, and `mdbook build` produces the static site in `book/`, which is what gets deployed. + +### Directory structure + +``` +. +├── src/ # mdbook source (markdown content) +│ ├── SUMMARY.md # table of contents / navigation +│ ├── private/ # git submodule — see below +│ └── ... +├── book/ # build output (not tracked) +├── content/ # assets and media not tracked by git — see below +├── book.toml # mdbook configuration +└── .forgejo/workflows/ # CI/CD pipelines +``` + +### Private content (git submodule) + +`src/private` is a separate private git repository included here as a submodule. This keeps personal content out of the public repo history while still building into the same site. The submodule is hosted at `https://forgejo.binning.net/www/private`. + +When working locally, the submodule URL can be overridden to SSH in `.git/config`: + +```bash +git config submodule.src/private.url forgejo@forgejo.binning.net:/www/private.git +git submodule sync +``` + +CI uses HTTPS with an OAuth token via a URL rewrite (`secrets.WWW_PRIVATE_TOKEN`), so `.gitmodules` should always contain the HTTPS URL. + +To update the submodule to the latest commit: + +```bash +git submodule update --remote src/private +git add src/private +git commit -m "Update private submodule" +``` + +### Assets + +Images and media referenced by content in `src/private/` are not tracked by this repo. They live on the server at `/srv/www/binning.net/assets/` and are managed separately. + +Markdown image links use absolute paths rooted at `/assets/`: + +```markdown +![alt text](/assets/copper-chronicle/chapter_1/image.jpg) +``` + +The deploy rsync uses `--filter='protect assets/'` to ensure the `assets/` directory is never deleted during deployment. + +## CI/CD + +Three Forgejo Actions workflows handle the build and deploy lifecycle: + +- **ci.yml** — builds on every push and uploads the artifact +- **cd.yml** — manual workflow dispatch to deploy to staging or prod +- **nightly.yml** — scheduled nightly build and deploy + +All workflows run on a self-hosted runner and deploy to `/srv/www/binning.net/` via rsync. + +## History + +- 2025-02-28: Restarted in [mdbook](https://rust-lang.github.io/mdBook/) after yet another data loss event. +- 2024-06-21: Migrated from cgit to Forgejo and from Kubernetes to nginx. +- 2023-10-07: Merged the deployment repository into this one and moved to self-hosting. +- 2022-01-05: Moved hosting to Vultr and switched to Cobalt. +- 2018-12-16: Started with [Namecheap], [Ruby], [Jekyll], and [Github Pages][Github-Pages]. [Namecheap]: https://www.namecheap.com/ [Ruby]: https://www.ruby-lang.org/ [Jekyll]: https://jekyllrb.com/ -[Github-Pages]: https://pages.github.com/ \ No newline at end of file +[Github-Pages]: https://pages.github.com/ diff --git a/deploy.sh b/deploy.sh index bb8283c..1a0127f 100755 --- a/deploy.sh +++ b/deploy.sh @@ -15,7 +15,7 @@ fi printf "Deploying website files...\n" ssh ${REMOTE_USER}@${REMOTE_HOST} "mkdir -p /tmp/blog-deploy" rsync -avz --delete blog/ ${REMOTE_USER}@${REMOTE_HOST}:/tmp/blog-deploy/ -ssh ${REMOTE_USER}@${REMOTE_HOST} "sudo rsync -avz --delete /tmp/blog-deploy/ ${REMOTE_PATH}/ && \ +ssh ${REMOTE_USER}@${REMOTE_HOST} "sudo rsync -avz --delete --filter='protect assets/' /tmp/blog-deploy/ ${REMOTE_PATH}/ && \ sudo chown -R nginx:nginx ${REMOTE_PATH}/ && \ printf 'Content deployed.\n'" diff --git a/src/README.md b/src/README.md index 2dd2da6..d24aa48 100644 --- a/src/README.md +++ b/src/README.md @@ -2,7 +2,7 @@ Welcome to my personal website, blog, and landing page for other self-hosted software. This website serves as a space to share musings, stories, and chronicles, about all of those things. -![cover photo](cover-photo.jpg) +![cover photo](/assets/cover-photo.jpg) ## About diff --git a/src/private b/src/private index 28cfe76..b9a3514 160000 --- a/src/private +++ b/src/private @@ -1 +1 @@ -Subproject commit 28cfe7618cc6babe24b12de6620e066af402e4e9 +Subproject commit b9a3514cf48badcb2165d7e8473217cbd6a7f2f2 diff --git a/todo.txt b/todo.txt index 8dce369..efd47fb 100644 --- a/todo.txt +++ b/todo.txt @@ -1,4 +1,3 @@ -Split www into www/blog, www/content, and www/assets Determine which articles should be incorporated into the website Build out the Copper Chronicle Fill out the DefCon article @@ -39,4 +38,5 @@ x 2026-03-23 Reduce the CSS where possible. Match my website's theme to align wi x Set up nightly builds x Personalize the index page. x Personalize the introduction page of the blog. +x 2026-04-04 Split www into www/blog, www/content, and www/assets