diff --git a/Makefile b/Makefile index cfc1e63cf8..a9d49ffdc1 100644 --- a/Makefile +++ b/Makefile @@ -29,8 +29,11 @@ devstack.provision: ## Provision all services devstack.reset: ## Remove all service containers docker-compose down -devstack.start: ## Start all services - docker-compose up +devstack.start: ## Start all services (with host volumes) + docker-compose -f docker-compose.yml -f docker-compose-host.yml up + +devstack.start.sync: ## Start all services (with docker-sync) + docker-sync-stack start devstack.stop: ## Stop all services docker-compose stop diff --git a/README.md b/README.md index 7c479a8101..600191c721 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,8 @@ configure Docker with a sufficient amount of resources. Our testing found that [ $ make devstack.provision ``` -3. Start the services. +3. Start the services. By default this command will use host directories for source code. This is known to be slow on + macOS. macOS users should follow the steps below for Docker Sync to avoid this performance hit. ``` $ make devstack.start @@ -55,6 +56,25 @@ For example to access the Catalog/Course Discovery Service, you can run: $ make devstack.open.discovery ``` +### Docker Sync + +Docker for Mac has known filesystem issues that significantly decrease performance. In order to mitigate these issues, +we use [Docker Sync](https://github.com/EugenMayer/docker-sync/wiki) to synchronize file data from the host machine to +the containers. Follow the steps below to setup Docker Sync. + +1. Ensure all containers are stopped. +``` +$ make devstack.stop +``` + +2. Follow the installation instructions at https://github.com/EugenMayer/docker-sync/wiki to install Docker Sync. + +3. Run Docker Sync and devstack. +``` +$ make devstack.start.sync +``` + + ## Usernames and Passwords The provisioning script creates a Django superuser for every service. diff --git a/docker-compose-host.yml b/docker-compose-host.yml new file mode 100644 index 0000000000..e2c369e266 --- /dev/null +++ b/docker-compose-host.yml @@ -0,0 +1,15 @@ +version: "2.1" + +services: + credentials: + volumes: + - ../credentials:/edx/app/credentials/credentials + discovery: + volumes: + - ../course-discovery:/edx/app/discovery/discovery + ecommerce: + volumes: + - ../ecommerce:/edx/app/ecommerce/ecommerce + edxapp: + volumes: + - ../edx-platform:/edx/app/edxapp/edx-platform diff --git a/docker-compose-sync.yml b/docker-compose-sync.yml new file mode 100644 index 0000000000..4a124634ea --- /dev/null +++ b/docker-compose-sync.yml @@ -0,0 +1,25 @@ +version: "2.1" + +services: + credentials: + volumes: + - credentials-sync:/edx/app/credentials/credentials:rw + discovery: + volumes: + - discovery-sync:/edx/app/discovery/discovery:rw + ecommerce: + volumes: + - ecommerce-sync:/edx/app/ecommerce/ecommerce:rw + edxapp: + volumes: + - edxapp-sync:/edx/app/edxapp/edx-platform:rw + +volumes: + credentials-sync: + external: true + discovery-sync: + external: true + ecommerce-sync: + external: true + edxapp-sync: + external: true diff --git a/docker-compose.yml b/docker-compose.yml index d0d5e94406..b8595b8c29 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -66,8 +66,6 @@ services: image: edxops/credentials:devstack ports: - "18150:18150" - volumes: - - ../credentials:/edx/app/credentials/credentials discovery: command: /edx/app/discovery/devstack.sh start @@ -82,8 +80,6 @@ services: image: edxops/discovery:devstack ports: - "18381:18381" - volumes: - - ../course-discovery:/edx/app/discovery/discovery ecommerce: command: /edx/app/ecommerce/devstack.sh start @@ -97,8 +93,6 @@ services: image: edxops/ecommerce:devstack ports: - "18130:18130" - volumes: - - ../ecommerce:/edx/app/ecommerce/ecommerce edxapp: command: /edx/app/edxapp/devstack.sh start @@ -111,8 +105,6 @@ services: ports: - "18000:18000" - "18010:18010" - volumes: - - ../edx-platform:/edx/app/edxapp/edx-platform volumes: elasticsearch_data: diff --git a/docker-sync.yml b/docker-sync.yml new file mode 100644 index 0000000000..32ddf37a0f --- /dev/null +++ b/docker-sync.yml @@ -0,0 +1,38 @@ +version: "2" + +options: + compose-file-path: 'docker-compose.yml' + compose-dev-file-path: 'docker-compose-sync.yml' + +syncs: + credentials-sync: + src: '../credentials/' + dest: '/edx/app/credentials/credentials' + sync_args: '-v --copy-links --hard-links' + sync_host_ip: 'localhost' + sync_host_port: 10872 + sync_strategy: 'rsync' + + discovery-sync: + src: '../course-discovery/' + dest: '/edx/app/discovery/discovery' + sync_args: '-v --copy-links --hard-links' + sync_host_ip: 'localhost' + sync_host_port: 10873 + sync_strategy: 'rsync' + + ecommerce-sync: + src: '../ecommerce/' + dest: '/edx/app/ecommerce/ecommerce' + sync_args: '-v --copy-links --hard-links' + sync_host_ip: 'localhost' + sync_host_port: 10874 + sync_strategy: 'rsync' + + edxapp-sync: + src: '../edx-platform/' + dest: '/edx/app/edxapp/edx-platform' + sync_args: '-v --copy-links --hard-links' + sync_host_ip: 'localhost' + sync_host_port: 10875 + sync_strategy: 'rsync'