Skip to content

Commit 12e3de3

Browse files
authored
docs: update examples (#148)
1 parent 92af56d commit 12e3de3

File tree

20 files changed

+392
-102
lines changed

20 files changed

+392
-102
lines changed

.examples/full/docker-compose.yml

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
version: "3.9"
1212

1313
services:
14-
app:
14+
app: &app
1515
build: ./app
1616
image: monica-app
1717
env_file: .env
@@ -36,7 +36,7 @@ services:
3636
- MYSQL_USER=monica
3737
- MYSQL_PASSWORD_FILE=/run/secrets/mysql_password
3838
volumes:
39-
- mysql:/var/lib/mysql
39+
- mysqldata:/var/lib/mysql
4040
restart: always
4141
secrets:
4242
- mysql_password
@@ -46,47 +46,19 @@ services:
4646
restart: always
4747

4848
cron:
49-
build: ./app
50-
image: monica-app
49+
<<: *app
5150
command: cron.sh
52-
env_file: .env
53-
environment:
54-
- APP_KEY_FILE=/run/secrets/app_key
55-
- DB_PASSWORD_FILE=/run/secrets/mysql_password
56-
restart: always
57-
volumes:
58-
- data:/var/www/html/storage
59-
depends_on:
60-
- db
61-
- redis
62-
secrets:
63-
- app_key
64-
- mysql_password
6551

6652
queue:
67-
build: ./app
68-
image: monica-app
53+
<<: *app
6954
command: queue.sh
70-
env_file: .env
71-
environment:
72-
- APP_KEY_FILE=/run/secrets/app_key
73-
- DB_PASSWORD_FILE=/run/secrets/mysql_password
74-
restart: always
75-
volumes:
76-
- data:/var/www/html/storage
77-
depends_on:
78-
- db
79-
- redis
80-
secrets:
81-
- app_key
82-
- mysql_password
8355

8456
web:
8557
build: ./web
8658
image: monica-web
8759
restart: always
8860
ports:
89-
- 8081:80
61+
- 80:80
9062
volumes:
9163
- data:/var/www/html/storage:ro
9264
depends_on:
@@ -95,7 +67,9 @@ services:
9567

9668
volumes:
9769
data:
98-
mysql:
70+
driver: local
71+
mysqldata:
72+
driver: local
9973

10074

10175
secrets:

.examples/full_v5/.env

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# The URL of your application.
2+
APP_URL=http://localhost
3+
4+
# Database information
5+
DB_CONNECTION=mysql
6+
DB_HOST=db
7+
DB_DATABASE=monica
8+
DB_USERNAME=monica
9+
10+
LOG_STACK=stderr
11+
12+
CACHE_STORE=memcached
13+
QUEUE_CONNECTION=redis
14+
SESSION_DRIVER=database
15+
REDIS_HOST=redis
16+
17+
# Mail credentials used to send emails from the application.
18+
MAIL_MAILER=smtp
19+
MAIL_HOST=smtp.domain.com
20+
MAIL_PORT=587
21+
MAIL_USERNAME=username
22+
MAIL_PASSWORD=password
23+
MAIL_ENCRYPTION=tls
24+
# Outgoing emails will be sent with these identity
25+
MAIL_FROM_ADDRESS=[email protected]
26+
MAIL_FROM_NAME="${APP_NAME}"
27+
MAIL_REPLY_TO_ADDRESS=[email protected]
28+
MAIL_REPLY_TO_NAME="${APP_NAME}"
29+
30+
SCOUT_DRIVER=meilisearch
31+
SCOUT_QUEUE=true
32+
MEILISEARCH_HOST=http://meilisearch:7700

.examples/full_v5/app/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM monica:5.0-fpm-alpine
2+
3+
# Use the default production configuration
4+
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
5+
6+
ENV PHP_UPLOAD_LIMIT="10G"

.examples/full_v5/docker-compose.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Run Monica with fpm flavor, mariadb, cron, queue, redis, and nginx
2+
#
3+
# You first need to generate the secrets for the encryption key and db password:
4+
# `{ echo -n 'base64:'; openssl rand -base64 32; } | docker secret create app_key -`
5+
# `openssl rand -hex 24 | docker secret create mysql_password -`
6+
#
7+
# You might want to set these variables in you .env file:
8+
#- APP_URL with your domain (https scheme)
9+
#
10+
11+
services:
12+
app: &app
13+
build: ./app
14+
image: monica-app
15+
env_file: .env
16+
environment:
17+
- APP_KEY_FILE=/run/secrets/app_key
18+
- DB_PASSWORD_FILE=/run/secrets/mysql_password
19+
- MEILISEARCH_KEY=ChangeMe_ChangeMe
20+
volumes:
21+
- data:/var/www/html/storage
22+
networks:
23+
- monica
24+
restart: always
25+
depends_on:
26+
- db
27+
- redis
28+
- memcached
29+
- meilisearch
30+
secrets:
31+
- app_key
32+
- mysql_password
33+
34+
db:
35+
image: mariadb:11
36+
environment:
37+
- MYSQL_RANDOM_ROOT_PASSWORD=true
38+
- MYSQL_DATABASE=monica
39+
- MYSQL_USER=monica
40+
- MYSQL_PASSWORD_FILE=/run/secrets/mysql_password
41+
volumes:
42+
- mysqldata:/var/lib/mysql
43+
networks:
44+
- monica
45+
restart: always
46+
secrets:
47+
- mysql_password
48+
49+
redis:
50+
image: redis:alpine
51+
restart: always
52+
networks:
53+
- monica
54+
55+
cron:
56+
<<: *app
57+
command: cron.sh
58+
59+
queue:
60+
<<: *app
61+
command: queue.sh
62+
63+
memcached:
64+
image: memcached:alpine
65+
networks:
66+
- monica
67+
68+
meilisearch:
69+
image: getmeili/meilisearch:latest
70+
environment:
71+
- MEILI_MASTER_KEY=ChangeMe_ChangeMe
72+
- MEILISEARCH_NO_ANALYTICS=true
73+
volumes:
74+
- meili_data:/meili_data
75+
networks:
76+
- monica
77+
78+
web:
79+
build: ./web
80+
image: monica-web
81+
restart: always
82+
ports:
83+
- 80:80
84+
volumes:
85+
- data:/var/www/html/storage:ro
86+
networks:
87+
- monica
88+
depends_on:
89+
- app
90+
91+
92+
networks:
93+
monica:
94+
driver: overlay
95+
96+
97+
volumes:
98+
data:
99+
driver: local
100+
mysqldata:
101+
driver: local
102+
meili_data:
103+
driver: local
104+
105+
106+
secrets:
107+
app_key:
108+
external: true
109+
mysql_password:
110+
external: true

.examples/full_v5/web/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM monica:5.0-fpm-alpine AS monica
2+
3+
FROM nginx:alpine
4+
5+
COPY nginx.conf /etc/nginx/nginx.conf
6+
7+
# Copy content of monica image
8+
COPY --from=monica /var/www/html /var/www/html
9+
RUN ln -sf /var/www/html/storage/app/public /var/www/html/public/storage

0 commit comments

Comments
 (0)