summaryrefslogtreecommitdiff
path: root/blocks/install.sh
blob: af54aee272bdd4c2bf803c9b86429a2ed1f3afd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash

set -e

python3 -m venv env
. env/bin/activate
pip install -q -U pip setuptools wheel
pip install -q -r requirements.txt
pip uninstall -q -y pip wheel

sed -i \
  -e "s,\\(SCILAB_DIR = '\\).*\\('\\),\\1/usr/local\\2," \
  -e "s,\\(CELERY_BROKER_URL = '\\).*\\('\\),\\1redis://localhost:6379/1\\2," \
  -e "s,\\(CELERY_RESULT_BACKEND = '\\).*\\('\\),\\1redis://localhost:6379/1\\2," \
  Xcos/common/AAAAAA.py \
  blocks/settings.py

mkdir -p file_storage/uploads logs media/saves media/uploads
make -s
python manage.py migrate -v0
python manage.py loaddata -v0 saveAPI xcosblocks

sed -i -e '/^\s*location \/ {/,/^\s*}/c\
        location / {\
                proxy_pass http://127.0.0.1:3500;\
        }\
\
        location /api/ {\
                proxy_pass http://127.0.0.1:8000;\
                proxy_buffering off;\
                proxy_cache off;\
        }\
\
        location /django_static/ {\
                proxy_pass http://127.0.0.1:8000;\
        }\
\
        location /files/ {\
                proxy_pass http://127.0.0.1:8000;\
        }\
\
        location /resources/ {\
                proxy_pass http://127.0.0.1:3500;\
                expires 7d;\
        }\
\
        location /ws {\
                proxy_pass http://127.0.0.1:3500;\
                proxy_http_version 1.1;\
                proxy_set_header Upgrade $http_upgrade;\
                proxy_set_header Connection "Upgrade";\
                proxy_set_header Host $host;\
                proxy_buffering off;\
                proxy_cache off;\
        }' /etc/nginx/sites-enabled/default

cd eda-frontend
if test "$1" = 'prod'; then
  npm install -g serve
fi
npm install --silent
if test "$1" = 'prod'; then
  npm run build
  rm -rf node_modules public src
fi