mirror of
https://github.com/by-jp/www.byjp.me.git
synced 2025-08-09 01:35:56 +01:00
Gemini: server (fly.io, non-functional)
This puts the framework for building a statically compiled agate into a scratch Docker image which can be run from fly.io (as well as the fly.toml that sets it up correctly). This doesn't seem to work on fly.io itself at the moment, so more tinkering soon, but it works locally.
This commit is contained in:
parent
7547001056
commit
68c939762e
5 changed files with 60 additions and 3 deletions
2
.dockerignore
Normal file
2
.dockerignore
Normal file
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!/public/
|
6
.github/workflows/publish.yml
vendored
6
.github/workflows/publish.yml
vendored
|
@ -29,6 +29,7 @@ jobs:
|
|||
HUGO_VERSION: 0.125.4
|
||||
PAGEFIND_VERSION: 1.1.0
|
||||
TASK_VERSION: 3.36.0
|
||||
RESTIC_VERSION: 0.16.4
|
||||
steps:
|
||||
- name: Install Hugo CLI
|
||||
run: |
|
||||
|
@ -44,6 +45,11 @@ jobs:
|
|||
wget -q -O ${{ runner.temp }}/task.tar.gz https://github.com/go-task/task/releases/download/v${TASK_VERSION}/task_linux_amd64.tar.gz \
|
||||
&& tar -xpf ${{ runner.temp }}/task.tar.gz task \
|
||||
&& mv task /usr/local/bin/task
|
||||
- name: Install Restic CLI
|
||||
run: |
|
||||
wget -q -O ${{ runner.temp }}/restic.bz2 https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/restic_${RESTIC_VERSION}_linux_amd64.bz2 \
|
||||
&& bunzip2 ${{ runner.temp }}/restic.bz2 \
|
||||
&& mv restic /usr/local/bin/restic
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
|
|
11
Dockerfile
Normal file
11
Dockerfile
Normal file
|
@ -0,0 +1,11 @@
|
|||
FROM ghcr.io/rust-cross/rust-musl-cross:x86_64-unknown-linux-musl as agate
|
||||
|
||||
RUN cargo install agate
|
||||
|
||||
FROM scratch
|
||||
COPY --from=agate /root/.cargo/bin/agate /bin/agate
|
||||
COPY ./public/ /var/agate/content/
|
||||
|
||||
EXPOSE 1965
|
||||
|
||||
ENTRYPOINT ["/bin/agate", "--content", "/var/agate/content/", "--addr", "0.0.0.0:1965", "--only-tls13", "--central-conf", "--lang", "en-GB", "--certs", "/var/agate/certificates/", "--hostname", "byjp.cc"]
|
13
Taskfile.yml
13
Taskfile.yml
|
@ -4,6 +4,7 @@ version: '3'
|
|||
|
||||
vars:
|
||||
domain: www.byjp.me
|
||||
gmi_domain: byjp.cc
|
||||
puma_dev_tld: .test
|
||||
|
||||
env:
|
||||
|
@ -54,14 +55,20 @@ tasks:
|
|||
- find -E ./public -regex '.*\.(html|js|css|css\.map|webmanifest|xml|xsl|ico|opml)' -type f -delete
|
||||
# Remove specific unneeded files
|
||||
- rm -rf ./public/favicon*.png ./public/_redirects ./public/{apple,android,mstile}*.png ./public/safari-pinned-tab.svg ./public/robots.txt
|
||||
# Remove specific unneeded direcctories
|
||||
# Remove specific unneeded directories
|
||||
- rm -rf ./public/.well-known/ ./public/fonts/ ./public/standalone/project-prime/
|
||||
# Remove empty directories
|
||||
- find ./public -type d -empty -delete
|
||||
|
||||
gemini-dev:
|
||||
desc: Builds the site & starts a gemini server (on the default port) for it.
|
||||
deps: [ build ]
|
||||
cmds:
|
||||
- agate --content public --lang en-GB --hostname "{{ .domain }}{{ .puma_dev_tld }}" --central-conf
|
||||
- agate --content public --addr 0.0.0.0:1965 --ed25519 --only-tls13 --lang en-GB --hostname "{{ .gmi_domain }}{{ .puma_dev_tld }}" --central-conf
|
||||
|
||||
gemini-deploy:
|
||||
desc: Builds, reduces, and deploys the gemini version of the site with fly.
|
||||
deps:
|
||||
- build
|
||||
- gemini-reduce
|
||||
cmds:
|
||||
- fly deploy
|
||||
|
|
31
fly.toml
Normal file
31
fly.toml
Normal file
|
@ -0,0 +1,31 @@
|
|||
# fly.toml app configuration file generated for byjp-cc on 2024-04-30T15:16:09+01:00
|
||||
#
|
||||
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
|
||||
#
|
||||
|
||||
app = 'byjp-cc'
|
||||
primary_region = 'lhr'
|
||||
|
||||
[build]
|
||||
|
||||
[[files]]
|
||||
guest_path = "/var/agate/certificates/byjp.cc/cert.der"
|
||||
secret_name = "AGATE_CERT"
|
||||
|
||||
[[files]]
|
||||
guest_path = "/var/agate/certificates/byjp.cc/key.der"
|
||||
secret_name = "AGATE_KEY"
|
||||
|
||||
[[services]]
|
||||
internal_port = 1965
|
||||
auto_stop_machines = true
|
||||
auto_start_machines = true
|
||||
min_machines_running = 0
|
||||
|
||||
[[services.ports]]
|
||||
port = 1965
|
||||
|
||||
[[vm]]
|
||||
memory = '1gb'
|
||||
cpu_kind = 'shared'
|
||||
cpus = 1
|
Loading…
Reference in a new issue