blueprints.git

commit 4ec6fba9cddd06b8a913a09d40cb9ec510ab4a08

Author: Adam <git@apiote.xyz>

add kosync

 kosync/Dockerfile | 9 +++++++++
 kosync/build.sh | 16 ++++++++++++++++


diff --git a/kosync/Dockerfile b/kosync/Dockerfile
new file mode 100644
index 0000000000000000000000000000000000000000..8225f3f71a7c8873cdd1756a0cdc7b0eb7d60087
--- /dev/null
+++ b/kosync/Dockerfile
@@ -0,0 +1,9 @@
+FROM alpine:edge
+RUN apk add git go openssh-client sqlite-dev
+WORKDIR /root
+RUN mkdir .ssh
+COPY ssh_key .ssh/id_ed25519
+COPY known_hosts .ssh/known_hosts
+COPY build.sh build.sh
+RUN chmod 755 build.sh
+ENTRYPOINT ["./build.sh"]




diff --git a/kosync/build.sh b/kosync/build.sh
new file mode 100755
index 0000000000000000000000000000000000000000..1d87297468721d1b597b0e5785b7224014b5efc0
--- /dev/null
+++ b/kosync/build.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -ex
+
+item="$1"
+
+git clone https://github.com/yeeac/kosyncsrv
+cd kosyncsrv
+go build
+commit=$(git show --pretty=oneline --abbrev-commit --name-only | head -n1 | cut -d ' ' -f 1)
+timestamp=$(date '+%Y%m%dT%H%M')
+scp kosync deploy@host.containers.internal:toys/goose/${item}/kosync_${timestamp}_${commit}
+ssh deploy@host.containers.internal "cp ~/toys/goose/${item}/kosync_${timestamp}_${commit} /tmp/kosync"
+ssh deploy@host.containers.internal "chmod 755 /tmp/kosync"
+ssh deploy@host.containers.internal "doas cp /tmp/kosync /usr/bin/kosync"
+ssh deploy@host.containers.internal "doas -u www doas /etc/init.d/kosync restart"