aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristine Dodrill <me@christine.website>2020-07-16 15:32:30 -0400
committerGitHub <noreply@github.com>2020-07-16 15:32:30 -0400
commit385d25c9f96c0acd5d932488e3bd0ed36ceb4dd7 (patch)
treeaf789f7250519b23038a7e5ea0ae7f4f4c1ffdfc
parent449e934246c82d90dd0aac2644d67f928befeeb4 (diff)
downloadxesite-385d25c9f96c0acd5d932488e3bd0ed36ceb4dd7.tar.xz
xesite-385d25c9f96c0acd5d932488e3bd0ed36ceb4dd7.zip
Rewrite site backend in Rust (#178)
* add shell.nix changes for Rust #176 * set up base crate layout * add first set of dependencies * start adding basic app modules * start html templates * serve index page * add contact and feeds pages * add resume rendering support * resume cleanups * get signalboost page working * rewrite config to be in dhall * more work * basic generic post loading * more tests * initial blog index support * fix routing? * render blogposts * X-Clacks-Overhead * split blog handlers into blog.rs * gallery index * gallery posts * fix hashtags * remove instantpage (it messes up the metrics) * talk support + prometheus * Create rust.yml * Update rust.yml * Update codeql-analysis.yml * add jsonfeed library * jsonfeed support * rss/atom * go mod tidy * atom: add posted date * rss: add publishing date * nix: build rust program * rip out go code * rip out go templates * prepare for serving in docker * create kubernetes deployment * create automagic deployment * build docker images on non-master * more fixes * fix timestamps * fix RSS/Atom/JSONFeed validation errors * add go vanity import redirecting * templates/header: remove this * atom feed: fixes * fix? * fix?? * fix rust tests * Update rust.yml * automatically show snow during the winter * fix dates * show commit link in footer * sitemap support * fix compiler warning * start basic patreon client * integrate kankyo * fix patreon client * add patrons page * remove this * handle patron errors better * fix build * clean up deploy * sort envvars for deploy * remove deps.nix * shell.nix: remove go * update README * fix envvars for tests * nice * blog: add rewrite in rust post * blog/site-update: more words
-rw-r--r--.gitattributes1
-rw-r--r--.github/workflows/codeql-analysis.yml39
-rw-r--r--.github/workflows/go.yml21
-rw-r--r--.github/workflows/kubernetes-cd.yml80
-rw-r--r--.github/workflows/nix.yml46
-rw-r--r--.github/workflows/rust.yml25
-rw-r--r--.gitignore2
-rw-r--r--Cargo.lock2592
-rw-r--r--Cargo.toml48
-rw-r--r--Dockerfile20
-rw-r--r--LICENSE2
-rw-r--r--README.md7
-rw-r--r--blog/OVE-20190623-0001.markdown (renamed from blog/OVE-20190623-0001.md)0
-rw-r--r--blog/OVE-20191021-0001.markdown (renamed from blog/OVE-20191021-0001.md)0
-rw-r--r--blog/site-update-2020-07-16.markdown189
-rw-r--r--cmd/site/clacks.go25
-rw-r--r--cmd/site/html.go245
-rw-r--r--cmd/site/internal/blog/blog.go137
-rw-r--r--cmd/site/internal/blog/blog_test.go66
-rw-r--r--cmd/site/internal/date.go10
-rw-r--r--cmd/site/internal/date_test.go28
-rw-r--r--cmd/site/internal/front/LICENSE19
-rw-r--r--cmd/site/internal/front/front.go24
-rw-r--r--cmd/site/internal/front/front_test.go42
-rw-r--r--cmd/site/internal/hash.go14
-rw-r--r--cmd/site/internal/middleware/metrics.go43
-rw-r--r--cmd/site/internal/middleware/requestid.go31
-rw-r--r--cmd/site/main.go296
-rw-r--r--cmd/site/pageview.go53
-rw-r--r--cmd/site/patreon.go112
-rw-r--r--cmd/site/rss.go91
-rw-r--r--cmd/site/signalboost.go29
-rw-r--r--cmd/site/signalboost_test.go28
-rw-r--r--config.dhall27
-rw-r--r--css/shim.css20
-rw-r--r--default.nix23
-rw-r--r--docker.nix21
-rw-r--r--go.mod21
-rw-r--r--go.sum211
-rw-r--r--jsonfeed/.travis.yml17
-rw-r--r--jsonfeed/LICENSE363
-rw-r--r--jsonfeed/README.md8
-rw-r--r--jsonfeed/jsonfeed.go73
-rw-r--r--jsonfeed/jsonfeed_test.go42
-rw-r--r--jsonfeed/testdata/feed.json21
-rw-r--r--lib/go_vanity/Cargo.toml15
-rw-r--r--lib/go_vanity/src/build.rs5
-rw-r--r--lib/go_vanity/src/lib.rs12
-rw-r--r--lib/go_vanity/templates/gitea.rs.html14
-rw-r--r--lib/go_vanity/templates/github.rs.html14
-rw-r--r--lib/jsonfeed/.gitignore4
-rw-r--r--lib/jsonfeed/Cargo.toml15
-rw-r--r--lib/jsonfeed/LICENSE-APACHE201
-rw-r--r--lib/jsonfeed/LICENSE-MIT25
-rw-r--r--lib/jsonfeed/README.adoc27
-rw-r--r--lib/jsonfeed/src/builder.rs204
-rw-r--r--lib/jsonfeed/src/errors.rs7
-rw-r--r--lib/jsonfeed/src/feed.rs296
-rw-r--r--lib/jsonfeed/src/item.rs493
-rw-r--r--lib/jsonfeed/src/lib.rs252
-rw-r--r--lib/patreon/.gitignore1
-rw-r--r--lib/patreon/Cargo.toml20
-rw-r--r--lib/patreon/examples/campaign.rs17
-rw-r--r--lib/patreon/src/lib.rs158
-rw-r--r--nix/deps.nix588
-rw-r--r--nix/sources.json12
-rwxr-xr-xscripts/docker.sh6
-rwxr-xr-xscripts/nixrun.sh4
-rwxr-xr-xscripts/release.sh10
-rw-r--r--shell.nix18
-rw-r--r--site.dhall23
-rw-r--r--site.nix53
-rw-r--r--src/app.rs191
-rw-r--r--src/build.rs11
-rw-r--r--src/handlers/blog.rs77
-rw-r--r--src/handlers/feeds.rs73
-rw-r--r--src/handlers/gallery.rs40
-rw-r--r--src/handlers/mod.rs145
-rw-r--r--src/handlers/talks.rs40
-rw-r--r--src/main.rs154
-rw-r--r--src/post/frontmatter.rs114
-rw-r--r--src/post/mod.rs178
-rw-r--r--src/signalboost.rs23
-rw-r--r--static/js/installsw.js7
-rw-r--r--static/js/instantpage-3.0.0.js2
-rwxr-xr-xstatic/js/sw.js46
-rw-r--r--templates/blogindex.rs.html (renamed from templates/blogindex.html)18
-rw-r--r--templates/blogpost.rs.html122
-rw-r--r--templates/contact.rs.html (renamed from templates/contact.html)17
-rw-r--r--templates/error.html9
-rw-r--r--templates/error.rs.html13
-rw-r--r--templates/feeds.rs.html (renamed from templates/feeds.html)11
-rw-r--r--templates/footer.rs.html17
-rw-r--r--templates/galleryindex.html26
-rw-r--r--templates/galleryindex.rs.html23
-rw-r--r--templates/gallerypost.html116
-rw-r--r--templates/gallerypost.rs.html (renamed from templates/blogpost.html)97
-rw-r--r--templates/header.rs.html (renamed from templates/base.html)75
-rw-r--r--templates/index.rs.html (renamed from templates/index.html)27
-rw-r--r--templates/notfound.rs.html11
-rw-r--r--templates/patrons.rs.html (renamed from templates/patrons.html)20
-rw-r--r--templates/resume.html9
-rw-r--r--templates/resume.rs.html13
-rw-r--r--templates/series.html16
-rw-r--r--templates/series.rs.html17
-rw-r--r--templates/series_posts.rs.html18
-rw-r--r--templates/serieslist.html16
-rw-r--r--templates/signalboost.rs.html (renamed from templates/signalboost.html)31
-rw-r--r--templates/talkindex.rs.html (renamed from templates/talkindex.html)19
-rw-r--r--templates/talkpost.rs.html (renamed from templates/talkpost.html)98
110 files changed, 6352 insertions, 3294 deletions
diff --git a/.gitattributes b/.gitattributes
index 813e826..5491853 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,2 +1 @@
-nix/deps.nix linguist-vendored
nix/sources.nix linguist-vendored
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
deleted file mode 100644
index 5e7db4c..0000000
--- a/.github/workflows/codeql-analysis.yml
+++ /dev/null
@@ -1,39 +0,0 @@
-name: "Code scanning - action"
-
-on:
- push:
- pull_request:
- schedule:
- - cron: '0 18 * * 6'
-
-jobs:
- CodeQL-Build:
- runs-on: ubuntu-latest
-
- steps:
- - name: Checkout repository
- uses: actions/checkout@v2
- with:
- # We must fetch at least the immediate parents so that if this is
- # a pull request then we can checkout the head.
- fetch-depth: 2
-
- # If this run was triggered by a pull request event, then checkout
- # the head of the pull request instead of the merge commit.
- - run: git checkout HEAD^2
- if: ${{ github.event_name == 'pull_request' }}
-
- # Initializes the CodeQL tools for scanning.
- - name: Initialize CodeQL
- uses: github/codeql-action/init@v1
- # Override language selection by uncommenting this and choosing your languages
- with:
- languages: go
-
- # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
- # If this step fails, then you should remove it and run the build manually (see below)
- - name: Autobuild
- uses: github/codeql-action/autobuild@v1
-
- - name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@v1
diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml
deleted file mode 100644
index e1e986f..0000000
--- a/.github/workflows/go.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-name: Go
-on:
- - push
- - pull_request
-jobs:
- build:
- name: Build
- runs-on: ubuntu-latest
- steps:
- - name: Set up Go 1.14
- uses: actions/setup-go@v1
- with:
- go-version: 1.14
- id: go
- - name: Check out code into the Go module directory
- uses: actions/checkout@v1
- - name: Test
- run: go test -v ./...
- env:
- GO111MODULE: on
- GOPROXY: https://cache.greedo.xeserv.us
diff --git a/.github/workflows/kubernetes-cd.yml b/.github/workflows/kubernetes-cd.yml
deleted file mode 100644
index 37f47b1..0000000
--- a/.github/workflows/kubernetes-cd.yml
+++ /dev/null
@@ -1,80 +0,0 @@
-name: "CI/CD"
-on:
- push:
- branches:
- - master
-jobs:
- deploy:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v1
- - name: Build container image
- run: |
- docker build -t xena/christinewebsite:$(echo $GITHUB_SHA | head -c7) .
- echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
- docker push xena/christinewebsite
- env:
- DOCKER_USERNAME: "xena"
- DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- - name: Download secrets/Install/Configure/Use Dyson
- run: |
- mkdir ~/.ssh
- echo $FILE_DATA | base64 -d > ~/.ssh/id_rsa
- md5sum ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- git clone git@ssh.tulpa.dev:cadey/within-terraform-secret
- curl https://xena.greedo.xeserv.us/files/dyson-linux-amd64-0.1.0.tgz | tar xz
- cp ./dyson-linux-amd64-0.1.1/dyson .
- rm -rf dyson-linux-amd64-0.1.1
- mkdir -p ~/.config/dyson
-
- echo '[DigitalOcean]
- Token = ""
-
- [Cloudflare]
- Email = ""
- Token = ""
-
- [Secrets]
- GitCheckout = "./within-terraform-secret"' > ~/.config/dyson/dyson.ini
-
- ./dyson manifest \
- --name=christinewebsite \
- --domain=christine.website \
- --dockerImage=xena/christinewebsite:$(echo $GITHUB_SHA | head -c7) \
- --containerPort=5000 \
- --replicas=2 \
- --useProdLE=true > $GITHUB_WORKSPACE/deploy.yml
- env:
- FILE_DATA: ${{ secrets.SSH_PRIVATE_KEY }}
- GIT_SSH_COMMAND: "ssh -i ~/.ssh/id_rsa -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
- - name: Save DigitalOcean kubeconfig
- uses: digitalocean/action-doctl@master
- env:
- DIGITALOCEAN_ACCESS_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }}
- with:
- args: kubernetes cluster kubeconfig show kubermemes > $GITHUB_WORKSPACE/.kubeconfig
- - name: Deploy to DigitalOcean Kubernetes
- uses: docker://lachlanevenson/k8s-kubectl
- with:
- args: --kubeconfig=/github/workspace/.kubeconfig apply -n apps -f /github/workspace/deploy.yml
- - name: Verify deployment
- uses: docker://lachlanevenson/k8s-kubectl
- with:
- args: --kubeconfig=/github/workspace/.kubeconfig rollout status -n apps deployment/christinewebsite
- - name: Ping Google
- uses: docker://lachlanevenson/k8s-kubectl
- with:
- args: --kubeconfig=/github/workspace/.kubeconfig apply -f /github/workspace/k8s/job.yml
-