From 2fb1a22895cc9de73322811db6ece095d1eb7190 Mon Sep 17 00:00:00 2001
From: Lova ANDRIARIMALALA <43842786+Xpirix@users.noreply.github.com>
Date: Tue, 21 May 2024 13:30:55 +0300
Subject: [PATCH] Add stats url to the env variables
---
dockerize/docker-compose.yml | 5 +++++
.../plugins/migrations/0010_merge_20240517_0729.py | 14 ++++++++++++++
qgis-app/plugins/views.py | 2 +-
qgis-app/settings_docker.py | 6 +++---
4 files changed, 23 insertions(+), 4 deletions(-)
create mode 100644 qgis-app/plugins/migrations/0010_merge_20240517_0729.py
diff --git a/dockerize/docker-compose.yml b/dockerize/docker-compose.yml
index 3b7c89db..dddecb09 100644
--- a/dockerize/docker-compose.yml
+++ b/dockerize/docker-compose.yml
@@ -44,6 +44,7 @@ services:
- ENABLE_LDAP=${ENABLE_LDAP:-False}
- RABBITMQ_HOST=${RABBITMQ_HOST:-rabbitmq}
- BROKER_URL=amqp://rabbitmq:5672
+ - METABASE_DOWNLOAD_STATS_URL=${METABASE_DOWNLOAD_STATS_URL:-/metabase}
- EMAIL_BACKEND=${EMAIL_BACKEND}
- EMAIL_HOST=${EMAIL_HOST}
- EMAIL_PORT=${EMAIL_PORT}
@@ -51,6 +52,7 @@ services:
- EMAIL_HOST_USER=${EMAIL_HOST_USER:-automation}
- EMAIL_HOST_PASSWORD=${EMAIL_HOST_PASSWORD}
- DEFAULT_PLUGINS_SITE=${DEFAULT_PLUGINS_SITE:-https://plugins.qgis.org/}
+
volumes:
- ../qgis-app:/home/web/django_project
- ./docker/uwsgi.conf:/uwsgi.conf
@@ -159,10 +161,13 @@ services:
environment:
- MB_DB_TYPE=postgres
- MB_DB_CONNECTION_URI=jdbc:postgresql://${DATABASE_HOST:-db}:5432/metabase?user=${DATABASE_USERNAME:-docker}&password=${DATABASE_PASSWORD:-docker}
+ # - MB_DB_USER=tim@kartoza.com
+ # - MB_DB_PASS=newpassword
links:
- db
expose:
- "3000"
+ # command: bash -c 'java -jar app/metabase.jar reset-password tim@kartoza.com'
certbot:
image: certbot/certbot
diff --git a/qgis-app/plugins/migrations/0010_merge_20240517_0729.py b/qgis-app/plugins/migrations/0010_merge_20240517_0729.py
new file mode 100644
index 00000000..54355764
--- /dev/null
+++ b/qgis-app/plugins/migrations/0010_merge_20240517_0729.py
@@ -0,0 +1,14 @@
+# Generated by Django 4.2.13 on 2024-05-17 07:29
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('plugins', '0005_auto_20231214_2317'),
+ ('plugins', '0009_merge_20240321_0207'),
+ ]
+
+ operations = [
+ ]
diff --git a/qgis-app/plugins/views.py b/qgis-app/plugins/views.py
index 2d003cb6..9f8766a4 100644
--- a/qgis-app/plugins/views.py
+++ b/qgis-app/plugins/views.py
@@ -545,7 +545,7 @@ def get_context_data(self, **kwargs):
"%s metadata is missing, this metadata entry is required. Please add %s to metadata.txt
."
) % (md, md)
messages.error(self.request, msg, fail_silently=True)
- stats_url = f"{settings.METABASE_DASHBOARD_URL}?package_name={plugin.package_name}#hide_parameters=package_name"
+ stats_url = f"{settings.METABASE_DOWNLOAD_STATS_URL}?package_name={plugin.package_name}#hide_parameters=package_name"
context.update(
{
"stats_url": stats_url,
diff --git a/qgis-app/settings_docker.py b/qgis-app/settings_docker.py
index 22d01068..9d8fcacf 100644
--- a/qgis-app/settings_docker.py
+++ b/qgis-app/settings_docker.py
@@ -135,9 +135,9 @@
}
GEOIP_PATH='/var/opt/maxmind/'
-METABASE_DASHBOARD_URL = os.environ.get(
- "METABASE_DASHBOARD_URL",
- "http://localhost:3000/public/dashboard/1d6c60d7-f855-40c3-a54c-06ba7f6c992a"
+METABASE_DOWNLOAD_STATS_URL = os.environ.get(
+ "METABASE_DOWNLOAD_STATS_URL",
+ "/metabase"
)
CELERY_RESULT_BACKEND = 'rpc://'
CELERY_BROKER_URL = os.environ.get('BROKER_URL', 'amqp://rabbitmq:5672')