forked from tangled.org/core
Monorepo for Tangled — https://tangled.org

docker: move to @tangled.sh/knot-docker

Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.sh>

anirudh.fi de3ab1d5 7d8fff21

verified
Changed files
+5 -127
docker
rootfs
etc
s6-overlay
s6-rc.d
create-sshd-host-keys
knotserver
dependencies.d
run
sshd
user
contents.d
scripts
ssh
sshd_config.d
docs
-37
docker/Dockerfile
···
-
FROM docker.io/golang:1.24-alpine3.21 AS build
-
-
ENV CGO_ENABLED=1
-
WORKDIR /usr/src/app
-
COPY go.mod go.sum ./
-
-
RUN apk add --no-cache gcc musl-dev
-
RUN go mod download
-
-
COPY . .
-
RUN go build -v \
-
-o /usr/local/bin/knot \
-
-ldflags='-s -w -extldflags "-static"' \
-
./cmd/knot
-
-
FROM docker.io/alpine:3.21
-
-
LABEL org.opencontainers.image.title=Tangled
-
LABEL org.opencontainers.image.description="Tangled is a decentralized and open code collaboration platform, built on atproto."
-
LABEL org.opencontainers.image.vendor=Tangled.sh
-
LABEL org.opencontainers.image.licenses=MIT
-
LABEL org.opencontainers.image.url=https://tangled.sh
-
LABEL org.opencontainers.image.source=https://tangled.sh/@tangled.sh/core
-
-
RUN apk add --no-cache shadow s6-overlay execline openssh git && \
-
adduser --disabled-password git && \
-
# We need to set password anyway since otherwise ssh won't work
-
head -c 32 /dev/random | base64 | tr -dc 'a-zA-Z0-9' | passwd git --stdin && \
-
mkdir /app && mkdir /home/git/repositories
-
-
COPY --from=build /usr/local/bin/knot /usr/local/bin
-
COPY docker/rootfs/ .
-
-
EXPOSE 22
-
EXPOSE 5555
-
-
ENTRYPOINT ["/bin/sh", "-c", "chown git:git /app && chown git:git /home/git/repositories && /init"]
-33
docker/docker-compose.yml
···
-
services:
-
knot:
-
build:
-
context: ..
-
dockerfile: docker/Dockerfile
-
environment:
-
KNOT_SERVER_HOSTNAME: ${KNOT_SERVER_HOSTNAME}
-
KNOT_SERVER_SECRET: ${KNOT_SERVER_SECRET}
-
KNOT_SERVER_DB_PATH: "/app/knotserver.db"
-
KNOT_REPO_SCAN_PATH: "/home/git/repositories"
-
volumes:
-
- "./keys:/etc/ssh/keys"
-
- "./repositories:/home/git/repositories"
-
- "./server:/app"
-
ports:
-
- "2222:22"
-
frontend:
-
image: caddy:2-alpine
-
command: >
-
caddy
-
reverse-proxy
-
--from ${KNOT_SERVER_HOSTNAME}
-
--to knot:5555
-
depends_on:
-
- knot
-
ports:
-
- "443:443"
-
- "443:443/udp"
-
volumes:
-
- caddy_data:/data
-
restart: always
-
volumes:
-
caddy_data:
-1
docker/rootfs/etc/s6-overlay/s6-rc.d/create-sshd-host-keys/type
···
-
oneshot
-1
docker/rootfs/etc/s6-overlay/s6-rc.d/create-sshd-host-keys/up
···
-
/etc/s6-overlay/scripts/create-sshd-host-keys
docker/rootfs/etc/s6-overlay/s6-rc.d/knotserver/dependencies.d/base

This is a binary file and will not be displayed.

-3
docker/rootfs/etc/s6-overlay/s6-rc.d/knotserver/run
···
-
#!/command/with-contenv ash
-
-
exec s6-setuidgid git /usr/local/bin/knot server
-1
docker/rootfs/etc/s6-overlay/s6-rc.d/knotserver/type
···
-
longrun
docker/rootfs/etc/s6-overlay/s6-rc.d/sshd/dependencies.d/base

This is a binary file and will not be displayed.

docker/rootfs/etc/s6-overlay/s6-rc.d/sshd/dependencies.d/create-sshd-host-keys

This is a binary file and will not be displayed.

-3
docker/rootfs/etc/s6-overlay/s6-rc.d/sshd/run
···
-
#!/usr/bin/execlineb -P
-
-
/usr/sbin/sshd -e -D
-1
docker/rootfs/etc/s6-overlay/s6-rc.d/sshd/type
···
-
longrun
docker/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/knotserver

This is a binary file and will not be displayed.

docker/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/sshd

This is a binary file and will not be displayed.

-21
docker/rootfs/etc/s6-overlay/scripts/create-sshd-host-keys
···
-
#!/usr/bin/execlineb -P
-
-
foreground {
-
if -n { test -d /etc/ssh/keys }
-
mkdir /etc/ssh/keys
-
}
-
-
foreground {
-
if -n { test -f /etc/ssh/keys/ssh_host_rsa_key }
-
ssh-keygen -t rsa -f /etc/ssh/keys/ssh_host_rsa_key -q -N ""
-
}
-
-
foreground {
-
if -n { test -f /etc/ssh/keys/ssh_host_ecdsa_key }
-
ssh-keygen -t rsa -f /etc/ssh/keys/ssh_host_ecdsa_key -q -N ""
-
}
-
-
foreground {
-
if -n { test -f /etc/ssh/keys/ssh_host_ed25519_key }
-
ssh-keygen -t rsa -f /etc/ssh/keys/ssh_host_ed25519_key -q -N ""
-
}
-9
docker/rootfs/etc/ssh/sshd_config.d/tangled_sshd.conf
···
-
HostKey /etc/ssh/keys/ssh_host_rsa_key
-
HostKey /etc/ssh/keys/ssh_host_ecdsa_key
-
HostKey /etc/ssh/keys/ssh_host_ed25519_key
-
-
PasswordAuthentication no
-
-
Match User git
-
AuthorizedKeysCommand /usr/local/bin/knot keys -o authorized-keys
-
AuthorizedKeysCommandUser nobody
+5 -17
docs/knot-hosting.md
···
3. A valid SSL certificate for your domain.
There's a couple of ways to get started:
-
* NixOS: refer to [flake.nix](https://tangled.sh/@tangled.sh/core/blob/master/flake.nix)
-
* Docker: Documented below.
+
* NixOS: refer to
+
[flake.nix](https://tangled.sh/@tangled.sh/core/blob/master/flake.nix)
+
* Docker: Documented at
+
[@tangled.sh/knot-docker](https://tangled.sh/@tangled.sh/knot-docker)
+
(community maintained: support is not guaranteed!)
* Manual: Documented below.
-
-
## docker setup
-
-
Clone this repository:
-
-
```
-
git clone https://tangled.sh/@tangled.sh/core
-
```
-
-
Modify the `docker/docker-compose.yml`, specifically the
-
`KNOT_SERVER_SECRET` and `KNOT_SERVER_HOSTNAME` env vars. Then run:
-
-
```
-
docker compose -f docker/docker-compose.yml up
-
```
## manual setup