├── .dockerignore ├── .envrc ├── .gitignore ├── .idea-dist ├── .gitignore.dist ├── .name ├── drupal.iml ├── misc.xml ├── modules.xml ├── php.xml ├── runConfigurations │ └── Docker_drush.xml └── workspace.xml ├── Dockerfile ├── Dockerfile.php7 ├── LICENSE ├── README.md ├── composer.json ├── config ├── .dockerignore ├── docker │ └── web │ │ ├── base │ │ ├── crontab │ │ ├── default.conf │ │ ├── drush.yml │ │ ├── opcache.ini │ │ ├── php.ini │ │ ├── rsyslog.conf │ │ ├── supervisord.conf │ │ ├── wait-for-db.sh │ │ ├── xdebug.ini │ │ └── xdebug.sh │ │ ├── bootstrap.sh │ │ └── web-writeable.txt └── drupal │ ├── development.services.yml │ ├── settings.local.php │ ├── settings.php │ └── sync │ └── .gitkeep ├── docker-compose.yml └── scripts ├── composer ├── ScriptHandler.php └── install.sh └── dev ├── dbash └── ddrush /.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore Drupal's file directory 2 | web/sites/default/files 3 | 4 | .idea 5 | .git 6 | -------------------------------------------------------------------------------- /.envrc: -------------------------------------------------------------------------------- 1 | PATH_add scripts/dev 2 | PATH_add vendor/bin 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore directories generated by Composer 2 | vendor 3 | web/core 4 | web/modules/contrib 5 | web/themes/contrib 6 | web/profiles/contrib 7 | 8 | # Ignore Drupal's file directory 9 | web/sites/default/files 10 | 11 | # Ignore files generated by PhpStorm 12 | .idea 13 | 14 | .drush 15 | -------------------------------------------------------------------------------- /.idea-dist/.gitignore.dist: -------------------------------------------------------------------------------- 1 | # Taken from https://github.com/github/gitignore/blob/613394b3a9753546f8c5656960e44a666d010459/Global/JetBrains.gitignore 2 | 3 | # User-specific stuff: 4 | deployment.xml 5 | workspace.xml 6 | tasks.xml 7 | dictionaries 8 | # Sensitive or high-churn files: 9 | dataSources.ids 10 | dataSources.xml 11 | dataSources.local.xml 12 | sqlDataSources.xml 13 | dynamic.xml 14 | uiDesigner.xml 15 | *.ipr 16 | *.iws 17 | -------------------------------------------------------------------------------- /.idea-dist/.name: -------------------------------------------------------------------------------- 1 | PROJECT-NAME-PLACEHOLDER 2 | -------------------------------------------------------------------------------- /.idea-dist/drupal.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea-dist/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.idea-dist/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea-dist/php.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea-dist/runConfigurations/Docker_drush.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.idea-dist/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $PROJECT_DIR$/web 6 | 7 | 8 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Docker container for Drupal 8 2 | 3 | FROM bradjonesllc/docker-drupal:php7-apache as base 4 | 5 | FROM base as deploy 6 | 7 | COPY . /var/www/html 8 | -------------------------------------------------------------------------------- /Dockerfile.php7: -------------------------------------------------------------------------------- 1 | # Docker container for Drupal 8 2 | 3 | FROM php:7.2.9-apache 4 | 5 | RUN apt-get update && apt-get install -yqq --no-install-recommends \ 6 | rsyslog \ 7 | supervisor \ 8 | cron \ 9 | mysql-client \ 10 | libpng-dev \ 11 | libfreetype6-dev \ 12 | libjpeg62-turbo-dev \ 13 | libpng-dev \ 14 | locales \ 15 | git \ 16 | wget \ 17 | ca-certificates \ 18 | && a2enmod rewrite \ 19 | && a2enmod expires \ 20 | && a2enmod headers \ 21 | && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ 22 | && docker-php-ext-install mysqli pdo_mysql zip mbstring gd exif pcntl opcache \ 23 | && pecl install apcu xdebug \ 24 | && echo extension=apcu.so > /usr/local/etc/php/conf.d/apcu.ini \ 25 | && rm -rf /var/lib/apt/lists/* 26 | 27 | RUN git clone https://github.com/php/pecl-php-uploadprogress.git /tmp/php-uploadprogress && \ 28 | cd /tmp/php-uploadprogress && \ 29 | phpize && \ 30 | ./configure --prefix=/usr --enable-uploadprogress && \ 31 | make && \ 32 | make install && \ 33 | echo 'extension=uploadprogress.so' > /usr/local/etc/php/conf.d/uploadprogress.ini && \ 34 | rm -rf /tmp/* 35 | 36 | ENV DOCKERIZE_VERSION v0.2.0 37 | RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \ 38 | && tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz 39 | 40 | COPY config /var/www/html 41 | COPY config/docker/web/base/supervisord.conf /etc/supervisor/conf.d/supervisord.conf 42 | COPY config/docker/web/base/default.conf /etc/apache2/sites-available/000-default.conf 43 | RUN a2ensite 000-default.conf 44 | COPY config/docker/web/base/drush.yml /etc/drush/drush.yml 45 | COPY config/docker/web/base/opcache.ini /usr/local/etc/php/conf.d/opcache.ini 46 | COPY config/docker/web/base/rsyslog.conf /etc/rsyslog.conf 47 | COPY config/docker/web/base/crontab /etc/cron.d/drupal 48 | COPY config/docker/web/base/wait-for-db.sh /wait-for-db.sh 49 | RUN chmod 644 /etc/cron.d/drupal && touch /cron-env 50 | COPY config/docker/web/base/php.ini /usr/local/etc/php/php.ini 51 | 52 | ENV PATH="${PATH}:/var/www/html/vendor/bin" 53 | 54 | EXPOSE 80 55 | 56 | WORKDIR /var/www/html 57 | 58 | CMD ["/usr/bin/supervisord"] 59 | 60 | ONBUILD ARG gitref=unknown 61 | ONBUILD ENV GITREF $gitref 62 | ONBUILD LABEL gitref $gitref 63 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | 341 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## ARCHIVED! Don't use this. 2 | 3 | It was nice while it lasted but Composer and Docker have come a long way, and this repository is a vestige of a bygone era. Things are simpler now - use `drupal/recommended-project` et. al. 4 | 5 | # Docker Scaffolding for Drupal 8 6 | 7 | [![Docker Automated buil](https://img.shields.io/docker/automated/bradjonesllc/docker-drupal.svg?maxAge=2592000)](https://hub.docker.com/r/bradjonesllc/docker-drupal) 8 | [![Packagist](https://img.shields.io/packagist/v/bradjonesllc/docker-drupal.svg?maxAge=2592000)](https://packagist.org/packages/bradjonesllc/docker-drupal) 9 | 10 | ## Purpose 11 | This repository provides two artifacts: 12 | 13 | 1. A Composer package intended for one-time, initial scaffolding of a new 14 | [Drupal 8](http://drupal.org) project, which would then be self-contained. 15 | It uses a `composer.json` file derived from 16 | [drupal-project](https://github.com/drupal-composer/drupal-project) 17 | to pull in Drupal core, and provides additional helpful Docker-focused 18 | functionality. The drupal-project `composer.json` file and helper scripts 19 | can then be used to manage core updates, contrib modules and more. Drupal 8, 20 | with its robust exportable configuration file management and Composer 21 | integration, is uniquely suited for containerized development. 22 | 1. A Docker image tailored for use with the enclosed project scaffolding. Its 23 | behavior is largely dictated by the files in `config/docker/web/base`, 24 | however they may be overridden on a project-specific basis by copying over 25 | the files at the appropriate destination. **Use this image at your own 26 | risk, understanding that backwards-compatibility in your particular case 27 | may not be guaranteed. For safest results, build your own base images.** 28 | 29 | ## Usage/Quick-Start 30 | ``` 31 | composer create-project --stability dev --no-interaction --ignore-platform-reqs bradjonesllc/docker-drupal:^2 PROJECT-DIR 32 | ``` 33 | ...Will install into a new directory named `PROJECT-DIR`. 34 | 35 | ### Default addresses and command examples 36 | - Start for first time; create data container, install Drupal: `docker-compose up` 37 | - Web: `http://localhost:8082` 38 | - Get a login for uid 1, after install: `docker-compose exec web drush uli` (See below for shortcut options) 39 | 40 | ## Features 41 | Your new Drupal 8 site comes with a number of helper scripts and config files that 42 | speed development in a containerized environment and production deployment. 43 | + A `Dockerfile` that includes all required PHP extensions for Drupal 8 44 | + A quick-start [Docker Compose](https://docs.docker.com/compose/) file, which provides 45 | an Apache/PHP web container, mysql container and data volume. 46 | + Site installation with: 47 | - Optional force-set of an existing site UUID and import of configuration files, 48 | if present. 49 | - Sensible default `settings.php`, `settings.local.php` and `development.services.yml` files. 50 | + Scripts respond to environment variables, with defaults in the docker-compose.yml file: 51 | - In development mode, enables Xdebug for Apache, and 52 | toggles inclusion of `settings.local.php` and `development.services.yml` 53 | + Wrapper scripts: 54 | - `ddrush`, for executing [drush](https://github.com/drush-ops/drush) inside the 55 | web container, with a starter global `/etc/drush/drushrc.php` file. 56 | - `dbash`, a shortcut for getting a bash shell inside the web container (as *www-data*) 57 | + An `.envrc` file, for use with [direnv](http://direnv.net/), that: 58 | - Tells wrapper scripts the correct container to execute against (by pattern). 59 | - Includes the wrapper script and the `vendor/bin` directory into the PATH. 60 | + Xdebug for development, and all invocations of the `ddrush` helper script 61 | + `.dockerignore` excludes VCS and uploaded files. Docker runs `composer install` 62 | inside the container on build, though if your development environment includes 63 | many of those files, having them copied into the container saves some time on 64 | build. See *Development Workflow*, below. 65 | + All processes in the web container log to `STDOUT`; this is useful if you wish to 66 | aggregate your Docker container logs or integrate with an external log service. 67 | + Default configuration files for [PhpStorm](https://www.jetbrains.com/phpstorm/), 68 | including a server configuration and path mapping for Xdebug and setting max 69 | debug connections == 10 for [compatibility with](https://github.com/drush-ops/drush/issues/1534) 70 | Drush's subrequests. 71 | + A default cron implementation via crontab, which runs only when not in 72 | development mode. 73 | + Support for site-wide HTTP Basic authentication when the `HTPASSWD_USER` 74 | and `HTPASSWD_PASSWORD` environment variables are set, e.g., for a 75 | staging site. (Or mount in your own `/etc/.htpasswd` file to use.) 76 | 77 | ### Why ship with Xdebug? Won't it waste resources in production? 78 | Xdebug is not loaded/started when in development mode (see below), 79 | so while you are shipping a slightly-larger container, this setup avoids the need for 80 | a "Development-only" Dockerfile. 81 | 82 | ## Development Workflow 83 | **TL;DR:** Leverage composer as much as possible for managing your project. The 84 | drupal-project README is very helpful on this point (see above.) 85 | 86 | While a wrapper is provided for running drush inside the container, avoid using 87 | commands like `drush dl`. When using the default `docker-compose.yml` file, we 88 | inject the entire file structure on the host into the container, so your local 89 | file changes are reflected in real time. Asking drush to make filesystem changes 90 | outside the `sites/*/files` directory (`drush cache-rebuild` should be OK) may 91 | result in permissions errors and other weirdness. 92 | 93 | ### Development Mode 94 | Enable development mode (on by default) by setting the `ENVIRONMENT` environment 95 | variable == `DEV`. 96 | 97 | ### Version control notes 98 | **The proper way to include projects and other dependencies**, when using composer, 99 | is to add them as requirements in `composer.json` and then running `composer update`. 100 | 101 | As noted above, the contents of those dependencies are excluded by default in 102 | `.gitignore`, so you should only be versioning code custom to your site. 103 | 104 | ### `ddrush` helper script 105 | Paired with the environment variable/PATH set with direnv (see above), you may execute 106 | most Drush commands inside the web container by typing `ddrush your-command` inside 107 | the project. (You may need to run `direnv allow`) in your shell, before starting work. 108 | More complex commands involving quoting are not passed through verbatim; run `dbash` 109 | first, then your `drush` command directly inside the container. 110 | 111 | ### Xdebug Usage on same host as Docker container 112 | [Toggle Xdebug](http://xdebug.org/docs/remote#starting) in your browser or HTTP 113 | request, and initiate a corresponding listening session in your IDE on port 9000. 114 | The provided PhpStorm configuration means you can just click the phone icon and go! 115 | 116 | ### Updating Drupal core 117 | drupal-project's post-install command will ensure your Drupal core "scaffolding" 118 | files are kept in sync with upstream. See drupal-project's README. 119 | 120 | ### What about Drupal 8 configuration? 121 | To ship/version a copy of your site with exported configuration, dump the config 122 | to disk - `ddrush config-export` - and your config will be dumped to `config/drupal/sync`. 123 | That directory is set as writable by the Apache user in development mode, for ease 124 | of export. In a production environment, import your configuration with drush or the web UI. 125 | 126 | ### Patching 127 | Check out [composer-patches](https://github.com/cweagans/composer-patches) for an easy 128 | solution. 129 | 130 | #### Configuration management in development mode 131 | When the web container starts in with the environment variable `DRUPAL_INSTALL = TRUE`, 132 | the bootstrap script attempts to determine the presence of an installed Drupal database. 133 | If not found, the script will attempt to install Drupal, set the site UUID, and import 134 | any existing configuration. Thus you can re-use (or, not) a development database even 135 | across web container rebuilds. 136 | 137 | #### Database management in development mode 138 | As noted above, the bootstrap script contains some safeguards against installing 139 | over an existing database. Should you wish to (re-)start from scratch (or a fresh 140 | import of your exported configuration files), remove the `db` database container, 141 | then the `drupal_data` container. 142 | 143 | ## SSL Support 144 | SSL termination is no longer bundled. In the spirit of Docker containers doing 145 | one task well, consider using [a proxy container](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion) 146 | in conjunction with a free [Let's Encrypt](https://letsencrypt.org/) certificate. 147 | 148 | ## Production Deployment 149 | ### Data Permanence 150 | With development mode off, Drupal will expect to find an installed database at the 151 | `db` alias. Also, it's strongly suggested you mount host directories into the container 152 | at the locations in [`web-writeable.txt`](https://github.com/BradJonesLLC/docker-drupal/blob/master/config/docker/web/web-writeable.txt) 153 | so user and system-generated files are preserved. 154 | 155 | ## Requirements 156 | - [Docker](https://docker.com) 157 | - [Docker Compose](https://docs.docker.com/compose/), for running containers locally. 158 | - Linux or similar virtualized environment with bash shell. Perhaps [Docker Toolbox](https://docs.docker.com/toolbox/overview/) will help if you're on Windows or Mac? 159 | - A local installation of [composer](http://getcomposer.org/) 160 | 161 | ### Highly Recommended 162 | - [direnv](http://direnv.net/) for zero-config use of `ddrush` drush wrapper and scripts in `vendor/bin`. 163 | 164 | ## Contributing 165 | Issues and pull requests welcome; Both Drupal 8 and Docker are relatively new and 166 | fast-moving projects. There doesn't appear to be many other comprehensive starterkits 167 | for Docker and Drupal, so this is my effort at helping others avoid my steep learning 168 | curve on this front. 169 | 170 | ### Known Issues 171 | See the [confirmed bugs in the issue queue](https://github.com/BradJonesLLC/docker-drupal/labels/bug). 172 | 173 | ## See Also 174 | ### Other Projects 175 | There are a few other Drupal/Docker projects, though most appear focused on Drupal 7: 176 | - [dropdock](https://github.com/twinbit/dropdock) 177 | - [drude](https://github.com/blinkreaction/drude) 178 | - [bowline](https://github.com/davenuman/bowline) 179 | 180 | ### Groups and Resources 181 | - [Docker group on groups.drupal.org](https://groups.drupal.org/docker) 182 | 183 | ## Copyright and License 184 | © 2016-2018, Brad Jones LLC. Licensed under GPL 2. 185 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bradjonesllc/docker-drupal", 3 | "description": "Project template for Drupal 8 with Composer and Docker", 4 | "type": "project", 5 | "license": "GPL-2.0+", 6 | "authors": [ 7 | { 8 | "name": "", 9 | "role": "" 10 | } 11 | ], 12 | "repositories": [ 13 | { 14 | "type": "composer", 15 | "url": "https://packages.drupal.org/8" 16 | } 17 | ], 18 | "require": { 19 | "composer/installers": "^1.2", 20 | "cweagans/composer-patches": "^1.6", 21 | "drupal-composer/drupal-scaffold": "^2.2", 22 | "drupal/console": "~1.0", 23 | "drupal/core": "^8.5.3", 24 | "drush/drush": "^9.0", 25 | "hirak/prestissimo": "^0.3", 26 | "webmozart/path-util": "^2.3", 27 | "drupal/console-yaml": "^0.1.3" 28 | }, 29 | "require-dev": { 30 | "webflo/drupal-core-require-dev": "^8.5.3" 31 | }, 32 | "conflict": { 33 | "drupal/drupal": "*" 34 | }, 35 | "minimum-stability": "dev", 36 | "prefer-stable": true, 37 | "config": { 38 | "sort-packages": true, 39 | "platform": { 40 | "ext-curl": "1", 41 | "ext-mbstring": "1", 42 | "ext-dom": "1", 43 | "ext-xmlwriter": "1", 44 | "ext-simplexml": "1", 45 | "ext-soap": "1", 46 | "ext-gmp": "1", 47 | "ext-gd": "1", 48 | "ext-xml": "1", 49 | "php": "7.2.9" 50 | } 51 | }, 52 | "autoload": { 53 | "classmap": [ 54 | "scripts/composer/ScriptHandler.php" 55 | ] 56 | }, 57 | "scripts": { 58 | "config-export": "docker-compose exec -e HOME=/var/www/html -T --user $(id -u) web bash -c 'drush -y config-export'", 59 | "drupal-updates": "docker-compose exec -T web bash -c 'drush -y updb && drush -y config-import && drush -y entity:updates'", 60 | "drupal-scaffold": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold", 61 | "pre-install-cmd": [ 62 | "DrupalProject\\composer\\ScriptHandler::checkComposerVersion" 63 | ], 64 | "pre-update-cmd": [ 65 | "DrupalProject\\composer\\ScriptHandler::checkComposerVersion" 66 | ], 67 | "post-install-cmd": [ 68 | "DrupalProject\\composer\\ScriptHandler::createRequiredFiles" 69 | ], 70 | "post-update-cmd": [ 71 | "DrupalProject\\composer\\ScriptHandler::createRequiredFiles" 72 | ], 73 | "post-create-project-cmd": "sh scripts/composer/install.sh" 74 | }, 75 | "extra": { 76 | "composer-exit-on-patch-failure": true, 77 | "installer-paths": { 78 | "web/core": ["type:drupal-core"], 79 | "web/libraries/{$name}": ["type:drupal-library"], 80 | "web/modules/contrib/{$name}": ["type:drupal-module"], 81 | "web/profiles/contrib/{$name}": ["type:drupal-profile"], 82 | "web/themes/contrib/{$name}": ["type:drupal-theme"], 83 | "drush/contrib/{$name}": ["type:drupal-drush"] 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /config/.dockerignore: -------------------------------------------------------------------------------- 1 | drupal 2 | -------------------------------------------------------------------------------- /config/docker/web/base/crontab: -------------------------------------------------------------------------------- 1 | MAILTO="" 2 | SHELL=/bin/bash 3 | 4 | 22 * * * * www-data . /cron-env; if [[ -n "$CRON_OK" ]]; then /bin/bash -c 'drush core-cron'; fi 5 | -------------------------------------------------------------------------------- /config/docker/web/base/default.conf: -------------------------------------------------------------------------------- 1 | php_value display_errors Off 2 | php_flag log_errors on 3 | php_value error_log syslog 4 | php_value xdebug.remote_enable 1 5 | ServerAdmin ${SERVER_ADMIN} 6 | 7 | 8 | php_flag xdebug.remote_autostart 1 9 | php_flag opcache.enable Off 10 | 11 | 12 | # Explicitly disallow files above web root, including keys and private files in /var/www. 13 | 14 | Options FollowSymLinks 15 | AllowOverride None 16 | Require all denied 17 | 18 | 19 | 20 | AllowOverride All 21 | Require all granted 22 | 23 | 24 | 25 | DocumentRoot /var/www/html/web 26 | ErrorLog /proc/self/fd/2 27 | CustomLog /dev/null common 28 | 29 | AuthType Basic 30 | AuthName Protected 31 | AuthUserFile "/etc/.htpasswd" 32 | Require valid-user 33 | 34 | 35 | -------------------------------------------------------------------------------- /config/docker/web/base/drush.yml: -------------------------------------------------------------------------------- 1 | drush: 2 | options: 3 | root: /var/www/html/web 4 | -------------------------------------------------------------------------------- /config/docker/web/base/opcache.ini: -------------------------------------------------------------------------------- 1 | opcache.memory_consumption=128 2 | opcache.interned_strings_buffer=8 3 | opcache.max_accelerated_files=4000 4 | opcache.revalidate_freq=60 5 | opcache.fast_shutdown=1 6 | opcache.enable_cli=1 7 | -------------------------------------------------------------------------------- /config/docker/web/base/php.ini: -------------------------------------------------------------------------------- 1 | [PHP] 2 | 3 | date.timezone = "America/Denver" 4 | upload_max_filesize = 40M 5 | post_max_size = 40M 6 | -------------------------------------------------------------------------------- /config/docker/web/base/rsyslog.conf: -------------------------------------------------------------------------------- 1 | $ModLoad imuxsock # provides support for local system logging 2 | $template TraditionalFormatWithPRI,"%pri-text%: %syslogtag%%msg:::drop-last-lf%\n" 3 | *.* /dev/stdout;TraditionalFormatWithPRI -------------------------------------------------------------------------------- /config/docker/web/base/supervisord.conf: -------------------------------------------------------------------------------- 1 | [supervisord] 2 | nodaemon=true 3 | loglevel=critical 4 | 5 | [program:apache2] 6 | command=/bin/bash -c "/var/www/html/config/docker/web/bootstrap.sh" 7 | stdout_logfile=syslog 8 | stderr_logfile=syslog 9 | autorestart=false 10 | 11 | [program:cron] 12 | command = cron -f -L 15 13 | autostart=true 14 | autorestart=true 15 | stdout_logfile=syslog 16 | stderr_logfile=syslog 17 | 18 | [program:rsyslog] 19 | command = rsyslogd -n 20 | autostart=true 21 | autorestart=true 22 | redirect_stderr=true 23 | stdout_logfile=/dev/stdout 24 | stdout_logfile_maxbytes=0 25 | -------------------------------------------------------------------------------- /config/docker/web/base/wait-for-db.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Only here for backwards-compatibility. 4 | 5 | echo "Calling /wait-for-db.sh is deprecated. Use dockerize instead.\n" 6 | HOST=${DRUPAL_DATABASE_HOST:-db} 7 | dockerize -wait tcp://$HOST:3306 -timeout 60s 8 | -------------------------------------------------------------------------------- /config/docker/web/base/xdebug.ini: -------------------------------------------------------------------------------- 1 | zend_extension=xdebug.so 2 | xdebug.show_exception_trace=0 3 | xdebug.collect_params=? 4 | xdebug.max_nesting_level=256 5 | xdebug.remote_port=9000 6 | xdebug.remote_host=172.17.0.1 7 | -------------------------------------------------------------------------------- /config/docker/web/base/xdebug.sh: -------------------------------------------------------------------------------- 1 | export XDEBUG_CONFIG='idekey=PHPSTORM remote_enable=1' 2 | export PHP_IDE_CONFIG='serverName=docker' 3 | -------------------------------------------------------------------------------- /config/docker/web/bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if [[ ! -f /etc/.htpasswd && -n "$HTPASSWD_PASSWORD" ]]; then 6 | printf "$HTPASSWD_USER:$(openssl passwd -crypt $HTPASSWD_PASSWORD)\n" >> /etc/.htpasswd 7 | printf "Enabled HTTP Basic Authentication.\n" 8 | fi 9 | 10 | cd /var/www/html/web 11 | 12 | rm /usr/local/etc/php/conf.d/xdebug.ini || true 13 | 14 | HOST=${DRUPAL_DATABASE_HOST:-db} 15 | dockerize -wait tcp://$HOST:3306 -timeout 120s 16 | 17 | if [[ -n "$DRUPAL_INSTALL" && ! `drush cget system.site uuid` ]]; then 18 | printf "Installing Drupal.\n" 19 | export INSTALL_ACTIVE=TRUE 20 | cmd="drupal site:install --force --no-interaction --no-ansi minimal" 21 | CONFIG_DIR=/var/www/html/config/drupal/sync 22 | if [[ -f "${CONFIG_DIR}/system.site.yml" ]]; then 23 | uuid=`drupal yaml:get:value ${CONFIG_DIR}/system.site.yml uuid` 24 | cmd="$cmd && drush cset -y system.site uuid $uuid && drush config-import -y" 25 | else 26 | # Not entirely contingent on having an exported config but implies that 27 | # The site has not been fully scaffolded. 28 | hash_salt=`drush php-eval "echo Drupal\Component\Utility\Crypt::randomBytesBase64(55);"` 29 | echo "\$settings['hash_salt'] = \"$hash_salt\";" >> /var/www/html/web/sites/default/settings.php 30 | fi 31 | eval "$cmd" 32 | unset INSTALL_ACTIVE 33 | fi 34 | 35 | for dn in `cat /var/www/html/config/docker/web/web-writeable.txt`; do 36 | [ -d /var/www/html/$dn ] || mkdir /var/www/html/$dn 37 | chown -R www-data /var/www/html/$dn 38 | done 39 | mkdir -p /var/www/.drush && chown www-data /var/www/.drush 40 | 41 | if [[ $ENVIRONMENT == 'DEV' ]]; then 42 | cp /var/www/html/config/docker/web/base/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini 43 | else 44 | export CRON_OK=TRUE 45 | fi 46 | 47 | printenv | sed 's/^\([a-zA-Z0-9_]*\)=\(.*\)$/export \1="\2"/g' > /cron-env 48 | 49 | apache2-foreground 50 | -------------------------------------------------------------------------------- /config/docker/web/web-writeable.txt: -------------------------------------------------------------------------------- 1 | web/sites/default/files 2 | web/sites/simpletest 3 | -------------------------------------------------------------------------------- /config/drupal/development.services.yml: -------------------------------------------------------------------------------- 1 | # Local development services. 2 | # 3 | # To activate this feature, follow the instructions at the top of the 4 | # 'example.settings.local.php' file, which sits next to this file. 5 | services: 6 | cache.backend.null: 7 | class: Drupal\Core\Cache\NullBackendFactory 8 | 9 | parameters: 10 | twig.config: 11 | debug: true 12 | auto_reload: true 13 | cache: false 14 | http.response.debug_cacheability_headers: true 15 | -------------------------------------------------------------------------------- /config/drupal/settings.local.php: -------------------------------------------------------------------------------- 1 | getenv('DRUPAL_DATABASE') ?: 'drupal', 10 | 'username' => getenv('DRUPAL_DATABASE_USER') ?: 'drupal', 11 | 'password' => getenv('DRUPAL_DATABASE_PASSWORD') ?: 'drupalpw', 12 | 'prefix' => '', 13 | 'host' => getenv('DRUPAL_DATABASE_HOST') ?: 'db', 14 | 'port' => '3306', 15 | 'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql', 16 | 'driver' => 'mysql', 17 | ); 18 | 19 | $settings['install_profile'] = 'minimal'; 20 | -------------------------------------------------------------------------------- /config/drupal/sync/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BradJonesLLC/docker-drupal/e95e49baa9c171ae1b7f9b8fb427468bf11fa96b/config/drupal/sync/.gitkeep -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | # Development compose file. 2 | 3 | version: '2.3' 4 | services: 5 | web: 6 | build: 7 | context: . 8 | target: base 9 | ports: 10 | - "127.0.0.1:8082:80" 11 | volumes: 12 | - .:/var/www/html 13 | environment: 14 | - ENVIRONMENT=DEV 15 | - DRUPAL_INSTALL=TRUE 16 | - HTPASSWD_USER 17 | - HTPASSWD_PASSWORD 18 | - SERVER_ADMIN 19 | - DRUSH_OPTIONS_URI=http://localhost:8082 20 | db: 21 | image: mysql:5.7 22 | environment: 23 | - MYSQL_ROOT_PASSWORD=docker 24 | - MYSQL_DATABASE=drupal 25 | - MYSQL_USER=drupal 26 | - MYSQL_PASSWORD=drupalpw 27 | volumes: 28 | - data:/var/lib/mysql 29 | volumes: 30 | data: {} 31 | -------------------------------------------------------------------------------- /scripts/composer/ScriptHandler.php: -------------------------------------------------------------------------------- 1 | locateRoot(getcwd()); 22 | $drupalRoot = $drupalFinder->getDrupalRoot(); 23 | 24 | $dirs = [ 25 | 'modules', 26 | 'profiles', 27 | 'themes', 28 | ]; 29 | 30 | // Required for unit testing 31 | foreach ($dirs as $dir) { 32 | if (!$fs->exists($drupalRoot . '/'. $dir)) { 33 | $fs->mkdir($drupalRoot . '/'. $dir); 34 | $fs->touch($drupalRoot . '/'. $dir . '/.gitkeep'); 35 | } 36 | } 37 | 38 | // Prepare the settings file for installation 39 | if (!$fs->exists($drupalRoot . '/sites/default/settings.php') and $fs->exists($drupalRoot . '/sites/default/default.settings.php')) { 40 | $fs->copy($drupalRoot . '/sites/default/default.settings.php', $drupalRoot . '/sites/default/settings.php'); 41 | require_once $drupalRoot . '/core/includes/bootstrap.inc'; 42 | require_once $drupalRoot . '/core/includes/install.inc'; 43 | $settings['config_directories'] = [ 44 | CONFIG_SYNC_DIRECTORY => (object) [ 45 | 'value' => Path::makeRelative($drupalFinder->getComposerRoot() . '/config/sync', $drupalRoot), 46 | 'required' => TRUE, 47 | ], 48 | ]; 49 | drupal_rewrite_settings($settings, $drupalRoot . '/sites/default/settings.php'); 50 | $fs->chmod($drupalRoot . '/sites/default/settings.php', 0666); 51 | $event->getIO()->write("Create a sites/default/settings.php file with chmod 0666"); 52 | } 53 | 54 | // Create the files directory with chmod 0777 55 | if (!$fs->exists($drupalRoot . '/sites/default/files')) { 56 | $oldmask = umask(0); 57 | $fs->mkdir($drupalRoot . '/sites/default/files', 0777); 58 | umask($oldmask); 59 | $event->getIO()->write("Create a sites/default/files directory with chmod 0777"); 60 | } 61 | } 62 | 63 | /** 64 | * Checks if the installed version of Composer is compatible. 65 | * 66 | * Composer 1.0.0 and higher consider a `composer install` without having a 67 | * lock file present as equal to `composer update`. We do not ship with a lock 68 | * file to avoid merge conflicts downstream, meaning that if a project is 69 | * installed with an older version of Composer the scaffolding of Drupal will 70 | * not be triggered. We check this here instead of in drupal-scaffold to be 71 | * able to give immediate feedback to the end user, rather than failing the 72 | * installation after going through the lengthy process of compiling and 73 | * downloading the Composer dependencies. 74 | * 75 | * @see https://github.com/composer/composer/pull/5035 76 | */ 77 | public static function checkComposerVersion(Event $event) { 78 | $composer = $event->getComposer(); 79 | $io = $event->getIO(); 80 | 81 | $version = $composer::VERSION; 82 | 83 | // The dev-channel of composer uses the git revision as version number, 84 | // try to the branch alias instead. 85 | if (preg_match('/^[0-9a-f]{40}$/i', $version)) { 86 | $version = $composer::BRANCH_ALIAS_VERSION; 87 | } 88 | 89 | // If Composer is installed through git we have no easy way to determine if 90 | // it is new enough, just display a warning. 91 | if ($version === '@package_version@' || $version === '@package_branch_alias_version@') { 92 | $io->writeError('You are running a development version of Composer. If you experience problems, please update Composer to the latest stable version.'); 93 | } 94 | elseif (Comparator::lessThan($version, '1.0.0')) { 95 | $io->writeError('Drupal-project requires Composer version 1.0.0 or higher. Please update your Composer before continuing.'); 96 | exit(1); 97 | } 98 | } 99 | 100 | } 101 | -------------------------------------------------------------------------------- /scripts/composer/install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | set -e 4 | 5 | cat config/drupal/settings.php >> web/sites/default/settings.php \ 6 | && cp config/drupal/settings.local.php web/sites/default \ 7 | && cp config/drupal/development.services.yml web/sites \ 8 | && mv .idea-dist .idea && printf '%s\n' "${PWD##*/}" > .idea/.name \ 9 | && mv .idea/.gitignore.dist .idea/.gitignore \ 10 | && sed -i 's/\.idea/\#.idea/g' .gitignore \ 11 | && printf "Your site is scaffolded. Run\n\t'docker-compose up --build'\nto spin up.\n" 12 | -------------------------------------------------------------------------------- /scripts/dev/dbash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker-compose exec --user www-data web bash 4 | -------------------------------------------------------------------------------- /scripts/dev/ddrush: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | COMMAND="export TERM=xterm && source /var/www/html/config/docker/web/base/xdebug.sh && drush $@" 4 | echo -e "Executing inside container with xdebug support:\n\tdrush $@\n" 5 | docker-compose exec --user www-data web bash -ci "$COMMAND" 6 | --------------------------------------------------------------------------------