Now your file system is all set up and ready to go, all we need to do now is in terminal go to the directory of your project and run docker-compose -f compose.yaml up -d this will output its starting containers. Our Docker container looks for a starter.sql in the root of the repo and imports it, if there is not database loaded in mysql. You will need to export that database and save the name as starter.sql, place that in the root of your project. Now, if this is a brand new site you can skip to the next section, but if you have an existing database we have a simple way to get that in. You'll also want to change the GIT_REPO to point to the http download of your git repo, if you don't have this in a git repo you can skip this and it will be okay. So instead of on line 3 it saying d8blank-mysql change it to mycoolsite-mysql and do that throughout the whole file. You'll need to take all the references to d8blank and change them to the name of your repo's directory. Networks: dockercompose: external: name: dockercompose_dockercompose ~/Sites /sites-files/d8blank: /mnt/sites-files PRODUCTION: "false" LOCAL: "true" volumes: GIT_REPO: https: ///CodeKoalas/drupal-project.git GIT_BRANCH: masterĭRUPAL_BASE_URL: http: //v DRUPAL_TRUSTED_HOSTS: d8blank\.dev$$ĭRUPAL_HTTPS: "off" APACHE_DOCROOT: /var/www /site/docroot ~/Sites /sites-databases/d8blank: /var/lib/mysqlĬommand: mysqld -max_allowed_packet= 64M Image: mysql: 5.6 environment: MYSQL_ROOT_PASSWORD: root Our D8 docker-compose file is drupal8blank.yaml You'll see in my site I have a compose.yaml, that's the next step we will take one of our templates we have in our docker-compose repo and use it in our site. It doesn't need everything I have in mine, but you will have your website's git repo, and inside of that will be the directory docroot which contains a full D8 install. ![]() Your local directory just needs to look like the following: Code Koalas' version of the composer Drupal project adds a couple of extra modules and maps the drupal install to docroot instead of web but you can use either or neither. We use a slight variant of the Drupal Composer - Drupal Project which lets you manage all of your contrib modules & themes and D8 itself using composer instead of clogging your own repo with other people's code. To get your Drupal site ready to spin up, all you need is a simple Drupal 8 codebase downloaded, but you need the D8 install not in the root of your repo but in a sub-directory like docroot. It will output some things and the first time ran will have to download some container images. That's telling docker compose to up a file in daemon mode and using a file. To spin up this repo you run the following command docker-compose -f /path/to/file/devenv.yaml up -d. You'll want to save that file somewhere on your system where you can access it later, this is why personally I have that whole docker-compose repo in my ~/Code directory on my computer. In the repo linked above, the yaml file we need for that is devenv.yaml The file is this: It will manage all the local network requests to docker and point them to the proper container. The first thing we do is spin up a small container that's an nginx proxy. You can stop it like this: sudo apachectl stop. If running Mac, it by default runs an Apache server sometimes, because why not. Make sure you have no other servers running on port 80 or our docker containers won't run.At Code Koalas we have a git repo for our docker compose templates, you don't need to pull in the whole thing but you can pull in the couple yaml files you need. ![]() Install Docker Compose, for Mac & Windows will get it already installed with the bundles linked above, for linux you'll need to install it yourself.For Windows, for Mac, for Linux you know what to do. Have docker for installed for you computer.This blog should get you off the ground and get your first Drupal site spun up so you can get right into working on your site. It's also great because once you have it set up you can spin up aditional sites in a matter of seconds instead of trying to manage a local web server on your computer yourself. Using Docker is great, it makes sure that every developer working on the project is using the same server and if it works on your machine it really should work on everyone's.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |