Skip to content

Commit 2b98506

Browse files
Merge pull request #120 from sharmaamitt16/starterkit-optimization
Checkin Mailhog in all staarterkits and changed the dependency of chown service.
2 parents 39fb388 + 2c94443 commit 2b98506

13 files changed

Lines changed: 180 additions & 61 deletions

File tree

starterkits/drupal8-php-fpm-apache/Readme.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ are documented in the table below.
1313
| Project name | .env | PROJECT_NAME | drupal8 |
1414

1515
---
16-
**NOTE**
17-
16+
## NOTE:
1817
Due to an issue as of now PHP_VERSION has to be updated in Tiltfile as well.
1918
---
2019

@@ -81,6 +80,17 @@ recommended alias:
8180
alias ddrush="docker-compose run --rm drupal drush"
8281
```
8382
---
83+
## NOTE:
84+
```
85+
Problem:
86+
On Linux OS, during composer install cli service throws
87+
a permission denied error while installing dependencies.
88+
89+
Solution:
90+
Run the cli service with root user and run chown service after to change the ownership.
91+
This will prevent the error throws during the composer install.
92+
```
93+
---
8494

8595
## Profiling
8696
All the starterkits in vega are shipped with blackfire for code profiling. This is also available on

starterkits/drupal8-php-fpm-apache/docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,16 @@ services:
4242
command:
4343
- "chown -R continua:continua /app"
4444
user: root
45+
depends_on:
46+
- cli
4547
volumes: *app-volumes
4648

4749
cli:
4850
image: "srijanlabs/php-cli:${PHP_VERSION}-10"
4951
container_name: ${PROJECT_NAME}_cli
5052
command: ["composer", "install", "--no-dev", "--prefer-dist", "--no-progress", "--no-suggest", "--no-interaction", "--optimize-autoloader"]
51-
user: continua
53+
user: user
5254
working_dir: /app
53-
depends_on:
54-
- chown
5555
volumes: *cli-volumes
5656
networks: *app-networks
5757
env_file: *app-envsfile

starterkits/drupal8-php-fpm-nginx/Readme.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
| PHP version | .env | PHP_VERSION | 7.3 |
77
| Project name | .env | PROJECT_NAME | drupal8 |
88

9+
---
10+
## NOTE:
11+
Due to an issue as of now PHP_VERSION has to be updated in Tiltfile as well.
12+
---
13+
914
### Configuring Runtime:
1015

1116
##### These values can be configure using [.env](.env) file
@@ -68,6 +73,18 @@ recommended alias:
6873
alias ddrush="docker-compose run --rm php drush"
6974
```
7075
---
76+
## NOTE:
77+
```
78+
Problem:
79+
On Linux OS, during composer install cli service throws
80+
a permission denied error while installing dependencies.
81+
82+
Solution:
83+
Run the cli service with root user and run chown service after to change the ownership.
84+
This will prevent the error throws during the composer install.
85+
```
86+
---
87+
7188
### Profiling:
7289
- Get your blackfire server id and token from https://blackfire.io/my/settings/credentials
7390
- Configure the blackfire server id and token in .env file.
@@ -87,3 +104,10 @@ alias ddrush="docker-compose run --rm php drush"
87104

88105
Please follow the document to setup xdebug:
89106
[Setup Xdebug](/starterkits/XDEBUG-SETUP.md)
107+
108+
## Mailhog
109+
110+
This starterkit ships with mailhog which can be accessed at localhost:8025. This can be a handy feature
111+
to test email functionality on local systems without worrying about sending mails accidently to real users.
112+
Mailhog is only available on dev images which are used for local development and not available on production
113+
images.

starterkits/drupal8-php-fpm-nginx/Tiltfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# -*- mode: Python -*-
22

33
docker_compose('docker-compose.yml')
4-
php_version = str(local('source .env && echo $PHP_VERSION')).strip()
4+
# php_version = str(local('source .env && echo $PHP_VERSION')).strip(). @TODO: This does not
5+
# work on some systems, hence for workaround php_version is hardcoded.
6+
# Change this in case you want to use someother version of php(supported: 7.2, 7.3 & .7.4).
7+
# Please ensure to change PHP_VERSION in .env file as well.
8+
php_version = "7.3"
59
docker_build('srijanlabs/php-fpm-nginx:' + php_version + '-10-local', '.',
6-
build_arg={'PHP_VERSION': php_version},
10+
build_args={'PHP_VERSION': php_version},
711
dockerfile='Dockerfile.dev',
812
live_update = [
913
sync('.', '/app'),

starterkits/drupal8-php-fpm-nginx/docker-compose.yml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#========================================= Drupal 8 StarterKit =============================================#
1+
# Drupal 8 + Nginx StarterKit with nginx.
22
version: '3.5'
3-
#____________________________________________ Named Volumes ________________________________________________#
3+
44
volumes:
55
app:
66
driver: local
@@ -13,11 +13,11 @@ volumes:
1313
# core: # drupal core
1414
# vendor: # php modules
1515
files: # files
16-
#______________________________________________ Networks ___________________________________________________#
16+
1717
networks:
1818
default:
1919
name: vega-${PROJECT_NAME}
20-
#___________________________________________ YAML extensions _______________________________________________#
20+
2121
x-app-volumes: &app-volumes
2222
- files:${DOC_ROOT}/sites/default/files:delegated
2323
# - ./:/app:cached
@@ -34,9 +34,7 @@ x-app-envsfile: &app-envsfile .env
3434
x-app-networks: &app-networks
3535
- default
3636

37-
#_______________________________________________ Services __________________________________________________#
3837
services:
39-
#----------------------------- permission setter ------------------------------------#
4038
# Change mounted named volumes user from root(default) to continua.
4139
chown:
4240
image: "srijanlabs/php-cli:${PHP_VERSION}-10"
@@ -45,22 +43,22 @@ services:
4543
command:
4644
- "chown -R continua:continua /app"
4745
user: root
46+
depends_on:
47+
- cli
4848
volumes: *app-volumes
49-
#---------------------------------- php cli -----------------------------------------#
49+
5050
cli:
5151
image: "srijanlabs/php-cli:${PHP_VERSION}-10"
5252
container_name: ${PROJECT_NAME}_cli
5353
command: ["composer", "install", "--no-dev", "--prefer-dist", "--no-progress", "--no-suggest", "--no-interaction", "--optimize-autoloader"]
54-
user: continua
54+
user: root
5555
working_dir: /app
56-
depends_on:
57-
- chown
5856
volumes: *cli-volumes
5957
networks: *app-networks
6058
env_file: *app-envsfile
6159
environment:
6260
- COMPOSER_MEMORY_LIMIT=-1 # Prevent composer from running out of memory
63-
#---------------------------------- php-fpm -----------------------------------------#
61+
6462
php:
6563
image: srijanlabs/php-fpm-nginx:${PHP_VERSION}-10-local
6664
build:
@@ -76,7 +74,7 @@ services:
7674
volumes: *app-volumes
7775
networks: *app-networks
7876
env_file: *app-envsfile
79-
#---------------------------------- nginx ------------------------------------------#
77+
8078
nginx:
8179
image: srijanlabs/php-fpm-nginx:${PHP_VERSION}-10-local
8280
container_name: ${PROJECT_NAME}_nginx
@@ -88,7 +86,7 @@ services:
8886
volumes: *app-volumes
8987
networks: *app-networks
9088
env_file: *app-envsfile
91-
#------------------------------- database (mysql) -----------------------------------#
89+
9290
mysql:
9391
image: mysql:5.7
9492
container_name: ${PROJECT_NAME}_mysql
@@ -102,7 +100,13 @@ services:
102100
MYSQL_PASSWORD: ${DB_PASSWORD}
103101
MYSQL_DATABASE: ${DB_NAME}
104102
networks: *app-networks
105-
#------------------------------- blackfire -----------------------------------#
103+
104+
mailhog:
105+
image: mailhog/mailhog
106+
ports:
107+
- "1025:1025"
108+
- "8025:8025"
109+
106110
# blackfire:
107111
# image: blackfire/blackfire
108112
# container_name: ${PROJECT_NAME}_blackfire
@@ -113,4 +117,4 @@ services:
113117
# BLACKFIRE_SERVER_ID: ${BLACKFIRE_SERVER_ID}
114118
# BLACKFIRE_SERVER_TOKEN: ${BLACKFIRE_SERVER_TOKEN}
115119
# networks: *app-networks
116-
#===========================================================================================================#
120+

starterkits/drupal9-php-fpm-apache/Readme.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
| PHP version | .env | PHP_VERSION | 7.3 |
77
| Project name | .env | PROJECT_NAME | drupal9 |
88

9+
---
10+
## NOTE:
11+
Due to an issue as of now PHP_VERSION has to be updated in Tiltfile as well.
12+
---
13+
914
### Configuring Runtime:
1015

1116
##### These values can be configure using [.env](.env) file
@@ -61,13 +66,26 @@ alias dcomposer="docker-compose run --rm cli composer"
6166
---
6267
### Running drush commands:
6368
```bash
64-
docker-compose run --rm php drush cr
69+
docker-compose run --rm drupal drush cr
6570
```
6671
recommended alias:
6772
```bash
68-
alias ddrush="docker-compose run --rm php drush"
73+
alias ddrush="docker-compose run --rm drupal drush"
6974
```
7075
---
76+
77+
## NOTE:
78+
```
79+
Problem:
80+
On Linux OS, during composer install cli service throws
81+
a permission denied error while installing dependencies.
82+
83+
Solution:
84+
Run the cli service with root user and run chown service after to change the ownership.
85+
This will prevent the error throws during the composer install.
86+
```
87+
---
88+
7189
### Profiling:
7290
- Get your blackfire server id and token from https://blackfire.io/my/settings/credentials
7391
- Configure the blackfire server id and token in .env file.
@@ -88,3 +106,10 @@ alias ddrush="docker-compose run --rm php drush"
88106

89107
Please follow the document to setup xdebug:
90108
[Setup Xdebug](/starterkits/XDEBUG-SETUP.md)
109+
110+
## Mailhog
111+
112+
This starterkit ships with mailhog which can be accessed at localhost:8025. This can be a handy feature
113+
to test email functionality on local systems without worrying about sending mails accidently to real users.
114+
Mailhog is only available on dev images which are used for local development and not available on production
115+
images.

starterkits/drupal9-php-fpm-apache/Tiltfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# -*- mode: Python -*-
22

33
docker_compose('docker-compose.yml')
4-
php_version = str(local('source .env && echo $PHP_VERSION')).strip()
4+
# php_version = str(local('source .env && echo $PHP_VERSION')).strip(). @TODO: This does not
5+
# work on some systems, hence for workaround php_version is hardcoded.
6+
# Change this in case you want to use someother version of php(supported: 7.2, 7.3 & .7.4).
7+
# Please ensure to change PHP_VERSION in .env file as well.
8+
php_version = "7.3"
59
docker_build('srijanlabs/php-fpm-apache:' + php_version + '-10-local', '.',
6-
build_arg={'PHP_VERSION': php_version},
10+
build_args={'PHP_VERSION': php_version},
711
dockerfile='Dockerfile.dev',
812
live_update = [
913
sync('.', '/app'),

starterkits/drupal9-php-fpm-apache/docker-compose.yml

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#========================================= Drupal 9 StarterKit =============================================#
1+
# Drupal 9 StarterKit with Nginx.
22
version: '3.5'
3-
#____________________________________________ Named Volumes ________________________________________________#
3+
44
volumes:
55
app:
66
driver: local
@@ -13,11 +13,11 @@ volumes:
1313
# core: # drupal core
1414
# vendor: # php modules
1515
files: # files
16-
#______________________________________________ Networks ___________________________________________________#
16+
1717
networks:
1818
default:
1919
name: vega-${PROJECT_NAME}
20-
#___________________________________________ YAML extensions _______________________________________________#
20+
2121
x-app-volumes: &app-volumes
2222
- files:${DOC_ROOT}/sites/default/files:delegated
2323
# - ./:/app:cached
@@ -34,9 +34,7 @@ x-app-envsfile: &app-envsfile .env
3434
x-app-networks: &app-networks
3535
- default
3636

37-
#_______________________________________________ Services __________________________________________________#
3837
services:
39-
#----------------------------- permission setter ------------------------------------#
4038
# Change mounted named volumes user from root(default) to continua.
4139
chown:
4240
image: "srijanlabs/php-cli:${PHP_VERSION}-10"
@@ -45,22 +43,22 @@ services:
4543
command:
4644
- "chown -R continua:continua /app"
4745
user: root
46+
depends_on:
47+
- cli
4848
volumes: *app-volumes
49-
#---------------------------------- php cli -----------------------------------------#
49+
5050
cli:
5151
image: "srijanlabs/php-cli:${PHP_VERSION}-10"
5252
container_name: ${PROJECT_NAME}_cli
5353
command: ["composer", "install", "--no-dev", "--prefer-dist", "--no-progress", "--no-suggest", "--no-interaction", "--optimize-autoloader"]
54-
user: continua
54+
user: root
5555
working_dir: /app
56-
depends_on:
57-
- chown
5856
volumes: *cli-volumes
5957
networks: *app-networks
6058
env_file: *app-envsfile
6159
environment:
6260
- COMPOSER_MEMORY_LIMIT=-1 # Prevent composer from running out of memory
63-
#---------------------------------- drupal ------------------------------------------#
61+
6462
drupal:
6563
image: srijanlabs/php-fpm-apache:${PHP_VERSION}-10-local
6664
build:
@@ -76,7 +74,7 @@ services:
7674
volumes: *app-volumes
7775
networks: *app-networks
7876
env_file: *app-envsfile
79-
#------------------------------- database (mysql) -----------------------------------#
77+
8078
mysql:
8179
image: mysql:5.7
8280
container_name: ${PROJECT_NAME}_mysql
@@ -90,7 +88,13 @@ services:
9088
MYSQL_PASSWORD: ${DB_PASSWORD}
9189
MYSQL_DATABASE: ${DB_NAME}
9290
networks: *app-networks
93-
#------------------------------- blackfire -----------------------------------#
91+
92+
mailhog:
93+
image: mailhog/mailhog
94+
ports:
95+
- "1025:1025"
96+
- "8025:8025"
97+
9498
# blackfire:
9599
# image: blackfire/blackfire
96100
# container_name: ${PROJECT_NAME}_blackfire
@@ -101,4 +105,3 @@ services:
101105
# BLACKFIRE_SERVER_ID: ${BLACKFIRE_SERVER_ID}
102106
# BLACKFIRE_SERVER_TOKEN: ${BLACKFIRE_SERVER_TOKEN}
103107
# networks: *app-networks
104-
#===========================================================================================================#

0 commit comments

Comments
 (0)