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

Commit 87acf41

Browse files
author
Renzo Lucioni
committed
Replace Python clone script with a Bash script
Eliminates the need for a virtualenv.
1 parent ce95689 commit 87acf41

6 files changed

Lines changed: 46 additions & 116 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ help: ## Display this help message
55
@perl -nle'print $& if m{^[\.a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m %-25s\033[0m %s\n", $$1, $$2}'
66

77
clone: ## Clone service repos
8-
./clone.py
8+
./clone.sh
99

1010
# TODO Print out help for this target. Even better if we can iterate over the services in docker-compose.yml, and
1111
# print the actual service names.

README.md

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,50 +23,36 @@ All of the services can be run by following the steps below. Note that since we
2323
configure Docker with a sufficient amount of resources. Our testing found that [configuring Docker for Mac](https://docs.docker.com/docker-for-mac/#/advanced)
2424
with 2 CPUs and 4GB of memory works well.
2525

26-
1. Create a Python 3 `virtualenv`. If you're using [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io
27-
), you can do this with:
26+
1. The Docker Compose file mounts a host volume for each service's executing code. The host directory is expected to be
27+
a sibling of this directory. For example, if this repo is cloned to `~/workspace/devstack`, host volumes will be
28+
expected in `~/workspace/course-discovery`, `~/workspace/ecommerce`, etc. These repos can be cloned with the command
29+
below.
2830

2931
```
30-
$ mkvirtualenv devstack --python=$(which python3)
32+
$ make clone
3133
```
3234

33-
Source the virtualenv and install requirements:
35+
2. Run the provision command, if you haven't already, to configure the various services with superusers (for
36+
development without the auth service) and tenants (for multi-tenancy).
37+
38+
The username and password for the superusers are both "edx". You can access the services directly via Django admin
39+
at the `/admin/` path, or login via single sign-on at `/login/`.
3440

3541
```
36-
$ workon devstack
37-
(devstack)$ make requirements
42+
$ make devstack.provision
3843
```
3944

40-
2. The Docker Compose file mounts a host volume for each service's executing code. The host directory is expected to be
41-
a sibling of this directory. For example, if this repo is cloned to `~/workspace/devstack`, host volumes will be
42-
expected in `~/workspace/course-discovery`, `~/workspace/ecommerce`, etc. These repos can be cloned with the command
43-
below.
45+
3. Start the services.
4446

4547
```
46-
(devstack)$ make clone
48+
$ make devstack.start
4749
```
4850

49-
3. Run the provision command, if you haven't already, to configure the various services with superusers (for
50-
development without the auth service) and tenants (for multi-tenancy).
51-
52-
The username and password for the superusers are both "edx". You can access the services directly via Django admin
53-
at the `/admin/` path, or login via single sign-on at `/login/`.
54-
55-
```
56-
(devstack)$ make devstack.provision
57-
```
58-
59-
4. Start the services.
60-
61-
```
62-
(devstack)$ make devstack.start
63-
```
64-
6551
After the services have started, if you need shell access to one of the services, run `make devstack.open.<service>`.
6652
For example to access the Catalog/Course Discovery Service, you can run:
6753

6854
```
69-
(devstack)$ make devstack.open.discovery
55+
$ make devstack.open.discovery
7056
```
7157

7258
## Usernames and Passwords

clone.py

Lines changed: 0 additions & 81 deletions
This file was deleted.

clone.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
# Script for cloning Git repos housing edX services. These repos are mounted as
4+
# data volumes into their corresponding Docker containers to facilitate development.
5+
# Repos are cloned to the directory above the one housing this file.
6+
7+
repos=(
8+
"https://github.com/edx/course-discovery.git"
9+
"https://github.com/edx/credentials.git"
10+
"https://github.com/edx/ecommerce.git"
11+
"https://github.com/edx/edx-platform.git"
12+
"https://github.com/edx/programs.git"
13+
)
14+
15+
name_pattern=".*edx/(.*).git"
16+
17+
for repo in ${repos[*]}
18+
do
19+
# Use Bash's regex match operator to capture the name of the repo.
20+
# Results of the match are saved to an array called $BASH_REMATCH.
21+
[[ $repo =~ $name_pattern ]]
22+
name="${BASH_REMATCH[1]}"
23+
24+
cd ..
25+
if [ -d "$name" ]; then
26+
printf "The [%s] repo is already checked out. Continuing.\n" $name
27+
else
28+
git clone $repo
29+
fi
30+
cd - &> /dev/null
31+
done

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
docker-compose>=1.9.0,<2.0.0
2-
PyYAML>=3.12,<4.0

settings.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)