This is an automated email from the ASF dual-hosted git repository.
lahirujayathilake pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airavata-portals.git
The following commit(s) were added to refs/heads/main by this push:
new 6c21527b3 support for running django portal in a local dev env
6c21527b3 is described below
commit 6c21527b30f78e6c1fdc8ddab05933d25c1aa7cf
Author: lahiruj <[email protected]>
AuthorDate: Tue Jul 29 14:04:41 2025 -0400
support for running django portal in a local dev env
---
.../compose/dbinit/01-init-db.sql | 8 ++++
airavata-django-portal/compose/docker-compose.yaml | 52 +++++++++++++++++++++
airavata-django-portal/django_airavata/__init__.py | 10 ++++
airavata-django-portal/requirements-dev.txt | Bin 506 -> 1142 bytes
4 files changed, 70 insertions(+)
diff --git a/airavata-django-portal/compose/dbinit/01-init-db.sql
b/airavata-django-portal/compose/dbinit/01-init-db.sql
new file mode 100644
index 000000000..8df43145f
--- /dev/null
+++ b/airavata-django-portal/compose/dbinit/01-init-db.sql
@@ -0,0 +1,8 @@
+CREATE DATABASE IF NOT EXISTS django_default;
+
+CREATE USER IF NOT EXISTS 'django'@'%' IDENTIFIED BY '123456';
+ALTER USER 'django'@'%' IDENTIFIED BY '123456';
+
+GRANT ALL PRIVILEGES ON *.* TO 'django'@'%';
+
+FLUSH PRIVILEGES;
diff --git a/airavata-django-portal/compose/docker-compose.yaml
b/airavata-django-portal/compose/docker-compose.yaml
new file mode 100644
index 000000000..25e9d2d57
--- /dev/null
+++ b/airavata-django-portal/compose/docker-compose.yaml
@@ -0,0 +1,52 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+version: "3.8"
+services:
+ db:
+ image: mariadb:lts-ubi9
+ restart: always
+ command:
+ --default-authentication-plugin=mysql_native_password
+ --character-set-server=utf8
+ --collation-server=utf8_general_ci
+ ports:
+ - "13306:3306"
+ environment:
+ MARIADB_ROOT_USER: root
+ MARIADB_ROOT_PASSWORD: 123456
+ MARIADB_USER: django
+ MARIADB_PASSWORD: 123456
+ MAX_ALLOWED_PACKET: 1073741824
+ healthcheck:
+ test: ["CMD-SHELL", "mariadb-admin ping --silent -u root
--password=$$MARIADB_ROOT_PASSWORD"]
+ interval: 10s
+ timeout: 5s
+ retries: 5
+ volumes:
+ - ./dbinit:/docker-entrypoint-initdb.d
+ - mysql_data:/var/lib/mysql
+
+ adminer:
+ image: adminer
+ restart: always
+ ports:
+ - 18888:8080
+
+volumes:
+ mysql_data:
diff --git a/airavata-django-portal/django_airavata/__init__.py
b/airavata-django-portal/django_airavata/__init__.py
index e69de29bb..2085355a5 100644
--- a/airavata-django-portal/django_airavata/__init__.py
+++ b/airavata-django-portal/django_airavata/__init__.py
@@ -0,0 +1,10 @@
+from django.conf import settings
+
+# Only use PyMySQL as the db driver when in a local dev environment
+if settings.DEBUG:
+ try:
+ import pymysql
+
+ pymysql.install_as_MySQLdb()
+ except ImportError:
+ pass
diff --git a/airavata-django-portal/requirements-dev.txt
b/airavata-django-portal/requirements-dev.txt
index 8c71b9044..532aa4071 100644
Binary files a/airavata-django-portal/requirements-dev.txt and
b/airavata-django-portal/requirements-dev.txt differ