Akinon Release Notes (05/12/2025) are now live! Click here to learn what's new.
LogoLogo
API Reference
  • Home
  • Quick Start
  • Tutorials
  • Technical Guides
  • Release Notes
  • Glossary
  • Welcome to Akinon Tutorials
  • ACC
    • How to Manage Projects and Services?
    • How to Use Demo Projects with ARC?
    • How to Move Apps into ACC?
    • How To Configure Database Connection in ACC?
    • How to Configure Your ACC Application with akinon.json and Procfile?
    • How to Create, Manage, Build, and Deploy Applications in ACC?
    • How to Install Applications from the App Store in ACC?
    • How to Add and Manage Domains in ACC?
    • How to Generate and Add Public Keys in ACC?
    • How to Monitor Application Resources in ACC?
    • How to Manage Users and Roles in ACC?
    • How to Integrate a BI Tool with Your Project in ACC?
  • Omnitron
    • Products & Catalogs
      • How to Add and Bulk Update Products in Omnitron?
      • How to Create Product Attributes and Attribute Sets in Omnitron?
      • How to Manage Catalogs in Omnitron?
      • How to Create and Update Price Lists in Omnitron?
      • How to Create and Update Stock Lists in Omnitron?
      • How to Create and Manage Collections in Omnitron?
    • Orders
      • How to Manage Orders in Omnitron?
      • How to Manage Cancellation and Return Requests in Omnitron?
    • Sales Channels
      • How to Manage Products in Omnitron?
      • How to Manage Registered Users Based on Sales Channel?
      • How to Create and Update Customer Groups in Omnitron?
      • Marketing
        • How to Create and Manage Campaigns in Omnitron
        • How to Create and Manage Coupons in Omnitron?
        • How to Create and Manage Bulk Coupons in Omnitron?
        • How to Create and Manage Discount Codes in Omnitron?
        • How to Configure SEO Settings in Omnitron?
        • How to Configure URL Redirects and Settings in Omnitron?​
        • How to Manage Promotions in Omnitron?
      • Content Management
        • How to Manage Widgets in Omnitron?
        • How to Manage Widget Schema in Omnitron?
        • How to Manage Flat Pages in Omnitron?
        • How to Manage Custom/Campaign Pages in Omnitron?
        • How to Manage Navigations/Menus in Omnitron?
        • How to Manage Mailing Templates in Omnitron?
      • Store Management
        • How to Manage Stores in Omnitron?
        • How to Manage Instore Store Employees in Omnitron?
        • How to Manage Instore Store from Omnitron?
        • How to Manage Store Delivery Points in Omnitron?
        • How to Manage Slots and Retail Store Groups?
      • Payment Management
        • How to Manage POS Integrations in Omnitron?
        • How to Manage Banks in Omnitron?
        • How to Manage Card Types in Omnitron?
        • How to Manage Card Settings in Omnitron?
        • How to Manage Checkout Providers in Omnitron?
        • How to Manage Payment Options in Omnitron?
      • Category Management
        • How to Automatically Assign Category Mapping Rules in Omnitron?
      • Sales Channel Settings
        • How to Configure Marketplace Attribute Mapping in Omnitron?
        • How to Manage Marketplace Mapping in Omnitron?
        • How to Manage Marketplace Operations?
        • How to Manage Address Mapping in Omnitron?
        • How to Manage Social Accounts in Omnitron?
        • How to Manage Loyalty Integration Settings?
        • How to Manage Store Stock Settings?
        • How to Manage Product List Filter Settings?
        • How to Manage Instore Settings in Omnitron?
        • How to Manage General Sorting Settings?
        • How to Manage Shipping Options in Omnitron?
        • How to Manage Delivery Options in Omnitron?
        • How to Manage Easy Return Shipping Options in Omnitron?
    • Integration
      • How to Manage Pending Products in Omnitron?
      • How to Manage City/District Mapping Error Logs in Omnitron?
    • Reports
      • How to Create and Download Reports in Omnitron?
    • Settings
      • How to Add and Configure a New Sales Channel in Omnitron?
      • How to Add and Configure a Shipping Company in Omnitron?
      • How to Create and Manage Sorting Algorithms in Omnitron?
      • How to Create and Manage Users in Omnitron?
      • How to Manage Reasons for Cancellation and Return in Omnitron?
      • How to Manage Authority Groups in Omnitron?
      • How to Manage Advanced Permission Policies and Items?
      • How to Log in to Omnitron Using OAuth2 (SSO)?
  • OMS
    • How to Set Up and Manage Locations in OMS?
    • How to Set Up Basic Configurations in OMS?
    • How to Manage Application Settings in OMS?
    • How to Add and Edit Stock Locations in OMS?
    • How to Create or Edit Distribution Scenarios in OMS?
    • How to Create or Edit Transfer Scenarios in OMS ?
    • How to Perform a Product Search in OMS?
    • How to Add or Edit a Product Stock Integration Engine in OMS?
    • How to Add or Edit Shipping Details in OMS?
    • How to Add or Edit a Webhook in OMS?
    • How to Add or Edit a State Transition in OMS?
    • How to Add or Edit a Packaging Refusal Reason in OMS?
    • How to Pull Orders from Omnitron to OMS?
    • How to Add or Edit Translatable Models in OMS?
    • How to Manage Scheduled Operations in OMS?
    • Working Logic of Scenarios
  • Instore
    • How to Install the Instore Service on an ACC Project?
    • How to Create Customer Account?
    • How to Manage Store & Staff?
    • How to Manage Instore Settings?
    • How to Create Instore Settings Via Omnitron Panel?
    • How to Customize Instore Widgets?
    • How to Configure Payment Methods in Instore?
    • Instore User Manual
      • Selling Through Instore
      • Order Refund/Cancellation Processes
      • Click & Collect Order Management (For Brands without an OMS)
      • Package Orders
      • Transfer Orders
      • Customer Profile
      • Settings
  • Integrator
    • How to Update S3 Bucket?
    • How to Manage Users in Integrator?
    • How to Create and Manage Integration Flow?
    • How to Monitor Integration Logs in Integrator?
    • How to Use the Flow Testing Screen in Integrator?
    • How to Use Alarm Services in Integrator?
    • How to Monitor Flow Performance in Integrator?
    • How to Create a Version Service in Integrator?
    • Flows
      • Login Flow
      • Product Flow
      • Stock Flow
      • Full Stock Flow
      • Price Flow
      • Full Price Flow
      • Order Flow
      • Order Status Flow
      • Order Cancel Flow
      • OMS Stock Flow
      • Whippy Stock Flow
      • Generic Proxy Flow
      • Image S3 Flow
      • Video S3 Flow
      • JOLT Mapping
      • Scripting in Flows
  • Project Zero
    • How to Configure Mini Basket?
    • How to Optimize Menu Performance?
    • How to Implement the Quickly Add to Cart Feature?
    • How to Implement Product Image Slider?
    • How to Create and Integrate a Custom Payment Option View in Checkout?
  • Marketplace Dashboard
    • How to Monitor Integration Logs in the Marketplace Dashboard?
    • How to Monitor Integration Reports in Marketplace Dashboard?
    • How to Create Alarms and Notifications in Marketplace Dashboard?
  • Akifast
    • Akifast Admin Dashboard
    • Akifast Merchant Dashboard
  • Seller Center
    • Seller
      • Settings
        • How to Manage Users in Seller Center?
        • How to Generate and Revoke Access Tokens in Seller Center?
        • How to Manage Delivery Settings in Seller Center?
      • Products
        • How to Use Offer Actions in Seller Center?
        • How to Add Single Product in Seller Center?
        • How to Add Product Offers Using Bulk Actions in Seller Center?
        • How to Manage Offers via Marketplace Catalog?
        • How to Create Revison Requests?
        • How to Use Bulk Actions in Seller Center?
        • Inventory Management
          • How to Manage Stock List in Seller Center?
          • How to Manage Price List in Seller Center?
      • Orders
        • How to Manage Orders in Seller Center?
        • How to Manage Packages in Seller Center?
        • How to Manage Cancellation & Returns in Seller Center?
      • Finance
        • Account Management
        • How to Manage Reconciliations in Seller Center?
      • Store Management
      • Messages
      • Support
    • Marketplace Owner
      • Settings
        • How to Manage Users in Seller Center?
        • How to Manage Delivery Settings in Seller Center?
        • How to Manage Offer Reject Reasons in Seller Center?
        • How to Manage Attribute Set & Category Mapping?
      • Products
        • How to Manage Offers via Marketplace Catalog?
        • How to Use Offer Actions in Seller Center?
      • Orders
        • How to Manage Orders in Seller Center?
        • How to Manage Packages in Seller Center?
        • How to Cancel or Return an Order in Seller Center?
      • Finance
        • How to Manage Reconciliations?
        • Seller Management
      • Support
      • Messages
  • Whippy Ware
    • Whippy Ware
  • Dynamic Price
    • Dynamic Price
  • How to Use Offer Reject Reasons?
Powered by GitBook

© 2025 Akinon. All rights reserved.

On this page
  • Recap: The akinon.json File
  • Configuring Addons
  • Using Environment Variables for Configuration
  • Automating of Database Migrations
  • Ensuring the Database Connection with Health-Check

Was this helpful?

  1. ACC

How To Configure Database Connection in ACC?

This tutorial explains how to configure a database connection for your application in ACC.

Recap: The akinon.json File

Earlier, we created a basic akinon.json configuration file:

{
  "name": "Quickstart Project",
  "description": "Quickstart Project",
  "scripts": {
    "release": "",
    "build": "sh build.sh"
  },
  "env": {},
  "formation": {
    "web": {
      "min": 1,
      "max": "auto"
    }
  },
  "runtime": "python:3.8-alpine", 
  "addons": []
}

Configuring Addons

Below is the method to specify the addons required for the application within the akinon.json file:

{
    "...": "...",
    "addons": [
        {
            "plan": "postgresql",
            // "options": {
            //     "instance_type": "db.r5.large",
            //     "instance_count": 1
            // }
        }
    ]
}

After completing the configuration, the akinon.json file will resemble the following:

{
  "name": "Quickstart Project",
  "description": "Quickstart Project",
  "scripts": {
    "release": "",
    "build": "sh build.sh"
  },
  "env": {},
  "formation": {
    "web": {
      "min": 1,
      "max": "auto"
    }
  },
  "runtime": "python:3.8-alpine", 
  "addons": [
        {
            "plan": "postgresql"
        }
    ]
}

Using Environment Variables for Configuration

When a database addon is added, the following environment variables become available to your app:

  • DB_HOST

  • DB_PORT

  • DB_NAME

  • DB_USER

  • DB_PASSWORD

Update your settings.py to use these variables:

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.postgresql",
        "HOST": env("DB_HOST"),
        "USER": env("DB_USER"),
        "PASSWORD": env("DB_PASSWORD"),
        "NAME": env("DB_NAME"),
        "PORT": env("DB_PORT", cast=int),
    }
}

To run the app locally, you’ll need to simulate these environment variables:

.env

# postgres
DB_NAME=quickstart
DB_USER=postgres_user
DB_PASSWORD='postgres_password'
DB_HOST=127.0.0.1
DB_PORT=5432

To enable the application to communicate with PostgreSQL, users must incorporate the postgresql-dev library into the build.sh file.

Below is the modified version of the build.sh file:

set -euo pipefail

apk add python3-dev postgresql-dev g++ jpeg-dev zlib-dev libffi-dev --no-cache
pip install -U --force-reinstall pip
pip install -r requirements.txt

apk del g++ python3-dev

Automating of Database Migrations

To ensure database migrations run automatically during deployment, add the migration command to the release script in akinon.json:

Below is the addition to be made in the akinon.json file:

{
  //... ,
  "scripts": {
    "release": "python manage.py migrate --noinput",
    "build": "sh build.sh"
  },
  // ...
}

Ensuring the Database Connection with Health-Check

To control the database connection and ensure that the application is running smoothly, users can create a healthcheck page. This page will serve as a status indicator, providing information about the application's proper configuration and functionality.

If everything is functioning well, the server will return an HTTP 200 OK status code. Otherwise, if there's an issue, it will handle the error and respond with an appropriate error status code (e.g., 500 Internal Server Error).

Let's add a new view to the application that will respond to the /healthz path and implement the health-check functionality:

views.py

import django
from django.http import HttpResponse
from django.views import View

class HomeView(View):
    def get(self, request):
        return HttpResponse(content='Quickstart App Home Page', status=200)

class HealthCheckView(View):
    def get(self, request):
        try:
            django.db.connection.ensure_connection()
        except Exception as exc:
            return HttpResponse(content='Database connection could not be established.', status=500)

        return HttpResponse(content='OK', status=200)

urls.py

from django.contrib import admin
from django.urls import path

from quickstart.views import HealthCheckView, HomeView

urlpatterns = [
    path('', HomeView.as_view(), name='home'),
    path('admin/', admin.site.urls),
    path('healthz/', HealthCheckView.as_view(), name='healthcheck')
]

Test the healthcheck page in the local environment:

Everything seems to be running smoothly! Let's try pausing the PostgreSQL service locally:

If the application is unable to connect to the database, the health check page will notify users of the issue.

By defining the health check path in the akinon.json file, ACC can automatically and periodically verify the application's health once it's deployed.

To enable this, simply add the healthcheck key under the formation > web section, specifying the path to the health check endpoint.

{
  //... 
  
  "env": {},
  "formation": {
    "web": {
      "min": 1,
      "max": "auto",
      "healthcheck": "/healthz/"
    }
  },
  
  // ...
}

To test the changes in the ACC environment, push the updates to your application’s repository and trigger a new version build. Once the build is complete, proceed with the deployment.

After deployment, navigate to the health check endpoint. If everything is configured correctly, the page will confirm a successful database connection—indicating that your application is running smoothly.

PreviousHow to Move Apps into ACC?NextHow to Configure Your ACC Application with akinon.json and Procfile?

Last updated 15 days ago

Was this helpful?

The needs of the application can be met by adding various components such as database, cache, CDN, and more into the addons field. For detailed information about addons, please refer to this .

To specify addons, simply fill out the plan area in the akinon.json file. Optional configurations can be made using the options field, as demonstrated above. For instance, users can configure the type and amount of the database instance. The available instance types are aligned with the .

For more detailed information, refer to the tutorial .

database instance names on AWS
here
link