Name: dm
Owner: PwC Experience Center
Description: A bootstrapping tool for local development on OSX with Docker
Created: 2017-10-27 06:41:16.0
Updated: 2017-10-27 06:41:18.0
Pushed: 2017-10-30 08:34:18.0
Size: 137
Language: Go
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Tom Whiston tom.whiston@gmail.com
Dm aims to make developing on docker in OSX a painless experience and to give you lots of tools to get started quickly
brew install socat
brew install libssh2
chmod +x dm
/tmp
is shareddm check
to check your system is set up correctlydm init
to initialize your system and create all necessary directories and assetsdm start
to bring up the dm container stackDm tries to make it easier to do docker development on your mac. This means:
dm hosts add myhostname.dev
dm
to see all the base commandsdm {command_name} -h
to see all available subcommands and helpThe default setup of DM tries to be project location agnostic, but this can cause issues with the data folder which is stored under /Users/Shared/.dm
SIP can change permissions on this folder when your machine reboots and although there is a fix for this below a better outcome can be achieved by setting the data_dir and share_dir folders keys explicitly in your ~/.dm/config.yml file
If you have previously used .dm you will need to follow these instructions.
top
grade dm to any version >= 1.0.0-beta1
lean stack
dm clean nfs
it your ~/.dm/config.yml file at this point. For example
ta_dir: /Users/me/.dmdata #This is where the dm files are stored (db etc...)
are_dir: /Users/me/Sites #This is the root of your project work
start docker machine
nit
this point if you want to copy over old db's or configs from your old dm data dir to your new one you should do it
tart
ady to go!
A simple drupal 8 development environment docker-compose.yml could be
This is based on our generic drupal s2i image, which is used for Openshift builds
age: openshift/php-56-centos7
lumes:
- ./:/opt/app-root/src
ternal_links
- mariadb_local
vironment:
# Needed for xdebug
- PHP_IDE_CONFIG="serverName=dev"
- VIRTUAL_HOST=test.dev
dm will expose a network called 'dm_bridge' that can be used to connect to container instances
for example
ion: "2"
ices:
p:
Local development image,
This is based on our generic drupal s2i image, which is used for Openshift builds
image: openshift/php-56-centos7
container_name: my-container
volumes:
# link the whole project into the image at the appropriate point.
# This allows nginx in the container to serve the correct files.
# ./ must be under the current users home folder
- ./:/opt/app-root/src
networks:
- dm_bridge
environment:
# Needed for xdebug
- PHP_IDE_CONFIG="serverName=dev"
# Needed for command line utils, e.g. clear
- TERM=xterm
- VIRTUAL_HOST=test.dev
orks:
_bridge:
external: true
Note that you DO NOT need to expose your ports in your docker compose file, as the nginx will detect the port you expose in the container If the container exposes multiple ports you will need to use the environment variable VIRTUAL_PORT. For more information about configuring your containers with the proxy please see: https://github.com/jwilder/nginx-proxy
To add assets to the project get the go-bindata library
go get -u github.com/jteeuwen/go-bindata/...
then run
go-bindata -o cmd/resources.go assets/...
This will generate the asset output for the binary. You can then go install
or go build
to get your app + assets.
Unfortunately this currently makes a file in the namespace main
so you will need to manually change this to cmd. This may be changed in future
Currently all the maria data, nfs share data and stack files are stored in /Users/Shared/.dm because of the way that nfs shares work. Because we dont want to force the site hosting folders to be in a specific we share the whole current user directory. This means that we need to store the database data (which requires a different set of permissions) outside of the current user dir. This means that it is not really suitable for use on a shared environment. But by adding some complexity to the init config this could be solved. If you want to work out an elegant fix for this drop me a line.
If the mariadb data folder has some issues around permissions and crashes when accessed you should sudo chmod -R 777 /Users/Shared/.dm/maria/data
It is also possible that it gets into a crash loop if it crashes a few times. In this case you should delete /Users/Shared/.dm/maria/data/tc.log
and restart dm
If you are running PHPUnit or similar from phpstorm you need the container to be on the dm_bridge network to access any shared resources.
To do this make sure that the (confusingly named) “network mode” field in the docker container settings is set to dm_bridge
Dm is bringing up an elasticsearch server composed of two nodes and a Kibana client.
Elasticsearch:
elasticsearch1
9200
HTTP
Kibana:
kibana.dev
(you will need to add yo your hosts file)HTTP
You can bring off the elasticsearch and kibana containers by executing: dm stop -e