mirror of https://github.com/veops/cmdb.git
修复nginx转发问题
This commit is contained in:
parent
5f389459e8
commit
47767e22d8
|
@ -1,16 +0,0 @@
|
||||||
FROM centos:7.6.1810
|
|
||||||
|
|
||||||
LABEL description="Python2.7.5,cmdb"
|
|
||||||
|
|
||||||
RUN mkdir -p /data/apps/cmdb /data/apps/cmdb/logs
|
|
||||||
|
|
||||||
COPY . /data/apps/cmdb
|
|
||||||
|
|
||||||
WORKDIR /data/apps/cmdb
|
|
||||||
|
|
||||||
RUN yum install -y epel-release \
|
|
||||||
&& yum install -y python-pip \
|
|
||||||
&& pip install --no-cache-dir -r docker-start/requirements.txt
|
|
||||||
|
|
||||||
CMD ["bash", "-c", "cp api/settings.py.example api/settings.py && sed -i 's#{user}:{password}@127.0.0.1:3306/{db}#:@127.0.0.1:3306/cmdb#g' api/settings.py && flask run"]
|
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
FROM centos:7.6.1810
|
# build under cmdb directory other than api
|
||||||
|
# maybe use: cd ..
|
||||||
|
FROM centos:7.6.1810 AS cmdb-api
|
||||||
|
|
||||||
LABEL description="Python2.7.5,cmdb"
|
LABEL description="Python2.7.5,cmdb"
|
||||||
|
|
||||||
RUN mkdir -p /data/apps/cmdb ~/.pip /data/apps/cmdb/logs
|
RUN mkdir -p /data/apps/cmdb /data/apps/cmdb/logs
|
||||||
|
|
||||||
COPY .. /data/apps/cmdb
|
COPY . /data/apps/cmdb
|
||||||
|
|
||||||
WORKDIR /data/apps/cmdb
|
WORKDIR /data/apps/cmdb
|
||||||
|
|
||||||
RUN mv /data/apps/cmdb/pip.conf ~/.pip/ \
|
RUN yum install -y epel-release \
|
||||||
&& yum install -y epel-release \
|
|
||||||
&& yum install -y python-pip \
|
&& yum install -y python-pip \
|
||||||
&& pip install -r requirements.txt
|
&& pip install --no-cache-dir -r docker-start/requirements.txt
|
||||||
|
|
||||||
CMD ["bash", "-c", "cp api/settings.py.example api/settings.py && sed -i 's#{user}:{password}@127.0.0.1:3306/{db}#:@127.0.0.1:3306/cmdb#g' api/settings.py && flask run"]
|
CMD ["bash", "-c", "cp api/settings.py.example api/settings.py && sed -i 's#{user}:{password}@127.0.0.1:3306/{db}#:@127.0.0.1:3306/cmdb#g' api/settings.py && flask run"]
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ services:
|
||||||
cmdb-ui:
|
cmdb-ui:
|
||||||
build:
|
build:
|
||||||
context: ./ui
|
context: ./ui
|
||||||
dockerfile: Dockerfile-ui
|
dockerfile: Dockerfile
|
||||||
image: cmdb-ui:0.1
|
image: cmdb-ui:0.1
|
||||||
container_name: cmdb-ui
|
container_name: cmdb-ui
|
||||||
command: ["sh", "-c", "sed -i 's#http://127.0.0.1:5000##g' .env && yarn run serve"]
|
command: ["sh", "-c", "sed -i 's#http://127.0.0.1:5000##g' .env && yarn run serve"]
|
||||||
|
@ -16,15 +16,13 @@ services:
|
||||||
start_period: 10s
|
start_period: 10s
|
||||||
depends_on:
|
depends_on:
|
||||||
- cmdb-api
|
- cmdb-api
|
||||||
ports:
|
|
||||||
- "8000:8000"
|
|
||||||
networks:
|
networks:
|
||||||
- new
|
- new
|
||||||
|
|
||||||
cmdb-api:
|
cmdb-api:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile-api
|
dockerfile: api/Dockerfile
|
||||||
image: cmdb-api:0.1
|
image: cmdb-api:0.1
|
||||||
container_name: cmdb-api
|
container_name: cmdb-api
|
||||||
command:
|
command:
|
||||||
|
@ -34,7 +32,9 @@ services:
|
||||||
cp api/settings.py.example api/settings.py
|
cp api/settings.py.example api/settings.py
|
||||||
sed -i 's#{user}:{password}@127.0.0.1:3306/{db}#cmdb:123456@mysql:3306/cmdb#g' api/settings.py
|
sed -i 's#{user}:{password}@127.0.0.1:3306/{db}#cmdb:123456@mysql:3306/cmdb#g' api/settings.py
|
||||||
sed -i 's/127.0.0.1/redis/g' api/settings.py
|
sed -i 's/127.0.0.1/redis/g' api/settings.py
|
||||||
gunicorn --workers=3 autoapp:app -b 0.0.0.0:5000
|
gunicorn --workers=3 autoapp:app -b 0.0.0.0:5000 -D
|
||||||
|
sleep 5
|
||||||
|
celery worker -A celery_worker.celery -E -Q cmdb_async --concurrency=1
|
||||||
depends_on:
|
depends_on:
|
||||||
- cmdb-db
|
- cmdb-db
|
||||||
- cmdb-cache
|
- cmdb-cache
|
||||||
|
@ -87,7 +87,9 @@ services:
|
||||||
- -c
|
- -c
|
||||||
- |
|
- |
|
||||||
envsubst '$$CMDB_API_HOST $$CMDB_UI_HOST $$NGINX_PORT' < /etc/nginx/conf.d/nginx.cmdb.conf.example > /etc/nginx/conf.d/cmdb.conf
|
envsubst '$$CMDB_API_HOST $$CMDB_UI_HOST $$NGINX_PORT' < /etc/nginx/conf.d/nginx.cmdb.conf.example > /etc/nginx/conf.d/cmdb.conf
|
||||||
|
rm /etc/nginx/conf.d/default.conf
|
||||||
nginx -g 'daemon off;'
|
nginx -g 'daemon off;'
|
||||||
|
curl http://localhost/api/v0.1/ci/flush
|
||||||
networks:
|
networks:
|
||||||
- new
|
- new
|
||||||
ports:
|
ports:
|
||||||
|
|
Loading…
Reference in New Issue