Skip to content

Commit

Permalink
Integrated edxapp
Browse files Browse the repository at this point in the history
The LMS and Studio (CMS) are now part of devstack!

ECOM-6560
  • Loading branch information
clintonb committed Jan 24, 2017
1 parent d0dadc4 commit c7a6097
Show file tree
Hide file tree
Showing 12 changed files with 13,806 additions and 78 deletions.
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,12 @@ devstack.provision: ## Provision all services
devstack.reset: ## Remove all service containers
docker-compose down

devstack.start: loopback ## Start all services
devstack.start: ## Start all services
docker-compose up

devstack.stop: ## Stop all services
docker-compose stop

loopback: ## Create loopback alias
./loopback.sh

requirements: ## Install requirements
pip install -r requirements.txt

Expand Down
29 changes: 3 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ This project is meant to replace the traditional Vagrant VM "devstack" with a mu

## Getting Started

All of the services can be run by following the steps below.
All of the services can be run by following the steps below. Note that since we are running many containers, you should
configure Docker with a sufficient amount of resources. Our testing found that [configuring Docker for Mac](https://docs.docker.com/docker-for-mac/#/advanced)
with 2 CPUs and 4GB of memory works well.

1. The Docker Compose file mounts a host volume for each service's executing code. The host directory is expected to be
a sibling of this directory. For example, if this repo is cloned to `~/workspace/devstack`, host volumes will be
Expand Down Expand Up @@ -38,28 +40,3 @@ After the services have started, if you need shell access to one of the services
```
$ make devstack.open.discovery
```
## Loopback Alias
Containers making requests to the LMS and Studio must communicate with ports exposed on the host system by the Vagrant VM. (This assumes that the LMS and Studio are still running in the traditional Vagrant-based devstack.)
This is fine on Linux, but doesn't work out of the box on OS X. Attempting to access localhost on a container will result
in talking to the Docker for Mac HyperKit VM, not the host machine.
While it's true that you can get this to work by accessing your Mac's external IP from your containers, this isn't ideal because
it won't work if you have no network access on your host. Your external IP also changes as you switch networks, meaning you'd have
to change the IP accessed by your containers every time you changed networks.
A better solution, borrowed from the [Docker forums](https://forums.docker.com/t/access-host-not-vm-from-inside-container/11747/10),
is to give your host a fixed address by creating a [loopback](http://askubuntu.com/questions/247625/what-is-the-loopback-device-and-how-do-i-use-it)
alias. This is done for you by the `devstack.start` target.
The result is a fixed IP which your containers can use to access ports on your host machine. Note that the underlying script uses `sudo`;
adding IP addresses requires root access. Also note that the alias will not survive a host reboot, which is why the `devstack.start` target
always attempts to set up the loopback for you.
Part of the loopback alias setup includes adding a line to the `/etc/hosts` file on your machine. If you want to stop using devstack, you can clean this up by opening your `/etc/hosts` file and removing this line:
```
10.254.254.254 docker.host
```
26 changes: 23 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ services:
# ports:
# - "11211:11211"

mongo:
container_name: edx.devstack.mongo
image: mongo:2.6.5
# ports:
# - "27017:27017"
volumes:
- mongo_data:/data/db

mysql:
command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci
container_name: edx.devstack.mysql
Expand Down Expand Up @@ -67,9 +75,6 @@ services:
environment:
TEST_ELASTICSEARCH_URL: "http://edx.devstack.elasticsearch:9200"
ENABLE_DJANGO_TOOLBAR: 1
extra_hosts:
# For server-to-server calls.
- "docker.host:10.254.254.254"
image: edxops/discovery:devstack
ports:
- "18381:18381"
Expand All @@ -91,6 +96,20 @@ services:
volumes:
- ../ecommerce:/edx/app/ecommerce/ecommerce

edxapp:
command: /edx/app/edxapp/devstack.sh start
container_name: edx.devstack.edxapp
depends_on:
- mysql
- memcached
- mongo
image: edxops/edxapp:devstack
ports:
- "18000:18000"
- "18010:18010"
volumes:
- ../edx-platform:/edx/app/edxapp/edx-platform

programs:
command: /edx/app/programs/devstack.sh start
container_name: edx.devstack.programs
Expand All @@ -107,4 +126,5 @@ services:

volumes:
elasticsearch_data:
mongo_data:
mysql_data:
18 changes: 18 additions & 0 deletions dump-db.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

# Dump the specified database to a file of the same name.
#
# Example:
# $ dump-db edxapp
#
# This will dump the edxapp database to a file named exapp.sql.

if [ -z "$1" ]
then
echo "You must supply a database name!"
exit 1
fi

echo "Dumping the $1 database..."
docker exec -i edx.devstack.mysql mysqldump --skip-add-drop-table -B $1 > $1.sql
echo "Finished dumping the $1 database!"
Loading

0 comments on commit c7a6097

Please sign in to comment.