-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start-play.sh
executable file
·510 lines (446 loc) · 17.4 KB
/
start-play.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
#!/bin/bash
. "/root/.sdkman/bin/sdkman-init.sh"
cd /root
if [ -d "/etc/secrets" ]; then
echo "Running in k8 environment"
PLAY_KEY=$(cat /etc/secrets/play/secret | base64)
POSTGRES_PASSWORD=$(cat /etc/secrets/postgres/password)
SLACK_BOT_TOKEN=""
SLACK_CLIENT_SECRET=$(cat /etc/secrets/slack/client_secret)
SLACK_CLIENT_ID=$(cat /etc/secrets/slack/client_id)
SLACK_SIGNING_SECRET=$(cat /etc/secrets/slack/signing_secret)
SLACK_DEPLOY_URL=$(cat /etc/secrets/slack/deploy_url)
AUTH0_DOMAIN=$(cat /etc/secrets/auth0/domain)
AUTH0_CLIENT_ID=$(cat /etc/secrets/auth0/client_id)
AUTH0_AUDIENCE=$(cat /etc/secrets/auth0/audience)
SODIUM_KEY=$(cat /etc/secrets/sodium/key)
POSTGRES_PORT=5432
POSTGRES_HOST="meso-alert-postgres"
EMAIL_SMTP_HOST=smtp.eu.mailgun.org
EMAIL_SMTP_PORT=587
EMAIL_HOST=$(cat /etc/secrets/email/username)
EMAIL_HOST_PASSWORD=$(cat /etc/secrets/email/password)
else
echo "Running in staging environment"
. "/root/meso-alert-config.sh"
fi
#
# Non-secret k8 configuration changes should be made directly below without
# using an environment variable.
#
cat <<EOF > application-production.conf
email.smtpHost = "${EMAIL_SMTP_HOST}"
email.smtpPort = "${EMAIL_SMTP_PORT}"
email.host = "${EMAIL_HOST}"
email.hostPassword = "${EMAIL_HOST_PASSWORD}"
email.destination = "${EMAIL_DESTINATION}"
email.destinationSupport = "${EMAIL_DESTINATION_SUPPORT}"
play.filters.disabled+=play.filters.hosts.AllowedHostsFilter
play.http.secret.key="${PLAY_KEY}"
play.i18n.langs = ["en"]
slack.clientId = "${SLACK_CLIENT_ID}"
slack.clientSecret = "${SLACK_CLIENT_SECRET}"
slack.signingSecret = "${SLACK_SIGNING_SECRET}"
slack.botToken = "${SLACK_BOT_TOKEN}"
slack.deployURL = "${SLACK_DEPLOY_URL}"
auth0.domain = "${AUTH0_DOMAIN}"
auth0.clientId = "${AUTH0_CLIENT_ID}"
auth0.audience = "${AUTH0_AUDIENCE}"
sodium.secret="${SODIUM_KEY}"
akka.actor.allow-java-serialization = off
akka {
actor {
# which serializers are available under which key
serializers {
proto = "akka.remote.serialization.ProtobufSerializer"
}
# which interfaces / traits / classes should be handled by which serializer
serialization-bindings {
"actors.SlackSecretsActor\$SlackSecretsEvent" = proto
"actors.SlackSecretsActor\$SecretsState" = proto
}
}
}
meso-alert.db = {
connectionPool = "HikariCP" //use HikariCP for our connection pool
dataSourceClass = "org.postgresql.ds.PGSimpleDataSource"
properties = {
serverName = "${POSTGRES_HOST}"
portNumber = "${POSTGRES_PORT}"
databaseName = "meso-alert"
user = "meso-alert"
password = "${POSTGRES_PASSWORD}"
}
numThreads = 12
queueSize = 50000
}
slackChat.dispatcher {
executor = "thread-pool-executor"
throughput = 1
thread-pool-executor {
fixed-pool-size = off
core-pool-size-min = 2
core-pool-size-factor = 3.0
core-pool-size-max = 8
max-pool-size-min = 8
max-pool-size-factor = 3.0
max-pool-size-max = 24
task-queue-size = 5
}
}
slackClient.dispatcher {
executor = "thread-pool-executor"
throughput = 1
thread-pool-executor {
fixed-pool-size = off
core-pool-size-min = 2
core-pool-size-factor = 3.0
core-pool-size-max = 8
max-pool-size-min = 8
max-pool-size-factor = 3.0
max-pool-size-max = 24
task-queue-size = 5
}
}
database.dispatcher {
executor = "thread-pool-executor"
throughput = 1
thread-pool-executor {
fixed-pool-size = off
core-pool-size-min = 2
core-pool-size-factor = 3.0
core-pool-size-max = 8
max-pool-size-min = 8
max-pool-size-factor = 3.0
max-pool-size-max = 24
task-queue-size = 5
}
}
email.dispatcher {
executor = "thread-pool-executor"
throughput = 1
thread-pool-executor {
fixed-pool-size = off
core-pool-size-min = 2
core-pool-size-factor = 3.0
core-pool-size-max = 8
max-pool-size-min = 8
max-pool-size-factor = 3.0
max-pool-size-max = 24
task-queue-size = 5
}
}
encryption.dispatcher {
executor = "thread-pool-executor"
throughput = 1
thread-pool-executor {
fixed-pool-size = off
core-pool-size-min = 2
core-pool-size-factor = 3.0
core-pool-size-max = 8
max-pool-size-min = 8
max-pool-size-factor = 3.0
max-pool-size-max = 24
task-queue-size = 5
}
}
akka.persistence {
# When starting many persistent actors at the same time the journal
# and its data store is protected from being overloaded by limiting number
# of recoveries that can be in progress at the same time. When
# exceeding the limit the actors will wait until other recoveries have
# been completed.
max-concurrent-recoveries = 50
# Fully qualified class name providing a default internal stash overflow strategy.
# It needs to be a subclass of akka.persistence.StashOverflowStrategyConfigurator.
# The default strategy throws StashOverflowException.
internal-stash-overflow-strategy = "akka.persistence.ThrowExceptionConfigurator"
journal {
# Absolute path to the journal plugin configuration entry used by
# persistent actor by default.
# Persistent actor can override journalPluginId method
# in order to rely on a different journal plugin.
plugin = "akka.persistence.journal.inmem"
# List of journal plugins to start automatically. Use "" for the default journal plugin.
auto-start-journals = []
}
snapshot-store {
# Absolute path to the snapshot plugin configuration entry used by
# persistent actor by default.
# Persistent actor can override snapshotPluginId method
# in order to rely on a different snapshot plugin.
# It is not mandatory to specify a snapshot store plugin.
# If you don't use snapshots you don't have to configure it.
# Note that Cluster Sharding is using snapshots, so if you
# use Cluster Sharding you need to define a snapshot store plugin.
plugin = "akka.persistence.snapshot-store.local"
# List of snapshot stores to start automatically. Use "" for the default snapshot store.
auto-start-snapshot-stores = []
}
# used as default-snapshot store if no plugin configured
# (see akka.persistence.snapshot-store)
no-snapshot-store {
class = "akka.persistence.snapshot.NoSnapshotStore"
}
# Default reliable delivery settings.
at-least-once-delivery {
# Interval between re-delivery attempts.
redeliver-interval = 5s
# Maximum number of unconfirmed messages that will be sent in one
# re-delivery burst.
redelivery-burst-limit = 10000
# After this number of delivery attempts a
# ReliableRedelivery.UnconfirmedWarning, message will be sent to the actor.
warn-after-number-of-unconfirmed-attempts = 5
# Maximum number of unconfirmed messages that an actor with
# AtLeastOnceDelivery is allowed to hold in memory.
max-unconfirmed-messages = 100000
}
# Default persistent extension thread pools.
dispatchers {
# Dispatcher used by every plugin which does not declare explicit
# plugin-dispatcher field.
default-plugin-dispatcher {
type = PinnedDispatcher
executor = "thread-pool-executor"
}
# Default dispatcher for message replay.
default-replay-dispatcher {
type = Dispatcher
executor = "fork-join-executor"
fork-join-executor {
parallelism-min = 2
parallelism-max = 8
}
}
# Default dispatcher for streaming snapshot IO
default-stream-dispatcher {
type = Dispatcher
executor = "fork-join-executor"
fork-join-executor {
parallelism-min = 2
parallelism-max = 8
}
}
}
# Fallback settings for journal plugin configurations.
# These settings are used if they are not defined in plugin config section.
journal-plugin-fallback {
# Fully qualified class name providing journal plugin api implementation.
# It is mandatory to specify this property.
# The class must have a constructor without parameters or constructor with
# one com.typesafe.config.Config parameter.
class = ""
# Dispatcher for the plugin actor.
plugin-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"
# Dispatcher for message replay.
replay-dispatcher = "akka.persistence.dispatchers.default-replay-dispatcher"
# Removed: used to be the Maximum size of a persistent message batch written to the journal.
# Now this setting is without function, PersistentActor will write as many messages
# as it has accumulated since the last write.
max-message-batch-size = 200
# If there is more time in between individual events gotten from the journal
# recovery than this the recovery will fail.
# Note that it also affects reading the snapshot before replaying events on
# top of it, even though it is configured for the journal.
recovery-event-timeout = 30s
circuit-breaker {
max-failures = 10
call-timeout = 10s
reset-timeout = 30s
}
# The replay filter can detect a corrupt event stream by inspecting
# sequence numbers and writerUuid when replaying events.
replay-filter {
# What the filter should do when detecting invalid events.
# Supported values:
# repair-by-discard-old : discard events from old writers,
# warning is logged
# fail : fail the replay, error is logged
# warn : log warning but emit events untouched
# off : disable this feature completely
mode = repair-by-discard-old
# It uses a look ahead buffer for analyzing the events.
# This defines the size (in number of events) of the buffer.
window-size = 100
# How many old writerUuid to remember
max-old-writers = 10
# Set this to on to enable detailed debug logging of each
# replayed event.
debug = off
}
}
# Fallback settings for snapshot store plugin configurations
# These settings are used if they are not defined in plugin config section.
snapshot-store-plugin-fallback {
# Fully qualified class name providing snapshot store plugin api
# implementation. It is mandatory to specify this property if
# snapshot store is enabled.
# The class must have a constructor without parameters or constructor with
# one com.typesafe.config.Config parameter.
class = ""
# Dispatcher for the plugin actor.
plugin-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"
circuit-breaker {
max-failures = 5
call-timeout = 20s
reset-timeout = 60s
}
# Set this to true if successful loading of snapshot is not necessary.
# This can be useful when it is alright to ignore snapshot in case of
# for example deserialization errors. When snapshot loading fails it will instead
# recover by replaying all events.
# Don't set to true if events are deleted because that would
# result in wrong recovered state if snapshot load fails.
snapshot-is-optional = false
}
fsm {
# PersistentFSM saves snapshots after this number of persistent
# events. Snapshots are used to reduce recovery times.
# When you disable this feature, specify snapshot-after = off.
# To enable the feature, specify a number like snapshot-after = 1000
# which means a snapshot is taken after persisting every 1000 events.
snapshot-after = off
}
# DurableStateStore settings
state {
# Absolute path to the KeyValueStore plugin configuration entry used by
# DurableStateBehavior actors by default.
# DurableStateBehavior can override durableStateStorePluginId method (withDurableStateStorePluginId)
# in order to rely on a different plugin.
plugin = ""
}
# Fallback settings for DurableStateStore plugin configurations
# These settings are used if they are not defined in plugin config section.
state-plugin-fallback {
recovery-timeout = 30s
}
}
# Protobuf serialization for the persistent extension messages.
akka.actor {
serializers {
akka-persistence-message = "akka.persistence.serialization.MessageSerializer"
akka-persistence-snapshot = "akka.persistence.serialization.SnapshotSerializer"
}
serialization-bindings {
"akka.persistence.serialization.Message" = akka-persistence-message
"akka.persistence.serialization.Snapshot" = akka-persistence-snapshot
}
serialization-identifiers {
"akka.persistence.serialization.MessageSerializer" = 7
"akka.persistence.serialization.SnapshotSerializer" = 8
}
}
###################################################
# Persistence plugins included with the extension #
###################################################
# In-memory journal plugin.
akka.persistence.journal.inmem {
# Class name of the plugin.
class = "akka.persistence.journal.inmem.InmemJournal"
# Dispatcher for the plugin actor.
plugin-dispatcher = "akka.actor.default-dispatcher"
# Turn this on to test serialization of the events
test-serialization = off
}
# Local file system snapshot store plugin.
akka.persistence.snapshot-store.local {
# Class name of the plugin.
class = "akka.persistence.snapshot.local.LocalSnapshotStore"
# Dispatcher for the plugin actor.
plugin-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"
# Dispatcher for streaming snapshot IO.
stream-dispatcher = "akka.persistence.dispatchers.default-stream-dispatcher"
# Storage location of snapshot files.
dir = "/root/snapshots"
# Number load attempts when recovering from the latest snapshot fails
# yet older snapshot files are available. Each recovery attempt will try
# to recover using an older than previously failed-on snapshot file
# (if any are present). If all attempts fail the recovery will fail and
# the persistent actor will be stopped.
max-load-attempts = 3
}
# LevelDB journal plugin.
# Note: this plugin requires explicit LevelDB dependency, see below.
akka.persistence.journal.leveldb {
# Class name of the plugin.
class = "akka.persistence.journal.leveldb.LeveldbJournal"
# Dispatcher for the plugin actor.
plugin-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"
# Dispatcher for message replay.
replay-dispatcher = "akka.persistence.dispatchers.default-replay-dispatcher"
# Storage location of LevelDB files.
dir = "journal"
# Use fsync on write.
fsync = on
# Verify checksum on read.
checksum = off
# Native LevelDB (via JNI) or LevelDB Java port.
native = on
# Number of deleted messages per persistence id that will trigger journal compaction
compaction-intervals {
}
}
# Shared LevelDB journal plugin (for testing only).
# Note: this plugin requires explicit LevelDB dependency, see below.
akka.persistence.journal.leveldb-shared {
# Class name of the plugin.
class = "akka.persistence.journal.leveldb.SharedLeveldbJournal"
# Dispatcher for the plugin actor.
plugin-dispatcher = "akka.actor.default-dispatcher"
# Timeout for async journal operations.
timeout = 10s
store {
# Dispatcher for shared store actor.
store-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"
# Dispatcher for message replay.
replay-dispatcher = "akka.persistence.dispatchers.default-replay-dispatcher"
# Storage location of LevelDB files.
dir = "journal"
# Use fsync on write.
fsync = on
# Verify checksum on read.
checksum = off
# Native LevelDB (via JNI) or LevelDB Java port.
native = on
# Number of deleted messages per persistence id that will trigger journal compaction
compaction-intervals {
}
}
}
akka.persistence.journal.proxy {
# Class name of the plugin.
class = "akka.persistence.journal.PersistencePluginProxy"
# Dispatcher for the plugin actor.
plugin-dispatcher = "akka.actor.default-dispatcher"
# Set this to on in the configuration of the ActorSystem
# that will host the target journal
start-target-journal = off
# The journal plugin config path to use for the target journal
target-journal-plugin = ""
# The address of the proxy to connect to from other nodes. Optional setting.
target-journal-address = ""
# Initialization timeout of target lookup
init-timeout = 10s
}
akka.persistence.snapshot-store.proxy {
# Class name of the plugin.
class = "akka.persistence.journal.PersistencePluginProxy"
# Dispatcher for the plugin actor.
plugin-dispatcher = "akka.actor.default-dispatcher"
# Set this to on in the configuration of the ActorSystem
# that will host the target snapshot-store
start-target-snapshot-store = off
# The journal plugin config path to use for the target snapshot-store
target-snapshot-store-plugin = ""
# The address of the proxy to connect to from other nodes. Optional setting.
target-snapshot-store-address = ""
# Initialization timeout of target lookup
init-timeout = 10s
}
EOF
mkdir /root/snapshots
unzip ./target/universal/meso-alert-1.0-SNAPSHOT.zip
./meso-alert-1.0-SNAPSHOT/bin/meso-alert -Dconfig.file=application-production.conf