Skip to content

Commit 3c7d09c

Browse files
committed
fix run.sh and add readme
1 parent dc72360 commit 3c7d09c

File tree

4 files changed

+38
-47
lines changed

4 files changed

+38
-47
lines changed

README.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## installation & deploy
2+
3+
- __install OpenNetLab-Controller__
4+
5+
```
6+
git clone <this-repo>; cd <this-repo>
7+
python3 -m venv venv
8+
source venv/bin/activate
9+
pip3 install -r requirements.txt
10+
```
11+
12+
- __install docker__
13+
14+
## run
15+
16+
- __first run onl-controller__
17+
18+
```
19+
./run.sh migrate
20+
./run.sh run
21+
```
22+
23+
- __then run onl-frontent
24+
25+
for more details check [OpenNetLab-FE](onl-fe)

init_db.sh

-19
This file was deleted.

run.sh

+13-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
cmd=$1
66
apps=("account" "announcement" "conf" "contest" "options" "problem" "submission")
77

8-
clean() {
8+
function clean {
99
rm -rf ./data/zips
1010
rm -rf ./data/problems
1111
rm -rf ./data/submissions
@@ -14,26 +14,31 @@ clean() {
1414
docker rm -f oj-redis-dev
1515
}
1616

17+
function migrate {
18+
for app in "${apps[@]}"; do
19+
python3 manage.py makemigrations $app
20+
done
21+
python3 manage.py migrate
22+
python3 manage.py inituser --username=root --password=rootroot --action=create_super_admin
23+
}
24+
1725
if [[ $cmd == "make" || $cmd == "makemigrations" ]]; then
1826
for app in "${apps[@]}"; do
1927
python3 manage.py makemigrations $app
2028
done
2129
elif [[ $cmd == "migrate" ]]; then
22-
python3 manage.py migrate
23-
python manage.py inituser --username=root --password=rootroot --action=create_super_admin
30+
migrate
2431
elif [[ $cmd == "clean" ]]; then
2532
clean
2633
elif [[ $cmd == "rebuild" ]]; then
2734
clean
28-
for app in "${apps[@]}"; do
29-
python3 manage.py makemigrations $app
30-
done
31-
python3 manage.py migrate
32-
python manage.py inituser --username=root --password=rootroot --action=create_super_admin
35+
migrate
3336
elif [[ $cmd == "run" ]]; then
3437
# run dramatiq
3538
pgrep dramatiq > /dev/null
3639

40+
# docker run -it -d -e POSTGRES_DB=onlinejudge -e POSTGRES_USER=onlinejudge -e POSTGRES_PASSWORD=onlinejudge -p 5435:5432 --name oj-postgres-dev postgres:10-alpine
41+
3742
if [[ $? -ne 0 ]]; then
3843
echo "running dramatiq ..."
3944
python3 manage.py rundramatiq &>data/log/dramatiq.log &

run_dev.sh

-20
This file was deleted.

0 commit comments

Comments
 (0)