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

Allow to make database type 'dummy' #25

Open
wants to merge 1 commit into
base: main
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
3 changes: 3 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ locals {
db_password = var.db_password
patches_allowed = var.patches_allowed
super_api_key = lower(var.super_api_key)
use_dummy_db = var.use_dummy_db
})

startup_script = templatefile("${path.module}/templates/startup-script.sh.tmpl", {
Expand All @@ -144,6 +145,8 @@ locals {
db_instance_name = var.db_instance_name
cloud_sql_proxy_enabled = var.db_instance_name != ""

use_dummy_db = var.use_dummy_db

telemetry_script = join("", module.telemetry.*.gcp_ubuntu_20_04_user_data)

gcp_logs_enabled = var.gcp_logs_enabled
Expand Down
4 changes: 4 additions & 0 deletions templates/config.hocon.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"maxConnections": 2048
}
"database": {
%{ if use_dummy_db ~}
"type": "dummy"
%{ else ~}
"type": "postgres"
"host": "${db_host}"
"port": ${db_port}
Expand All @@ -22,6 +25,7 @@
}
"transactionPool": "cached"
}
%{ endif ~}
}
"debug": false
"patchesAllowed": ${patches_allowed}
Expand Down
4 changes: 3 additions & 1 deletion templates/startup-script.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sudo base64 --decode << EOF > $${CONFIG_DIR}/iglu-server.hocon
${config_b64}
EOF

%{ if cloud_sql_proxy_enabled ~}
%{ if cloud_sql_proxy_enabled && !use_dummy_db ~}
# Setup the proxy service
sudo docker run \
-d \
Expand All @@ -22,6 +22,7 @@ sleep 5
%{ endif ~}

# Run the server setup
%{ if !use_dummy_db ~}
set +e
sudo docker run \
--name iglu-server-setup \
Expand All @@ -35,6 +36,7 @@ sudo docker run \
snowplow/iglu-server:${version} \
setup --config /snowplow/config/iglu-server.hocon
set -e
%{ endif ~}

# Launch the server
sudo docker run \
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ variable "db_password" {
sensitive = true
}

variable "use_dummy_db" {
description = "Whether in-memory dummy db wanted to be used for testing purposes"
type = bool
default = false
}

variable "super_api_key" {
description = "A UUIDv4 string to use as the master API key for Iglu Server management"
type = string
Expand Down