crawlab-team / crawlab

Distributed web crawler admin platform for spiders management regardless of languages and frameworks. 分布式爬虫管理平台,支持任何语言和框架
https://www.crawlab.cn
BSD 3-Clause "New" or "Revised" License
11.38k stars 1.8k forks source link

Set "VUE_APP_API_BASE_URL" environment variable from base image "crawlabteam/crawlab" #1049

Closed zerafachris closed 2 years ago

zerafachris commented 2 years ago

Is your feature request related to a problem? Please describe. I am trying to run crawlab under a different base url, localhost/web1. Setting CRAWLAB_BASE_URL: "web1" and VUE_APP_API_BASE_URL: "web1"on the latest crawlabteam/crawlab image does not cause a change. I am forcing the change by updating docker-start-master.sh to be

if [ "${CRAWLAB_BASE_URL}" = "" ];
then
    :
else
    indexpath=/app/dist/index.html
    sed -i "s?/js/?${CRAWLAB_BASE_URL}/js/?g" ${indexpath}
    sed -i "s?/css/?${CRAWLAB_BASE_URL}/css/?g" ${indexpath}
fi

# start nginx
service nginx start

# start seaweedfs server
seaweedfsDataPath=/data/seaweedfs
if [ -e ${seaweedfsDataPath} ]; then
    :
else
    mkdir -p ${seaweedfsDataPath}
fi
weed server \
    -dir /data \
    -master.dir ${seaweedfsDataPath} \
    -volume.dir.idx ${seaweedfsDataPath} \
    -ip localhost \
    -volume.port 9999 \
    -filer \
    >> /var/log/weed.log 2>&1 &

https://gist.github.com/zerafachris/215bb1c3aabe262b65363e73731ca4b3.js and

pulling the latest version of crawlab and updating crawlab/frontend/.env.docker to be VUE_APP_API_BASE_URL=/web1/api

Describe the solution you'd like Is there a way to have VUE_APP_API_BASE_URL as an environment variable for base image "crawlabteam/crawlab" so I do not have to build from source every time?

zerafachris commented 2 years ago

I had a look at the code and proposed the following solution https://github.com/crawlab-team/crawlab/pull/1050 Hopefully it will get merged soon

tikazyq commented 2 years ago

Took a look and it seems fine. Let me double check on develop branch.

zerafachris commented 2 years ago

Solution merged in https://github.com/crawlab-team/crawlab/pull/1050