From 92498e2665478f24e803e2af9c469398e0aa6389 Mon Sep 17 00:00:00 2001 From: Annie Elequin Date: Thu, 16 Sep 2021 14:18:39 -0400 Subject: [PATCH] replace mautrix-whatsapp with mautrix-groupme --- .gitlab-ci.yml | 38 +------------------ Dockerfile | 6 +-- Dockerfile.ci | 6 +-- config/config.go | 6 +-- docker-run.sh | 8 ++-- helm/mautrix-whatsapp/Chart.yaml | 6 +-- helm/mautrix-whatsapp/templates/_helpers.tpl | 16 ++++---- .../mautrix-whatsapp/templates/configmap.yaml | 6 +-- .../templates/deployment.yaml | 12 +++--- helm/mautrix-whatsapp/templates/service.yaml | 6 +-- .../templates/serviceaccount.yaml | 4 +- main.go | 6 +-- 12 files changed, 42 insertions(+), 78 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 38b1255..13463d3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 7b4224e..2128569 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/Dockerfile.ci b/Dockerfile.ci index d5e016f..44ce7f9 100644 --- a/Dockerfile.ci +++ b/Dockerfile.ci @@ -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 diff --git a/config/config.go b/config/config.go index e2df2ac..e84b598 100644 --- a/config/config.go +++ b/config/config.go @@ -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() } diff --git a/docker-run.sh b/docker-run.sh index dce6894..011e946 100755 --- a/docker-run.sh +++ b/docker-run.sh @@ -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 diff --git a/helm/mautrix-whatsapp/Chart.yaml b/helm/mautrix-whatsapp/Chart.yaml index 2cf274c..3a9c99d 100644 --- a/helm/mautrix-whatsapp/Chart.yaml +++ b/helm/mautrix-whatsapp/Chart.yaml @@ -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 diff --git a/helm/mautrix-whatsapp/templates/_helpers.tpl b/helm/mautrix-whatsapp/templates/_helpers.tpl index 1255560..6935623 100644 --- a/helm/mautrix-whatsapp/templates/_helpers.tpl +++ b/helm/mautrix-whatsapp/templates/_helpers.tpl @@ -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 -}} diff --git a/helm/mautrix-whatsapp/templates/configmap.yaml b/helm/mautrix-whatsapp/templates/configmap.yaml index 9abd656..43acefe 100644 --- a/helm/mautrix-whatsapp/templates/configmap.yaml +++ b/helm/mautrix-whatsapp/templates/configmap.yaml @@ -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 }} diff --git a/helm/mautrix-whatsapp/templates/deployment.yaml b/helm/mautrix-whatsapp/templates/deployment.yaml index 0bd5581..ba8faca 100644 --- a/helm/mautrix-whatsapp/templates/deployment.yaml +++ b/helm/mautrix-whatsapp/templates/deployment.yaml @@ -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 }} diff --git a/helm/mautrix-whatsapp/templates/service.yaml b/helm/mautrix-whatsapp/templates/service.yaml index 94145e7..6a86550 100644 --- a/helm/mautrix-whatsapp/templates/service.yaml +++ b/helm/mautrix-whatsapp/templates/service.yaml @@ -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 }} diff --git a/helm/mautrix-whatsapp/templates/serviceaccount.yaml b/helm/mautrix-whatsapp/templates/serviceaccount.yaml index 57903c5..9aac194 100644 --- a/helm/mautrix-whatsapp/templates/serviceaccount.yaml +++ b/helm/mautrix-whatsapp/templates/serviceaccount.yaml @@ -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 -}} diff --git a/main.go b/main.go index cee24f8..a5ae795 100644 --- a/main.go +++ b/main.go @@ -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 ] [-r ] [-g] [--migrate-db ]") + "mautrix-groupme - A Matrix-GroupMe puppeting bridge.", + "mautrix-groupme [-h] [-c ] [-r ] [-g] [--migrate-db ]") err := flag.Parse() if err != nil { _, _ = fmt.Fprintln(os.Stderr, err)