|
|
@@ -4,7 +4,7 @@
|
|
|
This inventory management system has been containerized with Docker for easy deployment and scaling. The setup includes:
|
|
|
- Backend PHP service with Apache
|
|
|
- Frontend Vue.js service with Nginx
|
|
|
-- MySQL database
|
|
|
+- **External database connectivity** (MySQL/PostgreSQL/etc.)
|
|
|
- Redis cache (optional)
|
|
|
- External volume mounts for uploads
|
|
|
|
|
|
@@ -14,24 +14,24 @@ This inventory management system has been containerized with Docker for easy dep
|
|
|
- Docker and Docker Compose installed
|
|
|
- At least 2GB RAM available
|
|
|
- Sufficient disk space for uploads
|
|
|
+- **External database server** (MySQL 8.0+ recommended)
|
|
|
|
|
|
### 1. Environment Configuration
|
|
|
-Copy the example environment file and customize it:
|
|
|
+For external database setup, use the external database template:
|
|
|
|
|
|
```bash
|
|
|
-cp .env.example .env
|
|
|
+cp .env.external .env
|
|
|
```
|
|
|
|
|
|
-Edit the `.env` file with your specific configuration:
|
|
|
+Edit the `.env` file with your external database configuration:
|
|
|
|
|
|
```bash
|
|
|
-# Database Configuration
|
|
|
-DB_HOST=mysql
|
|
|
+# External Database Configuration
|
|
|
+DB_HOST=your-external-db-host
|
|
|
DB_PORT=3306
|
|
|
DB_NAME=inventory_db
|
|
|
-DB_USER=inventory_user
|
|
|
-DB_PASS=your_secure_password
|
|
|
-MYSQL_ROOT_PASSWORD=your_root_password
|
|
|
+DB_USER=your-db-username
|
|
|
+DB_PASS=your-db-password
|
|
|
|
|
|
# Company Information
|
|
|
COMPANY_NAME=Your Company Name
|
|
|
@@ -52,27 +52,42 @@ UPLOADS_PATH=./uploads
|
|
|
VUE_APP_API_URL=http://localhost:8080
|
|
|
```
|
|
|
|
|
|
-### 2. Build and Start Containers
|
|
|
+### 2. Database Setup
|
|
|
+Before starting the containers, ensure your external database is ready:
|
|
|
+
|
|
|
+```sql
|
|
|
+-- Create database and user (MySQL example)
|
|
|
+CREATE DATABASE inventory_db;
|
|
|
+CREATE USER 'your-db-username'@'%' IDENTIFIED BY 'your-db-password';
|
|
|
+GRANT ALL PRIVILEGES ON inventory_db.* TO 'your-db-username'@'%';
|
|
|
+FLUSH PRIVILEGES;
|
|
|
+```
|
|
|
+
|
|
|
+Import the database schema:
|
|
|
+```bash
|
|
|
+mysql -h your-external-db-host -u your-db-username -p inventory_db < database/init.sql
|
|
|
+```
|
|
|
+
|
|
|
+### 3. Build and Start Containers
|
|
|
```bash
|
|
|
docker-compose up -d --build
|
|
|
```
|
|
|
|
|
|
-### 3. Access the Application
|
|
|
+### 4. Access the Application
|
|
|
- Frontend: http://localhost:3000
|
|
|
- Backend API: http://localhost:8080
|
|
|
-- Database: localhost:3306 (with your configured credentials)
|
|
|
+- Database: your-external-db-host:3306 (with your configured credentials)
|
|
|
|
|
|
## Configuration Details
|
|
|
|
|
|
### Environment Variables
|
|
|
|
|
|
#### Database Configuration
|
|
|
-- `DB_HOST`: Database server hostname (default: mysql)
|
|
|
+- `DB_HOST`: External database server hostname (required)
|
|
|
- `DB_PORT`: Database port (default: 3306)
|
|
|
- `DB_NAME`: Database name (default: inventory_db)
|
|
|
-- `DB_USER`: Database username (default: inventory_user)
|
|
|
+- `DB_USER`: Database username (required)
|
|
|
- `DB_PASS`: Database password (required)
|
|
|
-- `MYSQL_ROOT_PASSWORD`: MySQL root password (required)
|
|
|
|
|
|
#### Company Information
|
|
|
- `COMPANY_NAME`: Your company name
|