Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Slack-Integration #48

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 0 additions & 68 deletions README.md

This file was deleted.

4 changes: 2 additions & 2 deletions templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ Installed components:
Thank you for installing dacruz21/matrix-chart! If you have any questions or run into any issues, please file a GitHub issue or join us at #matrix-chart:typokign.com.

{{ if .Values.ingress.enabled }}
Your Synapse homeserver should soon be available at https://{{ .Values.ingress.hosts.synapse }}
Your Synapse homeserver should soon be available at http://{{ .Values.ingress.hosts.synapse }}
{{- if .Values.riot.enabled }}
Your Element Web instance should soon be available at https://{{ .Values.ingress.hosts.riot }}
Your Element Web instance should soon be available at http://{{ .Values.ingress.hosts.riot }}
{{- end }}
{{- end }}

Expand Down
4 changes: 2 additions & 2 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ Synapse hostname prepended with https:// to form a complete URL
*/}}
{{- define "matrix.baseUrl" -}}
{{- if .Values.matrix.hostname }}
{{- printf "https://%s" .Values.matrix.hostname -}}
{{- printf "http://%s" .Values.matrix.hostname -}}
{{- else }}
{{- printf "https://%s" .Values.ingress.hosts.synapse -}}
{{- printf "http://%s" .Values.ingress.hosts.synapse -}}
{{- end }}
{{- end }}

Expand Down
3 changes: 3 additions & 0 deletions templates/bridge-irc/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ spec:
containers:
- name: "bridge-irc"
image: "{{ .Values.bridges.irc.image.repository }}:{{ .Values.bridges.irc.image.tag }}"
command:
- "npm"
args: [ "start", "-c", "/data/config.yaml", "-f", "/data/appservice-registration-irc.yaml" ]
imagePullPolicy: {{ .Values.bridges.irc.image.pullPolicy }}
{{- if not .Values.bridges.irc.databaseSslVerify }}
env:
Expand Down
234 changes: 234 additions & 0 deletions templates/bridge-slack/_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
{{- define "matrix.slack.config" }}
homeserver:
# The domain name of your homeserver
#
server_name: "{{ .Values.matrix.serverName }}"

# The URL for connecting to your homeserver
#
url: "{{ include "matrix.baseUrl" . }}"

# The public facing url for media on your homeserver.
# This is usually the public url of your homeserver.
# Optional. Defaults to the value of `url`.
#
#media_url: "http://my.server.here"

# Optional. The maximum size of a uploaded file to Matrix in bytes. No limit by default
#
#max_upload_size: 104857600

# Optional. Used to specify the port of the appservice in the config, rather than the command line.
# If this is defined, it will **override** the port given in the process arguments.
#
#appservice_port: 5858

# The prefix to give Slack users on the Matrix server
#
username_prefix: "slack_"

# Settings for database connection
# Optional. Defaults engine to "nedb".
#
db:
# Which database engine to use.
# Recommended: "postgres"
# Deprecated: "nedb"
#
engine: "postgres"

# A postgres connection string (unused if using nedb)
#
connectionString: connectionString: {{ printf (include "matrix.postgresUri" .) .Values.bridges.slack.database | quote }}

# Optional. Use a matrix room to issue link and unlink commands to the bridge
#
matrix_admin_room: {{ .Values.bridges.slack.matrix_admin_room | quote }}

# Optional. TLS files to be used when handling Slack requests
#tls:
#key_file: /path/to/tls.key
#crt_file: /path/to/tls.crt

# Real Time Messaging API (RTM)
# Optional if slack_hook_port and inbound_uri_prefix are defined, required otherwise.
#
rtm:
# Use the RTM API to listen for requests, which does not require
# the bridge to listen on the hook port.
# You should leave this enabled, unless you plan to use the
# bridge exclusively for webhooks.
#
enable: true

# Logging level specific to RTM traffic.
#
logging: "silent"

# Port for incoming Slack requests from webhooks and event API messages
# Optional if using RTM API, required otherwise.
#
slack_hook_port: 9898

# Prefix of incoming requests to strip. This is NOT the bind host.
# Unlike most of the other urls, this one cannot use localhost,
# as this one must be publicly visible to the Slack API.
# Optional if using RTM API, required otherwise.
#
#inbound_uri_prefix: "https://my.server.here:9898/"

# Optional. Allow users to add channels dynamically by using oauth, or puppet themselves.
#
#oauth2:
#client_id: ""
#client_secret: ""

# A prefix similar to inbound_uri_prefix for oauth2 requests. inbound_uri_prefix will be used if this is not set
# Optional
#
#redirect_prefix: "https://my.server.here:9898/mycustomoauthendpoint"

# Optional
logging:
console: "info" # One of "debug", "info", "warning", "error", "silent"

# Files that the bridge may log into. The key is the minimum level to report.
#
files:
"./debug.log": "info"
"./error.log": "error"

# Optional. Enable metrics reporting on http://0.0.0.0:bridgePort/metrics which can be scraped by prometheus
#
enable_metrics: true

# Optional. Sync team users and channels
#
team_sync:
# Entry for a single team
# T0123ABCDEF:
# channels:
# enabled: true
# # Allow or deny private channels from being synced. Defaults to true.
# #
# allow_private: true
#
# # Optional. blacklist for channel ids. Trumps the whitelist.
# #
# #blacklist: ['CVCCPEY9X', 'C0108F9K37X']
#
# # Optional. whitelist for channel ids.
# #
# #whitelist: []
#
# # Prefix for room aliases in Matrix
# #
# #alias_prefix: "slack_"
#
# # Should sync *all* team users to Matrix
# #
# users:
# enabled: true
# Defaults for all other teams
all:
channels:
enabled: false
#whitelist: []
#blacklist: []
#alias_prefix: "slack_"
users:
enabled: false

# Optional.
#
provisioning:
enabled: true

# Should the bridge deny users bridging channels to private rooms.
#
require_public_room: true

# Should the bridge allow users to bridge private channels.
#
allow_private_channels: true
limits:
room_count: 20
team_count: 1

# Allow deny list for which Slack channels may be bridged.
# If allow is defined, all other channels are blocked by default
# If deny is defined, all other channels are allowed by default
# If both are defined, allow takes precedence.
#
# channel_adl:
# allow:
# #- "CCZ41UJV7"
# #- "#open.*"
# deny:
# #- "CRBCPA771"
# #- "#secret.*"

# Optional. Allows Matrix users to optionally authenticate their Slack accounts.
# When a Matrix user posts, the bridge will post using their Slack account.
#
puppeting:
# Should the bridge allow users to puppet their accounts
#
enabled: false

# Should the bridge send users a onboarding message when
# they join a Slack channel for the first time.
#
onboard_users: false

# Settings regarding who can send direct messages.
# If allow is defined, all other users are blocked by default
# If deny is defined, all other users are allowed by default
# If both are defined, allow takes precedence.
#
direct_messages:
allow:
# Which Slack users may DM Matrix users.
#
slack:
#- "U0156TG3W48"

# Which Matrix users may DM Slack users.
#
matrix:
#- "@badactor:badhost"
#- "@.*:badhost"

deny:
# Which Slack users may NOT DM Matrix users.
#
slack:
#- "U0156TG3W48"

# Which Matrix users may NOT DM Slack users.
#
matrix:
#- "@badactor:badhost"
#- "@.*:badhost"

# Optional. Set the bot's profile on startup
bot_profile:
# Optional. Set the displayname.
#
displayname: "Slack Bridge"

# Optional. Set the avatar.
#
avatar_url: "mxc://half-shot.uk/ea64c71ee946ca2f61379abefe2c7d977d276fbb"

# Optional. Enable encryption in DMs and private rooms.
encryption:
# Should encryption be enabled
#
enabled: false

# The URL where the bridge can access pantalaimon
#
pantalaimon_url: "http://localhost:8004"

{{- end }}
15 changes: 15 additions & 0 deletions templates/bridge-slack/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Shared secret for the slack server
*/}}
{{- define "matrix.slack.as_token" -}}
{{- randAlphaNum 64 -}}
{{- end }}

{{- define "matrix.slack.hs_token" -}}
{{- randAlphaNum 64 -}}
{{- end }}

{{- define "matrix.slack.passkey" -}}
{{- genPrivateKey "rsa" -}}
{{- end -}}
24 changes: 24 additions & 0 deletions templates/bridge-slack/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{- if .Values.bridges.slack.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "matrix.fullname" . }}-slack-config
labels:
{{ include "matrix.labels" . | nindent 4}}
data:
config.yaml: |
{{ include "matrix.slack.config" . | nindent 4 }}
registration.yaml: |
id: appservice-slack
as_token: "{{ include "matrix.slack.as_token" . }}"
hs_token: "{{ include "matrix.slack.hs_token" . }}"
namespaces:
users:
- exclusive: true
regex: '@slack_.*:{{ include "matrix.fullname" . }}'
aliases:
- exclusive: true
regex: '#slack_.*:{{ include "matrix.fullname" . }}'
url: "http://{{ include "matrix.fullname" . }}-bridge-slack:{{ .Values.bridges.slack.service.port }}"
sender_localpart: slackbot
{{- end }}
14 changes: 14 additions & 0 deletions templates/bridge-slack/data-pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if .Values.bridges.slack.enabled }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "matrix.fullname" . }}-slack-data
labels:
{{ include "matrix.labels" . | nindent 4}}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.bridges.slack.data.capacity }}
{{- end }}
Loading