- PHP 80.9%
- Blade 15.9%
- Dockerfile 1.2%
- Shell 0.9%
- HTML 0.7%
- Other 0.4%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
fix(test): stop the suite running against the working database See merge request shukry-datakraf/myinfra-ppun!35 |
||
| .github/workflows | ||
| app | ||
| bootstrap | ||
| config | ||
| database | ||
| docker | ||
| docs | ||
| documentation | ||
| k8s | ||
| public | ||
| resources | ||
| routes | ||
| storage | ||
| tests | ||
| .dockerignore | ||
| .DS_Store | ||
| .editorconfig | ||
| .env.example | ||
| .env.testing | ||
| .gitattributes | ||
| .gitignore | ||
| .gitlab-ci-test.yml | ||
| .gitlab-ci.yml | ||
| .gitmodules | ||
| .styleci.yml | ||
| artisan | ||
| CHANGELOG.md | ||
| composer.json | ||
| composer.lock | ||
| docker-compose.local.yml | ||
| docker-compose.override.yml.backup | ||
| docker-compose.prod.local.yml | ||
| docker-compose.prod.yml | ||
| docker-compose.yml | ||
| Dockerfile | ||
| Dockerfile.local | ||
| forgot-password-email-test.html | ||
| Makefile | ||
| myinfra-backend.zip | ||
| MyInfra.openapi.json | ||
| package-lock.json | ||
| package.json | ||
| Penerimaan.openapi.json | ||
| phpunit.xml | ||
| Ptra.openapi.json | ||
| README.md | ||
| realm-export.json | ||
| SenaraiPenerimaan.openapi.json | ||
| servers.json | ||
| Structure_PTRA.jpeg | ||
| vite.config.js | ||
🧰 System Requirements
Make sure the following are installed on your machine:
| Tool | Minimum Version | Install Guide |
|---|---|---|
| Ubuntu | 22.04 LTS | ✅ You’re good |
| Docker | 20+ | https://docs.docker.com/engine/install/ubuntu/ |
| Docker Compose | v2+ | https://docs.docker.com/compose/install/ |
| Make | 4.3+ | sudo apt install make |
| PHP | 8.2+ | Optional (for artisan commands locally) |
| Node.js | 18+ | Install via https://github.com/nvm-sh/nvm |
| NPM | 9+ | Comes with Node.js |
Update
📦 Clone the Project
Make sure to clone both frontend and backend repositories into the same parent directory:
git clone https://gitlab.com/shukry-datakraf/myinfra-backend.git
git clone https://gitlab.com/shukry-datakraf/myinfra-frontend.git
cd myinfra-backend
⚙️ Initial Setup
- Copy
.envfiles
cp .env.example .env
- Run full setup (first time only)
make reset
To start containers again later:
make up
To stop containers without removing:
make stop
🧪 Common Makefile Commands
Make sure you're inside the project root folder.
| Command | Description |
|---|---|
make up |
Start all containers |
make stop |
Stop containers without removing |
make down |
Stop and remove all containers |
make restart |
Rebuild and start containers |
make reset |
Full reset with volume + rebuild |
make bash |
Shell into Laravel backend container |
make frontend |
Shell into Nuxt frontend container |
make artisan |
Run artisan commands (use with cmd=...) |
make npm |
Run npm commands in Laravel (use cmd=...) |
make logs |
Tail all container logs |
make frontend-log |
Tail Nuxt frontend logs |
make backend-log |
Tail Laravel backend logs |
💄 Migrate the Database
- Enter Laravel container
make bash
- Run migrations (example):
make artisan cmd="migrate"
To refresh + seed:
make artisan cmd="migrate:fresh --seed"
🪪 Running the App
- Laravel API: http://localhost:8000/api
- Nuxt Frontend: http://localhost:3000
🤩 CORS & Sanctum Setup (for Laravel + Nuxt)
Make sure in .env:
SESSION_DOMAIN=localhost
SANCTUM_STATEFUL_DOMAINS=localhost:3000
And in config/cors.php:
'paths' => ['api/*', 'sanctum/csrf-cookie'],
'supports_credentials' => true,
🪩 Troubleshooting
⚠️ Keycloak Client Secret Issue
If you see warnings about The "kLpQ" variable is not set or get unauthorized_client errors:
The Keycloak client secret contains a $ character that needs proper escaping:
# WRONG - Single $ is interpreted as variable
KEYCLOAK_CLIENT_SECRET=Z#v7M&2rTx9$kLpQ
# CORRECT - Use $$ to escape the $ character in .env files
KEYCLOAK_CLIENT_SECRET=Z#v7M&2rTx9$$kLpQ
Note: The $$ in .env will be interpreted as a single $ when passed to containers.
After updating .env, restart containers:
make restart
If you still get unauthorized_client errors, the Keycloak client may need to be configured for service accounts:
- Access Keycloak Admin: http://localhost:8080 (admin/admin)
- Go to MyInfra realm → Clients → laravel-api
- Enable "Service accounts roles" under Settings
- Save the client configuration
Or run the testing seeder without Keycloak by modifying the seeder to skip Keycloak user creation.
❌ Nuxt: Permission denied
Fix in Dockerfile:
RUN chmod +x node_modules/.bin/nuxt
Or in docker-compose.yml:
command: ["sh", "-c", "chmod +x node_modules/.bin/nuxt && npm run dev"]
🧪 Run Laravel Tests
make bash
php artisan test
API Endpoints
All endpoints require authentication.
| Variable | Used By | Format (no /api) |
|---|---|---|
| STAGING_PGSN_API_URL | PPA, OPA, PPUN | http://myinfra-pgsn.url |
| STAGING_PPA_API_URL | OPA, PPUN | http://myinfra-ppa.url |
| BACKEND_PGSN_API_URL | Frontend (SSR) | http://myinfra-pgsn.url |
| BACKEND_PPA_API_URL | Frontend (SSR) | http://myinfra-ppa.url |
| BACKEND_OPA_API_URL | Frontend (SSR) | http://myinfra-opa.url |
| BACKEND_PPUN_API_URL | Frontend (SSR) | http://myinfra-ppun.url |