From 3c48e08ee421fd4920837f7a2e052aa8b2834d09 Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Tue, 13 Jan 2026 18:00:12 +0100 Subject: [PATCH] chore(redash): improve upgrade steps --- .vscode/settings.json | 2 + knowledge base/redash.md | 110 ++++++++++++++++++++++++++++--- snippets/aws/ecs.fish | 8 +++ snippets/aws/other commands.fish | 49 +++++++++++++- snippets/docker.sh | 3 + 5 files changed, 162 insertions(+), 10 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index f9f69d3..e72a1f3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -295,6 +295,7 @@ "radeon", "radicale", "rdsadmin", + "redash", "reflog", "rego", "replicatedctl", @@ -340,6 +341,7 @@ "sysrc", "systool", "tablespace", + "tailorable", "taskfile", "taskfiles", "tclsh", diff --git a/knowledge base/redash.md b/knowledge base/redash.md index ccec898..66ed1c8 100644 --- a/knowledge base/redash.md +++ b/knowledge base/redash.md @@ -33,31 +33,100 @@ Reference available variables from [Environment Variables Settings]. --> - - Refer [How to Upgrade] when upgrading a self-hosted instance. -Updating dependencies (DB, redis cache) versions directly seems to work, but mind that they do require downtime.
-Redash will temporarily lose connection to them during the update's downtime period, then properly connect back to them -without issues once they are up again. +When updating Redash or its dependencies (i.e., DB and redis cache): + +1. Stop Redash's components. + +
+ + ```sh + docker compose stop 'server' 'scheduler' 'scheduled_worker' 'adhoc_worker' + ``` + +
+ + The scheduler will exit should it suddenly be unable to write to the cache.
+ This usually happens when upgrading the cache's cluster when Redash is still active. + +1. Make a backup of the data (DB). +1. \[if needed] Update Redash's dependencies. +1. Make sure the DB has enough storage space for the migrations to run. +1. Update Redash. +1. \[if needed] Run the migration scripts. + +
+ + ```sh + docker compose run --rm 'server' manage db upgrade + ``` + +
+ +1. Restart Redash's components. + +
+ + ```sh + docker compose up -d + ``` + +
## Authentication @@ -148,7 +217,9 @@ POST /api/data_sources ```sh curl --request 'GET' --url 'https://redash.example.org/api/data_sources' --header 'Authorization: Key AA…99' -curl --request 'POST' --url 'https://redash.example.org/api/data_sources' --header 'Authorization: Key AA…99' \ +curl --request 'POST' --url 'https://redash.example.org/api/data_sources' \ + --header 'Authorization: Key AA…99' \ + --header 'Content-Type: application/json' \ --data '{ "name": "some data source", "type": "pg", @@ -181,6 +252,27 @@ response: Response = redash.create_data_source(data_source_name, data_source_typ +
+ Settings + +```plaintext +POST /api/settings/organization +{ + "auth_password_login_enabled": true, + "hide_plotly_mode_bar": true, + … +} +``` + +```sh +curl --request 'POST' --url 'https://redash.example.org/api/settings/organization' \ + --header 'Authorization: Key AA…99' \ + --header 'Content-Type: application/json' \ + --data '{"auth_password_login_enabled": true}' +``` + +
+ ## Further readings - [Website] @@ -189,6 +281,7 @@ response: Response = redash.create_data_source(data_source_name, data_source_typ ### Sources - [Documentation] +- [Ask Devin] - [Setting up a Redash Instance] - [API] @@ -215,3 +308,4 @@ response: Response = redash.create_data_source(data_source_name, data_source_typ [Website]: https://redash.io/ +[Ask Devin]: https://deepwiki.com/getredash/redash diff --git a/snippets/aws/ecs.fish b/snippets/aws/ecs.fish index 686f659..1b04bd5 100644 --- a/snippets/aws/ecs.fish +++ b/snippets/aws/ecs.fish @@ -37,6 +37,9 @@ aws ecs wait services-stable --cluster 'stg' --services 'grafana' # Update services' attributes aws ecs update-service --cluster 'stg' --service 'grafana' --enable-execute-command --force-new-deployment +# Scale services +aws ecs update-service --cluster 'stg' --service 'grafana' --desired-count '3' + # Check tasks' attributes aws ecs describe-tasks --cluster 'staging' --tasks 'ef6260ed8aab49cf926667ab0c52c313' --output 'yaml' \ --query 'tasks[0] | { @@ -87,3 +90,8 @@ aws ecs stop-service-deployment --stop-type 'ROLLBACK' \ aws ecs list-service-deployments --cluster 'staging' --service 'mimir' \ --query "serviceDeployments[?@.status=='IN_PROGRESS'].serviceDeploymentArn" --output 'text' \ | xargs -pn 1 aws ecs stop-service-deployment --service-deployment-arn + +# Get the image of specific containers. +aws ecs list-tasks --cluster 'someCluster' --service-name 'someService' --query 'taskArns[0]' --output 'text' \ +| xargs -oI '%%' aws ecs describe-tasks --cluster 'someCluster' --task '%%' \ + --query 'tasks[].containers[?name==`someContainer`].image' --output 'text' diff --git a/snippets/aws/other commands.fish b/snippets/aws/other commands.fish index 80229c8..ffa8690 100644 --- a/snippets/aws/other commands.fish +++ b/snippets/aws/other commands.fish @@ -192,11 +192,34 @@ aws eks describe-addon-configuration --addon-name 'aws-ebs-csi-driver' --addon-v # ------------------ ### +# Describe replication groups +aws elasticache describe-replication-groups +aws elasticache describe-replication-groups --query 'ReplicationGroups[].ReplicationGroupId' +aws elasticache describe-replication-groups --replication-group-id 'some-app' --output 'text' \ + --query "ReplicationGroups[].NodeGroups[].PrimaryEndpoint[].join(':', [Address, to_string(Port)])" +aws elasticache describe-replication-groups --replication-group-id 'some-app' --output 'text' \ + --query "ReplicationGroups[].NodeGroups[].PrimaryEndpoint[].join('', [`redis://`,Address,`:`,to_string(Port),`/0`])" + +# List pending changes to replication groups +aws elasticache describe-replication-groups --query 'ReplicationGroups[].PendingModifiedValues' +aws elasticache describe-replication-groups --replication-group-id 'some-app' --query 'ReplicationGroups[].PendingModifiedValues' + +# Upgrade replication groups' engine +aws elasticache modify-replication-group --replication-group-id 'some-app' --engine-version '6.2' --apply-immediately + +# Describe clusters aws elasticache describe-cache-clusters aws elasticache describe-cache-clusters --query 'CacheClusters[].CacheClusterId' -aws elasticache describe-replication-groups -aws elasticache describe-replication-groups --query 'ReplicationGroups[].ReplicationGroupId' +# List pending changes to clusters +aws elasticache describe-cache-clusters --query 'CacheClusters[].PendingModifiedValues' +aws elasticache describe-cache-clusters \ + --query 'CacheClusters[?length(PendingModifiedValues)>`0`].{"CacheClusterId":CacheClusterId,"PendingModifiedValues":PendingModifiedValues}' +aws elasticache describe-cache-clusters --cache-cluster-id 'some-cluster' --query 'CacheClusters[].PendingModifiedValues' + +# Apply pending changes to clusters +aws elasticache modify-cache-cluster --cache-cluster-id 'some-cluster' --num-cache-nodes 'current-number-of-nodes' \ + --apply-immediately ### @@ -418,6 +441,28 @@ aws rds describe-db-parameters --db-parameter-group-name 'default.postgres15' \ aws rds create-db-snapshot --db-instance-identifier 'some-db-instance' --db-snapshot-identifier 'some-db-snapshot' +aws rds describe-db-instances --db-instance-identifier 'some-instance' \ + --query 'DBInstances[0].InstanceCreateTime' --output 'text' + +aws rds describe-db-instances --db-instance-identifier 'some-db-instance' --output 'text' \ + --query 'DBInstances[0].Endpoint|join(`:`,[Address,to_string(Port)])' +aws rds describe-db-instances --db-instance-identifier 'some-db-instance' --output 'text' \ + --query ' + DBInstances[0] + | join(``, [ + `postgresql://`, + MasterUsername, + `:`, + `PASSWORD_PLACEHOLDER`, + `@`, + Endpoint.Address, + `:`, + to_string(Endpoint.Port), + `/`, + DBName || `postgres` + ]) + ' + ### # Route53 diff --git a/snippets/docker.sh b/snippets/docker.sh index 0fd46d5..3f40e11 100644 --- a/snippets/docker.sh +++ b/snippets/docker.sh @@ -12,6 +12,9 @@ docker volume inspect -f '{{ .Mountpoint }}' 'website' sudo vim '/var/lib/docker/volumes/website/_data/index.html' docker run -d --name 'some-nginx' -v '/some/content:/usr/share/nginx/html:ro' 'nginx' +docker run --rm --name 'redash-db-migrations' --platform 'linux/amd64' --dns '172.31.0.2' \ + --env 'REDASH_COOKIE_SECRET' --env 'REDASH_DATABASE_URL' --env 'REDASH_REDIS_URL' \ + "$REDASH_IMAGE" manage db upgrade docker run --rm --name 'pulumi' \ --env 'AWS_DEFAULT_REGION' --env 'AWS_ACCESS_KEY_ID' --env 'AWS_SECRET_ACCESS_KEY' --env 'AWS_PROFILE' \ --env-file '.env' --env-file '.env.local' \