From 728c5503a91c288af34e430fa9b116ffa7569996 Mon Sep 17 00:00:00 2001 From: "J. Elfring" Date: Sun, 1 May 2022 17:49:19 +0200 Subject: [PATCH] Add agate --- agate/Dockerfile | 30 +++++++++++++++++++++++++ agate/README.md | 53 +++++++++++++++++++++++++++++++++++++++++++++ agate/start.sh | 6 +++++ docker-compose.yaml | 4 ++++ 4 files changed, 93 insertions(+) create mode 100644 agate/Dockerfile create mode 100644 agate/README.md create mode 100644 agate/start.sh diff --git a/agate/Dockerfile b/agate/Dockerfile new file mode 100644 index 0000000..15f68d7 --- /dev/null +++ b/agate/Dockerfile @@ -0,0 +1,30 @@ +FROM alpine:latest AS builder +RUN apk add cargo +RUN wget -O source.tar.gz \ + $(wget -qO- https://api.github.com/repos/mbrubeck/agate/releases/latest \ + | sed -nE 's/^.*"tarball_url"\s*:\s*"([^"]+)".*$/\1/p' \ + ) \ + && tar xzf source.tar.gz \ + && mv /mbrubeck-agate-* /agate \ + && cd agate \ + && cargo build --release + + +FROM alpine:latest +RUN apk add --update --no-cache libgcc \ + && mkdir -p /app/.certificates \ + && mkdir /gmi \ + && chown daemon:daemon /app/.certificates +COPY --from=builder /agate/target/release/agate /usr/bin/agate +COPY ./start.sh /app + +ENV LANG=en-US \ + HOSTNAME=example.com +VOLUME ["/app/.certificates", "/gmi"] +EXPOSE 1965 + +USER daemon +WORKDIR /app + +ENTRYPOINT ["/bin/sh", "start.sh"] + diff --git a/agate/README.md b/agate/README.md new file mode 100644 index 0000000..970e4c3 --- /dev/null +++ b/agate/README.md @@ -0,0 +1,53 @@ +# Install agate in a docker container +(these instructions assume you use linux and have some experience with both docker and the command line) +## obtain the source code + +There are currently no container images online so you have to build the image yourself before you can use it. +There are two options available for this: downloading a release or cloning the repository with `git`. +I will explain both methods but if you're unsure which method to use, I would recommend the release for new comers because it's probably more tested so you'll encounter less problems. + +### downloading the release tarball + +Download the tarball. Go to [https://github.com/mbrubeck/agate/releases/latest](https://github.com/mbrubeck/agate/releases/latest), and copy the url of the source code tarball. + +``` +wget URL +``` + +Then unpack the tarball and remove it afterwards: +``` +tar -xzf tarball.tar.gz +rm tarball.tar.gz +``` + +### clone the repository with git + +I assume you have git already installed. If not, please search on how to do it in the internet. + +``` +git clone https://github.com/mbrubeck/agate +cd agate +``` + +## build the image +Enter the `tools/docker` directory: + +``` +cd tools/docker +``` +And now build the docker image: + +``` +docker build -t agate . +``` +This process will take a few minutes because all the rust modules have to be compiled from source. + +## start the docker container + +``` +docker run -t -d --name agate -p 1965:1965 -v /var/www/gmi:/gmi -v /var/www/gmi/.certificates:/app/.certificates -e HOSTNAME=example.org -e LANG=en-US agate:latest +``` + +You have to replace `/var/www/gmi/` with the folder where you'd like to have gemtext files and `/var/www/gmi/.certificates/` with the folder where you'd like to have your certificates stored. You also have to have to replace `example.org` with your domain name and if plan to speak in a different language than english in your gemini space than you should replace `en-US` with your countries language code (for example de-DE or fr-CA). + +## That's it! Now have agate running in a docker container! diff --git a/agate/start.sh b/agate/start.sh new file mode 100644 index 0000000..e9d028b --- /dev/null +++ b/agate/start.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +exec agate --content /gmi/ \ + --hostname ${HOSTNAME} \ + --lang ${LANG} + diff --git a/docker-compose.yaml b/docker-compose.yaml index 7a5cf2e..8664ebd 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -14,3 +14,7 @@ services: toolbox: build: ./toolbox image: elfrinjo/toolbox:latest + + agate: + build: ./agate + image: elfrinjo/agate:latest