TencentBlueKing / bk-ci

蓝鲸持续集成平台(蓝盾)
https://bk.tencent.com
Other
2.38k stars 499 forks source link

部署文档中的一些疑惑 #2376

Closed tiffany199410 closed 2 years ago

tiffany199410 commented 4 years ago

大佬们:关于部署文档中的一些疑惑,麻烦指点下: 疑惑一: 拷贝渲染后的模板文件到nginx代码目录 cp -rf {{code}}/ci/gateway/core/* {{code}}/src/gateway/core/ 第一个{{code}}指的是部署目录的路径?第二个{{code}}指的是源码的路径吗?

疑惑二: 将nginx配置文件复制到项目目录下 cp -rf {{code}}/src/gateway/core/* __INSTALL_PATH__/gateway

__INSTALL_PATH__/具体指的是什么路径

疑惑三: ./sbin/nginx # 启动nginx,启动nginx成功后 在浏览器中打开显示的是:Welcome to OpenResty!这个页面,麻烦在文档上加一下,或者告知下,配置完这个网关部署成功后,最终显示的是哪个界面代表启动成功。

zanyzhao commented 4 years ago

1、2可以参考我们的release pipeline: https://github.com/Tencent/bk-ci/blob/bafe3535ed7306ef9685d2f9f22e1b5abcf29044/.github/workflows/release.yml#L100

如果nginx配置正确,应该看到如下页面 image

tiffany199410 commented 4 years ago

@zanyzhao 非常感谢回复。 1、2的中的{{code}}都指的bkci的路径话,我有个疑问。 image cp -rf {{code}}/ci/gateway/core/* {{code}}/src/gateway/core/ image bkci的下一个目录是有src目录的,但是并没有ci目录,在命令行中运行是会报错找不到路径的

freyzheng commented 4 years ago

@zanyzhao 非常感谢回复。 1、2的中的{{code}}都指的bkci的路径话,我有个疑问。 image cp -rf {{code}}/ci/gateway/core/* {{code}}/src/gateway/core/ image bkci的下一个目录是有src目录的,但是并没有ci目录,在命令行中运行是会报错找不到路径的

1、{{code}}是指我们githu上的工程根目录 2、{{code}}/ci目录是执行sh ./render_tpl -m ci ../support-files/templates/gateway*之后根据scripts/bkenv.properties文件中的变量渲染出来的template文件目录。 3、 INSTALL_PATH是我们渲染完成后运行代码所在的根目录,一般我们会把源码和渲染后的运行代码分开存放。 4、启动nginx之后提示“ Welcome to OpenResty!”,是因为你还没有部署和配置前端页面的目录,找不到对应的静态资源,所以返回了Openresty的默认页面。

tiffany199410 commented 4 years ago

@freyzheng 感谢指导。4、启动nginx之后提示“ Welcome to OpenResty!”,是因为你还没有部署和配置前端页面的目录,找不到对应的静态资源,所以返回了Openresty的默认页面。 我已经部署了和配置了前端页面的目录,微服务也可以正常启动了,但是也一直返回的Openresty的默认页面。 这个是我Nginx.conf是我的配置,完全没有看到任何指向蓝鲸ci的记录,这个index网页就是这个默认页面 image

image

http://127.0.0.1:8005 麻烦您是否可以提供下网关配置正确,软链到nginx.conf的正确模版是怎样的。

tiffany199410 commented 4 years ago

麻烦各位大佬解答下吧,这个目前我部署了一个月了,但是这块部署文档写得经常让人很困惑,然后每次被卡着,就真的没有一点办法。

tiffany199410 commented 4 years ago

@zanyzhao 我现在发现了问题,是因为我的nginx默认会读取nginx.conf这个nginx刚安装好时的默认文件。但是并没有读取bkee网关部署后,我做了一系列软链操作软连过去的conf文件下,有好几个文件server.common.conf、devops.server.conf、auth.conf、init.lua,这些文件是要手动include上去吗,如果要include要加哪一个呢,还是都要加进去呢

image
freyzheng commented 4 years ago

@zanyzhao 我现在发现了问题,是因为我的nginx默认会读取nginx.conf这个nginx刚安装好时的默认文件。但是并没有读取bkee网关部署后,我做了一系列软链操作软连过去的conf文件下,有好几个文件server.common.conf、devops.server.conf、auth.conf、init.lua,这些文件是要手动include上去吗,如果要include要加哪一个呢,还是都要加进去呢

image

你只需要把nginx下的conf目录软链到渲染好的"INSTALL_PATH/gateway"目录下即可。

文档中的这个命令就是做这个操作的。

rm -rf /usr/local/openresty/nginx/conf
ln -s  __INSTALL_PATH__/gateway /usr/local/openresty/nginx/conf
mikeeastin commented 2 years ago

[root@jszx-test nginx]# ls conf html logs run sbin [root@jszx-test nginx]# cd sbin/ [root@jszx-test sbin]# ./nginx -t nginx: [emerg] invalid number of arguments in "upstream" directive in /usr/local/openresty/nginx/conf/vhosts/devops.bkrepo.upstream.conf:1 nginx: configuration file /usr/local/openresty/nginx/conf/nginx.conf test failed [root@jszx-test sbin]# cat /usr/local/openresty/nginx/conf/vhosts/devops.bkrepo.upstream.conf upstream { server ; }

mikeeastin commented 2 years ago

[root@jszx-test scripts]# ./render_tpl -m ci ../support-files/templates/* render ../support-files/templates/boot-service.sh -> /data/bkee/ci/boot-service.sh render ../support-files/templates/#etc#ci#application-agentless.yml -> /data/bkee//etc/ci/application-agentless.yml render ../support-files/templates/#etc#ci#application-artifactory.yml -> /data/bkee//etc/ci/application-artifactory.yml render ../support-files/templates/#etc#ci#application-assembly.yml -> /data/bkee//etc/ci/application-assembly.yml render ../support-files/templates/#etc#ci#application-auth.yml -> /data/bkee//etc/ci/application-auth.yml render ../support-files/templates/#etc#ci#application-buildless.yml -> /data/bkee//etc/ci/application-buildless.yml render ../support-files/templates/#etc#ci#application-dispatch-docker.yml -> /data/bkee//etc/ci/application-dispatch-docker.yml render ../support-files/templates/#etc#ci#application-dispatch.yml -> /data/bkee//etc/ci/application-dispatch.yml render ../support-files/templates/#etc#ci#application-dockerhost.yml -> /data/bkee//etc/ci/application-dockerhost.yml render ../support-files/templates/#etc#ci#application-environment.yml -> /data/bkee//etc/ci/application-environment.yml render ../support-files/templates/#etc#ci#application-image.yml -> /data/bkee//etc/ci/application-image.yml render ../support-files/templates/#etc#ci#application-log.yml -> /data/bkee//etc/ci/application-log.yml render ../support-files/templates/#etc#ci#application-misc.yml -> /data/bkee//etc/ci/application-misc.yml render ../support-files/templates/#etc#ci#application-monitoring.yml -> /data/bkee//etc/ci/application-monitoring.yml render ../support-files/templates/#etc#ci#application-notify.yml -> /data/bkee//etc/ci/application-notify.yml render ../support-files/templates/#etc#ci#application-openapi.yml -> /data/bkee//etc/ci/application-openapi.yml render ../support-files/templates/#etc#ci#application-plugin.yml -> /data/bkee//etc/ci/application-plugin.yml render ../support-files/templates/#etc#ci#application-process.yml -> /data/bkee//etc/ci/application-process.yml render ../support-files/templates/#etc#ci#application-project.yml -> /data/bkee//etc/ci/application-project.yml render ../support-files/templates/#etc#ci#application-quality.yml -> /data/bkee//etc/ci/application-quality.yml render ../support-files/templates/#etc#ci#application-repository.yml -> /data/bkee//etc/ci/application-repository.yml render ../support-files/templates/#etc#ci#application-sign.yml -> /data/bkee//etc/ci/application-sign.yml render ../support-files/templates/#etc#ci#application-store.yml -> /data/bkee//etc/ci/application-store.yml render ../support-files/templates/#etc#ci#application-ticket.yml -> /data/bkee//etc/ci/application-ticket.yml render ../support-files/templates/#etc#ci#application-websocket.yml -> /data/bkee//etc/ci/application-websocket.yml render ../support-files/templates/#etc#ci#common.yml -> /data/bkee//etc/ci/common.yml render ../support-files/templates/gateway#core#auth.conf -> /data/bkee/ci/gateway/core/auth.conf render ../support-files/templates/gateway#core#devops.server.conf -> /data/bkee/ci/gateway/core/devops.server.conf render ../support-files/templates/gateway#core#lua#init.lua -> /data/bkee/ci/gateway/core/lua/init.lua render ../support-files/templates/gateway#core#server.common.conf -> /data/bkee/ci/gateway/core/server.common.conf render ../support-files/templates/gateway#core#vhosts#devops.bkrepo.upstream.conf -> /data/bkee/ci/gateway/core/vhosts/devops.bkrepo.upstream.conf render ../support-files/templates/op#application-local.properties -> /data/bkee/ci/op/application-local.properties render ../support-files/templates/op#application.properties -> /data/bkee/ci/op/application.properties [root@jszx-test scripts]# cd /data/bkee/etc/ci/