No description
  • PHP 71.4%
  • Blade 28.1%
  • Makefile 0.3%
  • Dockerfile 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
mohd naqiuddin e639b7f297 Merge branch 'feat/pkh-pelupusan-me-scope-alignment' into 'master'
fix(me): align PelupusanAggregator with PKH controllers, no controller changes

See merge request shukry-datakraf/myinfra-pkh!28
2026-08-22 02:44:15 +00:00
app fix(me): kuartersBcaCards RM totals respect user scope 2026-08-22 10:24:58 +08:00
bootstrap initial push pkh 2026-04-24 11:02:24 +08:00
config chore(pkh): update minio bucket config and add api settings 2026-08-04 23:08:29 +08:00
database Restrict Jalan Tarikh/Status Mesyuarat and add AJK gred column 2026-08-07 11:30:09 +08:00
docker perf(docker): enable OPcache + disable Xdebug for local dev; fix php.ini mount 2026-06-29 12:49:43 +08:00
k8s chore(pkh): update minio bucket config and add api settings 2026-08-04 23:08:29 +08:00
public pdf and add ppg, ppl for pelupusan 2026-05-06 21:20:10 +08:00
resources fix hapuskira bencana 2026-07-30 00:56:10 +08:00
routes feat(internal): serve TPATA metrics and disposal totals for 3B and 3C 2026-08-19 17:14:46 +08:00
storage Initialize myinfra-pkh project base 2026-04-10 16:55:14 +08:00
tests Overhaul F10/5 progress computation, add snapshot freeze and destroy 2026-07-27 17:11:05 +08:00
.editorconfig Initialize myinfra-pkh project base 2026-04-10 16:55:14 +08:00
.env.example chore(pkh): update minio bucket config and add api settings 2026-08-04 23:08:29 +08:00
.env.testing test(pkh): add PKH feature suite + isolated test DB infra 2026-06-03 14:50:31 +08:00
.gitattributes Initialize myinfra-pkh project base 2026-04-10 16:55:14 +08:00
.gitignore Initialize myinfra-pkh project base 2026-04-10 16:55:14 +08:00
.gitlab-ci.yml update core repo using main 2026-06-23 10:11:00 +08:00
artisan Initialize myinfra-pkh project base 2026-04-10 16:55:14 +08:00
composer.json Update composer.json 2026-06-11 14:59:25 +00:00
composer.lock initial push pkh 2026-04-24 11:02:24 +08:00
docker-compose.test.yml test(pkh): add PKH feature suite + isolated test DB infra 2026-06-03 14:50:31 +08:00
docker-compose.yml perf(docker): enable OPcache + disable Xdebug for local dev; fix php.ini mount 2026-06-29 12:49:43 +08:00
Dockerfile update core repo using main 2026-06-23 10:11:00 +08:00
Dockerfile.ci Initialize myinfra-pkh project base 2026-04-10 16:55:14 +08:00
Dockerfile.local Initialize myinfra-pkh project base 2026-04-10 16:55:14 +08:00
Makefile test(pkh): add PKH feature suite + isolated test DB infra 2026-06-03 14:50:31 +08:00
package.json Initialize myinfra-pkh project base 2026-04-10 16:55:14 +08:00
phpunit.xml remove unused test 2026-06-03 15:36:34 +08:00
README.md docs: add project setup README for maintainers 2026-04-10 17:00:38 +08:00
vite.config.js Initialize myinfra-pkh project base 2026-04-10 16:55:14 +08:00

MyInfra PKH (Pelupusan & Hapus Kira)

Backend microservice for Modul Pelupusan & Hapus Kira (Disposal & Write-off).

Framework Laravel 12
Port 8010
Database myinfradb_pkh (PostgreSQL)
Auth Keycloak (RS256 JWT)
API Prefix /api/pkh
Container myinfra-pkh
K8s Namespace myinfra-pkh

Prerequisites

  • Docker & Docker Compose
  • myinfra-pgsn service running (provides shared PostgreSQL, Redis, Keycloak, MinIO)
  • myinfra-core package cloned at ../myinfra-core

Setup

1. Clone the repository

cd /path/to/myinfra-2
git clone [email protected]:shukry-datakraf/myinfra-pkh.git
cd myinfra-pkh

2. Environment configuration

cp .env.example .env

Edit .env if needed. The defaults work for local development with myinfra-pgsn.

3. Install dependencies

composer install --ignore-platform-req=ext-mongodb

Note: The --ignore-platform-req=ext-mongodb flag is needed because the MongoDB extension is installed inside Docker, not on the host machine.

4. Create the database

Make sure myinfra-pgsn is running, then create the PKH database:

docker exec -it myinfra-pgsn-pgsql psql -U postgres -c "CREATE DATABASE myinfradb_pkh;"

On fresh myinfra-pgsn setups, this database is created automatically via docker/init/multi-db-init.sql.

5. Start the service

docker compose up -d

6. Run migrations

docker compose exec myinfra-pkh php artisan migrate

7. Verify

curl http://localhost:8010/api/health
# {"status":"ok","service":"myinfra-pkh","timestamp":"..."}

curl http://localhost:8010/api/test/database
# {"status":"ok","message":"Database connection successful","database":"pgsql"}

Make Commands

Command Description
make up Start the container
make down Stop the container
make restart Restart the container
make bash Shell into the container
make migrate Run database migrations
make fresh Fresh migration with seeds
make logs View container logs
make app-log View nginx/php-fpm logs
make queue-log View queue worker logs
make cache-clear Clear all Laravel caches
make test Run PHPUnit tests
make status Show container status

Run make help for the full list.

Project Structure

myinfra-pkh/
├── app/
│   ├── Helpers/helpers.php          # getCurrentUser(), auth helpers
│   ├── Http/
│   │   ├── Controllers/             # API controllers
│   │   └── Middleware/               # Keycloak auth middleware
│   ├── Models/                       # Eloquent models
│   │   ├── User.php                  # Uses pgsql-pgsn (read-only)
│   │   └── Pegawai.php              # Uses pgsql-pgsn (read-only)
│   └── Providers/
│       └── AppServiceProvider.php    # Service bindings
├── config/
│   ├── auth.php                      # Keycloak guard config
│   ├── cors.php                      # CORS policy
│   ├── database.php                  # pgsql + pgsql-pgsn + mongodb
│   └── keycloak.php                  # Keycloak JWT settings
├── docker/
│   ├── nginx.conf                    # Nginx config
│   ├── supervisord.conf              # Process manager
│   ├── php.ini                       # PHP settings
│   ├── entrypoint.sh                 # Production entrypoint
│   └── entrypoint-local.sh           # Local dev entrypoint
├── k8s/
│   ├── staging/                      # K8s manifests (staging)
│   └── production/                   # K8s manifests (production)
├── routes/api.php                    # API routes
├── docker-compose.yml                # Local development
├── Dockerfile                        # Production image
├── Dockerfile.local                  # Local dev image
├── Dockerfile.ci                     # CI testing image
├── .gitlab-ci.yml                    # CI/CD pipeline
└── Makefile                          # Developer commands

Database Connections

Connection Database Purpose
pgsql (default) myinfradb_pkh PKH module data
pgsql-pgsn myinfradb_pgsn Shared users/pegawai (read-only)

API Endpoints

Public

Method Endpoint Description
GET /api/health Health check
GET /api/test Service status
POST /api/test/echo Echo request data
GET /api/test/database Database connection test

Protected (requires Keycloak token)

Method Endpoint Description
- /api/pkh/* PKH module routes (TBD)

CI/CD

The GitLab pipeline (.gitlab-ci.yml) runs on staging, training, and production branches:

  1. prebuild-test - Build CI test image
  2. test - PHPUnit with PostgreSQL
  3. build - Docker production image
  4. deploy - Deploy to K8s (myinfra-pkh namespace)
  5. rollback - Manual rollback option

Troubleshooting

Container crashes on startup

Check if myinfra-pgsn is running — PKH depends on the shared Docker network:

cd ../myinfra-pgsn && docker compose ps

PHP version mismatch

If you see Your Composer dependencies require a PHP version ">= 8.4.0", your host PHP is newer than Docker's PHP 8.2. Fix:

composer config platform.php 8.2.30
rm -rf vendor composer.lock
composer install --ignore-platform-req=ext-mongodb

Database connection refused

Ensure the database exists:

docker exec -it myinfra-pgsn-pgsql psql -U postgres -l | grep myinfradb_pkh