✨ 页面缓存
✨ 页面缓存
This commit is contained in:
commit
e4cd871675
2
.dockerignore
Normal file
2
.dockerignore
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
node_modules
|
||||||
|
npm-debug.log
|
58
.onedev-buildspec.yml
Normal file
58
.onedev-buildspec.yml
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
version: 18
|
||||||
|
jobs:
|
||||||
|
- name: vue ci
|
||||||
|
steps:
|
||||||
|
- !CheckoutStep
|
||||||
|
name: checkout
|
||||||
|
cloneCredential: !DefaultCredential {}
|
||||||
|
withLfs: false
|
||||||
|
withSubmodules: false
|
||||||
|
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
||||||
|
- !SetBuildVersionStep
|
||||||
|
name: set build version
|
||||||
|
buildVersion: '@script:builtin:node:determine-project-version@'
|
||||||
|
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
||||||
|
- !CommandStep
|
||||||
|
name: build & test
|
||||||
|
runInContainer: true
|
||||||
|
image: node:16.17.0-alpine
|
||||||
|
interpreter: !DefaultInterpreter
|
||||||
|
commands:
|
||||||
|
- yarn --registry=https://registry.npm.taobao.org
|
||||||
|
- npx nuxt build
|
||||||
|
useTTY: false
|
||||||
|
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
||||||
|
triggers:
|
||||||
|
- !BranchUpdateTrigger {}
|
||||||
|
retryCondition: never
|
||||||
|
maxRetries: 3
|
||||||
|
retryDelay: 30
|
||||||
|
cpuRequirement: 250
|
||||||
|
memoryRequirement: 256
|
||||||
|
caches:
|
||||||
|
- key: npm-cache
|
||||||
|
path: /root/.npm
|
||||||
|
timeout: 3600
|
||||||
|
- name: Build Docker Image
|
||||||
|
jobExecutor: internal
|
||||||
|
steps:
|
||||||
|
- !CheckoutStep
|
||||||
|
name: Checkout Code
|
||||||
|
cloneCredential: !DefaultCredential {}
|
||||||
|
withLfs: false
|
||||||
|
withSubmodules: false
|
||||||
|
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
||||||
|
- !BuildImageStep
|
||||||
|
name: Build Docker Image
|
||||||
|
tags: rymcu/nebula:latest
|
||||||
|
publish: false
|
||||||
|
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
||||||
|
triggers:
|
||||||
|
- !TagCreateTrigger
|
||||||
|
projects: nebula
|
||||||
|
retryCondition: never
|
||||||
|
maxRetries: 3
|
||||||
|
retryDelay: 30
|
||||||
|
cpuRequirement: 250
|
||||||
|
memoryRequirement: 256
|
||||||
|
timeout: 3600
|
29
Dockerfile
Normal file
29
Dockerfile
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
FROM node:16.17.0-alpine
|
||||||
|
|
||||||
|
#创建/opt/app 目录作为部署目录,创建容器实例时,挂载此目录
|
||||||
|
RUN mkdir -p /opt/app
|
||||||
|
# 设置工作目录
|
||||||
|
WORKDIR /opt/app
|
||||||
|
|
||||||
|
# 将代码复制到容器中
|
||||||
|
COPY . /opt/app
|
||||||
|
|
||||||
|
RUN cd /opt/app
|
||||||
|
# 添加权限,防止依赖无法安装
|
||||||
|
RUN chmod -R 777 *
|
||||||
|
# 添加执行shell文件权限
|
||||||
|
RUN chmod u+x pm2.sh
|
||||||
|
RUN yarn --registry=https://registry.npm.taobao.org
|
||||||
|
RUN npm i pm2 -g --registry=https://registry.npm.taobao.org
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
RUN ls -l -a
|
||||||
|
|
||||||
|
# 容器对外暴露的端口号,要和node项目配置的端口号一致
|
||||||
|
EXPOSE 3000
|
||||||
|
# 修复容器外无法访问问题
|
||||||
|
ENV NUXT_HOST=0.0.0.0
|
||||||
|
ENV NUXT_PORT=3000
|
||||||
|
|
||||||
|
# 通过shell文件来执行多条命令
|
||||||
|
CMD ["./pm2.sh"]
|
@ -4,7 +4,7 @@
|
|||||||
<header-view/>
|
<header-view/>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main>
|
<el-main>
|
||||||
<nuxt :nuxt-child-key="$route.name"/>
|
<nuxt :nuxt-child-key="$route.name" keep-alive :keep-alive-props="{max: 16}"/>
|
||||||
</el-main>
|
</el-main>
|
||||||
<el-footer height="5rem">
|
<el-footer height="5rem">
|
||||||
<footer-view/>
|
<footer-view/>
|
||||||
|
@ -11,6 +11,16 @@ const apisMap = {
|
|||||||
VDITOR: 'https://static.rymcu.com/vditor@3.8.14/',
|
VDITOR: 'https://static.rymcu.com/vditor@3.8.14/',
|
||||||
VDITOR_CSS: 'https://static.rymcu.com/vditor@3.8.14/dist/css/content-theme'
|
VDITOR_CSS: 'https://static.rymcu.com/vditor@3.8.14/dist/css/content-theme'
|
||||||
},
|
},
|
||||||
|
test: {
|
||||||
|
FE: 'https://test.rymcu.com',
|
||||||
|
BASE: 'https://test.rymcu.com',
|
||||||
|
CDN: 'https://static.rymcu.com',
|
||||||
|
PROXY: 'https://static.rymcu.com/proxy',
|
||||||
|
SOCKET: 'https://test.rymcu.com/wss',
|
||||||
|
GRAVATAR: 'https://static.rymcu.com/avatar',
|
||||||
|
VDITOR: 'https://static.rymcu.com/vditor@3.8.14/',
|
||||||
|
VDITOR_CSS: 'https://static.rymcu.com/vditor@3.8.14/dist/css/content-theme'
|
||||||
|
},
|
||||||
production: {
|
production: {
|
||||||
FE: 'https://rymcu.com',
|
FE: 'https://rymcu.com',
|
||||||
BASE: 'https://rymcu.com',
|
BASE: 'https://rymcu.com',
|
||||||
|
@ -110,7 +110,8 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
EditTags
|
EditTags
|
||||||
},
|
},
|
||||||
fetch({store, params, error}) {
|
fetch() {
|
||||||
|
let {store, params, error} = this.$nuxt.context
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
store
|
store
|
||||||
.dispatch('admin/fetchArticles', params)
|
.dispatch('admin/fetchArticles', params)
|
||||||
|
@ -76,7 +76,8 @@ import Records from "../../components/common/bank/account/records";
|
|||||||
export default {
|
export default {
|
||||||
name: "bank-accounts",
|
name: "bank-accounts",
|
||||||
components: {Records},
|
components: {Records},
|
||||||
fetch({store, params, error}) {
|
fetch() {
|
||||||
|
let {store, params, error} = this.$nuxt.context
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
store
|
store
|
||||||
.dispatch('bank-account/fetchList', params)
|
.dispatch('bank-account/fetchList', params)
|
||||||
|
@ -87,7 +87,8 @@ import {mapState} from 'vuex';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "banks",
|
name: "banks",
|
||||||
fetch({store, params, error}) {
|
fetch() {
|
||||||
|
let {store, params, error} = this.$nuxt.context
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
store
|
store
|
||||||
.dispatch('bank/fetchList', params)
|
.dispatch('bank/fetchList', params)
|
||||||
|
@ -97,7 +97,8 @@ import {mapState} from 'vuex';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "comments",
|
name: "comments",
|
||||||
fetch({store, params, error}) {
|
fetch() {
|
||||||
|
let {store, params, error} = this.$nuxt.context
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
store
|
store
|
||||||
.dispatch('admin/fetchComments', params)
|
.dispatch('admin/fetchComments', params)
|
||||||
|
@ -81,7 +81,8 @@ import {mapState} from 'vuex';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "currency-rules",
|
name: "currency-rules",
|
||||||
fetch({store, params, error}) {
|
fetch() {
|
||||||
|
let {store, params, error} = this.$nuxt.context
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
store
|
store
|
||||||
.dispatch('currency-rule/fetchList', params)
|
.dispatch('currency-rule/fetchList', params)
|
||||||
|
@ -251,7 +251,8 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
EditTags
|
EditTags
|
||||||
},
|
},
|
||||||
fetch({store, params, error}) {
|
fetch() {
|
||||||
|
let {store, params, error} = this.$nuxt.context
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
store
|
store
|
||||||
.dispatch('dashboard/fetchDashboard', params)
|
.dispatch('dashboard/fetchDashboard', params)
|
||||||
|
@ -80,7 +80,8 @@ import {mapState} from 'vuex';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "products",
|
name: "products",
|
||||||
fetch({store, params, error}) {
|
fetch() {
|
||||||
|
let {store, params, error} = this.$nuxt.context
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
store
|
store
|
||||||
.dispatch('admin/fetchProducts', params)
|
.dispatch('admin/fetchProducts', params)
|
||||||
|
@ -91,7 +91,8 @@
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "roles",
|
name: "roles",
|
||||||
fetch({store, params, error}) {
|
fetch() {
|
||||||
|
let {store, params, error} = this.$nuxt.context
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
store
|
store
|
||||||
.dispatch('admin/fetchRoles', params)
|
.dispatch('admin/fetchRoles', params)
|
||||||
|
@ -48,7 +48,8 @@
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "tags",
|
name: "tags",
|
||||||
fetch({store, params, error}) {
|
fetch() {
|
||||||
|
let {store, params, error} = this.$nuxt.context
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
store
|
store
|
||||||
.dispatch('tag/fetchList', params)
|
.dispatch('tag/fetchList', params)
|
||||||
|
@ -77,7 +77,8 @@ export default {
|
|||||||
}
|
}
|
||||||
return params.topic_uri
|
return params.topic_uri
|
||||||
},
|
},
|
||||||
fetch({store, params, error}) {
|
fetch() {
|
||||||
|
let {store, params, error} = this.$nuxt.context
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
store.dispatch('topic/fetchDetail', params)
|
store.dispatch('topic/fetchDetail', params)
|
||||||
.catch(err => error({statusCode: 404})),
|
.catch(err => error({statusCode: 404})),
|
||||||
|
@ -39,7 +39,8 @@
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "topics",
|
name: "topics",
|
||||||
fetch({store, params, error}) {
|
fetch() {
|
||||||
|
let {store, params, error} = this.$nuxt.context
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
store
|
store
|
||||||
.dispatch('topic/fetchList', params)
|
.dispatch('topic/fetchList', params)
|
||||||
|
@ -119,7 +119,8 @@ import {mapState} from 'vuex';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "users",
|
name: "users",
|
||||||
fetch({store, params, error}) {
|
fetch() {
|
||||||
|
let {store, params, error} = this.$nuxt.context
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
store
|
store
|
||||||
.dispatch('admin/fetchUsers', params)
|
.dispatch('admin/fetchUsers', params)
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
components: {
|
components: {
|
||||||
DraftList
|
DraftList
|
||||||
},
|
},
|
||||||
fetch({store, error}) {
|
fetch() {
|
||||||
|
let {store, error} = this.$nuxt.context
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
store
|
store
|
||||||
.dispatch('draft/fetchList')
|
.dispatch('draft/fetchList')
|
||||||
|
@ -11,7 +11,8 @@ import {mapState} from 'vuex';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Index',
|
name: 'Index',
|
||||||
fetch({store, query}) {
|
fetch() {
|
||||||
|
let {store, query, error} = this.$nuxt.context
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
store.dispatch('article/fetchList', {page: query.page || 1}),
|
store.dispatch('article/fetchList', {page: query.page || 1}),
|
||||||
store.dispatch('article/fetchAnnouncementList', {page: query.page || 1})
|
store.dispatch('article/fetchAnnouncementList', {page: query.page || 1})
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
components: {
|
components: {
|
||||||
NotificationList
|
NotificationList
|
||||||
},
|
},
|
||||||
fetch({store, query, error}) {
|
fetch() {
|
||||||
|
let {store, query, error} = this.$nuxt.context
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
store
|
store
|
||||||
.dispatch('notification/fetchList', {page: query.page || 1})
|
.dispatch('notification/fetchList', {page: query.page || 1})
|
||||||
|
@ -54,7 +54,8 @@ import gzh from "assets/rymcugzh.jpg";
|
|||||||
Vue.prototype.$echarts = echarts;
|
Vue.prototype.$echarts = echarts;
|
||||||
export default {
|
export default {
|
||||||
name: "openData",
|
name: "openData",
|
||||||
fetch({store, params, error}) {
|
fetch() {
|
||||||
|
let {store, params, error} = this.$nuxt.context
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
store
|
store
|
||||||
.dispatch('open-data/fetchLastThirtyDays', params)
|
.dispatch('open-data/fetchLastThirtyDays', params)
|
||||||
|
@ -16,7 +16,8 @@ import PortfolioList from "~/components/common/portfolio/list";
|
|||||||
export default {
|
export default {
|
||||||
name: "Portfolios",
|
name: "Portfolios",
|
||||||
components: {PortfolioList},
|
components: {PortfolioList},
|
||||||
fetch({store, query, error}) {
|
fetch() {
|
||||||
|
let {store, params, error} = this.$nuxt.context
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
store
|
store
|
||||||
.dispatch('portfolio/fetchList', {page: query.page || 1})
|
.dispatch('portfolio/fetchList', {page: query.page || 1})
|
||||||
|
@ -13,7 +13,8 @@ import ProductList from "~/components/common/product/list";
|
|||||||
export default {
|
export default {
|
||||||
name: "products",
|
name: "products",
|
||||||
components: {ProductList},
|
components: {ProductList},
|
||||||
fetch({store, query, error}) {
|
fetch() {
|
||||||
|
let {store, params, error} = this.$nuxt.context
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
store
|
store
|
||||||
.dispatch('product/fetchList', {page: query.page || 1})
|
.dispatch('product/fetchList', {page: query.page || 1})
|
||||||
|
19
pm2.json
Normal file
19
pm2.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"name": "nebula",
|
||||||
|
"exec_mode": "cluster",
|
||||||
|
"instances": "max",
|
||||||
|
"script": "./node_modules/nuxt/bin/nuxt.js",
|
||||||
|
"args": "start",
|
||||||
|
"env": {
|
||||||
|
"NODE_ENV": "production"
|
||||||
|
},
|
||||||
|
"env_test": {
|
||||||
|
"NODE_ENV": "test"
|
||||||
|
},
|
||||||
|
"env_dev": {
|
||||||
|
"NODE_ENV": "development"
|
||||||
|
},
|
||||||
|
"env_prod": {
|
||||||
|
"NODE_ENV": "production"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user