add update nginx config to domain and create production setup docker

This commit is contained in:
2025-06-11 19:02:02 +07:00
parent 647aa51187
commit 0b211915f1
13 changed files with 1899 additions and 74 deletions

View File

@@ -23,9 +23,9 @@ Dokumentasi ini menjelaskan cara menjalankan aplikasi CKB menggunakan Docker unt
## Prerequisites
- Docker Engine 20.10+
- Docker Compose 2.0+
- Git
- Docker Engine 20.10+
- Docker Compose 2.0+
- Git
## Setup untuk Local Development
@@ -46,19 +46,20 @@ ls ckb.sql
```
Script ini akan otomatis:
- Setup environment file
- Start semua containers
- Import database dari ckb.sql
- Generate application key
- Setup Laravel application
- Setup environment file
- Start semua containers
- Import database dari ckb.sql
- Generate application key
- Setup Laravel application
### 2. Manual Setup
Jika Anda ingin setup manual:
```bash
# Copy environment file
cp docker/env.example .env
# Setup local environment
./docker-setup-env.sh local
# Start containers
docker-compose up -d --build
@@ -82,11 +83,11 @@ docker-compose up -d
### 3. Akses Aplikasi
- **Web Application**: http://localhost:8000
- **Database (phpMyAdmin)**: http://localhost:8080
- **Mail Testing (MailHog)**: http://localhost:8025
- **MySQL Direct**: localhost:3306
- **Redis**: localhost:6379
- **Web Application**: http://localhost:8000
- **Database (phpMyAdmin)**: http://localhost:8080
- **Mail Testing (MailHog)**: http://localhost:8025
- **MySQL Direct**: localhost:3306
- **Redis**: localhost:6379
### 4. Menjalankan Laravel Commands
@@ -183,9 +184,10 @@ docker-compose -f docker-compose.prod.yml logs -f
### 2. Debugging dengan Xdebug (Development)
Xdebug sudah dikonfigurasi untuk development environment:
- Port: 9003
- IDE Key: PHPSTORM
- Host: host.docker.internal
- Port: 9003
- IDE Key: PHPSTORM
- Host: host.docker.internal
### 3. Monitoring Resources
@@ -207,7 +209,7 @@ Untuk mengimport database dari file backup ckb.sql:
# Import ke development environment
./docker-import-db.sh dev
# Import ke production environment
# Import ke production environment
./docker-import-db.sh prod
# Import file SQL khusus
@@ -215,11 +217,12 @@ Untuk mengimport database dari file backup ckb.sql:
```
Script import akan otomatis:
- Backup database yang sudah ada (safety)
- Drop dan recreate database
- Import data dari file SQL
- Jalankan migrations jika diperlukan
- Clear cache Laravel
- Backup database yang sudah ada (safety)
- Drop dan recreate database
- Import data dari file SQL
- Jalankan migrations jika diperlukan
- Clear cache Laravel
### 2. Backup Database
@@ -262,9 +265,10 @@ docker-compose build --no-cache --pull
```
**Common Build Errors:**
- **curl extension error**: Fixed dengan menambah `libcurl4-openssl-dev` dan `pkg-config`
- **gd extension error**: Pastikan `libfreetype6-dev` dan `libjpeg62-turbo-dev` terinstall
- **Out of space**: Jalankan `docker system prune -a -f` untuk cleanup
- **curl extension error**: Fixed dengan menambah `libcurl4-openssl-dev` dan `pkg-config`
- **gd extension error**: Pastikan `libfreetype6-dev` dan `libjpeg62-turbo-dev` terinstall
- **Out of space**: Jalankan `docker system prune -a -f` untuk cleanup
### 2. Permission Issues
@@ -345,9 +349,10 @@ docker-compose exec app php artisan cache:clear
```
**Common Redis Errors:**
- **Class Redis not found**: Fixed dengan install `pecl install redis`
- **Connection refused**: Pastikan Redis container berjalan
- **Config not loaded**: Jalankan `php artisan config:clear`
- **Class Redis not found**: Fixed dengan install `pecl install redis`
- **Connection refused**: Pastikan Redis container berjalan
- **Config not loaded**: Jalankan `php artisan config:clear`
## Security Notes untuk Production
@@ -371,9 +376,9 @@ docker-compose exec app composer install --optimize-autoloader --no-dev
### 2. Docker Optimizations
- Gunakan multi-stage builds untuk image yang lebih kecil
- Leverage Docker layer caching
- Optimize .dockerignore untuk build speed
- Gunakan multi-stage builds untuk image yang lebih kecil
- Leverage Docker layer caching
- Optimize .dockerignore untuk build speed
## Backup Strategy
@@ -396,4 +401,4 @@ tar -czf "backup_${DATE}.tar.gz" backup_${DATE}.sql storage/
docker run --rm -v ckb_mysql_data:/data -v $(pwd):/backup alpine tar czf /backup/mysql_backup.tar.gz /data
```
Untuk pertanyaan lebih lanjut atau issues, silakan buat issue di repository ini.
Untuk pertanyaan lebih lanjut atau issues, silakan buat issue di repository ini.