forked from edly-io/devstack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
provision-ida.sh
executable file
·23 lines (17 loc) · 1.54 KB
/
provision-ida.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh -x
app_name=$1 # The name of the IDA application, i.e. /edx/app/<app_name>
client_name=$2 # The name of the Oauth client stored in the edxapp DB.
client_port=$3 # The port corresponding to this IDA service in devstack.
container_name=${4:-$1} # (Optional) The name of the container. If missing, will use app_name.
docker-compose up -d $app_name
echo -e "${GREEN}Installing requirements for ${app_name}...${NC}"
docker-compose exec ${container_name} bash -c 'source /edx/app/$1/$1_env && cd /edx/app/$1/$1/ && make requirements' -- "$app_name"
echo -e "${GREEN}Running migrations for ${app_name}...${NC}"
docker-compose exec ${container_name} bash -c 'source /edx/app/$1/$1_env && cd /edx/app/$1/$1/ && make migrate' -- "$app_name"
echo -e "${GREEN}Creating super-user for ${app_name}...${NC}"
docker-compose exec ${container_name} bash -c 'source /edx/app/$1/$1_env && echo "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser(\"edx\", \"[email protected]\", \"edx\") if not User.objects.filter(username=\"edx\").exists() else None" | python /edx/app/$1/$1/manage.py shell' -- "$app_name"
./provision-ida-user.sh $app_name $client_name $client_port
# Compile static assets last since they are absolutely necessary for all services. This will allow developers to get
# started if they do not care about static assets
echo -e "${GREEN}Compiling static assets for ${app_name}...${NC}"
docker-compose exec ${container_name} bash -c 'source /edx/app/$1/$1_env && cd /edx/app/$1/$1/ && make static' -- "$app_name"