Skip to content

Commit

Permalink
feat: updated the docker files and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
devansh-webkul committed Oct 29, 2024
1 parent 7a901ba commit 8905fc7
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 89 deletions.
13 changes: 9 additions & 4 deletions .configs/.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ APP_NAME=Bagisto
APP_ENV=local
APP_KEY=base64:Ai+PWx3RGrp5M/3gf/Cs7WLEAAFH/HwtKYeEkTETB3U=
APP_DEBUG=true
APP_DEBUG_ALLOWED_IPS=
APP_URL=http://localhost
APP_ADMIN_URL=admin
APP_TIMEZONE=Asia/Kolkata
APP_LOCALE=en
APP_CURRENCY=INR

VITE_HOST=
VITE_PORT=

LOG_CHANNEL=stack

DB_CONNECTION=mysql
Expand All @@ -28,8 +32,10 @@ REDIS_HOST=bagisto-redis
REDIS_PASSWORD=null
REDIS_PORT=6379

RESPONSE_CACHE_ENABLED=false

MAIL_MAILER=smtp
MAIL_HOST=bagisto-mailhog
MAIL_HOST=bagisto-mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
Expand All @@ -42,7 +48,8 @@ [email protected]
ADMIN_MAIL_NAME=Admin

FIXER_API_KEY=
EXCHANGE_RATES_API_KEY=c23c0af00d5b63af52c2d3971502a038
EXCHANGE_RATES_API_KEY=
EXCHANGE_RATES_API_ENDPOINT=

PUSHER_APP_ID=
PUSHER_APP_KEY=
Expand Down Expand Up @@ -71,5 +78,3 @@ LINKEDIN_CALLBACK_URL=https://yourhost.com/customer/social-login/linkedin/callba
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_CALLBACK_URL=https://yourhost.com/customer/social-login/github/callback

ELASTICSEARCH_HOST=bagisto-elasticsearch
13 changes: 9 additions & 4 deletions .configs/.env.testing
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ APP_NAME=Bagisto
APP_ENV=testing
APP_KEY=base64:Ai+PWx3RGrp5M/3gf/Cs7WLEAAFH/HwtKYeEkTETB3U=
APP_DEBUG=true
APP_DEBUG_ALLOWED_IPS=
APP_URL=http://localhost
APP_ADMIN_URL=admin
APP_TIMEZONE=Asia/Kolkata
APP_LOCALE=en
APP_CURRENCY=INR

VITE_HOST=
VITE_PORT=

LOG_CHANNEL=stack

DB_CONNECTION=mysql
Expand All @@ -28,8 +32,10 @@ REDIS_HOST=bagisto-redis
REDIS_PASSWORD=null
REDIS_PORT=6379

RESPONSE_CACHE_ENABLED=false

MAIL_MAILER=smtp
MAIL_HOST=bagisto-mailhog
MAIL_HOST=bagisto-mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
Expand All @@ -42,7 +48,8 @@ [email protected]
ADMIN_MAIL_NAME=Admin

FIXER_API_KEY=
EXCHANGE_RATES_API_KEY=c23c0af00d5b63af52c2d3971502a038
EXCHANGE_RATES_API_KEY=
EXCHANGE_RATES_API_ENDPOINT=

PUSHER_APP_ID=
PUSHER_APP_KEY=
Expand Down Expand Up @@ -71,5 +78,3 @@ LINKEDIN_CALLBACK_URL=https://yourhost.com/customer/social-login/linkedin/callba
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_CALLBACK_URL=https://yourhost.com/customer/social-login/github/callback

ELASTICSEARCH_HOST=bagisto-elasticsearch
22 changes: 9 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# main image
FROM php:8.1-apache
FROM php:8.3-apache

# arguments
ARG uid
ARG user
ARG container_project_path

# installing dependencies
RUN apt-get update && apt-get install -y \
Expand All @@ -24,22 +29,13 @@ RUN docker-php-ext-configure intl
RUN docker-php-ext-install bcmath calendar exif gd gmp intl mysqli pdo pdo_mysql zip

# installing composer
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
COPY --from=composer:2.7 /usr/bin/composer /usr/local/bin/composer

# installing node js
COPY --from=node:latest /usr/local/lib/node_modules /usr/local/lib/node_modules
COPY --from=node:latest /usr/local/bin/node /usr/local/bin/node
COPY --from=node:22 /usr/local/lib/node_modules /usr/local/lib/node_modules
COPY --from=node:22 /usr/local/bin/node /usr/local/bin/node
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm

# installing global node dependencies
RUN npm install -g npx
RUN npm install -g laravel-echo-server

# arguments
ARG container_project_path
ARG uid
ARG user

# setting work directory
WORKDIR $container_project_path

Expand Down
113 changes: 56 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@

## Introduction

### What is Bagisto?
The primary purpose of this repository is to provide a workspace along with all the necessary dependencies for Bagisto. In this repository, we include the following services:

Bagisto is a hand tailored E-Commerce framework designed on some of the hottest opensource technologies such as Laravel a PHP framework, Vue.js a progressive Javascript framework.
- PHP-Apache
- MySQL
- Redis
- PHPMyAdmin
- Elasticsearch
- Kibana
- Mailpit

Bagisto is viable attempt to cut down your time, cost and workforce for building online stores or migrating from physical stores to the ever demanding online world. Your business whether small or huge it suits all and very simple to set it up.
## Supported Bagisto Version

### What is Docker?
Currently, all these services are included to fulfill the dependencies for the following Bagisto version:

Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. Docker can also be used for defining and running multi-container Docker applications using Docker-Compose tool.
**Bagisto Version:** >= v2.0

With the help of docker-compose, one can define containers to be built, their configuration, links, volumes, ports etc in a single file and it gets launched by a single command. One can add multiple servers and services just by adding them to docker-compose configuration file. This configuration file is in YAML format.
However, there may be some specific cases where adjustments are necessary. We recommend reviewing the `Dockerfile` or the `docker-compose.yml` file for any required modifications.

## System Requirements

Expand All @@ -22,73 +28,66 @@ With the help of docker-compose, one can define containers to be built, their co

## Installation

- Adjust your Apache, MySQL and PHPMyAdmin port.
- This is a straightforward repository with no complex configurations. Just update the `docker-compose.yml` file if needed, and you’re all set!

~~~yml
version: '3.1'
- Adjust your services as needed. For example, most Linux users have a UID of 1000. If your UID is different, make sure to update it according to your host machine.

```yml
version: "3.1"

services:
bagisto-php-apache:
build:
args:
container_project_path: /var/www/html/
uid: 1000 # add your uid here
user: $USER
context: .
dockerfile: ./Dockerfile
image: bagisto-php-apache
ports:
- 80:80 # adjust your port here, if you want to change
volumes:
- ./workspace/:/var/www/html/

bagisto-mysql:
image: mysql:8.0
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_HOST: '%'
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306 # adjust your port here, if you want to change
volumes:
- ./.configs/mysql-data:/var/lib/mysql/

bagisto-phpmyadmin:
image: phpmyadmin:latest
restart: always
environment:
PMA_HOST: bagisto-mysql
PMA_USER: root
PMA_PASSWORD: root
ports:
- 8080:80 # adjust your port here, if you want to change

volumes:
mysql-data:
~~~

- Run the below command and everything setup for you,

~~~sh
bagisto-php-apache:
build:
args:
container_project_path: /var/www/html/
uid: 1000 # add your uid here
user: $USER
context: .
dockerfile: ./Dockerfile
image: bagisto-php-apache
ports:
- 80:80 # adjust your port here, if you want to change
volumes:
- ./workspace/:/var/www/html/
```
- In this repository, the initial focus was on meeting all project requirements. Whether your project is new or pre-existing, you can easily copy and paste it into the designated workspace directory. If you’re unsure where to begin, a shell script has been provided to streamline the setup process for you. To install and set up everything, simply run:
```sh
sh setup.sh
~~~
```

## After installation

- To log in as admin.

~~~text
```text
http(s)://your_server_endpoint/admin/login
Email: [email protected]
Password: admin123
~~~
```

- To log in as customer. You can directly register as customer and then login.

~~~text
```text
http(s):/your_server_endpoint/customer/register
~~~
```

## Already Docker Expert?

- You can use this repository as your workspace. To build your container, simply run the following command:

```sh
docker-compose build
```

- After building, you can run the container with:

```sh
docker-compose up -d
```

- Now, you can access the container's shell and install [Bagisto](https://github.com/bagisto/bagisto).

In case of any issues or queries, raise your ticket at [Webkul Support](https://webkul.uvdesk.com/en/customer/create-ticket/).
20 changes: 10 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ services:
bagisto-php-apache:
build:
args:
container_project_path: /var/www/html/
uid: 1000
user: $USER
container_project_path: /var/www/html/
context: .
dockerfile: ./Dockerfile
image: bagisto-php-apache
Expand Down Expand Up @@ -73,12 +73,12 @@ services:
depends_on:
- bagisto-elasticsearch

bagisto-mailhog:
image: mailhog/mailhog
logging:
# Disable saving logs.
driver: 'none'
ports:
# SMTP server.
- 1025:1025
- 8025:8025
bagisto-mailpit:
image: axllent/mailpit:latest
logging:
# Disable saving logs.
driver: 'none'
ports:
# SMTP server.
- 1025:1025
- 8025:8025
2 changes: 1 addition & 1 deletion setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ docker exec ${apache_container_id} git clone https://github.com/bagisto/bagisto

# setting bagisto stable version
echo "Now, setting up Bagisto stable version..."
docker exec -i ${apache_container_id} bash -c "cd bagisto && git reset --hard $(git describe --tags $(git rev-list --tags --max-count=1))"
docker exec -i ${apache_container_id} bash -c "cd bagisto && git reset --hard v2.3.3"

# installing composer dependencies inside container
docker exec -i ${apache_container_id} bash -c "cd bagisto && composer install"
Expand Down

0 comments on commit 8905fc7

Please sign in to comment.