OpenDK

OpenDK

OpenDK (Open Data Kecamatan) is an open-source web-based platform developed to support data management and administrative services at the sub-district level. OpenDK is designed so that sub-districts can integrate data from villages using OpenSID and provide accurate data for planning, monitoring, and public services.

OpenDK is developed by the OpenSID community, which focuses on providing technology-based solutions for village and sub-district governments in Indonesia. With OpenDK, sub-districts can strengthen governance and support efforts toward transparency and public accountability.

1. System Requirements

System requirements for OpenDK:

  • PHP 7.2.5+
  • MySQL 5.7.8+ or MariaDB 5.7.8+
  • Apache or Nginx
  • Composer

Before starting the deployment, prepare:

  • A VPS or server with Ubuntu 24.04 OS
  • SSH access to the server
  • A domain already pointed to the server

2. Server Preparation

Update the system

sudo apt update
sudo apt upgrade -y

Install Apache

sudo apt install apache2 -y

Install MariaDB

sudo apt install mariadb-server -y

Add the PPA ondrej/php repository

sudo add-apt-repository ppa:ondrej/php -y
sudo apt upgrade -y

Install PHP 8.3 and required extensions

sudo apt install libapache2-mod-php8.3 php8.3 php8.3-cli php8.3-common \
  php8.3-apcu php8.3-mbstring php8.3-gd php8.3-intl \
  php8.3-xml php8.3-soap php8.3-bcmath php8.3-mysql php8.3-zip \
  php8.3-curl php8.3-tidy php8.3-imagick -y

Install Composer

sudo wget https://getcomposer.org/download/latest-stable/composer.phar -O /usr/local/bin/composer
sudo chmod +x /usr/local/bin/composer

3. Create Database

Log in to MariaDB

sudo mysql

Create database and user

CREATE DATABASE opendk;
GRANT ALL PRIVILEGES ON opendk.* TO 'opendk'@'localhost' IDENTIFIED BY 'rahasia';
FLUSH PRIVILEGES;
exit

4. Apache Configuration

Create virtual host configuration

sudo nano /etc/apache2/sites-available/opendk.nama.desa.id.conf

Insert the configuration

<VirtualHost *:80>
    ServerName opendk.nama.desa.id
    DocumentRoot /var/www/opendk.nama.desa.id/public
    <Directory /var/www/opendk.nama.desa.id/public>
        Options -Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog /var/log/apache2/opendk.nama.desa.id_error.log
    CustomLog /var/log/apache2/opendk.nama.desa.id_access.log combined
</VirtualHost>

Enable the rewrite module, virtual host, and restart apache2

sudo a2enmod rewrite
sudo a2ensite opendk.nama.desa.id
sudo systemctl restart apache2		

5. Install SSL

Install certbot

sudo apt install certbot python3-certbot-apache -y	

Request SSL certificate

sudo certbot --non-interactive \
    -m [email protected] \
    --agree-tos \
    --no-eff-email \
    --apache -d opendk.nama.desa.id \
    --redirect	

6. Install OpenDK

Download the OpenDK source code from GitHub

git clone https://github.com/OpenSID/OpenDK.git opendk	

Create the .env file

cd opendk
cp .env.example .env

Open the .env file

nano .env

Set the configuration

DB_DATABASE=opendk
DB_USERNAME=opendk
DB_PASSWORD=rahasia

Install dependencies

composer install

Migrate the database

php artisan migrate

Answer yes to the question Do you really wish to run this command?

Do you really wish to run this command? (yes/no) [no] 
> yes

Move the directory to /var/www

sudo mv ../opendk /var/www/opendk.nama.desa.id 

Change the directory’s user-group

sudo chown -R www-data:www-data /var/www/opendk.nama.desa.id

Access https://opendk.nama.desa.id to proceed with the installation.

  1. Click Cek Kebutuhan to check server requirements
  2. If everything is met, click Cek Hak Akses to check directory permissions
  3. If everything is met, click Konfigurasi Lingkungan to configure the environment
  4. Click Form Penyetelan Wizard
  5. Enter the Application Name, select Application Environment as Production, select No for Debug Application, and enter the Application URL as https://opendk.nama.desa.id, then click Setel Basis Data
  6. Enter the Database Name, Database User, and Database Password, then click Setel Aplikasi
  7. Click Pasang
  8. If the installation is successful, a message will appear saying Dashboard Kecamatan berhasil DIPASANG ..., then click Klik di sini untuk keluar