-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74d39d7
commit 8522b76
Showing
12 changed files
with
78 additions
and
300 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
dependencies: | ||
- name: redis | ||
repository: oci://registry-1.docker.io/bitnamicharts | ||
version: 18.12.1 | ||
version: 18.19.1 | ||
- name: postgresql | ||
repository: oci://registry-1.docker.io/bitnamicharts | ||
version: 13.4.4 | ||
digest: sha256:1eaf4fb2a3299e8922a03fad1738dfb7895a2956927b8b5dc164e42ac8c67899 | ||
generated: "2024-02-07T13:02:13.441958453+02:00" | ||
version: 13.4.6 | ||
digest: sha256:8db4ce09a5b6bd07db541bb4ff6a3fae95a1dc76fa27dee5710d2b59bab3fd69 | ||
generated: "2024-03-09T17:57:58.062411571+02:00" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,93 +0,0 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "redash.fullname" . }} | ||
labels: | ||
{{- include "redash.labels" . | nindent 4 }} | ||
data: | ||
install-upgrade.sh: | | ||
#!/usr/bin/env bash | ||
echo "This will retry connections until PostgreSQL/Redis is up, then perform database installation/migrations as needed." | ||
# Status command timeout | ||
STATUS_TIMEOUT=45 | ||
# Create tables command timeout | ||
CREATE_TIMEOUT=60 | ||
# Upgrade command timeout | ||
UPGRADE_TIMEOUT=600 | ||
# Time to wait between attempts | ||
RETRY_WAIT=10 | ||
# Max number of attempts | ||
MAX_ATTEMPTS=5 | ||
# Load connection variables | ||
. /config/dynamicenv.sh | ||
# Check Settings (for debug) | ||
# /app/manage.py check_settings | ||
# Initialize attempt counter | ||
ATTEMPTS=0 | ||
while ((ATTEMPTS < MAX_ATTEMPTS)); do | ||
echo "Starting attempt ${ATTEMPTS} of ${MAX_ATTEMPTS}" | ||
ATTEMPTS=$((ATTEMPTS+1)) | ||
# Install and upgrade | ||
if [[ "${1}" == "install" ]]; then | ||
echo "Installing Redash:" | ||
timeout $CREATE_TIMEOUT /app/manage.py database create_tables | ||
echo "Tables created" | ||
echo "Running Redash database migrations after install" | ||
timeout $UPGRADE_TIMEOUT /app/manage.py db upgrade | ||
echo "Upgrade complete" | ||
fi | ||
# Upgrade | ||
if [[ "${1}" == "upgrade" ]]; then | ||
echo "Running Redash database migrations:" | ||
timeout $UPGRADE_TIMEOUT /app/manage.py db upgrade | ||
echo "Upgrade complete" | ||
fi | ||
STATUS=$(timeout $STATUS_TIMEOUT /app/manage.py status 2>&1) | ||
RETCODE=$? | ||
echo "Return code: ${RETCODE}" | ||
echo "Status: ${STATUS}" | ||
case "$RETCODE" in | ||
0) | ||
exit 0 | ||
;; | ||
124) | ||
echo "Status command timed out after ${STATUS_TIMEOUT} seconds." | ||
;; | ||
esac | ||
case "$STATUS" in | ||
*sqlalchemy.exc.OperationalError*) | ||
echo "Database not yet functional, waiting." | ||
;; | ||
*sqlalchemy.exc.ProgrammingError*) | ||
echo "Database does not appear to be installed." | ||
;; | ||
esac | ||
echo "Waiting ${RETRY_WAIT} seconds before retrying." | ||
sleep 10 | ||
done | ||
echo "Reached ${MAX_ATTEMPTS} attempts, giving up." | ||
exit 1 | ||
dynamicenv.sh: | | ||
# Build connection URLs from environment variables. | ||
# NOTES: | ||
# This script should be sourced, not run directly. | ||
# All variables are expected to be set by the caller. | ||
if [ -z "$REDASH_DATABASE_URL" ]; then | ||
export REDASH_DATABASE_URL=postgresql://${REDASH_DATABASE_USER}:${REDASH_DATABASE_PASSWORD}@${REDASH_DATABASE_HOSTNAME}:${REDASH_DATABASE_PORT}/${REDASH_DATABASE_DB} | ||
echo "Using Database: postgresql://${REDASH_DATABASE_USER}:******@${REDASH_DATABASE_HOSTNAME}:${REDASH_DATABASE_PORT}/${REDASH_DATABASE_DB}" | ||
else | ||
echo "Using external postgresql database" | ||
fi | ||
if [ -z "$REDASH_REDIS_URL" ]; then | ||
export REDASH_REDIS_URL=redis://:${REDASH_REDIS_PASSWORD}@${REDASH_REDIS_HOSTNAME}:${REDASH_REDIS_PORT}/${REDASH_REDIS_DB} | ||
echo "Using Redis: redis://:******@${REDASH_REDIS_HOSTNAME}:${REDASH_REDIS_PORT}/${REDASH_REDIS_DB}" | ||
else | ||
echo "Using external redis database" | ||
fi | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.