Skip to content

Commit

Permalink
docs: update examples (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin authored Dec 28, 2024
1 parent 92af56d commit 12e3de3
Show file tree
Hide file tree
Showing 20 changed files with 392 additions and 102 deletions.
42 changes: 8 additions & 34 deletions .examples/full/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
version: "3.9"

services:
app:
app: &app
build: ./app
image: monica-app
env_file: .env
Expand All @@ -36,7 +36,7 @@ services:
- MYSQL_USER=monica
- MYSQL_PASSWORD_FILE=/run/secrets/mysql_password
volumes:
- mysql:/var/lib/mysql
- mysqldata:/var/lib/mysql
restart: always
secrets:
- mysql_password
Expand All @@ -46,47 +46,19 @@ services:
restart: always

cron:
build: ./app
image: monica-app
<<: *app
command: cron.sh
env_file: .env
environment:
- APP_KEY_FILE=/run/secrets/app_key
- DB_PASSWORD_FILE=/run/secrets/mysql_password
restart: always
volumes:
- data:/var/www/html/storage
depends_on:
- db
- redis
secrets:
- app_key
- mysql_password

queue:
build: ./app
image: monica-app
<<: *app
command: queue.sh
env_file: .env
environment:
- APP_KEY_FILE=/run/secrets/app_key
- DB_PASSWORD_FILE=/run/secrets/mysql_password
restart: always
volumes:
- data:/var/www/html/storage
depends_on:
- db
- redis
secrets:
- app_key
- mysql_password

web:
build: ./web
image: monica-web
restart: always
ports:
- 8081:80
- 80:80
volumes:
- data:/var/www/html/storage:ro
depends_on:
Expand All @@ -95,7 +67,9 @@ services:

volumes:
data:
mysql:
driver: local
mysqldata:
driver: local


secrets:
Expand Down
32 changes: 32 additions & 0 deletions .examples/full_v5/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# The URL of your application.
APP_URL=http://localhost

# Database information
DB_CONNECTION=mysql
DB_HOST=db
DB_DATABASE=monica
DB_USERNAME=monica

LOG_STACK=stderr

CACHE_STORE=memcached
QUEUE_CONNECTION=redis
SESSION_DRIVER=database
REDIS_HOST=redis

# Mail credentials used to send emails from the application.
MAIL_MAILER=smtp
MAIL_HOST=smtp.domain.com
MAIL_PORT=587
MAIL_USERNAME=username
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
# Outgoing emails will be sent with these identity
MAIL_FROM_ADDRESS=hello@example.com
MAIL_FROM_NAME="${APP_NAME}"
MAIL_REPLY_TO_ADDRESS=hello@example.com
MAIL_REPLY_TO_NAME="${APP_NAME}"

SCOUT_DRIVER=meilisearch
SCOUT_QUEUE=true
MEILISEARCH_HOST=http://meilisearch:7700
6 changes: 6 additions & 0 deletions .examples/full_v5/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM monica:5.0-fpm-alpine

# Use the default production configuration
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"

ENV PHP_UPLOAD_LIMIT="10G"
110 changes: 110 additions & 0 deletions .examples/full_v5/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Run Monica with fpm flavor, mariadb, cron, queue, redis, and nginx
#
# You first need to generate the secrets for the encryption key and db password:
# `{ echo -n 'base64:'; openssl rand -base64 32; } | docker secret create app_key -`
# `openssl rand -hex 24 | docker secret create mysql_password -`
#
# You might want to set these variables in you .env file:
#- APP_URL with your domain (https scheme)
#

services:
app: &app
build: ./app
image: monica-app
env_file: .env
environment:
- APP_KEY_FILE=/run/secrets/app_key
- DB_PASSWORD_FILE=/run/secrets/mysql_password
- MEILISEARCH_KEY=ChangeMe_ChangeMe
volumes:
- data:/var/www/html/storage
networks:
- monica
restart: always
depends_on:
- db
- redis
- memcached
- meilisearch
secrets:
- app_key
- mysql_password

db:
image: mariadb:11
environment:
- MYSQL_RANDOM_ROOT_PASSWORD=true
- MYSQL_DATABASE=monica
- MYSQL_USER=monica
- MYSQL_PASSWORD_FILE=/run/secrets/mysql_password
volumes:
- mysqldata:/var/lib/mysql
networks:
- monica
restart: always
secrets:
- mysql_password

redis:
image: redis:alpine
restart: always
networks:
- monica

cron:
<<: *app
command: cron.sh

queue:
<<: *app
command: queue.sh

memcached:
image: memcached:alpine
networks:
- monica

meilisearch:
image: getmeili/meilisearch:latest
environment:
- MEILI_MASTER_KEY=ChangeMe_ChangeMe
- MEILISEARCH_NO_ANALYTICS=true
volumes:
- meili_data:/meili_data
networks:
- monica

web:
build: ./web
image: monica-web
restart: always
ports:
- 80:80
volumes:
- data:/var/www/html/storage:ro
networks:
- monica
depends_on:
- app


networks:
monica:
driver: overlay


volumes:
data:
driver: local
mysqldata:
driver: local
meili_data:
driver: local


secrets:
app_key:
external: true
mysql_password:
external: true
9 changes: 9 additions & 0 deletions .examples/full_v5/web/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM monica:5.0-fpm-alpine AS monica

FROM nginx:alpine

COPY nginx.conf /etc/nginx/nginx.conf

# Copy content of monica image
COPY --from=monica /var/www/html /var/www/html
RUN ln -sf /var/www/html/storage/app/public /var/www/html/public/storage
Loading

0 comments on commit 12e3de3

Please sign in to comment.