Table of Contents
A very complex, extremely interesting first post to a blog. Mostly just testing the infrastructure, to see how it works.
In theory, if this is being read, then it's running just fine!
For reference, if you're at all interested, this is how things are working.
How Things are Working #
I, like most people working with config files and a technical mind, like
Git. This blog is in a Git repository, and that Git repository has a
central copy on GitLab. There is a .gitlab-ci.yml
file
in the root of this repository, which manages deploying the site to
prose.sh.
In order to preserve my vanity and serve this blog on a subdomain of my main
domain, I have followed the prose.sh instructions to set
it up. In short, my BIND zonefiles contain a CNAME
and a TXT
record;
the CNAME points prose.rickhenry.uk
to prose.sh
, and the TXT record tells
prose.sh which user's blog to show these posts as.
GitLab is configured with an SSH private key (also set up on the pico.sh console app) as a CI variable, which is loaded and used to authenticate with prose.sh to upload config.
The .gitlab-ci.yml
file #
The .gitlab-ci.yml
file is, at the time of writing this, like the following:
1---
2stages:
3 - validate
4 - deploy
5
6lint-markdown:
7 stage: validate
8 image:
9 name: ghcr.io/igorshubovych/markdownlint-cli:latest
10 entrypoint: [""]
11 script:
12 - markdownlint --version
13 - markdownlint .
14
15deploy-to-prose:
16 stage: deploy
17 rules:
18 # Only run on main branch
19 - if: '$CI_COMMIT_BRANCH == "main"'
20 # Only if previous stages succeed
21 - when: on_success
22
23 before_script:
24 - echo "### Creating .ssh directory"
25 - mkdir -p ~/.ssh
26 - chmod 700 ~/.ssh
27 - echo "### Loading SSH key!"
28 - eval $(ssh-agent -s)
29 - chmod 400 "$SSH_PRIVATE_KEY"
30 - ssh-add "$SSH_PRIVATE_KEY"
31 - ssh-add -l
32 - echo "### Setting known hosts!"
33 - cp "$SSH_KNOWN_HOSTS" ~/.ssh/known_hosts
34 - chown 644 ~/.ssh/known_hosts
35 - echo "### Installing rsync"
36 - apt-get --quiet update
37 - apt-get --yes --quiet install rsync
38 script:
39 # https://pico.sh/file-uploads#what-rsync-options-are-supported
40 # To remove files: `sftp prose.sh` then `rm file`
41 - echo "### Deploying.."
42 - ls -1 *.md
43 - rsync --verbose --recursive *.md prose.sh:/
As you can see, it's extraordinarily complicated. The most interesting bit is
the before_script
of the deploy-to-prose
stage, and that is mostly lifted
directly from GitLab's own examples.
Troubles and tribulations #
One problem I can see with the configuration as it stands is that it won't ever
deploy any images to prose.sh. In case you missed it, that's because I
only rsync
across .md
files, and not images. I'll probably sort something
out there before too long, but at the moment I'm just seeing how this works out.
This fascinating read doesn't really have any use for images.