This inventory management system has been containerized with Docker for easy deployment and scaling. The setup includes:
For external database setup, use the external database template:
cp .env.external .env
Edit the .env file with your external database configuration:
# External Database Configuration
DB_HOST=your-external-db-host
DB_PORT=3306
DB_NAME=inventory_db
DB_USER=your-db-username
DB_PASS=your-db-password
# Company Information
COMPANY_NAME=Your Company Name
COMPANY_ADDRESS=123 Business Street
COMPANY_CITY=Helsinki
COMPANY_POSTAL_CODE=00100
COMPANY_COUNTRY=Finland
COMPANY_PHONE=+358 123 456 789
COMPANY_EMAIL=info@yourcompany.com
COMPANY_Y_TUNNUS=1234567-8
# File Upload Configuration
UPLOAD_MAX_SIZE=10M
ALLOWED_FILE_TYPES=pdf,doc,docx,xls,xlsx,jpg,jpeg,png,gif
UPLOADS_PATH=./uploads
# Frontend Configuration
VUE_APP_API_URL=http://localhost:8080
# Port Configuration
BACKEND_PORT=8080
FRONTEND_PORT=3000
REDIS_PORT=6379
Before starting the containers, ensure your external database is ready:
-- 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:
mysql -h your-external-db-host -u your-db-username -p inventory_db < database/init.sql
docker-compose up -d --build
DB_HOST: External database server hostname (required)DB_PORT: Database port (default: 3306)DB_NAME: Database name (default: inventory_db)DB_USER: Database username (required)DB_PASS: Database password (required)BACKEND_PORT: Backend service port (default: 8080)FRONTEND_PORT: Frontend service port (default: 3000)REDIS_PORT: Redis service port (default: 6379)COMPANY_NAME: Your company nameCOMPANY_ADDRESS: Company addressCOMPANY_CITY: Company cityCOMPANY_POSTAL_CODE: Postal codeCOMPANY_COUNTRY: CountryCOMPANY_PHONE: Phone numberCOMPANY_EMAIL: Email addressCOMPANY_Y_TUNNUS: Finnish business IDUPLOAD_MAX_SIZE: Maximum file upload size (default: 10M)ALLOWED_FILE_TYPES: Allowed file extensionsUPLOADS_PATH: External path for uploads volume mountVUE_APP_API_URL: Backend API URL for frontendThe uploads directory is mounted as an external volume to persist file uploads across container restarts:
volumes:
uploads_data:
driver: local
driver_opts:
type: none
o: bind
device: ${UPLOADS_PATH:-./uploads}
MySQL data is persisted in a Docker volume:
volumes:
mysql_data:
driver: local
All services communicate through a dedicated Docker network:
networks:
inventory-network:
driver: bridge
The architecture supports horizontal scaling:
Consider adding:
For development, you can run services individually:
# Start only database
docker-compose up -d mysql
# Start backend with live reload
docker-compose up -d --build backend
# Start frontend with live reload
cd frontend && npm run serve
View logs for specific services:
# Backend logs
docker-compose logs -f backend
# Frontend logs
docker-compose logs -f frontend
# Database logs
docker-compose logs -f mysql
Connect to the database:
docker-compose exec mysql mysql -u inventory_user -p inventory_db
docker-compose ps.env filedocker-compose logs mysqlls -la uploads/curl http://localhost:8080/api/company.phpdocker-compose logs frontendTo update the application:
# Pull latest changes
git pull
# Rebuild and restart containers
docker-compose down
docker-compose up -d --build
Regular backups should include:
docker-compose exec mysql mysqldump -u root -p inventory_dbtar -czf uploads_backup.tar.gz uploads/Remove unused containers and images:
docker system prune -a
docker volume prune
For issues and questions, refer to the application logs or contact your system administrator.