- Docker For Mac Raw Format Free
- Docker For Mac Raw Format Free
- Docker For Mac Raw Format Software
- Docker For Mac Raw Format Tool
For general information, see Hosting farmOS with Docker.
Install Docker and Docker Compose¶
Current Docker for Mac (as long as 17.03.0-ce-mac1) use qcow2 as disk image format. But qcow2 is worse performance than raw format. This short script change image type qcow2 to raw. Make sure you have Docker Desktop running - in the taskbar in Windows and the menu bar on the Mac you’ll see Docker’s whale logo. Click the whale and select Settings: A new screen opens with all of Docker Desktop’s configuration options. Click on Kubernetes and check the Enable Kubernetes checkbox: That’s it!
The recommended approach for local farmOS development in Docker is to useDocker Compose to run both the farmOS container and the database containeron your local host.
- Install Docker
- On Mac OS X, use 'Docker for Mac' (not 'Docker Toolbox')
- On Windows, use 'Docker for Windows' (not 'Docker Toolbox')
- On Linux, follow the directions on docker.com
Create containers¶
Docker For Mac Raw Format Free
To create the farmOS Docker containers, start by creating a new farmOS directoryon your host:
Next, copy the docker-compose.development.yml
file into the directory andrename it to docker-compose.yml
:
Then, use docker-compose up
to create the containers:
This will create two containers: a farmOS application container, and a MariaDBdatabase container.
This will run the two containers in your open terminal window, and will printApage and MariaDB logs to the screen. This is useful for debugging, and you canshut them down with Ctrl+C when you're done.
If you want to run these containers in the background, so you don't need to keepyour terminal window, add -d
to the end of the command:
Then you can shut them down and remove the containers with:
Mac Specific Instructions¶
Due to performance issues with shared volumes in Docker for Mac, it isrecommended that you add :delegated
to your volume definitions indocker-compose.yml
.
For example, instead of:
Replace with:
Do this for both the db
and www
container volumes.
Install farmOS¶
Once the containers are up and running, you can install farmOS using the Drupalinstaller. This is a simple step-by-step process that you will need to gothrough when you first access the site in your browser.
Browser address¶
If you are running Docker on Linux, you can simply go to http://localhost
inyour browser. Otherwise, you may need to look up the IP address of the Dockercontainer that was created and access it that way.
To find the IP address of your farmOS container, use the following command:
Visit the IP address in a browser - you should see the Drupal/farmOS installer.
Database setup¶
In the 'Set up database' step of installation, use the following values:
- Database name:
farm
- Database username:
farm
- Database password:
farm
- Under 'Advanced options', change 'Database host' to:
db
Follow the instructions to continue with the installation and you should be leftwith a fully-functioning farmOS instance running in a Docker container!
Development workflow¶
Persistent volumes¶
The docker-compose.development.yml
file defines two Docker volumes that willbe mounted into the containers from your host directory:
./www
-/var/html/www
from the farmOS application container, which includes the entire farmOS codebase,settings.php
file (for connecting to the database), and any files that are uploaded/created in farmOS../db
-/var/lib/mysql
from the MariaDB database container, which contains the farmOS database.
Both will be made available within the farmOS
directory you created initially.
This is where you will be able to access the code for development purposes. Itis also how your database and files are persisted when the containers aredestroyed and rebuilt.
File ownership¶
On a Linux host, all the files in www
will have an owner and group ofwww-data
. As of farmOS 7.x-1.7 the www-data
user and group id of the dev dockerimage are set to 1000
by default. On most single-user systems this matches theuser and group ID of the primary user and everything should just work - the dockercontainer and your user will both have normal read/write access to the files.
If you encounter permissions issues, you can check your user/group ids with thefollowing commands;
If those don't return a value of 1000
, there are two main strategies.
One-off ownership modification¶
You can change the owner of everything in the www
container to your local user.This can be done with the following command:
This changes the owner of everything in /var/www/html to the currently loggedin user on the host. But it leaves the group alone (www-data
). Just make sureto do this after installation has completed.
Building a custom dev docker image¶
The dev image also accepts the WWW_DATA_ID
build parameter which the buildprocess will use as the ID of the www-data user and group inside the image.
Setting this to the ID of the developer's user on the host machine allows filescreated and/or owned by www-data inside the container be editable by the developeroutside of the container.
If your user ID is not 1000
(as determined above), build the image with: --build-arg WWW_DATA_ID=$(id -u)
.
Updating farmOS¶
Important: these instructions are for updating a development environmenthosted with Docker. If you are running a production environment, seeHosting farmOS with Docker.
There are two ways to update your development codebase: incremental vs complete.
Incremental update¶
An incremental update can be done if the changes are relatively simple. Thisincludes commits to the farmOS repository that do not include any of thefollowing:
- Updates to Drupal core
- Updates to contrib modules
- New contrib modules
- New patches to Drupal core or contrib modules
These things are handled by Drush Make, which is run during a complete update(see below). If you are familiar with Drupal and Drush Make, it is possible tomake these updates incrementally as well, but if you are not then follow the'Complete update' instructions below.
To perform an incremental update, run git pull origin 7.x-1.x
in the farmOSinstallation profile repository, which is inside www/profiles/farm
:
Complete update¶
Warning: if you have made any changes to the code inside www
, theywill be overwritten by this process. The one exception is the www/sites
directory, which will not be modified. It's a good idea to put extra modulesthat you have downloaded/developed yourself into www/sites/all/modules
forthis reason.
First, stop the containers and create a backup snapshot so that you can easilyrestore if anything goes wrong. See 'Backup/restore during development' below.
Pull the latest version of the farmOS Docker dev
image:
Stop the farmOS containers:
Docker For Mac Raw Format Free
Move the sites
directory out of the webroot:
Delete everthing in www
:
Restart the farmOS containers:
The www
container should be automatically populated again with the newcodebase.
Restore the sites
directory:
Run database updates by going to /update.php
in your browser and followingthe instructions.
You may also need to revert any overridden features in/admin/structure/features
(if they are not automatically). Warning: Ifyou have made any modifications to farmOS configuration, reverting features mayoverwrite those changes.
If anything goes wrong during this process, you can restore to the backup youcreated. See 'Backup/restore during development' below.
Backup/restore during development¶
During development, you can create quick snapshots of the database and/orcodebase from these volume directories. Simply shut down the running containersand create tarball(s).
Backup:
Restore
Development Tools¶
Docker For Mac Raw Format Software
Drush¶
Drush is a command line shell and Unix scripting interface for Drupal. Drushcore ships with lots of useful commands for interacting with code likemodules/themes/profiles. Similarly, it runs update.php, executes sql queriesand DB migrations, and misc utilities like run cron or clear cache.
If you setup farmOS with the Docker farmOS dev
image then Drush is alreadyincluded!
To use it simply run the following when the docker images are running:
Note: The farmOS container will be named farmos_www_1
ONLY if your farmOSdirectory is named farmOS
. Docker Compose names the containers based on thefolder that they are in. If you name your folder myfarmOS
then the containerwill be named myfarmos_www_1
.
If all goes well, you should see a list of Drush commands.
Note that you can also alias this command to your .bashrc
file. Add thefollowing line to your ~/.bashrc
file:
Run the following to start a bash session with the new alias and test thedrush
command:
This should display the same list of drush commands.
Docker For Mac Raw Format Tool
(Optional) Configure a Local Https Reverse Proxy¶
See Configuring a Local Https Reverse Proxy.