Skip to content

Commit a7948a4

Browse files
Merge pull request #402 from suraj-webkul/update-docs
Update docs.
2 parents 833cd07 + d833420 commit a7948a4

File tree

8 files changed

+545
-1344
lines changed

8 files changed

+545
-1344
lines changed

docs/.vuepress/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ module.exports = {
2121
logo: '/logo.png',
2222
nav: [
2323
{ text: 'Home', link: '/' },
24+
{ text: 'User Guide', link: 'https://docs.bagisto.com/' },
2425
{ text: 'Extensions', link: 'https://bagisto.com/en/extensions/' },
2526
{ text: 'Community Forum', link: 'https://forums.bagisto.com/' }
2627
],

docs/1.5.x/introduction/docker.md

Lines changed: 19 additions & 191 deletions
Original file line numberDiff line numberDiff line change
@@ -13,213 +13,41 @@ With the help of Docker Compose, you can define containers to be built, their co
1313
It is recommended to keep your application files and database data volume on the Docker host and mount them on the running container. This ensures that the application and database data persistence even in the case of containers' failure or termination. In this way, even if you destroy containers, your data won't get lost unless you remove them forcefully.
1414
This compose configuration file mounts the application directory **`app`** and database volume **`dbvolume`** from the host to running Docker containers at the time of containers' launch.
1515

16-
## Installation & Setup
16+
### Docker Setup for Bagisto
1717

18-
### First steps
18+
You can configure Bagisto using Docker in two different ways:
1919

20-
Before you can launch Bagisto in a Docker environment, you need to install the latest versions of Docker and Docker Compose.
20+
**Using Bagisto Docker Image from Docker Hub**
2121

22-
- [Docker](https://docs.docker.com/install/)
23-
- [Docker Compose](https://docs.docker.com/compose/install/)
24-
- [Composer](https://getcomposer.org) (optional)
22+
Both approaches allow you to set up the application quickly, managing all system requirements like Apache, MySQL, and PHPMyAdmin within isolated containers. Below is a detailed guide for each method.
2523

26-
### Configure the Docker container
24+
### **Using Bagisto Docker Image from Docker Hub**
2725

28-
Once Docker and Docker Compose are installed, you need to create a **`docker-compose.yml`** file. The **`docker-compose.yml`** configuration file requires the following inputs from the user:
26+
Follow the steps below to set up Bagisto using Docker Hub. This approach provides a pre-configured Docker image of Bagisto, allowing for a quick and easy installation.
2927

30-
#### Webserver configuration
28+
#### Step 1: Pull Bagisto Docker Image
3129

32-
In the **`web_server`** service block, assign your system's working user UID to the **`USER_UID`** environment variable. To find your user ID, run the following command on Linux or macOS:
33-
```shell
34-
id -u
35-
```
36-
37-
#### Database configuration
38-
39-
In the **`database_server`** service block, assign the MySQL database name, MySQL database user name, MySQL database user password, and MySQL root password to the **`MYSQL_DATABASE`**, **`MYSQL_USER`**, **`MYSQL_PASSWORD`**, and **`MYSQL_ROOT_PASSWORD`** environment variables, respectively.
40-
41-
#### Clone configuration from GitHub
42-
43-
You can make use of our repository from GitHub by cloning it into your new directory:
44-
```shell
45-
git clone https://github.com/bagisto/bagisto-docker.git .
46-
```
47-
48-
#### Manual configuration
49-
50-
Alternatively, you can create a new folder, for example, **`bagisto-docker`**, and manually create the **`docker-compose.yml`** file inside it. Add the following content to **`docker-compose.yml`**:
51-
52-
```yml
53-
version: '3'
54-
55-
services:
56-
57-
web_server:
58-
image: webkul/apache-php:latest
59-
container_name: apache2
60-
restart: always
61-
volumes:
62-
- ./app:/var/www/html
63-
working_dir: /var/www/html/
64-
environment:
65-
USER_UID: 'mention your system user ID here. ex: 1001, 1000, 33, etc'
66-
networks:
67-
- bagisto-network
68-
ports:
69-
- '80:80'
70-
expose:
71-
- '80'
72-
depends_on:
73-
- database_server
74-
links:
75-
- database_server
76-
77-
database_server:
78-
image: mysql:5.7
79-
container_name: mysql
80-
restart: always
81-
environment:
82-
MYSQL_DATABASE: 'mention the name of the database to be created here. eg: mydatabase'
83-
MYSQL_USER: 'mention database user here. eg: mydatabase_user'
84-
MYSQL_PASSWORD: 'mention database user password here. ex: mystrongPassword'
85-
MYSQL_ROOT_PASSWORD: 'mention mysql root password here. ex: mysqlstrongpass'
86-
MYSQL_ROOT_HOST: '%'
87-
networks:
88-
- bagisto-network
89-
ports:
90-
- '3306:3306'
91-
expose:
92-
- '3306'
93-
volumes:
94-
- ./dbvolume:/var/lib/mysql
95-
96-
volumes:
97-
dbvolume:
98-
app:
99-
100-
networks:
101-
bagisto-network:
102-
**
103-
```
104-
105-
#### Downloading the Docker Image
106-
107-
To download the Docker images for Apache-PHP version 7.3 and MySQL version 5.7, execute the following command:
108-
109-
```shell
110-
docker-compose pull
111-
```
112-
113-
### Launching the Docker Container
114-
115-
Execute the following command to create a network and launch web server and database containers with the names **`apache2`** and **`mysql`** respectively. It will also create new directories **`app`** and **`dbvolume`** within your current directory and mount them to the respective Docker containers as specified in the **`docker-compose.yml`** file. Additionally, it binds your **`host port 80`** to the Apache2 container's port 80, and your **`host port 3306`** to the MySQL container's port 3306. If you wish to use different ports for the containers, modify their values in the **`docker-compose.yml`** file.
116-
117-
```
118-
docker-compose up -d
119-
```
120-
121-
### Monitoring Your Container(s)
122-
123-
To check the running Docker containers, use the following commands:
124-
125-
**`docker ps`** OR **`docker-compose ps`**
126-
```shell
127-
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
128-
62a10346b84a webkul/apache-php:latest "/usr/bin/supervisord" About an hour ago Up About an hour 0.0.0.0:80->80/tcp apache2
129-
90a0a2e0e46b mysql:5.7 "docker-entrypoint.s…" About an hour ago Up About an hour 0.0.0.0:3306->3306/tcp, 33060/tcp mysql
130-
```
131-
132-
## Configuring Bagisto
30+
To pull the Bagisto Docker image from Docker Hub, use the following command:
13331

134-
After setting up your environment, you can proceed with the installation of Bagisto. There are two ways to install Bagisto: either from [Github](#install-without-composer) or using [composer](#install-with-composer).
135-
136-
### Install without Composer
137-
138-
To install Bagisto without using composer, follow these steps:
139-
1. Download the [latest release](https://bagisto.com/en/download) and save it in the **`app/bagisto`** directory.
140-
2. Open the **`.env`** file located inside the **app/bagisto** directory.
141-
3. Set the following environment variables as shown below:
142-
143-
```editorconfig
144-
APP_URL=https://127.0.0.1
145-
DB_CONNECTION=mysql
146-
DB_HOST=mysql
147-
DB_PORT=3306
148-
DB_DATABASE=
149-
DB_USERNAME=
150-
DB_PASSWORD=
151-
```
152-
153-
Run the following commands to install Bagisto.
154-
```shell
155-
docker exec -i apache2 bash -c "su - www-data -s /bin/bash -c 'php bagisto/artisan migrate'"
156-
docker exec -i apache2 bash -c "su - www-data -s /bin/bash -c 'php bagisto/artisan db:seed'"
157-
docker exec -i apache2 bash -c "su - www-data -s /bin/bash -c 'php bagisto/artisan vendor:publish'"
158-
docker exec -i apache2 bash -c "su - www-data -s /bin/bash -c 'php bagisto/artisan storage:link'"
159-
docker exec -i apache2 bash -c "su - www-data -s /bin/bash -c 'composer dump-autoload -d bagisto'"
160-
```
161-
162-
Mention the database details same as docker-compose.yml and admin details.
163-
164-
165-
### Install with composer
166-
167-
The following commands will be exexcuted within the docker container
168-
```shell
169-
docker exec -i apache2 bash -c "su - www-data -s /bin/bash -c 'composer create-project bagisto/bagisto'"
170-
```
171-
172-
Open the .env file inside **`app/bagisto`** directory and set the following environment variables listed below:
173-
174-
```editorconfig
175-
APP_URL=https://127.0.0.1
176-
DB_CONNECTION=mysql
177-
DB_HOST=mysql
178-
DB_PORT=3306
179-
DB_DATABASE=
180-
DB_USERNAME=
181-
DB_PASSWORD=
182-
```
183-
184-
To install Bagisto, execute the following commands:
185-
186-
```shell
187-
docker exec -i apache2 bash -c "su - www-data -s /bin/bash -c 'php bagisto/artisan migrate'"
188-
docker exec -i apache2 bash -c "su - www-data -s /bin/bash -c 'php bagisto/artisan db:seed'"
189-
docker exec -i apache2 bash -c "su - www-data -s /bin/bash -c 'php bagisto/artisan vendor:publish'"
190-
docker exec -i apache2 bash -c "su - www-data -s /bin/bash -c 'php bagisto/artisan storage:link'"
191-
docker exec -i apache2 bash -c "su - www-data -s /bin/bash -c 'composer dump-autoload -d bagisto'"
32+
```bash
33+
docker pull webkul/bagisto:1.5.1
19234
```
19335

194-
Bagisto has been successfully installed and is now ready to use. To access it, open your web browser and enter your server's IP address or domain name.
36+
#### Step 2: Run a New Container
19537

196-
### Configuring Apache
38+
Once the image is pulled, you can run a new Docker container using the command below. This will bind your local port 80 to the container’s port 80, so Bagisto can be accessed via the browser.
19739

198-
By default, the Apache document root is set to **/var/www/html/public_html**. Additionally, the **app** directory on your host machine is mapped to the **html** directory inside the container. To ensure proper configuration, we need to create a symlink of **`bagisto/public`** in the **`app`** directory that points to **`/var/www/html/public_html`**.
199-
200-
To create the symlink, follow the steps below:
201-
202-
On Linux or macOS, run the following command:
20340
```bash
204-
cd app; ln -snf bagisto/public public_html
41+
docker run -it -d -p 80:80 webkul/bagisto:1.5.1
20542
```
20643

207-
On Windows, run the following command:
208-
```command-line
209-
cd app
210-
mklink bagisto/public public_html
211-
```
212-
213-
### Ready to Use
214-
215-
#### Admin Login:
44+
#### Step 3: Access Bagisto in Your Browser
21645

217-
You can access the admin interface by visiting [http://your_server_endpoint/admin](http://your_server_endpoint/admin/) and logging in with the following credentials:
46+
After the container is up and running, open your browser and navigate to `http://localhost`. This will load the Bagisto setup.
21847

219-
| Email | Password |
220-
|----------------------|----------|
221-
| admin@example.com | admin123 |
48+
#### Step 4: Admin Login Credentials
22249

223-
#### Customer Login:
50+
Use the following credentials to log in to the Bagisto admin panel:
22451

225-
To access your store, visit [http://your_server_endpoint/](http://your_server_endpoint/).
52+
- **Admin Username**: `admin@example.com`
53+
- **Admin Password**: `admin123`

0 commit comments

Comments
 (0)