~rbdr/gemlog

974d53853d141d14dcd8612938c3342f9cfde48b — Ruben Beltran del Rio 27 days ago 826ddac main
blog-sync-up-1711400338722
9 files changed, 18 insertions(+), 100 deletions(-)

A archive/1711400338658/link-fosdem-2024-so-you-think-you-know-git.gmi
A archive/1711400338658/metadata.json
A posts/0/link-fosdem-2024-so-you-think-you-know-git.gmi
M posts/0/metadata.json
M posts/1/metadata.json
R posts/{0/pivoting-to-files.gmi => 1/pivoting-to-files.gmi}
R posts/{1/geography.gmi => 2/geography.gmi}
D posts/2/how-i-publish-my-website-using-page-and-sourcehut.gmi
M posts/2/metadata.json
A archive/1711400338658/link-fosdem-2024-so-you-think-you-know-git.gmi => archive/1711400338658/link-fosdem-2024-so-you-think-you-know-git.gmi +6 -0
@@ 0,0 1,6 @@
# Link: FOSDEM 2024 - So you think you know Git

=> https://fosdem.org/2024/schedule/event/fosdem-2024-3611-so-you-think-you-know-git/ FOSDEM 2024 - So you think you know Git
I’ve been using git for a long time but never dived into the less common or newer features. This talk is a great list of things to try!

Conditional configs are the feature i’m most excited about, but learning about the maintenance is also very interesting.
\ No newline at end of file

A archive/1711400338658/metadata.json => archive/1711400338658/metadata.json +1 -0
@@ 0,0 1,1 @@
{"id":"1711400338658","created_on":1711400338658}
\ No newline at end of file

A posts/0/link-fosdem-2024-so-you-think-you-know-git.gmi => posts/0/link-fosdem-2024-so-you-think-you-know-git.gmi +6 -0
@@ 0,0 1,6 @@
# Link: FOSDEM 2024 - So you think you know Git

=> https://fosdem.org/2024/schedule/event/fosdem-2024-3611-so-you-think-you-know-git/ FOSDEM 2024 - So you think you know Git
I’ve been using git for a long time but never dived into the less common or newer features. This talk is a great list of things to try!

Conditional configs are the feature i’m most excited about, but learning about the maintenance is also very interesting.
\ No newline at end of file

M posts/0/metadata.json => posts/0/metadata.json +1 -4
@@ 1,4 1,1 @@
{
  "id": "1709228030045",
  "createdOn": 1709228030045
}
\ No newline at end of file
{"id":"1711400338658","created_on":1711400338658}
\ No newline at end of file

M posts/1/metadata.json => posts/1/metadata.json +2 -2
@@ 1,4 1,4 @@
{
  "id": "1707912360364",
  "createdOn": 1707912360364
  "id": "1709228030045",
  "createdOn": 1709228030045
}
\ No newline at end of file

R posts/0/pivoting-to-files.gmi => posts/1/pivoting-to-files.gmi +0 -0
R posts/1/geography.gmi => posts/2/geography.gmi +0 -0
D posts/2/how-i-publish-my-website-using-page-and-sourcehut.gmi => posts/2/how-i-publish-my-website-using-page-and-sourcehut.gmi +0 -92
@@ 1,92 0,0 @@
# How I publish my website using page and sourcehut

I have a very simple website available in gemini[1] and https[2]: It's gemini-first so it consists of gemtext and some assorted static files so I built a tool called page[3,4] to help me generate the static version of the site. In this post I describe how I use that tool and sourcehut to publish my site.

=> gemini://gemini.unlimited.pizza [1] my website (gemini version)
=> https://www.unlimited.pizza [2] my website (https version)
=> gemini://gemini.unlimited.pizza/page.gmi [3] page page (gemini version)
=> https://www.unlimited.pizza/page.html [4] page page (https version)

You can read more about page in the link above, but in short:

* it reads a _layout.html at the root of the directory.
* it takes every .gmi file, and converts it to html using the layout file above.
* it copies over static files and creates two "upload-ready" directories with html and gemini content.

This is easy enough to run locally, but I have the build set up in sourcehut so I can update it on push. Breaking down my .build.yml, it goes something like this:

Step 1. Specify an image. I've been using arch for a while so I went with archlinux, but the rest doesn't change that much.

```
image: archlinux
```

Step 2. Install dependencies. page needs rust and make, and I use rsync to copy files to my VPS so I only need those three.

```
packages:
  - make
  - rust
  - rsync
```

Step 3. Select which sources to clone. I'm building page from source and I'm using my website so I specify those two.

```
sources:
  - https://git.sr.ht/~rbdr/page
  - git@git.sr.ht:~rbdr/www.unlimited.pizza
```

Step 4. My secrets. I need a set of credentials to clone the sources, and another to connect to my VPS. Sourcehut has great documentation[4] on this, but it basically corresponds to keyfiles I can use to connect.

=> https://man.sr.ht/builds.sr.ht/#secrets [4] sourcehut build documentation.

```
secrets:
  - 01234567-89ab-cdef-0123-456789abcdef
  - fedcba98-7654-3210-fedc-ba9876543210
```

Step 5. Do the actual work. I've separated my task in four steps. First we build page, then we generate the static files, then we rsync the html, and finally we rsync the gemini content. One thing of note is that I exclude the .build.yml because page will upload everything in the directory, including hidden files.

```
tasks:
  - build_page: |
      cd page
      make -e profile=release
  - generate_page: |
      cd www.unlimited.pizza
      ../page/target/release/page
  - sync_html: |
      rsync -r --exclude '.build.yml' www.unlimited.pizza_html/ deploy@www.unlimited.pizza:/srv/http/www
  - sync_gemini: |
      rsync -r --exclude '.build.yml' www.unlimited.pizza_gemini/ deploy@gemini.unlimited.pizza:/srv/gemini/content
```

And that's it! The build system in sourcehut is very straightforward, so using this for other website builders shouldn't be a big change. And maybe, if you're also publishing with gemini you will find page useful. In upcoming posts I'll write about how I use stargazer to host the gemini capsule (+ some cgi scripts), and how I use nginx to host the https version. Anyway! here's the complete .build.yml:

```
image: archlinux
packages:
  - make
  - rust
  - rsync
sources:
  - https://git.sr.ht/~rbdr/page
  - git@git.sr.ht:~rbdr/www.unlimited.pizza
secrets:
  - 01234567-89ab-cdef-0123-456789abcdef
  - fedcba98-7654-3210-fedc-ba9876543210
tasks:
  - build_page: |
      cd page
      make -e profile=release
  - generate_page: |
      cd www.unlimited.pizza
      ../page/target/release/page
  - sync_html: |
      rsync -r --exclude '.build.yml' www.unlimited.pizza_html/ deploy@www.unlimited.pizza:/srv/http/www
  - sync_gemini: |
      rsync -r --exclude '.build.yml' www.unlimited.pizza_gemini/ deploy@gemini.unlimited.pizza:/srv/gemini/content
```

M posts/2/metadata.json => posts/2/metadata.json +2 -2
@@ 1,4 1,4 @@
{
  "id": "1707084701399",
  "createdOn": 1707084701399
  "id": "1707912360364",
  "createdOn": 1707912360364
}
\ No newline at end of file