Skip to content
Merged
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
52 changes: 37 additions & 15 deletions cassandra-schema.cql
Original file line number Diff line number Diff line change
Expand Up @@ -1720,19 +1720,17 @@ CREATE TABLE galley_test.mls_proposal_refs (
AND speculative_retry = '99PERCENTILE';
CREATE KEYSPACE gundeck_test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true;

CREATE TABLE gundeck_test.push (
ptoken text,
app text,
transport int,
client text,
connection blob,
usr uuid,
PRIMARY KEY (ptoken, app, transport)
) WITH CLUSTERING ORDER BY (app ASC, transport ASC)
AND bloom_filter_fp_chance = 0.1
CREATE TABLE gundeck_test.data_migration (
id int,
version int,
date timestamp,
descr text,
PRIMARY KEY (id, version)
) WITH CLUSTERING ORDER BY (version ASC)
AND bloom_filter_fp_chance = 0.01
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy'}
AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
AND dclocal_read_repair_chance = 0.1
Expand Down Expand Up @@ -1790,10 +1788,16 @@ CREATE TABLE gundeck_test.meta (
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';

CREATE TABLE gundeck_test.notification_payload (
id uuid PRIMARY KEY,
payload blob
) WITH bloom_filter_fp_chance = 0.1
CREATE TABLE gundeck_test.push (
ptoken text,
app text,
transport int,
client text,
connection blob,
usr uuid,
PRIMARY KEY (ptoken, app, transport)
) WITH CLUSTERING ORDER BY (app ASC, transport ASC)
AND bloom_filter_fp_chance = 0.1
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy'}
Expand Down Expand Up @@ -1832,6 +1836,24 @@ CREATE TABLE gundeck_test.user_push (
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';

CREATE TABLE gundeck_test.notification_payload (
id uuid PRIMARY KEY,
payload blob
) WITH bloom_filter_fp_chance = 0.1
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy'}
AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
AND dclocal_read_repair_chance = 0.1
AND default_time_to_live = 0
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';
CREATE KEYSPACE spar_test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true;

CREATE TABLE spar_test.bind_cookie (
Expand Down
1 change: 1 addition & 0 deletions changelog.d/2-features/delete-voip-tokens
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gundeck: Delete all APNS_VOIP and APNS_VOIP_SANDBOX push tokens
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ spec:
metadata:
name: "{{.Release.Name}}"
labels:
app: galley-migrate-data
app: galley-migrate-data
heritage: {{.Release.Service | quote }}
release: {{.Release.Name | quote }}
Expand Down
59 changes: 59 additions & 0 deletions charts/cassandra-migrations/templates/gundeck-migrate-data.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# This jobs runs migrations on the gundeck DB using the gundeck-migrate-data tool.
# The source for the tool can be found at services/gundeck in the wire-server
# repository.
{{- if .Values.enableGundeckMigrations }}
apiVersion: batch/v1
kind: Job
metadata:
name: gundeck-migrate-data
labels:
app: "cassandra-migrations"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-weight": "10"
"helm.sh/hook-delete-policy": "before-hook-creation"
spec:
template:
metadata:
name: "{{.Release.Name}}"
labels:
app: gundeck-migrate-data
heritage: {{.Release.Service | quote }}
release: {{.Release.Name | quote }}
chart: "{{.Chart.Name}}-{{.Chart.Version}}"
spec:
restartPolicy: OnFailure
containers:
- name: gundeck-migrate-data
image: "{{ .Values.images.gundeckMigrateData }}:{{ .Values.images.tag }}"
imagePullPolicy: {{ default "" .Values.imagePullPolicy | quote }}
{{- if eq (include "includeSecurityContext" .) "true" }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 12 }}
{{- end }}
args:
- --cassandra-host
- "{{ template "cassandraGundeckHost" . }}"
- --cassandra-port
- "9042"
- --cassandra-keyspace
- gundeck
{{- if eq (include "useTlsGundeck" .) "true" }}
- --tls-ca-certificate-file
- /certs/gundeck/{{- (include "tlsSecretRefGundeck" . | fromYaml).key }}
{{- end }}
{{- if eq (include "useTlsGundeck" .) "true" }}
volumeMounts:
- name: gundeck-cassandra-cert
mountPath: "/certs/gundeck"
{{- end }}
{{- if eq (include "useTlsGundeck" .) "true" }}
volumes:
- name: gundeck-cassandra-cert
secret:
secretName: {{ (include "tlsSecretRefGundeck" . | fromYaml).name }}
{{- end }}
{{- end }}
1 change: 1 addition & 0 deletions charts/cassandra-migrations/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ images:
galley: quay.io/wire/galley-schema
spar: quay.io/wire/spar-schema
galleyMigrateData: quay.io/wire/galley-migrate-data
gundeckMigrateData: quay.io/wire/gundeck-migrate-data
sparMigrateData: quay.io/wire/spar-migrate-data

# Setting cassandra host name and replication is mandatory to specify.
Expand Down
2 changes: 1 addition & 1 deletion nix/wire-server.nix
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ let
cargohold = [ "cargohold" "cargohold-integration" ];
federator = [ "federator" "federator-integration" ];
galley = [ "galley" "galley-integration" "galley-schema" "galley-migrate-data" ];
gundeck = [ "gundeck" "gundeck-integration" "gundeck-schema" ];
gundeck = [ "gundeck" "gundeck-integration" "gundeck-schema" "gundeck-migrate-data" ];
proxy = [ "proxy" ];
spar = [ "spar" "spar-integration" "spar-schema" "spar-migrate-data" ];
stern = [ "stern" "stern-integration" ];
Expand Down
4 changes: 4 additions & 0 deletions services/gundeck/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
, bytestring
, bytestring-conversion
, cassandra-util
, conduit
, containers
, criterion
, errors
Expand Down Expand Up @@ -153,8 +154,10 @@ mkDerivation {
bytestring
bytestring-conversion
cassandra-util
conduit
containers
exceptions
extended
gundeck-types
HsOpenSSL
http-client
Expand All @@ -175,6 +178,7 @@ mkDerivation {
tasty-ant-xml
tasty-hunit
text
time
tinylog
types-common
uuid
Expand Down
92 changes: 84 additions & 8 deletions services/gundeck/gundeck.cabal
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
cabal-version: 1.12
cabal-version: 3.0
name: gundeck
version: 1.45.0
synopsis: Push Notification Hub
category: Network
author: Wire Swiss GmbH
maintainer: Wire Swiss GmbH <backend@wire.com>
copyright: (c) 2017 Wire Swiss GmbH
license: AGPL-3
license: AGPL-3.0-only
license-file: LICENSE
build-type: Simple

Expand Down Expand Up @@ -46,6 +46,7 @@ library
Gundeck.Schema.Run
Gundeck.Schema.V1
Gundeck.Schema.V10
Gundeck.Schema.V11
Gundeck.Schema.V2
Gundeck.Schema.V3
Gundeck.Schema.V4
Expand Down Expand Up @@ -110,7 +111,7 @@ library
-Wredundant-constraints -Wunused-packages

build-depends:
aeson >=2.0.1.0
, aeson >=2.0.1.0
, amazonka >=2
, amazonka-core >=2
, amazonka-sns >=2
Expand Down Expand Up @@ -219,7 +220,7 @@ executable gundeck
-Wunused-packages

build-depends:
base
, base
, gundeck
, HsOpenSSL
, imports
Expand Down Expand Up @@ -288,7 +289,7 @@ executable gundeck-integration
-threaded -Wredundant-constraints -Wunused-packages

build-depends:
aeson
, aeson
, async
, base >=4 && <5
, base16-bytestring >=0.1
Expand Down Expand Up @@ -329,6 +330,81 @@ executable gundeck-integration

default-language: GHC2021

executable gundeck-migrate-data
main-is: ../main.hs
hs-source-dirs: migrate-data/src
default-extensions:
AllowAmbiguousTypes
BangPatterns
ConstraintKinds
DataKinds
DefaultSignatures
DeriveFunctor
DeriveGeneric
DeriveLift
DeriveTraversable
DerivingStrategies
DerivingVia
DuplicateRecordFields
EmptyCase
FlexibleContexts
FlexibleInstances
FunctionalDependencies
GADTs
InstanceSigs
KindSignatures
LambdaCase
MultiParamTypeClasses
MultiWayIf
NamedFieldPuns
NoImplicitPrelude
OverloadedRecordDot
OverloadedStrings
PackageImports
PatternSynonyms
PolyKinds
QuasiQuotes
RankNTypes
ScopedTypeVariables
StandaloneDeriving
TupleSections
TypeApplications
TypeFamilies
TypeFamilyDependencies
TypeOperators
UndecidableInstances
ViewPatterns

ghc-options:
-O2 -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates
-Wpartial-fields -fwarn-tabs -optP-Wno-nonportable-include-path
-threaded -Wredundant-constraints -Wunused-packages

-- cabal-fmt: expand migrate-data/src
other-modules:
Gundeck.DataMigration
Gundeck.DataMigration.Types
Run
V1_DeleteApnsVoipTokens

build-depends:
, base
, cassandra-util
, conduit
, exceptions
, extended
, imports
, optparse-applicative
, text
, time
, tinylog
, types-common

if flag(static)
ld-options: -static

default-language: GHC2021

executable gundeck-schema
main-is: Main.hs
hs-source-dirs: schema
Expand Down Expand Up @@ -380,7 +456,7 @@ executable gundeck-schema
-threaded -Wredundant-constraints -Wunused-packages

build-depends:
gundeck
, gundeck
, imports

if flag(static)
Expand Down Expand Up @@ -451,7 +527,7 @@ test-suite gundeck-tests
-threaded -Wredundant-constraints -Wunused-packages

build-depends:
aeson
, aeson
, aeson-pretty
, amazonka
, amazonka-core
Expand Down Expand Up @@ -540,7 +616,7 @@ benchmark gundeck-bench
-Wredundant-constraints -Wunused-packages

build-depends:
amazonka
, amazonka
, base
, criterion
, gundeck
Expand Down
1 change: 1 addition & 0 deletions services/gundeck/migrate-data/main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import Run
Loading