Skip to content

Commit

Permalink
Merge pull request #299 from ysknsid25/mailhog
Browse files Browse the repository at this point in the history
Introduction of mailhog
  • Loading branch information
jsdecena authored Nov 14, 2024
2 parents 3450b0f + 003be1f commit bcbabeb
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 23 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea
dbdata
dbdata
mails
65 changes: 43 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,56 @@
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FLaracommerce%2Flaracom.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2FLaracommerce%2Flaracom?ref=badge_shield)

# Get discount on Digital Ocean

Sign-up with [Digital Ocean and get $10 discount](https://m.do.co/c/bce94237de96)!

# Laravel FREE E-Commerce Software

Features Provided
- Products
- Cart
- Checkout
- Categories
- Customers
- Orders
- Payment
- Couriers
- Employees

- To view more details of the features
See full [documentation](https://jsdecena.github.io/laracom)

- Products
- Cart
- Checkout
- Categories
- Customers
- Orders
- Payment
- Couriers
- Employees

- To view more details of the features
See full [documentation](https://jsdecena.github.io/laracom)

# Simplified DOCKER setup
### In your teminal, issue these commands

- RUN `docker-compose up -d --build`
- If your runtime is apple silicon, use `docker-compose -f docker-compose-m1.yml up -d --build` command
- RUN `docker exec -it app bash`
- Inside the container, run `composer install && chmod -R 777 storage/ bootstrap/cache/`
- Inside the container, run `php artisan migrate --seed`
- While inside the container, compile the assets with `npm i && npm run dev`
- While inside the container, link the images `php artisan storage:link`
- OPEN [http://localhost:8000](http://localhost:8000)
## In your teminal, issue these commands

- RUN `docker-compose up -d --build`
- If your runtime is apple silicon, use `docker-compose -f docker-compose-m1.yml up -d --build` command
- RUN `docker exec -it app bash`
- Inside the container, run `composer install && chmod -R 777 storage/ bootstrap/cache/`
- Inside the container, run `php artisan migrate --seed`
- While inside the container, compile the assets with `npm i && npm run dev`
- While inside the container, link the images `php artisan storage:link`
- OPEN [http://localhost:8000](http://localhost:8000)

## If you want to use mailhog as SMTP

1.Create a ./mails directory
2.change .env like this

```
MAIL_DRIVER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="test@example.com"
MAIL_FROM_NAME="${APP_NAME}"
```

3.Go to http://localhost:8025 and verify that the mailhog screen appears

# Author

Expand All @@ -46,6 +67,6 @@ See full [documentation](https://jsdecena.github.io/laracom)

<a href="https://github.com/jsdecena/laracom/graphs/contributors"><img src="https://opencollective.com/laracom/contributors.svg?width=890" title="contributors" alt="contributors" /></a>


## License

[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FLaracommerce%2Flaracom.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FLaracommerce%2Flaracom?ref=badge_large)
14 changes: 14 additions & 0 deletions docker-compose-m1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ services:
- ./dbdata:/var/lib/mysql
networks:
- app-network
mailhog:
build: ./mailhog
container_name: mailhog
tty: true
ports:
- "8025:8025"
- "1025:1025"
environment:
MH_STORAGE: maildir
MH_MAILDIR_PATH: /home/mailhog/mails
volumes:
- ./mails:/home/mailhog/mails
networks:
- app-network
networks:
app-network:
driver: bridge
Expand Down
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ services:
- ./dbdata:/var/lib/mysql
networks:
- app-network
mailhog:
build: ./mailhog
container_name: mailhog
tty: true
ports:
- "8025:8025"
- "1025:1025"
environment:
MH_STORAGE: maildir
MH_MAILDIR_PATH: /home/mailhog/mails
volumes:
- ./mails:/home/mailhog/mails
networks:
- app-network
networks:
app-network:
driver: bridge
Expand Down
32 changes: 32 additions & 0 deletions mailhog/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# MailHog Dockerfile
#

FROM golang:1.18-alpine as builder

# Install MailHog:
RUN apk --no-cache add --virtual build-dependencies \
git \
&& mkdir -p /root/gocode \
&& export GOPATH=/root/gocode \
&& go install github.com/mailhog/MailHog@latest

FROM alpine:3
# Add mailhog user/group with uid/gid 1000.
# This is a workaround for boot2docker issue #581, see
# https://github.com/boot2docker/boot2docker/issues/581
RUN adduser -D -u 1000 mailhog

COPY --from=builder /root/gocode/bin/MailHog /usr/local/bin/

USER mailhog

WORKDIR /home/mailhog

RUN mkdir ./mails
RUN chmod 644 ./mails

ENTRYPOINT ["MailHog"]

# Expose the SMTP and HTTP ports:
EXPOSE 1025 8025

0 comments on commit bcbabeb

Please sign in to comment.