Skip to content

Commit

Permalink
推送docker部署方案
Browse files Browse the repository at this point in the history
  • Loading branch information
ss1917 committed Aug 14, 2019
1 parent d4301c1 commit 83031ce
Show file tree
Hide file tree
Showing 58 changed files with 3,218 additions and 914 deletions.
40 changes: 40 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM centos:7
# 设置编码
ENV LANG en_US.UTF-8
# 同步时间
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# 1. 安装基本依赖和nginx
RUN yum update -y && yum install epel-release -y && yum update -y && yum install wget nginx git -y
WORKDIR /app

# 2. 准备node
RUN wget -q -c https://npm.taobao.org/mirrors/node/v10.16.1/node-v10.16.1-linux-x64.tar.xz && tar xf node-v10.16.1-linux-x64.tar.xz -C /usr/local/
RUN rm -rf /usr/local/bin/node && rm -rf /usr/local/bin/npm \
&& ln -s /usr/local/node-v10.16.1-linux-x64/bin/node /usr/local/bin/node \
&& ln -s /usr/local/node-v10.16.1-linux-x64/bin/node /usr/bin/node \
&& ln -s /usr/local/node-v10.16.1-linux-x64/bin/npm /usr/local/bin/npm \
&& ln -s /usr/local/node-v10.16.1-linux-x64/bin/npm /usr/bin/npm

# 4. 复制代码
RUN mkdir -p /app
ADD . /app

RUN rm -rf /app/node_modules && npm config set registry https://registry.npmjs.org/ \
&& npm cache clean --force \
&& npm install --ignore-script \
&& npm run build \
&& mkdir -p /var/www/codo && cp -r /app/dist/* /var/www/codo/

# 5. 日志
VOLUME /var/log/

# 6. 准备文件
COPY nginx_ops.conf /etc/nginx/conf.d/default.conf

# 开放端口
EXPOSE 80
EXPOSE 443

CMD ["nginx"]
70 changes: 70 additions & 0 deletions nginx_ops.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
server {
listen 80;
server_name demo-init.opendevops.cn;
access_log /var/log/nginx/codo-access.log;
error_log /var/log/nginx/codo-error.log;

location / {
root /var/www/codo;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}

location /api {
### ws 支持
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

add_header 'Access-Control-Allow-Origin' '*';
proxy_pass http://gw.opendevops.cn:8888;
}

location ~ /(.svn|.git|admin|manage|.sh|.bash)$ {
return 403;
}
}

# server {
# listen 80;
# server_name demo-init.opendevops.cn;
# rewrite ^(.*)$ https://$host$1 permanent;
# }

server {
listen 443;
server_name demo-init.opendevops.cn;
access_log /var/log/nginx/codo-access.log;
error_log /var/log/nginx/codo-error.log;
ssl on;
index index.html index.htm;
ssl_certificate /etc/nginx/opendevops.crt;
ssl_certificate_key /etc/nginx/opendevops.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:AES256-GCM-SHA384:AES256-SHA256:AES256-SHA:ECDHE-RSA-AES128-SHA256:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!DSS:!PKS;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;

location / {
root /var/www/codo;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}

location /api {
proxy_redirect off;
proxy_read_timeout 600;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

add_header 'Access-Control-Allow-Origin' '*';
proxy_pass http://gw.opendevops.cn:8888;
}

location ~ /(.svn|.git|admin|manage|.sh|.bash)$ {
return 403;
}
}
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

160 changes: 80 additions & 80 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,82 +1,82 @@
{
"name": "codo",
"version": "1.0.0",
"author": "ss<[email protected]>",
"private": false,
"scripts": {
"dev": "vue-cli-service serve --open",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"test:unit": "vue-cli-service test:unit",
"test:e2e": "vue-cli-service test:e2e"
},
"dependencies": {
"@riophae/vue-treeselect": "0.0.38",
"axios": "^0.18.0",
"babel-core": "^6.26.3",
"babel-loader": "^8.0.5",
"clipboard": "^2.0.0",
"clonedeep": "^2.0.0",
"codemirror": "^5.38.0",
"countup": "^1.8.2",
"cropperjs": "^1.2.2",
"dayjs": "^1.7.7",
"echarts": "^4.0.4",
"emmet": "git+https://github.com/yangmv/emmet-core.git",
"html2canvas": "^1.0.0-alpha.12",
"iview": "^3.2.2",
"iview-area": "^1.5.17",
"js-cookie": "^2.2.0",
"jwt-decode": "^2.2.0",
"qrcode": "^1.3.0",
"qrcodejs2": "0.0.2",
"simplemde": "^1.11.2",
"sortablejs": "^1.7.0",
"vue": "^2.5.10",
"vue-clipboard2": "^0.2.1",
"vue-i18n": "^7.8.0",
"vue-qart": "^2.2.0",
"vue-router": "^3.0.1",
"vue-websocket": "^0.2.3",
"vue2-ace-editor": "0.0.13",
"vuedraggable": "^2.16.0",
"vuex": "^3.0.1",
"vuex-persistedstate": "^2.5.4",
"wangeditor": "^3.1.1",
"xlsx": "^0.13.3",
"xterm": "^3.9.1"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.0.1",
"@vue/cli-plugin-eslint": "^3.0.1",
"@vue/cli-plugin-unit-mocha": "^3.0.1",
"@vue/cli-service": "^3.0.1",
"@vue/eslint-config-standard": "^3.0.0-beta.10",
"@vue/test-utils": "^1.0.0-beta.10",
"chai": "^4.1.2",
"eslint-plugin-cypress": "^2.0.1",
"less": "^2.7.3",
"less-loader": "^4.0.5",
"lint-staged": "^6.0.0",
"mockjs": "^1.0.1-beta3",
"vue-template-compiler": "^2.5.13"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
],
"gitHooks": {
"pre-commit": "lint-staged"
},
"lint-staged": {
"*.js": [
"vue-cli-service lint",
"git add"
"name": "codo",
"version": "1.0.0",
"author": "ss<[email protected]>",
"private": false,
"scripts": {
"dev": "vue-cli-service serve --open",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"test:unit": "vue-cli-service test:unit",
"test:e2e": "vue-cli-service test:e2e"
},
"dependencies": {
"@riophae/vue-treeselect": "0.0.38",
"axios": "^0.18.1",
"babel-core": "^6.26.3",
"babel-loader": "^8.0.5",
"clipboard": "^2.0.0",
"clonedeep": "^2.0.0",
"codemirror": "^5.38.0",
"countup": "^1.8.2",
"cropperjs": "^1.2.2",
"dayjs": "^1.7.7",
"echarts": "^4.0.4",
"emmet": "git+https://github.com/yangmv/emmet-core.git",
"html2canvas": "^1.0.0-alpha.12",
"iview": "^3.2.2",
"iview-area": "^1.5.17",
"js-cookie": "^2.2.0",
"jwt-decode": "^2.2.0",
"qrcode": "^1.3.0",
"qrcodejs2": "0.0.2",
"simplemde": "^1.11.2",
"sortablejs": "^1.7.0",
"vue": "^2.5.10",
"vue-clipboard2": "^0.2.1",
"vue-i18n": "^7.8.0",
"vue-qart": "^2.2.0",
"vue-router": "^3.0.1",
"vue-websocket": "^0.2.3",
"vue2-ace-editor": "0.0.13",
"vuedraggable": "^2.16.0",
"vuex": "^3.0.1",
"vuex-persistedstate": "^2.5.4",
"wangeditor": "^3.1.1",
"xlsx": "^0.13.3",
"xterm": "^3.9.1"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.0.1",
"@vue/cli-plugin-eslint": "^3.0.1",
"@vue/cli-plugin-unit-mocha": "^3.0.1",
"@vue/cli-service": "^3.0.1",
"@vue/eslint-config-standard": "^3.0.0-beta.10",
"@vue/test-utils": "^1.0.0-beta.10",
"chai": "^4.1.2",
"eslint-plugin-cypress": "^2.0.1",
"less": "^2.7.3",
"less-loader": "^4.0.5",
"lint-staged": "^6.0.0",
"mockjs": "^1.0.1-beta3",
"vue-template-compiler": "^2.5.13"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
],
"*.vue": [
"vue-cli-service lint",
"git add"
]
}
}
"gitHooks": {
"pre-commit": "lint-staged"
},
"lint-staged": {
"*.js": [
"vue-cli-service lint",
"git add"
],
"*.vue": [
"vue-cli-service lint",
"git add"
]
}
}
36 changes: 34 additions & 2 deletions src/api/git-repo.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ export const getGittree = () => {
})
}

export const getGittree2 = () => {
return axios.request({
url: '/task/other/v1/git/tree2/',
method: 'get'
})
}

export const getGitrepo = (git_url, group_name, searchVal) => {
return axios.request({
url: '/task/other/v1/git/repo/',
Expand Down Expand Up @@ -46,10 +53,24 @@ export const optGithooks = (data, meth) => {
})
}

export const getGitHooklog = () => {
export const getGitHooklog = (search_val, git_url, relative_path, hook_name) => {
return axios.request({
url: '/task/other/v1/git/logs/',
method: 'get'
method: 'get',
params: {
search_val,
git_url,
relative_path,
hook_name
}
})
}

export const optGitHooklog = (data) => {
return axios.request({
url: '/task/other/v1/git/logs/',
method: 'delete',
data
})
}

Expand All @@ -73,4 +94,15 @@ export const Gitsync = () => {
url: '/task/other/v1/git/sync/',
method: 'post'
})
}

export const getGitRepotags = (git_url, project_id) => {
return axios.request({
url: '/task/other/v1/git/tags/',
method: 'get',
params: {
git_url,
project_id,
}
})
}
Loading

0 comments on commit 83031ce

Please sign in to comment.