docker.recipes

Bagisto Laravel E-commerce

intermediate

Modern Laravel-based e-commerce with multi-warehouse and marketplace support.

Overview

Bagisto is a modern, Laravel-based e-commerce platform that provides multi-warehouse management, marketplace functionality, and extensive customization capabilities for online retailers. Built with a headless architecture approach, Bagisto separates the frontend presentation layer from the backend business logic, making it ideal for businesses requiring custom storefronts or multi-channel selling strategies. This implementation combines Bagisto with MySQL for transactional data storage, Redis for session management and caching, Elasticsearch for product search and analytics, and NGINX as a high-performance web server and reverse proxy. The stack creates a robust e-commerce environment capable of handling complex inventory management across multiple warehouses while providing fast search capabilities and efficient caching for improved customer experience. This configuration is particularly valuable for medium to large-scale online retailers, marketplace operators, and businesses with complex inventory requirements who need a scalable platform that can grow with their operations while maintaining the flexibility to customize both frontend experiences and backend workflows.

Key Features

  • Multi-warehouse inventory management with real-time stock tracking across locations
  • Built-in marketplace functionality supporting multiple vendors and commission structures
  • Laravel framework foundation with Eloquent ORM for rapid custom development
  • Elasticsearch-powered product search with faceted filtering and real-time indexing
  • Redis-based session storage and application caching for improved performance
  • Multi-currency and multi-language support for international e-commerce operations
  • RESTful API architecture enabling headless commerce implementations
  • MySQL 8.0 with InnoDB storage engine providing ACID compliance for transactional integrity

Common Use Cases

  • 1Multi-vendor marketplaces requiring vendor management and commission tracking
  • 2Retailers with multiple warehouse locations needing unified inventory management
  • 3B2B e-commerce platforms requiring custom pricing and bulk ordering features
  • 4International retailers needing multi-currency and multi-language capabilities
  • 5Businesses requiring headless commerce architecture for custom frontend applications
  • 6Growing online stores needing scalable search functionality for large product catalogs
  • 7Custom e-commerce solutions requiring extensive Laravel-based backend modifications

Prerequisites

  • Minimum 4GB RAM (2GB for Elasticsearch, 1GB for MySQL, 512MB for Redis, 512MB for application)
  • Docker Engine 20.10+ and Docker Compose v2 for modern compose file support
  • Available ports 80 for web access and 9200 for Elasticsearch (if external access needed)
  • Basic understanding of Laravel framework and PHP for customization and troubleshooting
  • Familiarity with MySQL database administration for backup and maintenance procedures
  • Understanding of Elasticsearch concepts for search optimization and index management

For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms

docker-compose.yml

docker-compose.yml
1services:
2 mysql:
3 image: mysql:8.0
4 environment:
5 - MYSQL_DATABASE=bagisto
6 - MYSQL_USER=bagisto
7 - MYSQL_PASSWORD=${MYSQL_PASSWORD}
8 - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
9 volumes:
10 - mysql_data:/var/lib/mysql
11 networks:
12 - bagisto_net
13
14 redis:
15 image: redis:7-alpine
16 volumes:
17 - redis_data:/data
18 networks:
19 - bagisto_net
20
21 elasticsearch:
22 image: docker.elastic.co/elasticsearch/elasticsearch:8.11.0
23 environment:
24 - discovery.type=single-node
25 - xpack.security.enabled=false
26 volumes:
27 - es_data:/usr/share/elasticsearch/data
28 networks:
29 - bagisto_net
30
31 bagisto:
32 image: bagisto/bagisto:latest
33 environment:
34 - APP_URL=http://localhost
35 - DB_HOST=mysql
36 - DB_DATABASE=bagisto
37 - DB_USERNAME=bagisto
38 - DB_PASSWORD=${MYSQL_PASSWORD}
39 - REDIS_HOST=redis
40 - ELASTICSEARCH_HOST=elasticsearch
41 volumes:
42 - bagisto_data:/var/www/html
43 depends_on:
44 - mysql
45 - redis
46 - elasticsearch
47 networks:
48 - bagisto_net
49
50 nginx:
51 image: nginx:alpine
52 ports:
53 - "80:80"
54 volumes:
55 - ./nginx.conf:/etc/nginx/nginx.conf:ro
56 - bagisto_data:/var/www/html:ro
57 depends_on:
58 - bagisto
59 networks:
60 - bagisto_net
61
62volumes:
63 mysql_data:
64 redis_data:
65 es_data:
66 bagisto_data:
67
68networks:
69 bagisto_net:

.env Template

.env
1# Bagisto
2MYSQL_PASSWORD=secure_mysql_password
3MYSQL_ROOT_PASSWORD=secure_root_password
4
5# Shop at http://localhost
6# Admin at http://localhost/admin

Usage Notes

  1. 1Shop at http://localhost
  2. 2Admin at http://localhost/admin
  3. 3Built on Laravel framework
  4. 4Multi-warehouse support
  5. 5Marketplace module available

Individual Services(5 services)

Copy individual services to mix and match with your existing compose files.

mysql
mysql:
  image: mysql:8.0
  environment:
    - MYSQL_DATABASE=bagisto
    - MYSQL_USER=bagisto
    - MYSQL_PASSWORD=${MYSQL_PASSWORD}
    - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
  volumes:
    - mysql_data:/var/lib/mysql
  networks:
    - bagisto_net
redis
redis:
  image: redis:7-alpine
  volumes:
    - redis_data:/data
  networks:
    - bagisto_net
elasticsearch
elasticsearch:
  image: docker.elastic.co/elasticsearch/elasticsearch:8.11.0
  environment:
    - discovery.type=single-node
    - xpack.security.enabled=false
  volumes:
    - es_data:/usr/share/elasticsearch/data
  networks:
    - bagisto_net
bagisto
bagisto:
  image: bagisto/bagisto:latest
  environment:
    - APP_URL=http://localhost
    - DB_HOST=mysql
    - DB_DATABASE=bagisto
    - DB_USERNAME=bagisto
    - DB_PASSWORD=${MYSQL_PASSWORD}
    - REDIS_HOST=redis
    - ELASTICSEARCH_HOST=elasticsearch
  volumes:
    - bagisto_data:/var/www/html
  depends_on:
    - mysql
    - redis
    - elasticsearch
  networks:
    - bagisto_net
nginx
nginx:
  image: nginx:alpine
  ports:
    - "80:80"
  volumes:
    - ./nginx.conf:/etc/nginx/nginx.conf:ro
    - bagisto_data:/var/www/html:ro
  depends_on:
    - bagisto
  networks:
    - bagisto_net

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 mysql:
5 image: mysql:8.0
6 environment:
7 - MYSQL_DATABASE=bagisto
8 - MYSQL_USER=bagisto
9 - MYSQL_PASSWORD=${MYSQL_PASSWORD}
10 - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
11 volumes:
12 - mysql_data:/var/lib/mysql
13 networks:
14 - bagisto_net
15
16 redis:
17 image: redis:7-alpine
18 volumes:
19 - redis_data:/data
20 networks:
21 - bagisto_net
22
23 elasticsearch:
24 image: docker.elastic.co/elasticsearch/elasticsearch:8.11.0
25 environment:
26 - discovery.type=single-node
27 - xpack.security.enabled=false
28 volumes:
29 - es_data:/usr/share/elasticsearch/data
30 networks:
31 - bagisto_net
32
33 bagisto:
34 image: bagisto/bagisto:latest
35 environment:
36 - APP_URL=http://localhost
37 - DB_HOST=mysql
38 - DB_DATABASE=bagisto
39 - DB_USERNAME=bagisto
40 - DB_PASSWORD=${MYSQL_PASSWORD}
41 - REDIS_HOST=redis
42 - ELASTICSEARCH_HOST=elasticsearch
43 volumes:
44 - bagisto_data:/var/www/html
45 depends_on:
46 - mysql
47 - redis
48 - elasticsearch
49 networks:
50 - bagisto_net
51
52 nginx:
53 image: nginx:alpine
54 ports:
55 - "80:80"
56 volumes:
57 - ./nginx.conf:/etc/nginx/nginx.conf:ro
58 - bagisto_data:/var/www/html:ro
59 depends_on:
60 - bagisto
61 networks:
62 - bagisto_net
63
64volumes:
65 mysql_data:
66 redis_data:
67 es_data:
68 bagisto_data:
69
70networks:
71 bagisto_net:
72EOF
73
74# 2. Create the .env file
75cat > .env << 'EOF'
76# Bagisto
77MYSQL_PASSWORD=secure_mysql_password
78MYSQL_ROOT_PASSWORD=secure_root_password
79
80# Shop at http://localhost
81# Admin at http://localhost/admin
82EOF
83
84# 3. Start the services
85docker compose up -d
86
87# 4. View logs
88docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/bagisto-ecommerce/run | bash

Troubleshooting

  • Elasticsearch container fails with 'max virtual memory areas vm.max_map_count too low': Increase vm.max_map_count with 'sudo sysctl -w vm.max_map_count=262144'
  • Bagisto shows 'SQLSTATE[HY000] [2002] Connection refused' error: Ensure MySQL container is fully started before Bagisto container attempts connection
  • Product search returns no results despite having products: Check Elasticsearch indexing status in Bagisto admin and manually trigger reindexing if necessary
  • Redis connection timeout errors in application logs: Verify Redis container health and increase Redis timeout settings in Bagisto configuration
  • NGINX shows 502 Bad Gateway error: Check that Bagisto PHP-FPM process is running and accessible on the expected port within the container
  • MySQL container exits with 'disk space' error: Clean up old MySQL binary logs or increase available disk space for mysql_data volume

Community Notes

Loading...
Loading notes...

Download Recipe Kit

Get all files in a ready-to-deploy package

Includes docker-compose.yml, .env template, README, and license

Ad Space