replace mautrix-whatsapp with mautrix-groupme

This commit is contained in:
Annie Elequin 2021-09-16 14:18:39 -04:00
parent 47962cafbc
commit 92498e2665
12 changed files with 42 additions and 78 deletions

View File

@ -37,14 +37,6 @@ build amd64:
<<: *build
image: dock.mau.dev/tulir/gomuks-build-docker:linux-amd64
# build arm64:
# <<: *build
# image: dock.mau.dev/tulir/gomuks-build-docker:linux-arm64
# build arm:
# <<: *build
# image: dock.mau.dev/tulir/gomuks-build-docker:linux-arm
build docker amd64:
<<: *build-docker
tags:
@ -63,32 +55,4 @@ build docker amd64:
apk add --update curl
rm -rf /var/cache/apk/*
curl "$NOVA_ADMIN_API_URL" -H "Content-Type: application/json" -d '{"password":"'"$NOVA_ADMIN_NIGHTLY_PASS"'","bridge":"'$NOVA_BRIDGE_TYPE'","image":"'$CI_REGISTRY_IMAGE':'$CI_COMMIT_SHA'-amd64"}'
fi
# build docker arm64:
# <<: *build-docker
# tags:
# - arm64
# dependencies:
# - build arm64
# needs:
# - build arm64
# variables:
# DOCKER_ARCH: arm64
# manifest:
# stage: manifest
# variables:
# GIT_STRATEGY: none
# before_script:
# - "mkdir -p $HOME/.docker && echo '{\"experimental\": \"enabled\"}' > $HOME/.docker/config.json"
# - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
# needs:
# - build docker amd64
# - build docker arm64
# script:
# - docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-amd64
# - docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-arm64
# - if [ "$CI_COMMIT_BRANCH" = "master" ]; then docker manifest create $CI_REGISTRY_IMAGE:latest $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-amd64 $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-arm64 && docker manifest push $CI_REGISTRY_IMAGE:latest; fi
# - if [ "$CI_COMMIT_BRANCH" != "master" ]; then docker manifest create $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-amd64 $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-arm64 && docker manifest push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME; fi
# - docker rmi $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-amd64 $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-arm64
fi

View File

@ -9,7 +9,7 @@ RUN apk add --no-cache git ca-certificates build-base su-exec olm-dev
COPY . /build
WORKDIR /build
RUN go build -o /usr/bin/mautrix-whatsapp
RUN go build -o /usr/bin/mautrix-groupme
FROM alpine:3.12
@ -23,8 +23,8 @@ ENV UID=1337 \
RUN apk add --no-cache ffmpeg su-exec ca-certificates olm bash jq yq@edge curl
COPY --from=builder /usr/bin/mautrix-whatsapp /usr/bin/mautrix-whatsapp
COPY --from=builder /build/example-config.yaml /opt/mautrix-whatsapp/example-config.yaml
COPY --from=builder /usr/bin/mautrix-groupme /usr/bin/mautrix-groupme
COPY --from=builder /build/example-config.yaml /opt/mautrix-groupme/example-config.yaml
COPY --from=builder /build/docker-run.sh /docker-run.sh
VOLUME /data

View File

@ -10,9 +10,9 @@ ENV UID=1337 \
RUN apk add --no-cache ffmpeg su-exec ca-certificates bash jq curl yq@edge
ARG EXECUTABLE=./mautrix-whatsapp
COPY $EXECUTABLE /usr/bin/mautrix-whatsapp
COPY ./example-config.yaml /opt/mautrix-whatsapp/example-config.yaml
ARG EXECUTABLE=./mautrix-groupme
COPY $EXECUTABLE /usr/bin/mautrix-groupme
COPY ./example-config.yaml /opt/mautrix-groupme/example-config.yaml
COPY ./docker-run.sh /docker-run.sh
VOLUME /data

View File

@ -70,7 +70,7 @@ type Config struct {
WhatsApp struct {
OSName string `yaml:"os_name"`
BrowserName string `yaml:"browser_name"`
} `yaml:"whatsapp"`
} `yaml:"groupme"`
Bridge BridgeConfig `yaml:"bridge"`
@ -80,8 +80,8 @@ type Config struct {
func (config *Config) setDefaults() {
config.AppService.Database.MaxOpenConns = 20
config.AppService.Database.MaxIdleConns = 2
config.WhatsApp.OSName = "Mautrix-WhatsApp bridge"
config.WhatsApp.BrowserName = "mx-wa"
config.GroupMe.OSName = "Mautrix-GroupMe bridge"
config.GroupMe.BrowserName = "mx-wa"
config.Bridge.setDefaults()
}

View File

@ -6,11 +6,11 @@ fi
# Define functions.
function fixperms {
chown -R $UID:$GID /data /opt/mautrix-whatsapp
chown -R $UID:$GID /data /opt/mautrix-groupme
}
if [[ ! -f /data/config.yaml ]]; then
cp /opt/mautrix-whatsapp/example-config.yaml /data/config.yaml
cp /opt/mautrix-groupme/example-config.yaml /data/config.yaml
echo "Didn't find a config file."
echo "Copied default config file to /data/config.yaml"
echo "Modify that config file to your liking."
@ -19,7 +19,7 @@ if [[ ! -f /data/config.yaml ]]; then
fi
if [[ ! -f /data/registration.yaml ]]; then
/usr/bin/mautrix-whatsapp -g -c /data/config.yaml -r /data/registration.yaml
/usr/bin/mautrix-groupme -g -c /data/config.yaml -r /data/registration.yaml
echo "Didn't find a registration file."
echo "Generated one for you."
echo "Copy that over to synapses app service directory."
@ -28,4 +28,4 @@ fi
cd /data
fixperms
exec su-exec $UID:$GID /usr/bin/mautrix-whatsapp
exec su-exec $UID:$GID /usr/bin/mautrix-groupme

View File

@ -1,12 +1,12 @@
apiVersion: v1
name: mautrix-whatsapp
name: mautrix-groupme
version: 0.1.0
appVersion: "0.1.0"
description: A Matrix-Whatsapp puppeting bridge.
description: A Matrix-GroupMe puppeting bridge.
keywords:
- matrix
- bridge
- whatsapp
- groupme
maintainers:
- name: Tulir Asokan
email: tulir@maunium.net

View File

@ -1,7 +1,7 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "mautrix-whatsapp.name" -}}
{{- define "mautrix-groupme.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
@ -10,7 +10,7 @@ Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "mautrix-whatsapp.fullname" -}}
{{- define "mautrix-groupme.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name.
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "mautrix-whatsapp.chart" -}}
{{- define "mautrix-groupme.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "mautrix-whatsapp.labels" -}}
app.kubernetes.io/name: {{ include "mautrix-whatsapp.name" . }}
helm.sh/chart: {{ include "mautrix-whatsapp.chart" . }}
{{- define "mautrix-groupme.labels" -}}
app.kubernetes.io/name: {{ include "mautrix-groupme.name" . }}
helm.sh/chart: {{ include "mautrix-groupme.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
@ -46,9 +46,9 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{/*
Create the name of the service account to use
*/}}
{{- define "mautrix-whatsapp.serviceAccountName" -}}
{{- define "mautrix-groupme.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "mautrix-whatsapp.fullname" .) .Values.serviceAccount.name }}
{{ default (include "mautrix-groupme.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}

View File

@ -1,12 +1,12 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "mautrix-whatsapp.fullname" . }}
name: {{ template "mautrix-groupme.fullname" . }}
labels:
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app.kubernetes.io/name: {{ template "mautrix-whatsapp.name" . }}
app.kubernetes.io/name: {{ template "mautrix-groupme.name" . }}
data:
config.yaml: |
homeserver:
@ -14,7 +14,7 @@ data:
domain: {{ .Values.homeserver.domain }}
appservice:
address: http://{{ include "mautrix-whatsapp.fullname" . }}:{{ .Values.service.port }}
address: http://{{ include "mautrix-groupme.fullname" . }}:{{ .Values.service.port }}
hostname: 0.0.0.0
port: {{ .Values.service.port }}

View File

@ -1,14 +1,14 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "mautrix-whatsapp.fullname" . }}
name: {{ include "mautrix-groupme.fullname" . }}
labels:
{{- include "mautrix-whatsapp.labels" . | nindent 4 }}
{{- include "mautrix-groupme.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: {{ include "mautrix-whatsapp.name" . }}
app.kubernetes.io/name: {{ include "mautrix-groupme.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
{{- if .Values.podAnnotations }}
@ -17,10 +17,10 @@ spec:
{{- end }}
metadata:
labels:
app.kubernetes.io/name: {{ include "mautrix-whatsapp.name" . }}
app.kubernetes.io/name: {{ include "mautrix-groupme.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
serviceAccountName: {{ template "mautrix-whatsapp.serviceAccountName" . }}
serviceAccountName: {{ template "mautrix-groupme.serviceAccountName" . }}
containers:
- name: {{ .Chart.Name }}
securityContext:
@ -51,7 +51,7 @@ spec:
volumes:
- name: config-volume
configMap:
name: {{ template "mautrix-whatsapp.fullname" . }}
name: {{ template "mautrix-groupme.fullname" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}

View File

@ -1,9 +1,9 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "mautrix-whatsapp.fullname" . }}
name: {{ include "mautrix-groupme.fullname" . }}
labels:
{{ include "mautrix-whatsapp.labels" . | indent 4 }}
{{ include "mautrix-groupme.labels" . | indent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
@ -12,5 +12,5 @@ spec:
protocol: TCP
name: http
selector:
app.kubernetes.io/name: {{ include "mautrix-whatsapp.name" . }}
app.kubernetes.io/name: {{ include "mautrix-groupme.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}

View File

@ -2,7 +2,7 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "mautrix-whatsapp.serviceAccountName" . }}
name: {{ template "mautrix-groupme.serviceAccountName" . }}
labels:
{{ include "mautrix-whatsapp.labels" . | indent 4 }}
{{ include "mautrix-groupme.labels" . | indent 4 }}
{{- end -}}

View File

@ -42,7 +42,7 @@ import (
var (
// These are static
Name = "mautrix-whatsapp"
Name = "mautrix-groupme"
URL = "https://github.com/tulir/mautrix-whatsapp"
// This is changed when making a release
Version = "0.1.5"
@ -438,8 +438,8 @@ func (bridge *Bridge) Main() {
func main() {
flag.SetHelpTitles(
"mautrix-whatsapp - A Matrix-WhatsApp puppeting bridge.",
"mautrix-whatsapp [-h] [-c <path>] [-r <path>] [-g] [--migrate-db <source type> <source uri>]")
"mautrix-groupme - A Matrix-GroupMe puppeting bridge.",
"mautrix-groupme [-h] [-c <path>] [-r <path>] [-g] [--migrate-db <source type> <source uri>]")
err := flag.Parse()
if err != nil {
_, _ = fmt.Fprintln(os.Stderr, err)