181 lines
2.3 KiB
Markdown
181 lines
2.3 KiB
Markdown
# NRML Dashboard
|
|
|
|
Laravel-based dashboard application running with Docker, Nginx, MySQL, and phpMyAdmin.
|
|
|
|
## Requirements
|
|
|
|
* Docker Desktop
|
|
* Docker Compose
|
|
* Git
|
|
|
|
## Project Structure
|
|
|
|
```text
|
|
nrml_dashboard/
|
|
├── dashboard/ # Laravel application
|
|
├── docker/
|
|
├── docker-compose.yml
|
|
├── Dockerfile
|
|
├── nginx.conf
|
|
```
|
|
|
|
## First-Time Setup
|
|
|
|
### Clone Repository
|
|
|
|
```bash
|
|
git clone https://gitea.niph.org.kh/khantey/nrml_dashboard.git
|
|
cd nrml_dashboard
|
|
```
|
|
|
|
### Create Environment File
|
|
|
|
```bash
|
|
cd dashboard
|
|
cp .env.example .env
|
|
```
|
|
|
|
### Start Docker Containers
|
|
|
|
```bash
|
|
docker compose up -d --build
|
|
```
|
|
|
|
### Install PHP Dependencies
|
|
|
|
```bash
|
|
docker exec -it dashboard_app bash
|
|
|
|
cd /var/www
|
|
|
|
composer install
|
|
```
|
|
|
|
### Generate Application Key
|
|
|
|
```bash
|
|
php artisan key:generate
|
|
```
|
|
|
|
### Configure Database
|
|
|
|
Update `.env`:
|
|
|
|
```env
|
|
DB_CONNECTION=mysql
|
|
DB_HOST=mysql
|
|
DB_PORT=3306
|
|
DB_DATABASE=dashboard
|
|
DB_USERNAME=laravel
|
|
DB_PASSWORD=secret
|
|
```
|
|
|
|
### Run Migrations
|
|
|
|
```bash
|
|
php artisan migrate
|
|
```
|
|
|
|
### Frontend Assets
|
|
|
|
Install dependencies:
|
|
|
|
```bash
|
|
cd dashboard
|
|
npm install
|
|
npm run build
|
|
```
|
|
|
|
## Application URLs
|
|
|
|
### Dashboard
|
|
|
|
http://localhost:8000
|
|
|
|
### phpMyAdmin
|
|
|
|
http://localhost:8083
|
|
|
|
Credentials:
|
|
|
|
```text
|
|
Server: mysql
|
|
Username: laravel
|
|
Password: secret
|
|
```
|
|
|
|
## Storage Directories
|
|
|
|
The following Laravel directories are committed to Git using placeholder `.gitignore` files:
|
|
|
|
```text
|
|
storage/framework/cache
|
|
storage/framework/sessions
|
|
storage/framework/testing
|
|
storage/framework/views
|
|
storage/logs
|
|
```
|
|
|
|
Do not remove these directories.
|
|
|
|
## Common Commands
|
|
|
|
Enter application container:
|
|
|
|
```bash
|
|
docker exec -it dashboard_app bash
|
|
```
|
|
|
|
Clear Laravel caches:
|
|
|
|
```bash
|
|
php artisan optimize:clear
|
|
```
|
|
|
|
View logs:
|
|
|
|
```bash
|
|
php artisan pail
|
|
```
|
|
|
|
Stop containers:
|
|
|
|
```bash
|
|
docker compose down
|
|
```
|
|
|
|
Restart containers:
|
|
|
|
```bash
|
|
docker compose restart
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
### "Please provide a valid cache path"
|
|
|
|
Verify that the following directories exist:
|
|
|
|
```text
|
|
storage/framework/cache
|
|
storage/framework/sessions
|
|
storage/framework/testing
|
|
storage/framework/views
|
|
storage/logs
|
|
```
|
|
|
|
Then run:
|
|
|
|
```bash
|
|
php artisan optimize:clear
|
|
```
|
|
|
|
### Permission Issues
|
|
|
|
Inside the container:
|
|
|
|
```bash
|
|
chown -R www-data:www-data storage bootstrap/cache
|
|
chmod -R 775 storage bootstrap/cache
|
|
```
|