[Update] Docker done
Potensi masalah: db tidak sehat
This commit is contained in:
parent
a3e68b8cd0
commit
37d48c8b15
@ -1,10 +1,82 @@
|
||||
node_modules
|
||||
vendor
|
||||
.env
|
||||
Dockerfile
|
||||
docker-compose.yml
|
||||
# ========================================
|
||||
# Docker Ignore File
|
||||
# ========================================
|
||||
|
||||
# Git
|
||||
.git
|
||||
.gitignore
|
||||
tests
|
||||
.gitattributes
|
||||
|
||||
# Documentation
|
||||
README.md
|
||||
CHANGELOG.md
|
||||
Documentation/
|
||||
*.md
|
||||
|
||||
# Tests
|
||||
tests/
|
||||
phpunit.xml
|
||||
.phpunit.cache
|
||||
.phpunit.result.cache
|
||||
|
||||
# IDE & Editors
|
||||
.vscode/
|
||||
.idea/
|
||||
.fleet/
|
||||
.nova/
|
||||
.zed/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
.phpactor.json
|
||||
|
||||
# Docker files (tidak perlu di-copy ke image)
|
||||
Dockerfile
|
||||
docker-compose*.yml
|
||||
.dockerignore
|
||||
|
||||
# Environment files (akan di-set via environment variables)
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
|
||||
# Dependencies (akan di-install via composer & npm)
|
||||
/vendor/
|
||||
/node_modules/
|
||||
|
||||
# Build artifacts (akan di-build di stage terpisah)
|
||||
/public/hot
|
||||
/public/build
|
||||
|
||||
# Storage & Cache (akan di-mount sebagai volume)
|
||||
/storage/*.key
|
||||
/storage/logs/*
|
||||
/storage/framework/cache/*
|
||||
/storage/framework/sessions/*
|
||||
/storage/framework/views/*
|
||||
/storage/pail
|
||||
|
||||
# Generated files
|
||||
/public/storage
|
||||
/bootstrap/cache/*
|
||||
|
||||
# Local development files
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
auth.json
|
||||
.vagrant
|
||||
.phpstorm.meta.php
|
||||
_ide_helper.php
|
||||
|
||||
# Logs
|
||||
*.log
|
||||
storage/logs/*
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# OS Files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
desktop.ini
|
||||
86
.env.docker
Normal file
86
.env.docker
Normal file
@ -0,0 +1,86 @@
|
||||
# ========================================
|
||||
# Abbauf Kasir - Docker Environment Configuration
|
||||
# ========================================
|
||||
# Copy file ini ke .env sebelum deployment
|
||||
# Ganti semua placeholder dengan nilai yang sesuai
|
||||
|
||||
# Application
|
||||
APP_NAME=Abbauf-Kasir
|
||||
APP_ENV=production
|
||||
APP_KEY= # Generate dengan: php artisan key:generate
|
||||
APP_DEBUG=false
|
||||
APP_URL=http://localhost # Ganti dengan domain production
|
||||
|
||||
APP_LOCALE=id
|
||||
APP_FALLBACK_LOCALE=en
|
||||
APP_FAKER_LOCALE=id_ID
|
||||
|
||||
APP_MAINTENANCE_DRIVER=file
|
||||
PHP_CLI_SERVER_WORKERS=4
|
||||
|
||||
BCRYPT_ROUNDS=12
|
||||
|
||||
# Logging
|
||||
LOG_CHANNEL=stack
|
||||
LOG_STACK=daily
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=error
|
||||
|
||||
# Database Configuration
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=mysql # Nama service di docker-compose
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=kasir_db # Nama database
|
||||
DB_USERNAME=kasir_user # Username database
|
||||
DB_PASSWORD=strong_password_here # GANTI dengan password kuat!
|
||||
|
||||
# MySQL Root Password (untuk docker-compose)
|
||||
MYSQL_ROOT_PASSWORD=root_strong_password # GANTI dengan password root yang kuat!
|
||||
|
||||
# Cache & Session
|
||||
CACHE_STORE=redis
|
||||
SESSION_DRIVER=redis
|
||||
SESSION_LIFETIME=120
|
||||
SESSION_ENCRYPT=false
|
||||
SESSION_PATH=/
|
||||
SESSION_DOMAIN=null
|
||||
|
||||
# Redis Configuration
|
||||
REDIS_CLIENT=phpredis
|
||||
REDIS_HOST=redis
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
# Queue
|
||||
QUEUE_CONNECTION=redis
|
||||
|
||||
# Broadcasting
|
||||
BROADCAST_CONNECTION=log
|
||||
|
||||
# Filesystem
|
||||
FILESYSTEM_DISK=local
|
||||
|
||||
# Mail Configuration (opsional)
|
||||
MAIL_MAILER=log
|
||||
MAIL_SCHEME=null
|
||||
MAIL_HOST=127.0.0.1
|
||||
MAIL_PORT=2525
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_FROM_ADDRESS="noreply@abbauf-kasir.local"
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
# AWS (jika menggunakan S3 untuk storage)
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
# Ports (untuk docker-compose)
|
||||
APP_PORT=80 # Port untuk akses aplikasi
|
||||
# DB_PORT=3306 # Uncomment jika ingin expose DB port
|
||||
# REDIS_PORT=6379 # Uncomment jika ingin expose Redis port
|
||||
|
||||
# Vite
|
||||
VITE_APP_NAME="${APP_NAME}"
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@ -22,3 +22,8 @@
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
Thumbs.db
|
||||
|
||||
# Docker - Database Backups (exclude backups from git)
|
||||
/docker/mysql/backups/*.sql
|
||||
/docker/mysql/backups/*.sql.gz
|
||||
!/docker/mysql/backups/README.md
|
||||
|
||||
87
Dockerfile
87
Dockerfile
@ -1,34 +1,91 @@
|
||||
# Stage 1: Build Vue (tetap sama)
|
||||
FROM node:20 as node_builder
|
||||
# ========================================
|
||||
# Stage 1: Build Frontend Assets (Vue.js)
|
||||
# ========================================
|
||||
FROM node:20-alpine as node_builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files untuk caching layer
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
|
||||
# Install dependencies
|
||||
RUN npm ci --legacy-peer-deps
|
||||
|
||||
# Copy seluruh source code
|
||||
COPY . .
|
||||
|
||||
# Build production assets
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Laravel
|
||||
FROM php:8.3-fpm
|
||||
# ========================================
|
||||
# Stage 2: Laravel Application
|
||||
# ========================================
|
||||
FROM php:8.3-fpm-alpine
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git unzip libzip-dev libpng-dev libonig-dev libxml2-dev curl \
|
||||
&& docker-php-ext-install pdo_mysql zip gd mbstring exif pcntl bcmath \
|
||||
&& apt-get clean && rm -rf /var/lib/apt/lists/* # Cleanup untuk ukuran kecil
|
||||
# Install system dependencies dan PHP extensions
|
||||
RUN apk update && apk add --no-cache \
|
||||
git \
|
||||
unzip \
|
||||
libzip-dev \
|
||||
libpng-dev \
|
||||
oniguruma-dev \
|
||||
libxml2-dev \
|
||||
curl \
|
||||
mysql-client \
|
||||
autoconf \
|
||||
g++ \
|
||||
make \
|
||||
&& docker-php-ext-install \
|
||||
pdo_mysql \
|
||||
zip \
|
||||
gd \
|
||||
mbstring \
|
||||
exif \
|
||||
pcntl \
|
||||
bcmath \
|
||||
&& pecl install redis \
|
||||
&& docker-php-ext-enable redis \
|
||||
&& apk del autoconf g++ make \
|
||||
&& rm -rf /var/cache/apk/* /tmp/*
|
||||
|
||||
# Install Composer
|
||||
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /var/www/html
|
||||
|
||||
# Copy source code
|
||||
# Copy composer files untuk caching layer
|
||||
COPY composer.json composer.lock ./
|
||||
|
||||
# Install PHP dependencies
|
||||
RUN composer install --no-dev --no-scripts --no-autoloader --prefer-dist
|
||||
|
||||
# Copy application source code
|
||||
COPY . .
|
||||
# Copy hasil build Vue
|
||||
|
||||
# Copy hasil build Vue dari stage 1
|
||||
COPY --from=node_builder /app/public/build /var/www/html/public/build
|
||||
|
||||
RUN composer install --no-dev --optimize-autoloader
|
||||
RUN php artisan config:cache && php artisan route:cache && php artisan view:cache # Optimasi cache untuk performa laporan/transaksi
|
||||
# Generate autoload files dengan optimasi
|
||||
RUN composer dump-autoload --optimize --classmap-authoritative
|
||||
|
||||
# Set permission dan user non-root
|
||||
RUN chown -R www-data:www-data /var/www/html
|
||||
# Create required directories dan set permissions
|
||||
RUN mkdir -p \
|
||||
storage/framework/cache \
|
||||
storage/framework/sessions \
|
||||
storage/framework/views \
|
||||
storage/logs \
|
||||
bootstrap/cache \
|
||||
&& chown -R www-data:www-data \
|
||||
/var/www/html/storage \
|
||||
/var/www/html/bootstrap/cache \
|
||||
&& chmod -R 775 \
|
||||
/var/www/html/storage \
|
||||
/var/www/html/bootstrap/cache
|
||||
|
||||
# Switch ke user non-root untuk keamanan
|
||||
USER www-data
|
||||
|
||||
EXPOSE 9000
|
||||
|
||||
CMD ["php-fpm"]
|
||||
|
||||
186
README.md
186
README.md
@ -1,6 +1,6 @@
|
||||
# 💎 Aplikasi Kasir Toko Perhiasan
|
||||
|
||||
Aplikasi kasir modern berbasis web untuk toko perhiasan dengan sistem manajemen yang lengkap dan antarmuka yang user-friendly.
|
||||
Aplikasi kasir modern berbasis web untuk toko perhiasan dengan sistem manajemen yang lengkap dan antarmuka yang user-friendly. Dibuat khusus sesuai kebutuhan Toko Emas Jakarta Citayam.
|
||||
|
||||
## 👥 Tim Development
|
||||
|
||||
@ -15,7 +15,7 @@ Aplikasi kasir modern berbasis web untuk toko perhiasan dengan sistem manajemen
|
||||
|
||||
## 🚀 Tentang Aplikasi
|
||||
|
||||
Aplikasi Kasir Toko Perhiasan adalah sistem Point of Sale (POS) yang dirancang khusus untuk kebutuhan toko perhiasan dengan fitur manajemen yang komprehensif dan sistem role-based access control.
|
||||
Semuah sistem Point of Sale (POS) yang dirancang khusus untuk kebutuhan toko perhiasan dengan fitur manajemen yang komprehensif dan sistem role-based access control.
|
||||
|
||||
### ✨ Fitur Utama
|
||||
|
||||
@ -38,7 +38,7 @@ Aplikasi Kasir Toko Perhiasan adalah sistem Point of Sale (POS) yang dirancang k
|
||||
|
||||
- **Backend**: Laravel 11.x
|
||||
- **Frontend**: Vue.js 3 + Vue Router
|
||||
- **Database**: MySQL/PostgreSQL
|
||||
- **Database**: MySQL
|
||||
- **Styling**: Tailwind CSS
|
||||
- **Build Tool**: Vite
|
||||
- **Authentication**: Laravel Sanctum
|
||||
@ -48,18 +48,68 @@ Aplikasi Kasir Toko Perhiasan adalah sistem Point of Sale (POS) yang dirancang k
|
||||
|
||||
## 📋 Prerequisites
|
||||
|
||||
Pastikan sistem Anda sudah memiliki:
|
||||
### Opsi 1: Docker (Recommended) 🐳
|
||||
|
||||
- **PHP** >= 8.1
|
||||
- **Composer** >= 2.0
|
||||
- **Node.js** >= 16.x
|
||||
- **NPM** atau **Yarn**
|
||||
- **MySQL** >= 8.0 atau **PostgreSQL** >= 13
|
||||
- **Docker Desktop** (Windows/Mac) atau **Docker Engine** (Linux)
|
||||
- **Docker Compose** v2.0+
|
||||
- **Git**
|
||||
|
||||
### Opsi 2: Manual Installation
|
||||
|
||||
- **PHP** 8.2+
|
||||
- **Composer**
|
||||
- **Node.js** 18+
|
||||
- **NPM**
|
||||
- **MySQL** 8.0+
|
||||
- **Redis** (optional)
|
||||
- **Git**
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Instalasi
|
||||
## <20> Docker Installation (Recommended)
|
||||
|
||||
### Quick Start dengan Docker
|
||||
|
||||
```bash
|
||||
# 1. Clone repository
|
||||
git clone https://git.abbauf.com/Magang-2025/Kasir.git
|
||||
cd Kasir
|
||||
|
||||
# 2. Setup environment
|
||||
copy .env.docker .env # Windows
|
||||
# atau
|
||||
cp .env.docker .env # Linux/Mac
|
||||
|
||||
# 3. Edit .env (PENTING: ganti password!)
|
||||
notepad .env # Windows
|
||||
nano .env # Linux/Mac
|
||||
|
||||
# 4. Deploy dengan satu command
|
||||
docker-deploy.bat # Windows
|
||||
# atau
|
||||
./docker-deploy.sh # Linux/Mac
|
||||
|
||||
# 5. Akses aplikasi
|
||||
# http://localhost
|
||||
```
|
||||
|
||||
**Dokumentasi Docker Lengkap:**
|
||||
- 📖 Quick Start: [README-DOCKER.md](README-DOCKER.md)
|
||||
- 📚 Full Guide: [DOCKER-DEPLOYMENT.md](DOCKER-DEPLOYMENT.md)
|
||||
- 📋 Checklist: [DEPLOYMENT-CHECKLIST.md](DEPLOYMENT-CHECKLIST.md)
|
||||
- 🎯 Quick Reference: [QUICK-REFERENCE.txt](QUICK-REFERENCE.txt)
|
||||
|
||||
**Management Commands:**
|
||||
```bash
|
||||
docker-helper.bat status # Cek status containers
|
||||
docker-helper.bat logs # Lihat logs
|
||||
docker-helper.bat backup # Backup database
|
||||
docker-helper.bat restart # Restart containers
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## <20>🔧 Manual Installation
|
||||
|
||||
### 1. Clone Repository
|
||||
|
||||
@ -90,15 +140,15 @@ npm install
|
||||
|
||||
### 4. Konfigurasi Database
|
||||
|
||||
Edit file `.env` sesuai dengan konfigurasi database Anda:
|
||||
Edit file `.env` sesuai dengan konfigurasi database:
|
||||
|
||||
```env
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=kasir_perhiasan
|
||||
DB_USERNAME=your_username
|
||||
DB_PASSWORD=your_password
|
||||
DB_DATABASE=toko_emas
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
```
|
||||
|
||||
---
|
||||
@ -106,17 +156,16 @@ DB_PASSWORD=your_password
|
||||
### 5. Setup Database
|
||||
|
||||
```bash
|
||||
# Jalankan migrasi
|
||||
php artisan migrate
|
||||
```
|
||||
|
||||
# Jalankan seeder (data dummy)
|
||||
```bash
|
||||
php artisan db:seed
|
||||
```
|
||||
|
||||
### 6. Storage Link
|
||||
|
||||
```bash
|
||||
# Buat symbolic link untuk storage
|
||||
php artisan storage:link
|
||||
```
|
||||
|
||||
@ -125,24 +174,9 @@ php artisan storage:link
|
||||
#### Development Mode
|
||||
|
||||
```bash
|
||||
# Terminal 1 - Laravel Server
|
||||
php artisan serve
|
||||
|
||||
# Terminal 2 - Vite Dev Server
|
||||
npm run dev
|
||||
```
|
||||
|
||||
#### Production Mode
|
||||
|
||||
```bash
|
||||
# Build untuk production
|
||||
npm run build
|
||||
|
||||
# Jalankan dengan web server (Apache/Nginx)
|
||||
# atau gunakan PHP built-in server
|
||||
php artisan serve --host=0.0.0.0 --port=8000
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🌐 Akses Aplikasi
|
||||
@ -243,24 +277,10 @@ ItemTransaksi -> belongsTo -> Item
|
||||
|
||||
## 🛠️ Development
|
||||
|
||||
### Menjalankan Tests
|
||||
|
||||
```bash
|
||||
# PHP Unit Tests
|
||||
php artisan test
|
||||
|
||||
# atau dengan coverage
|
||||
php artisan test --coverage
|
||||
```
|
||||
|
||||
### Code Quality
|
||||
|
||||
```bash
|
||||
# PHP CS Fixer
|
||||
vendor/bin/php-cs-fixer fix
|
||||
|
||||
# Laravel Pint
|
||||
vendor/bin/pint
|
||||
npm run dev
|
||||
```
|
||||
|
||||
### Database Management
|
||||
@ -276,13 +296,77 @@ php artisan backup:run
|
||||
php artisan make:model ProductCategory -m
|
||||
```
|
||||
|
||||
### Production
|
||||
### Production Deployment
|
||||
|
||||
> Pastikan `.env.production` sudah ada.
|
||||
**Dengan Docker (Recommended):**
|
||||
```bash
|
||||
# 1. Setup .env untuk production
|
||||
copy .env.docker .env
|
||||
# Edit: APP_ENV=production, APP_DEBUG=false, set password kuat
|
||||
|
||||
```bash
|
||||
docker compose --env-file .env.production up --build -d
|
||||
# 2. Deploy
|
||||
docker-deploy.bat
|
||||
|
||||
# 3. Monitor
|
||||
docker-helper.bat status
|
||||
docker-helper.bat logs
|
||||
```
|
||||
|
||||
**Manual Deployment:**
|
||||
```bash
|
||||
# Build assets
|
||||
npm run build
|
||||
|
||||
# Optimize Laravel
|
||||
php artisan config:cache
|
||||
php artisan route:cache
|
||||
php artisan view:cache
|
||||
|
||||
# Set permissions
|
||||
chmod -R 775 storage bootstrap/cache
|
||||
```
|
||||
|
||||
**Dokumentasi lengkap:** [DOCKER-DEPLOYMENT.md](DOCKER-DEPLOYMENT.md)
|
||||
|
||||
---
|
||||
|
||||
## 🔄 Update Aplikasi
|
||||
|
||||
**Dengan Docker:**
|
||||
```bash
|
||||
docker-helper.bat update # Otomatis: pull, rebuild, migrate, cache
|
||||
```
|
||||
|
||||
**Manual:**
|
||||
```bash
|
||||
git pull origin main
|
||||
composer install --no-dev
|
||||
npm install && npm run build
|
||||
php artisan migrate --force
|
||||
php artisan config:cache
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 💾 Backup & Restore
|
||||
|
||||
**Backup Database (Docker):**
|
||||
```bash
|
||||
docker-helper.bat backup
|
||||
# File tersimpan di: docker/mysql/backups/
|
||||
```
|
||||
|
||||
**Restore Database (Docker):**
|
||||
```bash
|
||||
docker-helper.bat restore
|
||||
# Pilih file backup yang tersedia
|
||||
```
|
||||
|
||||
**Manual Backup:**
|
||||
```bash
|
||||
mysqldump -u root -p toko_emas > backup.sql
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📄 License
|
||||
|
||||
@ -1,56 +1,176 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
# ========================================
|
||||
# Laravel PHP-FPM Application
|
||||
# ========================================
|
||||
laravel:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: laravel_app_prod
|
||||
container_name: abbauf_kasir_app
|
||||
restart: unless-stopped
|
||||
working_dir: /var/www/html
|
||||
volumes:
|
||||
# Mount storage untuk uploads dan logs (persistent)
|
||||
- ./storage:/var/www/html/storage
|
||||
# Mount public build assets (read-only)
|
||||
- ./public/build:/var/www/html/public/build:ro
|
||||
environment:
|
||||
# Application
|
||||
APP_NAME: ${APP_NAME:-Abbauf-Kasir}
|
||||
APP_ENV: ${APP_ENV:-production}
|
||||
APP_KEY: ${APP_KEY}
|
||||
APP_DEBUG: ${APP_DEBUG:-false}
|
||||
APP_URL: ${APP_URL:-http://localhost}
|
||||
|
||||
# Database
|
||||
DB_CONNECTION: mysql
|
||||
DB_HOST: mysql
|
||||
DB_PORT: 3306
|
||||
DB_DATABASE: ${DB_DATABASE:-kasir_db}
|
||||
DB_USERNAME: ${DB_USERNAME:-kasir_user}
|
||||
DB_PASSWORD: ${DB_PASSWORD}
|
||||
|
||||
# Cache & Session
|
||||
CACHE_STORE: redis
|
||||
SESSION_DRIVER: redis
|
||||
REDIS_HOST: redis
|
||||
REDIS_PORT: 6379
|
||||
|
||||
# Queue
|
||||
QUEUE_CONNECTION: redis
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_started
|
||||
networks:
|
||||
- kasir_network
|
||||
healthcheck:
|
||||
test: ["CMD", "php-fpm", "-t"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
|
||||
# ========================================
|
||||
# Nginx Web Server
|
||||
# ========================================
|
||||
nginx:
|
||||
image: nginx:alpine
|
||||
container_name: abbauf_kasir_nginx
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "${APP_PORT:-80}:80"
|
||||
volumes:
|
||||
# Nginx configuration
|
||||
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
# Laravel public directory (untuk static assets)
|
||||
- ./public:/var/www/html/public:ro
|
||||
# Storage symlink untuk file uploads
|
||||
- ./storage/app/public:/var/www/html/public/storage:ro
|
||||
depends_on:
|
||||
- laravel
|
||||
networks:
|
||||
- kasir_network
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost/"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
|
||||
# ========================================
|
||||
# MySQL Database
|
||||
# ========================================
|
||||
mysql:
|
||||
image: mysql:8.4
|
||||
container_name: abbauf_kasir_db
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root_secret_password}
|
||||
MYSQL_DATABASE: ${DB_DATABASE:-kasir_db}
|
||||
MYSQL_USER: ${DB_USERNAME:-kasir_user}
|
||||
MYSQL_PASSWORD: ${DB_PASSWORD}
|
||||
MYSQL_CHARACTER_SET_SERVER: utf8mb4
|
||||
MYSQL_COLLATION_SERVER: utf8mb4_unicode_ci
|
||||
ports:
|
||||
- "${DB_PORT:-3306}:3306"
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql
|
||||
# Optional: backup folder
|
||||
- ./docker/mysql/backups:/backups
|
||||
networks:
|
||||
- kasir_network
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${MYSQL_ROOT_PASSWORD:-root_secret_password}"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
command: --default-authentication-plugin=mysql_native_password
|
||||
|
||||
# ========================================
|
||||
# Redis Cache & Session Store
|
||||
# ========================================
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: abbauf_kasir_redis
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "${REDIS_PORT:-6379}:6379"
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
networks:
|
||||
- kasir_network
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
command: redis-server --appendonly yes
|
||||
|
||||
# ========================================
|
||||
# Queue Worker (Optional - untuk background jobs)
|
||||
# ========================================
|
||||
queue:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: abbauf_kasir_queue
|
||||
restart: unless-stopped
|
||||
working_dir: /var/www/html
|
||||
volumes:
|
||||
- ./storage:/var/www/html/storage
|
||||
ports:
|
||||
- "9000"
|
||||
depends_on:
|
||||
- mysql
|
||||
environment:
|
||||
APP_ENV: production
|
||||
APP_DEBUG: false
|
||||
APP_ENV: ${APP_ENV:-production}
|
||||
APP_KEY: ${APP_KEY}
|
||||
DB_CONNECTION: mysql
|
||||
DB_HOST: mysql
|
||||
DB_PORT: 3306
|
||||
DB_DATABASE: ${DB_DATABASE}
|
||||
DB_USERNAME: ${DB_USERNAME}
|
||||
DB_DATABASE: ${DB_DATABASE:-kasir_db}
|
||||
DB_USERNAME: ${DB_USERNAME:-kasir_user}
|
||||
DB_PASSWORD: ${DB_PASSWORD}
|
||||
|
||||
nginx:
|
||||
image: nginx:alpine
|
||||
container_name: nginx_prod
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
- ./storage:/var/www/html/storage:ro
|
||||
REDIS_HOST: redis
|
||||
QUEUE_CONNECTION: redis
|
||||
depends_on:
|
||||
- laravel
|
||||
- redis
|
||||
- mysql
|
||||
networks:
|
||||
- kasir_network
|
||||
command: php artisan queue:work --tries=3 --timeout=90
|
||||
|
||||
mysql:
|
||||
image: mysql:8
|
||||
container_name: mysql_db_prod
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
|
||||
MYSQL_DATABASE: ${DB_DATABASE}
|
||||
MYSQL_USER: ${DB_USERNAME}
|
||||
MYSQL_PASSWORD: ${DB_PASSWORD}
|
||||
ports:
|
||||
- "3306:3306"
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql
|
||||
|
||||
redis:
|
||||
image: redis:alpine
|
||||
container_name: redis_prod
|
||||
ports:
|
||||
- "6379:6379"
|
||||
# ========================================
|
||||
# Networks
|
||||
# ========================================
|
||||
networks:
|
||||
kasir_network:
|
||||
driver: bridge
|
||||
|
||||
# ========================================
|
||||
# Persistent Volumes
|
||||
# ========================================
|
||||
volumes:
|
||||
mysql_data:
|
||||
driver: local
|
||||
redis_data:
|
||||
driver: local
|
||||
|
||||
73
nginx.conf
73
nginx.conf
@ -1,14 +1,43 @@
|
||||
# ========================================
|
||||
# Abbauf Kasir - Nginx Configuration
|
||||
# ========================================
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
index index.php index.html;
|
||||
error_log /var/log/nginx/error.log;
|
||||
access_log /var/log/nginx/access.log;
|
||||
listen [::]:80;
|
||||
server_name localhost;
|
||||
|
||||
root /var/www/html/public;
|
||||
index index.php index.html index.htm;
|
||||
|
||||
# Logging
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
|
||||
# Security Headers
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-XSS-Protection "1; mode=block" always;
|
||||
|
||||
# Client body size limit (untuk upload file)
|
||||
client_max_body_size 20M;
|
||||
|
||||
# Gzip compression
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_proxied any;
|
||||
gzip_comp_level 6;
|
||||
gzip_types text/plain text/css text/xml text/javascript
|
||||
application/json application/javascript application/xml+rss
|
||||
application/rss+xml font/truetype font/opentype
|
||||
application/vnd.ms-fontobject image/svg+xml;
|
||||
|
||||
# Main location block
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
# PHP-FPM configuration
|
||||
location ~ \.php$ {
|
||||
try_files $uri =404;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
@ -17,5 +46,43 @@ server {
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
|
||||
# Buffer settings untuk performa
|
||||
fastcgi_buffer_size 128k;
|
||||
fastcgi_buffers 256 16k;
|
||||
fastcgi_busy_buffers_size 256k;
|
||||
fastcgi_temp_file_write_size 256k;
|
||||
|
||||
# Timeout settings
|
||||
fastcgi_read_timeout 300;
|
||||
fastcgi_connect_timeout 300;
|
||||
}
|
||||
|
||||
# Cache static assets
|
||||
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
access_log off;
|
||||
}
|
||||
|
||||
# Deny access to hidden files
|
||||
location ~ /\. {
|
||||
deny all;
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
}
|
||||
|
||||
# Deny access to sensitive files
|
||||
location ~ /(?:\.env|\.git|composer\.json|composer\.lock|package\.json|package-lock\.json|README\.md|\.gitignore) {
|
||||
deny all;
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
}
|
||||
|
||||
# Health check endpoint
|
||||
location /health {
|
||||
access_log off;
|
||||
return 200 "healthy\n";
|
||||
add_header Content-Type text/plain;
|
||||
}
|
||||
}
|
||||
@ -15,7 +15,7 @@
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import mainLayout from '../layouts/mainLayout.vue'
|
||||
import searchbar from '../components/Searchbar.vue';
|
||||
import searchbar from '../components/searchbar.vue';
|
||||
import BrankasList from '../components/BrankasList.vue';
|
||||
const searchQuery = ref("");
|
||||
</script>
|
||||
|
||||
@ -168,7 +168,7 @@ import { ref, onMounted, computed } from "vue";
|
||||
import axios from "axios";
|
||||
import mainLayout from "../layouts/mainLayout.vue";
|
||||
import ProductCard from "../components/ProductCard.vue";
|
||||
import searchbar from "../components/Searchbar.vue";
|
||||
import searchbar from "../components/searchbar.vue";
|
||||
import CreateItemModal from "../components/CreateItemModal.vue";
|
||||
import ConfirmDeleteModal from "../components/ConfirmDeleteModal.vue";
|
||||
import InputSelect from "../components/InputSelect.vue";
|
||||
|
||||
@ -60,7 +60,7 @@
|
||||
import { ref } from "vue";
|
||||
import axios from "axios";
|
||||
import mainLayout from "../layouts/mainLayout.vue";
|
||||
import Searchbar from "../components/Searchbar.vue";
|
||||
import Searchbar from "../components/searchbar.vue";
|
||||
import TrayList from "../components/TrayList.vue";
|
||||
import InputField from "../components/InputField.vue";
|
||||
import ConfirmDeleteModal from "../components/ConfirmDeleteModal.vue";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user