This repository has been archived by the owner on Oct 15, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcompose-default.yml
219 lines (207 loc) · 7.34 KB
/
compose-default.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# WunderTools docker-compose
#
# This file is a standard docker-compose version 2 format file.
#
# Docker compose is used as a standard base in the wundertools idea
# because it is an industry standard format, used even by groups
# that don't use the docker supported python app.
# It is considered a safe approach for defining nodes from development
# to production.
#
# Note that version "2" offers some features that earlier version
# don't, but it seems that some tools don't yet support it (such as
# possible rancherOS)
#
#
# Because the goal of this file is to have something which can be
# used anywhere, even outside of this repo, the file should not
# rely on any builds or bind volumes, as such elements would not
# work on a host, without access to the full wundertools set.
#
# - Any volume binds should be limited to overlaying local configuration
# or source code on top of something that already exists in the image,
# in order to get local access in development.
# - Any image builds should push directly to hosted images, which can
# be used in production.
#
####
####
# This file uses docker-compose version 2 syntax. It doesn't really need
# to though, so if this gives you problems, test it without the version
# and services lines.
version: "2"
####
# The following services are considered a part of this application
#
services:
####
# SOURCE
#
# Create a container for source code
# [In production this should be an image with source code in the build]
#
# This container has a "CMD" but it never needs to run as it is used only as
# a source of "volume" from which other containers get their source code.
# When the service stars, it will exit with 0, which is expected.
#
# In development, we overlay the host code to get local file access, but in
# production we want an image that has source code built in.
#
source:
image: quay.io/wunder/wunder-alpine-base
command:
- /bin/true # this is an industry standard hack used with docker-compose
volumes:
# Here we overlay local source on top of where the built source code
# would be in a production ready source image.
#
# @NOTE we use an env variable to point to a sub-path, but this is not
# recommended, as it creates a dependency on the host environment.
# consider creating a more formal layout instead.
#
- "./app/web:/app/web"
- "./app/web/vendor:/app/vendor"
####
# Assets
#
# In contrast to source, assets holds any mutable files and data that other
# container may need access to.
# Assets is a distributable image, with volumes that need to be managed in any
# environment (backups, revisioned, distributed.) Asset volumes are typically
# used with named-volumes in production environments, so they do not need to
# have anything kept in image, but it can be advantageous to keep things in the
# image.
#
assets:
image: quay.io/wunder/client-fi-wkfi-assets:master
command:
- /bin/true
volumes:
- "assets_files:/app/web/sites/default/files"
- "assets_private:/app/private"
- "assets_backup:/app/backup"
####
# Servers
#
# The following nodes are services that support the application. Typically
# the AMP stack is represented, along with any key-value, search and static-caching
# servers used.
#
# It is optimal if the services use generic shared images, that are used across
# instances, and across applications. This makes the overally server impact low
# and means that management tools can focus on the source and asset images
#
####
# DB node
#
# Presents a standalone DB server with an open port
#
# This image has a defaul db already created. If you'd like to have a custom
# db and db credentials, comment out the "image:" line, and uncomment the
# build section, where you can set credentials.
#
# by default: mysql://app:[email protected]/app
# where db.app is define in fpm: links: below
#
db:
image: quay.io/wunder/wundertools-image-fuzzy-mariadb
volumes:
- "dbdata:/var/lib/mysql"
####
# IMAGE BUILD OVERRIDES
#
# If you want custom credentials, consider commenting out the
# db: "image:" line, and uncommenting this. It will give you a custom
# db image for your app, with credentials as suggested below.
# The default values are show.
#
#build:
# context: ./images/james/alpine-mariadb-app
# args: # arguments used only during build
# MYSQL_ROOT_PASSWORD: root
# MYSQL_USER: app
# MYSQL_PASSWORD: app
# MYSQL_DATABASE: app
####
# MemCacheD
#
# A running memcacheD service, that the fpm container links to.
# The fpm container has a settings: links: memcache:memcached.app
# which makes this container available at URL "memcache.app"
#
memcache:
image: quay.io/wunder/alpine-memcached
####
# FPM node
#
# presents a standalone PHP-FPM service which accepts tcp connections. It links
# to the DB using the URL db.app and pulls source code form the source node volumes
#
fpm:
#image: quay.io/wunder/alpine-php-app
image: quay.io/wunder/wundertools-image-fuzzy-php
volumes_from:
- source:ro # FPM gets source code from the source container as Read Only
- assets # FPM gets assets as Read/Write
links:
- db:db.app # fpm sees the db container at URL "db.app"
- memcache:memcached.app # fpm sees the memcached container at URL "memcached.app"
####
# WWW node
#
# Either an nginx or apache server that receives https requests, and if needed
# hands off to fpm using the url fpm.app. This service gets only read access to
# volumes from the source container.
#
# There is an ENV variable here, that would configure DNSDOCK to use a specific URL
# if you have DNSDOCK set up. If you aren't using DNSDOCK then it does nothing.
#
# You can reach this container: http://localhost:8081
# (as configured in the ports section)
#
www:
#image: quay.io/wunder/alpine-nginx-pagespeed-app
image: quay.io/wunder/wundertools-image-fuzzy-nginx
environment:
# If you are using DNSDOCK, this will assign a local DNS entry
DNSDOCK_ALIAS: www.wunderdemo.docker
volumes_from:
- source:ro # www gets source code from the source container AS READ ONLY
- assets:ro # www gets source code from the assets container AS READ ONLY
links:
# map the fpm container to URL "fpm.app"
- fpm:fpm.app
ports:
# currently portmapping port 80 to the host 8081
- "8081:80"
####
# Static cache service
#
# This container passes off to the www container, as configured using
# the env variable and link. www is available at the url backend.app
# inside the container.
#
# You can reach this container: http://localhost:8080
# (as configured in the ports section)
#
varnish:
image: quay.io/wunder/alpine-varnish
environment:
# If you are using DNSDOCK, this will assign a local DNS entry
DNSDOCK_ALIAS: varnish.wunderdemo.docker
# this is an image variable, which is used to configure the varnish vcl
VARNISH_BACKEND_HOST: backend.app
links:
# map the www container to URL backend.app
- www:backend.app
ports:
# currently portmapping port 80 to the host 8080
- "8080:80"
####
# Define a volume to store database data.
#
volumes:
dbdata:
assets_files:
assets_private:
assets_backup: