You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by ka...@apache.org on 2021/08/16 04:26:22 UTC

[fineract-credit-scorecard] branch develop updated: Dockerize Scorecard Server Application

This is an automated email from the ASF dual-hosted git repository.

kaze pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-credit-scorecard.git


The following commit(s) were added to refs/heads/develop by this push:
     new 973dbd9  Dockerize Scorecard Server Application
973dbd9 is described below

commit 973dbd9c2d4736d6fee3760ca93260f78a3afdaa
Author: Nasser Kaze <ka...@outlook.com>
AuthorDate: Mon Aug 16 05:25:48 2021 +0100

    Dockerize Scorecard Server Application
---
 .gitignore                |   2 ++
 Dockerfile                |  10 ++++++++++
 README.md                 | Bin 8454 -> 10088 bytes
 build.gradle              |   2 +-
 clients/java/README.md    |   4 ++--
 clients/java/build.gradle |   2 +-
 clients/java/pom.xml      |   2 +-
 docker-compose.yml        |  29 +++++++++++++++++++++++++++++
 entrypoint.sh             |   4 ++++
 server/settings.py        |  18 ++++++++++++------
 10 files changed, 62 insertions(+), 11 deletions(-)

diff --git a/.gitignore b/.gitignore
index 27fbeb1..040215e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -121,3 +121,5 @@ build
 
 .settings
 .project
+
+data/
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..72c3047
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,10 @@
+FROM python:3
+
+COPY . app
+WORKDIR /app
+
+RUN pip install -r requirements.txt
+
+EXPOSE 8000
+
+ENTRYPOINT [ "/bin/bash", "entrypoint.sh"]
diff --git a/README.md b/README.md
index c0a5943..e34a5b0 100644
Binary files a/README.md and b/README.md differ
diff --git a/build.gradle b/build.gradle
index 2a72056..9dbf82b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -76,7 +76,7 @@ task buildJavaSdk(type: org.openapitools.generator.gradle.plugin.tasks.GenerateT
     skipValidateSpec = true
     inputSpec = "$openapiSpecFile"
     outputDir = "$buildDir/generated/java".toString()
-    groupId = 'org.apache.fineract.cn'
+    groupId = 'org.apache.fineract'
     id = 'credit-scorecard-java-client'
     apiPackage = 'org.apache.fineract.credit.scorecard.services'
     invokerPackage = 'org.apache.fineract.credit.scorecard'
diff --git a/clients/java/README.md b/clients/java/README.md
index 2f854ae..eb99cf7 100644
--- a/clients/java/README.md
+++ b/clients/java/README.md
@@ -37,7 +37,7 @@ Add this dependency to your project's POM:
 
 ```xml
 <dependency>
-  <groupId>org.apache.fineract.cn</groupId>
+  <groupId>org.apache.fineract</groupId>
   <artifactId>credit-scorecard-java-client</artifactId>
   <version>1.0.0</version>
   <scope>compile</scope>
@@ -49,7 +49,7 @@ Add this dependency to your project's POM:
 Add this dependency to your project's build file:
 
 ```groovy
-compile "org.apache.fineract.cn:credit-scorecard-java-client:1.0.0"
+compile "org.apache.fineract:credit-scorecard-java-client:1.0.0"
 ```
 
 ### Others
diff --git a/clients/java/build.gradle b/clients/java/build.gradle
index 7b8a016..9c59550 100644
--- a/clients/java/build.gradle
+++ b/clients/java/build.gradle
@@ -2,7 +2,7 @@ apply plugin: 'idea'
 apply plugin: 'eclipse'
 apply plugin: 'java'
 
-group = 'org.apache.fineract.cn'
+group = 'org.apache.fineract'
 version = '1.0.0'
 
 buildscript {
diff --git a/clients/java/pom.xml b/clients/java/pom.xml
index 0adb749..6e4bff5 100644
--- a/clients/java/pom.xml
+++ b/clients/java/pom.xml
@@ -1,7 +1,7 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
-    <groupId>org.apache.fineract.cn</groupId>
+    <groupId>org.apache.fineract</groupId>
     <artifactId>credit-scorecard-java-client</artifactId>
     <packaging>jar</packaging>
     <name>credit-scorecard-java-client</name>
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..aa49180
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,29 @@
+version: "3.9"
+   
+services:
+  db:
+    image: mysql:5.7
+    volumes:
+      - ./data/db:/var/lib/mysql
+    restart: always
+    environment:
+      MYSQL_ROOT_PASSWORD: skdcnwauicn2ucnaecasdsajdnizucawencascdca
+      MYSQL_DATABASE: fineract_credit_scorecard
+    healthcheck:
+      test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost", "--password=skdcnwauicn2ucnaecasdsajdnizucawencascdca" ]
+      timeout: 10s
+      retries: 10
+    ports:
+      - 4306:4306
+
+  app:
+    build: .
+    ports:
+      - 8000:8000
+    depends_on:
+      - db
+    environment:
+      - DB_HOST=db
+      - DB_PORT=4306
+      - DB_PASSWORD=skdcnwauicn2ucnaecasdsajdnizucawencascdca
+  
\ No newline at end of file
diff --git a/entrypoint.sh b/entrypoint.sh
new file mode 100644
index 0000000..e053490
--- /dev/null
+++ b/entrypoint.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+python manage.py migrate
+python manage.py runserver 0:8000
+echo Running Django on the local host at http://localhost:8000
\ No newline at end of file
diff --git a/server/settings.py b/server/settings.py
index 1e09543..ffd107b 100644
--- a/server/settings.py
+++ b/server/settings.py
@@ -42,10 +42,16 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 SECRET_KEY = 'fd363ff3-ab24-476d-8409-9a45ab0300f9'
 
 # SECURITY WARNING: don't run with debug turned on in production!
-DEBUG = True
+DEBUG = os.environ.get('DEBUG', True),
 
 ALLOWED_HOSTS = []
 
+# SECURE_SSL_REDIRECT = True
+
+# SESSION_COOKIE_SECURE = True
+
+# CSRF_COOKIE_SECURE = True
+
 # Application references
 # https://docs.djangoproject.com/en/2.1/ref/settings/#std:setting-INSTALLED_APPS
 INSTALLED_APPS = [
@@ -106,11 +112,11 @@ WSGI_APPLICATION = 'server.wsgi.application'
 DATABASES = {
     'default': {
         'ENGINE': 'django.db.backends.mysql',
-        'NAME': os.environ.get('DBNAME', 'fineract_credit_scorecard'),
-        'USER': os.environ.get('DBUSER', 'root'),
-        'PASSWORD': os.environ.get('DBPASSWORD', 'mysql'),
-        'HOST': os.environ.get('DBHOST', '127.0.0.1'),
-        'PORT': os.environ.get('DBPORT', '3306'),
+        'NAME': os.environ.get('DB_NAME', 'fineract_credit_scorecard'),
+        'USER': os.environ.get('DB_USER', 'root'),
+        'PASSWORD': os.environ.get('DB_PASSWORD', 'mysql'),
+        'HOST': os.environ.get('DB_HOST', '127.0.0.1'),
+        'PORT': os.environ.get('DB_PORT', '3306'),
         'OPTIONS': {
             'read_default_file': 'MySQL.cnf',
         },