Skip to content
This repository was archived by the owner on Aug 1, 2024. It is now read-only.

Commit c7a6097

Browse files
committed
Integrated edxapp
The LMS and Studio (CMS) are now part of devstack! ECOM-6560
1 parent d0dadc4 commit c7a6097

File tree

12 files changed

+13806
-78
lines changed

12 files changed

+13806
-78
lines changed

Makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,12 @@ devstack.provision: ## Provision all services
1818
devstack.reset: ## Remove all service containers
1919
docker-compose down
2020

21-
devstack.start: loopback ## Start all services
21+
devstack.start: ## Start all services
2222
docker-compose up
2323

2424
devstack.stop: ## Stop all services
2525
docker-compose stop
2626

27-
loopback: ## Create loopback alias
28-
./loopback.sh
29-
3027
requirements: ## Install requirements
3128
pip install -r requirements.txt
3229

README.md

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ This project is meant to replace the traditional Vagrant VM "devstack" with a mu
66

77
## Getting Started
88

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

1113
1. The Docker Compose file mounts a host volume for each service's executing code. The host directory is expected to be
1214
a sibling of this directory. For example, if this repo is cloned to `~/workspace/devstack`, host volumes will be
@@ -38,28 +40,3 @@ After the services have started, if you need shell access to one of the services
3840
```
3941
$ make devstack.open.discovery
4042
```
41-
42-
## Loopback Alias
43-
44-
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.)
45-
46-
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
47-
in talking to the Docker for Mac HyperKit VM, not the host machine.
48-
49-
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
50-
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
51-
to change the IP accessed by your containers every time you changed networks.
52-
53-
A better solution, borrowed from the [Docker forums](https://forums.docker.com/t/access-host-not-vm-from-inside-container/11747/10),
54-
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)
55-
alias. This is done for you by the `devstack.start` target.
56-
57-
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`;
58-
adding IP addresses requires root access. Also note that the alias will not survive a host reboot, which is why the `devstack.start` target
59-
always attempts to set up the loopback for you.
60-
61-
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:
62-
63-
```
64-
10.254.254.254 docker.host
65-
```

docker-compose.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ services:
2929
# ports:
3030
# - "11211:11211"
3131

32+
mongo:
33+
container_name: edx.devstack.mongo
34+
image: mongo:2.6.5
35+
# ports:
36+
# - "27017:27017"
37+
volumes:
38+
- mongo_data:/data/db
39+
3240
mysql:
3341
command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci
3442
container_name: edx.devstack.mysql
@@ -67,9 +75,6 @@ services:
6775
environment:
6876
TEST_ELASTICSEARCH_URL: "http://edx.devstack.elasticsearch:9200"
6977
ENABLE_DJANGO_TOOLBAR: 1
70-
extra_hosts:
71-
# For server-to-server calls.
72-
- "docker.host:10.254.254.254"
7378
image: edxops/discovery:devstack
7479
ports:
7580
- "18381:18381"
@@ -91,6 +96,20 @@ services:
9196
volumes:
9297
- ../ecommerce:/edx/app/ecommerce/ecommerce
9398

99+
edxapp:
100+
command: /edx/app/edxapp/devstack.sh start
101+
container_name: edx.devstack.edxapp
102+
depends_on:
103+
- mysql
104+
- memcached
105+
- mongo
106+
image: edxops/edxapp:devstack
107+
ports:
108+
- "18000:18000"
109+
- "18010:18010"
110+
volumes:
111+
- ../edx-platform:/edx/app/edxapp/edx-platform
112+
94113
programs:
95114
command: /edx/app/programs/devstack.sh start
96115
container_name: edx.devstack.programs
@@ -107,4 +126,5 @@ services:
107126

108127
volumes:
109128
elasticsearch_data:
129+
mongo_data:
110130
mysql_data:

dump-db.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
3+
# Dump the specified database to a file of the same name.
4+
#
5+
# Example:
6+
# $ dump-db edxapp
7+
#
8+
# This will dump the edxapp database to a file named exapp.sql.
9+
10+
if [ -z "$1" ]
11+
then
12+
echo "You must supply a database name!"
13+
exit 1
14+
fi
15+
16+
echo "Dumping the $1 database..."
17+
docker exec -i edx.devstack.mysql mysqldump --skip-add-drop-table -B $1 > $1.sql
18+
echo "Finished dumping the $1 database!"

0 commit comments

Comments
 (0)