Skip to content

Commit 74c3b3c

Browse files
singularopingers
authored andcommitted
Develop (#60)
* Adding redis config and updating dockerfiles to add it in for development. * Supporting memcache more correctly. * Add in the infinispan config file by default. Alphabetise other config file order. * Missed the actual config file. * Adding infinispan container and updating build to support extending the s2i container. * Add Dockerfile into the list of default installed files. * Can't stand it any longer, we either alphabeticise, or group by related. * Need to export the user so that docker-compose has it. Adjust Dockerfile style. * Add removing built image to purge command. * Adding infinispan memcached for development. * Remove personal bits, add some missing parts. * Missed the memcache enable for osx. * Adding redis prefix support, exposing infinispan management. * Remove unsupported parameter. * Missing exposed ports and default user/pass for infinispan. * Fix syntax error. * Sigh fix another syntax error. * Moving build specific files into their own dir. * HOTFIX: Add phpstan deprecation analysis to lint command. * Moving xdebug into docker/ dir * Fixing some other things that hadn't quite had that updated yet. * Make redis and memcache prefixes consistent. * Default to Redis - we're not committing to RDG/Infinispan yet.
1 parent f5a17ab commit 74c3b3c

File tree

7 files changed

+536
-35
lines changed

7 files changed

+536
-35
lines changed

docker-compose.linux.yml

Lines changed: 62 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,88 @@
11
version: '3'
22
services:
33
web:
4-
image: uofa/apache2-php7-dev:foundation
5-
# This makes the container run on the same network stack as your
6-
# workstation. Meaning that you can interact on "localhost".
7-
network_mode: host
4+
build:
5+
context: .
6+
dockerfile: docker/Dockerfile
7+
args:
8+
USER_ID: ${USER_ID:-1000}
9+
GROUP_ID: ${GROUP_ID:-1000}
10+
image: uofa/s2i-shepherd-drupal-dev
11+
# Chrome webdriver requires this - used for tests.
12+
privileged: true
13+
hostname: ${PROJECT}
14+
ports:
15+
- "80:8080"
816
environment:
17+
CONFIG_SYNC_DIRECTORY: /shared/private/random-hash/sync
18+
DATABASE_HOST: db
19+
DATABASE_USER: user
20+
DATABASE_PASSWORD: password
21+
HASH_SALT: random-hash
22+
MEMCACHE_ENABLED: 0
23+
MEMCACHE_HOST: memcached
24+
PHP_IDE_CONFIG: serverName=${PROJECT}.${DOMAIN}
25+
PUBLIC_DIR: /shared/public
26+
REDIS_ENABLED: 1
27+
REDIS_HOST: redis
28+
SHEPHERD_SITE_ID: 2
29+
SHEPHERD_INSTALL_PROFILE: ua
30+
SHEPHERD_SECRET_PATH: /code/private
31+
SHEPHERD_TOKEN: super-secret-token
32+
SHEPHERD_URL: http://shepherd.test
933
SITE_TITLE: WCMS D8
1034
SITE_MAIL: [email protected]
1135
SITE_ADMIN_EMAIL: [email protected]
1236
SITE_ADMIN_USERNAME: admin
1337
SITE_ADMIN_PASSWORD: password
14-
PUBLIC_DIR: /shared/public
15-
HASH_SALT: random-hash
16-
CONFIG_SYNC_DIRECTORY: /shared/private/random-hash/sync
17-
SHEPHERD_SITE_ID: 2
18-
SHEPHERD_URL: http://shepherd.test
19-
SHEPHERD_TOKEN: super-secret-token
20-
SHEPHERD_INSTALL_PROFILE: ua
21-
REDIS_ENABLED: 1
22-
SHEPHERD_SECRET_PATH: /code/private
23-
XDEBUG_CONFIG: "remote_host=127.0.0.1"
24-
PHP_IDE_CONFIG: serverName=localhost
38+
VIRTUAL_HOST: ${PROJECT}.${DOMAIN}
39+
# Do not define this as '/' or apache2 will give strange behaviour, to test locally,
40+
# change to the web directory and create a symlink to the subpath name eg ln -s . subpath
41+
# WEB_PATH: /subpath
42+
XDEBUG_CONFIG: "remote_host=172.17.0.1"
2543
volumes:
2644
- .:/code
2745
- ./shared:/shared
28-
- $HOME/.ssh/id_rsa:/root/.ssh/id_rsa
46+
- ${XDG_RUNTIME_DIR}/keyring:/ssh
47+
networks:
48+
- default
2949

3050
db:
3151
image: mariadb
32-
network_mode: host
3352
environment:
3453
MYSQL_DATABASE: drupal
3554
MYSQL_USER: user
3655
MYSQL_PASSWORD: password
3756
MYSQL_ROOT_PASSWORD: super-secret-password
57+
networks:
58+
- default
3859

3960
mail:
4061
image: mailhog/mailhog
41-
network_mode: host
62+
environment:
63+
VIRTUAL_HOST: mail.${PROJECT}.${DOMAIN}
64+
networks:
65+
- default
4266

4367
redis:
4468
image: redis:alpine
45-
network_mode: host
69+
networks:
70+
- default
71+
72+
memcached:
73+
image: jboss/infinispan-server:9.4.11.Final
74+
ports:
75+
- "9990:9990"
76+
environment:
77+
APP_USER: user
78+
APP_PASS: pass
79+
MGMT_USER: admin
80+
MGMT_PASS: admin
81+
entrypoint:
82+
- docker-entrypoint.sh
83+
- -c
84+
- standalone-memcached.xml
85+
volumes:
86+
- ./docker/standalone-memcached.xml:/opt/jboss/infinispan-server/standalone/configuration/standalone-memcached.xml
87+
networks:
88+
- default

docker-compose.osx.yml

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,40 @@
11
version: '3'
22
services:
33
web:
4-
image: uofa/apache2-php7-dev:foundation
4+
build:
5+
context: .
6+
dockerfile: docker/Dockerfile
7+
args:
8+
USER_ID: ${USER_ID:-1000}
9+
GROUP_ID: ${GROUP_ID:-1000}
10+
image: uofa/s2i-shepherd-drupal-dev
511
# You will notice that we are forwarding port which do not belong to PHP.
612
# We have to declare them here because these "sidecar" services are sharing
713
# THIS containers network stack.
814
ports:
9-
- "80:80"
15+
- "80:8080"
1016
- "3306:3306"
1117
- "8025:8025"
18+
- "9990:9990"
19+
- "11211:11211"
1220
environment:
21+
CONFIG_SYNC_DIRECTORY: /shared/private/random-hash/sync
22+
HASH_SALT: random-hash
23+
MEMCACHE_ENABLED: 0
24+
PUBLIC_DIR: /shared/public
25+
REDIS_ENABLED: 1
26+
SHEPHERD_INSTALL_PROFILE: ua
27+
SHEPHERD_SITE_ID: 2
28+
SHEPHERD_SECRET_PATH: /code/private
29+
SHEPHERD_TOKEN: super-secret-token
30+
SHEPHERD_URL: http://shepherd.test
1331
SITE_TITLE: WCMS D8
1432
SITE_MAIL: [email protected]
1533
SITE_ADMIN_EMAIL: [email protected]
1634
SITE_ADMIN_USERNAME: admin
1735
SITE_ADMIN_PASSWORD: password
18-
PUBLIC_DIR: /shared/public
19-
HASH_SALT: random-hash
20-
CONFIG_SYNC_DIRECTORY: /shared/private/random-hash/sync
21-
SHEPHERD_SITE_ID: 2
22-
SHEPHERD_URL: http://shepherd.test
23-
SHEPHERD_TOKEN: super-secret-token
24-
SHEPHERD_INSTALL_PROFILE: ua
25-
REDIS_ENABLED: 1
26-
SHEPHERD_SECRET_PATH: /code/private
27-
XDEBUG_CONFIG: "remote_host=docker.for.mac.localhost"
2836
PHP_IDE_CONFIG: serverName=localhost
37+
XDEBUG_CONFIG: "remote_host=docker.for.mac.localhost"
2938
volumes:
3039
- nfsmount:/code
3140
- ./shared:/shared
@@ -54,6 +63,21 @@ services:
5463
image: redis:alpine
5564
network_mode: service:web
5665

66+
memcached:
67+
image: jboss/infinispan-server:9.4.11.Final
68+
environment:
69+
APP_USER: user
70+
APP_PASS: pass
71+
MGMT_USER: admin
72+
MGMT_PASS: admin
73+
entrypoint:
74+
- docker-entrypoint.sh
75+
- -c
76+
- standalone-memcached.xml
77+
volumes:
78+
- ./docker/standalone-memcached.xml:/opt/jboss/infinispan-server/standalone/configuration/standalone-memcached.xml
79+
network_mode: service:web
80+
5781
volumes:
5882
nfsmount:
5983
driver: local

docker/Dockerfile

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# This dockerfile takes the current users uid/gid at build time and adjusts reality
2+
# so that the running user for www-data is actually the same as the launching user.
3+
FROM uofa/s2i-shepherd-drupal
4+
5+
ARG USER_ID
6+
ARG GROUP_ID
7+
8+
# Need to switch from www-data to root to do the change of uid
9+
USER 0:0
10+
11+
# Remove existing www user (both) and group (dialout is the users group on mac).
12+
RUN \
13+
if [ ${USER_ID:-0} -ne 0 ] && [ ${GROUP_ID:-0} -ne 0 ]; then \
14+
userdel -f www-data \
15+
&& groupdel dialout \
16+
&& if getent group www-data ; then groupdel www-data; fi \
17+
&& groupadd -g ${GROUP_ID} www-data \
18+
&& useradd -l -u ${USER_ID} -g www-data www-data \
19+
&& install -d -m 0755 -o www-data -g www-data /home/www-data \
20+
&& chown --changes --no-dereference --recursive \
21+
--from=33 ${USER_ID}:${GROUP_ID} \
22+
/var/www \
23+
/run/lock \
24+
/var/run/apache2 \
25+
/var/log/apache2 \
26+
/var/lock/apache2 \
27+
/code \
28+
/shared; \
29+
fi
30+
31+
# Add the chromedriver repo using php, no wget or curl yet.
32+
RUN php -n -r 'echo file_get_contents("https://dl-ssl.google.com/linux/linux_signing_key.pub");' | apt-key add - \
33+
&& echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' > /etc/apt/sources.list.d/google-chrome.list
34+
35+
# Upgrade all currently installed packages and install additional packages.
36+
RUN apt-get update \
37+
&& apt-get -y install php-sqlite3 php-xdebug php7.2-cli git wget sudo unzip libnotify-bin google-chrome-stable vim \
38+
&& sed -ri 's/^zend.assertions\s*=\s*-1/zend.assertions = 1/g' /etc/php/7.2/cli/php.ini \
39+
&& sed -i 's/^\(allow_url_fopen\s*=\s*\).*$/\1on/g' /etc/php/7.2/mods-available/php_custom.ini \
40+
&& CHROME_DRIVER_VERSION=$(php -n -r 'echo file_get_contents("https://chromedriver.storage.googleapis.com/LATEST_RELEASE");') \
41+
&& wget https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip \
42+
&& unzip -o chromedriver_linux64.zip -d /usr/local/bin \
43+
&& rm -f chromedriver_linux64.zip \
44+
&& chmod +x /usr/local/bin/chromedriver \
45+
&& apt-get -y autoremove && apt-get -y autoclean && apt-get clean && rm -rf /var/lib/apt/lists /tmp/* /var/tmp/*
46+
47+
# Install Composer.
48+
RUN wget -q https://getcomposer.org/installer -O - | php -d allow_url_fopen=On -- --install-dir=/usr/local/bin --filename=composer
49+
50+
COPY ./docker/xdebug.ini /etc/php/7.2/mods-available/xdebug.ini
51+
52+
RUN echo "www-data ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/www-data
53+
54+
# Enable xdebug.
55+
RUN phpenmod -v ALL -s ALL xdebug
56+
57+
USER www-data

0 commit comments

Comments
 (0)