Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .env.preview
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
NEXT_PUBLIC_RUNTIME_ENV=preview
NEXT_PUBLIC_HOME_URL=https://community-preview.tidb.net
NEXT_PUBLIC_ACCOUNTS_BASE_URL=https://accounts-preview.pingcap.cn
NEXT_PUBLIC_BRAND_URL=https://community.pingkai.cn
NEXT_PUBLIC_HOME_URL=$NEXT_PUBLIC_BRAND_URL/tidbcommunity
NEXT_PUBLIC_BLOG_URL=$NEXT_PUBLIC_BRAND_URL/tidbcommunity/blog
NEXT_PUBLIC_ACCOUNTS_BASE_URL=$NEXT_PUBLIC_BRAND_URL/accounts
NEXT_PUBLIC_ASKTUG_WEBSITE_BASE_URL=$NEXT_PUBLIC_BRAND_URL/tidbcommunity/forum
NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_HOME_URL
NEXT_PUBLIC_LOCALES_BASE_URL=$NEXT_PUBLIC_HOME_URL/locales
NEXT_PUBLIC_STRAPI_BASE_URL=http://community-cms.default.svc.cluster.local
NEXT_PUBLIC_STRAPI_BASE_URL=https://cms.tidb.net
NEXT_PUBLIC_ASKTUG_PROXY_BASE_URL=$NEXT_PUBLIC_HOME_URL/forum

NEXT_PUBLIC_FT_ACTIVITIES=true
NEXT_PUBLIC_CMS_CDN_URL=https://img3.pingcap.com
NEXT_PUBLIC_CDN_URL=https://tidb-net-preview.oss-cn-beijing.aliyuncs.com
NEXT_PUBLIC_ASKTUG_PROXY_BASE_URL=$NEXT_PUBLIC_HOME_URL/_asktug
NEXT_PUBLIC_ASKTUG_WEBSITE_BASE_URL=https://new.asktug.com
SENTRY_ORG=pingcap
SENTRY_PROJECT=tug-website
ENABLE_SENTRY=false
Expand Down
12 changes: 7 additions & 5 deletions .env.production
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
NEXT_PUBLIC_RUNTIME_ENV=production
NEXT_PUBLIC_HOME_URL=https://tidb.net
NEXT_PUBLIC_ACCOUNTS_BASE_URL=https://accounts.pingcap.cn
NEXT_PUBLIC_BRAND_URL=https://pingkai.cn
NEXT_PUBLIC_HOME_URL=$NEXT_PUBLIC_BRAND_URL/tidbcommunity
NEXT_PUBLIC_BLOG_URL=$NEXT_PUBLIC_BRAND_URL/tidbcommunity/blog
NEXT_PUBLIC_ACCOUNTS_BASE_URL=$NEXT_PUBLIC_BRAND_URL/accounts
NEXT_PUBLIC_ASKTUG_WEBSITE_BASE_URL=$NEXT_PUBLIC_BRAND_URL/tidbcommunity/forum
NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_HOME_URL
NEXT_PUBLIC_LOCALES_BASE_URL=$NEXT_PUBLIC_HOME_URL/locales
NEXT_PUBLIC_STRAPI_BASE_URL=http://community-cms.default.svc.cluster.local
NEXT_PUBLIC_ASKTUG_WEBSITE_BASE_URL=https://asktug.com
NEXT_PUBLIC_ASKTUG_PROXY_BASE_URL=$NEXT_PUBLIC_HOME_URL/_asktug
NEXT_PUBLIC_STRAPI_BASE_URL=https://cms.tidb.net
NEXT_PUBLIC_ASKTUG_PROXY_BASE_URL=$NEXT_PUBLIC_HOME_URL/forum

# Available feature toggles
NEXT_PUBLIC_FT_ACTIVITIES=true
Expand Down
99 changes: 50 additions & 49 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,52 +40,53 @@ jobs:
OSS_ACCESS_KEY: ${{ secrets.OSS_ACCESS_KEY }}
OSS_ACCESS_SECRET: ${{ secrets.OSS_ACCESS_SECRET }}

deploy-preview:
needs: [ build-preview ]
uses: ./.github/workflows/deploy-k8s.yml
with:
build-env: preview
secrets:
JUMP_SERVER_IP: ${{ secrets.JUMP_SERVER_IP }}
JUMP_SERVER_USER: ${{ secrets.JUMP_SERVER_USER }}
JUMP_SERVER_PATH: ${{ secrets.JUMP_SERVER_PATH }}
JUMP_SERVER_PRIVATE_KEY: ${{ secrets.JUMP_SERVER_PRIVATE_KEY }}

deploy-production:
needs: [ build-production ]
uses: ./.github/workflows/deploy-k8s.yml
with:
build-env: production
secrets:
JUMP_SERVER_IP: ${{ secrets.JUMP_SERVER_IP }}
JUMP_SERVER_USER: ${{ secrets.JUMP_SERVER_USER }}
JUMP_SERVER_PATH: ${{ secrets.JUMP_SERVER_PATH }}
JUMP_SERVER_PRIVATE_KEY: ${{ secrets.JUMP_SERVER_PRIVATE_KEY }}

preview-pages-test:
needs: [ deploy-preview ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Use Node.js 20.9.0
uses: actions/setup-node@v3
with:
node-version: 20.9.0
cache: 'npm'

- name: Cache dependencies
id: dep-caches
uses: actions/cache@v3
with:
path: |
node_modules
packages/*/node_modules
!packages/ui/node_modules
key: ${{ runner.os }}-build-${{ hashFiles('package-lock.json', 'packages/*/package-lock.json', '!packages/ui/node_modules') }}
restore-keys: ${{ runner.os }}-build

- name: Run page tests
run: node testurls.mjs
env:
NEXT_PUBLIC_HOME_URL: https://community-preview.tidb.net
## Disable old deployment scripts
# deploy-preview:
# needs: [ build-preview ]
# uses: ./.github/workflows/deploy-k8s.yml
# with:
# build-env: preview
# secrets:
# JUMP_SERVER_IP: ${{ secrets.JUMP_SERVER_IP }}
# JUMP_SERVER_USER: ${{ secrets.JUMP_SERVER_USER }}
# JUMP_SERVER_PATH: ${{ secrets.JUMP_SERVER_PATH }}
# JUMP_SERVER_PRIVATE_KEY: ${{ secrets.JUMP_SERVER_PRIVATE_KEY }}
#
# deploy-production:
# needs: [ build-production ]
# uses: ./.github/workflows/deploy-k8s.yml
# with:
# build-env: production
# secrets:
# JUMP_SERVER_IP: ${{ secrets.JUMP_SERVER_IP }}
# JUMP_SERVER_USER: ${{ secrets.JUMP_SERVER_USER }}
# JUMP_SERVER_PATH: ${{ secrets.JUMP_SERVER_PATH }}
# JUMP_SERVER_PRIVATE_KEY: ${{ secrets.JUMP_SERVER_PRIVATE_KEY }}
#
# preview-pages-test:
# needs: [ deploy-preview ]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
#
# - name: Use Node.js 20.9.0
# uses: actions/setup-node@v3
# with:
# node-version: 20.9.0
# cache: 'npm'
#
# - name: Cache dependencies
# id: dep-caches
# uses: actions/cache@v3
# with:
# path: |
# node_modules
# packages/*/node_modules
# !packages/ui/node_modules
# key: ${{ runner.os }}-build-${{ hashFiles('package-lock.json', 'packages/*/package-lock.json', '!packages/ui/node_modules') }}
# restore-keys: ${{ runner.os }}-build
#
# - name: Run page tests
# run: node testurls.mjs
# env:
# NEXT_PUBLIC_HOME_URL: https://community-preview.tidb.net
8 changes: 8 additions & 0 deletions MIGRATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
tidb.net/blog -> pingkai.cn/tidbcommunity/blog
tidb.net/my -> pingkai.cn/tidbcommunity/my
tidb.net/member -> pingkai.cn/tidbcommunity/member
tidb.net/u/wd0517 -> pingkai.cn/tidbcommunity/u/wd0517
accounts.pingcap.cn/login ->pingkai.cn/accounts/login
accounts.pingcap.cn/register -> pingkai.cn/accounts/register
asktug.com -> pingkai.cn/tidbcommunity/forum
tidb.net -> pingkai.cn/tidbcommunity
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,23 @@ Check out our [Next.js deployment documentation](https://nextjs.org/docs/deploym

### 列表公共信息

- data/asktug_site.json ( download from https://asktug.com/site.json )
- data/asktug_site.json ( download from https://pingkai.cn/tidbcommunity/forum/site.json )

### 精选文章列表

- https://asktug.com/c/blog/how-to/l/latest.json?order=default&page=0&per_page=10
- https://pingkai.cn/tidbcommunity/forum/c/blog/how-to/l/latest.json?order=default&page=0&per_page=10

### 用户实践列表

- https://asktug.com/c/blog/practice/l/latest.json?order=default&page=0&per_page=10
- https://pingkai.cn/tidbcommunity/forum/c/blog/practice/l/latest.json?order=default&page=0&per_page=10

### 原理解读列表

- https://asktug.com/c/blog/theory/l/latest.json?order=default&page=0&per_page=10
- https://pingkai.cn/tidbcommunity/forum/c/blog/theory/l/latest.json?order=default&page=0&per_page=10

### 热门问答列表

- https://asktug.com/top/weekly.json?order=default&page=0&per_page=10
- https://pingkai.cn/tidbcommunity/forum/top/weekly.json?order=default&page=0&per_page=10

### /mva

Expand Down Expand Up @@ -116,7 +116,7 @@ Check out our [Next.js deployment documentation](https://nextjs.org/docs/deploym

### data/asktug_site.json

该文件来源于 [https://asktug.com/site.json](https://asktug.com/site.json) 需要在 AskTUG 网站有相关论坛版块信息更新后手动更新(后续可考虑通过 CircleCI 定时更新该数据)
该文件来源于 [https://pingkai.cn/tidbcommunity/forum/site.json](https://pingkai.cn/tidbcommunity/forum/site.json) 需要在 AskTUG 网站有相关论坛版块信息更新后手动更新(后续可考虑通过 CircleCI 定时更新该数据)

首页问答中通过 API 获取的帖子信息中只包含论坛版块 ID,不包括具体版块信息,因此需要依赖该文件获取相关论坛板块信息。

Expand Down
4 changes: 3 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ const unifyNodeModules = (names) =>
const config = {
i18n,

basePath: '/tidbcommunity',

pageExtensions: ['page.js', 'page.jsx', 'page.tsx'],

images: {
domains: [
'localhost',
'tidb.net',
'pingkai.cn/tidbcommunity',
'contributor.tidb.io',
'cms.tidb.net',
'img3.pingcap.com',
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"devDependencies": {
"@babel/eslint-parser": "~7.17.0",
"@pingcap-inc/tidb-community-editor": "0.6.8",
"@pingcap-inc/tidb-community-site-components": "1.8.27",
"@pingcap-inc/tidb-community-site-components": "1.9.2",
"@pingcap-inc/tidb-community-ui": "^1.3.3",
"@sentry/webpack-plugin": "~1.18.8",
"@svgr/webpack": "~6.2.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/datasource/src/api/asktug/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ export interface BadgeEntity {
has_badge: boolean;
}

export const getBadgesList: ApiRequestFunction<void, any> = () => client.get('/_asktug/badges');
export const getBadgesList: ApiRequestFunction<void, any> = () => client.get('/forum/badges');
2 changes: 1 addition & 1 deletion packages/datasource/src/api/blogClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const isDispatchGlobalApiError = (status) => {
};

const blogClient = axios.create({
baseURL: (process.env.NEXT_PUBLIC_API_BASE_URL ?? '') + '/blog',
baseURL: process.env.NEXT_PUBLIC_BLOG_URL ?? '',
withCredentials: true,
headers: {
accept: 'application/json',
Expand Down
2 changes: 1 addition & 1 deletion packages/datasource/src/api/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const isDispatchGlobalApiError = (status) => {
};

const client = axios.create({
baseURL: process.env.NEXT_PUBLIC_API_BASE_URL ?? '',
baseURL: process.env.NEXT_PUBLIC_ACCOUNTS_BASE_URL ?? '',
withCredentials: true,
});

Expand Down
14 changes: 7 additions & 7 deletions packages/datasource/src/config.domains.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
export const defaultEnvDomains = {
production: {
'tidb.net': 'tidb.net',
'tidb.net': 'pingkai.cn/tidbcommunity',
'contributor.tidb.io': 'contributor.tidb.io',
'asktug.com': 'asktug.com',
'accounts.pingcap.com': 'accounts.pingcap.com',
'asktug.com': 'pingkai.cn/tidbcommunity/forum',
'accounts.pingcap.com': 'pingkai.cn/accounts',
},
preview: {
'tidb.net': 'community-preview.tidb.io',
'contributor.tidb.io': 'community-preview-contributor.tidb.io',
'asktug.com': 'community-preview.asktug.com',
'accounts.pingcap.com': 'accounts-preview.pingcap.cn',
'tidb.net': 'community.pingkai.cn/tidbcommunity',
'contributor.tidb.io': 'contributor.tidb.io',
'asktug.com': 'community.pingkai.cn/tidbcommunity/forum',
'accounts.pingcap.com': 'community.pingkai.cn/accounts',
},
local: {
'tidb.net': 'localhost:3000',
Expand Down
2 changes: 1 addition & 1 deletion packages/datasource/src/nav/footer/footer.data-en.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const navItems = [
},
{
title: 'Forum',
link: 'https://asktug.com',
link: 'https://pingkai.cn/tidbcommunity/forum',
},
{
title: 'Mailing List',
Expand Down
4 changes: 2 additions & 2 deletions packages/datasource/src/nav/footer/footer.data-zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const navItems = [
},
{
title: '论坛',
link: 'https://asktug.com',
link: 'https://pingkai.cn/tidbcommunity/forum',
},
{
title: '邮件列表',
Expand Down Expand Up @@ -47,7 +47,7 @@ export const navItems = [
},
{
title: '博客',
link: 'https://asktug.com/c/blog/l/latest',
link: 'https://pingkai.cn/tidbcommunity/forum/c/blog/l/latest',
},
{
title: 'Github',
Expand Down
18 changes: 9 additions & 9 deletions packages/datasource/src/nav/header/header.data-en.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const navItems = [
{
title: 'Home',
link: 'https://tidb.net',
link: 'https://pingkai.cn/tidbcommunity',
},
{
title: 'Learning',
Expand Down Expand Up @@ -54,11 +54,11 @@ export const navItems = [
},
{
title: 'Events',
link: 'https://tidb.net/events',
link: 'https://pingkai.cn/tidbcommunity/events',
},
{
title: 'Blog',
link: 'https://tidb.net/blog',
link: 'https://pingkai.cn/tidbcommunity/blog',
},
{
title: 'Community',
Expand All @@ -69,15 +69,15 @@ export const navItems = [
},
{
title: 'User Group',
link: 'https://tidb.net/tug',
link: 'https://pingkai.cn/tidbcommunity/tug',
items: [
{
title: 'Join TiDB User Group',
link: 'https://tidb.net/tug/apply',
link: 'https://pingkai.cn/tidbcommunity/tug/apply',
},
{
title: 'MVA',
link: 'https://tidb.net/tug/mva',
link: 'https://pingkai.cn/tidbcommunity/tug/mva',
},
],
},
Expand Down Expand Up @@ -145,7 +145,7 @@ export const navItems = [
},
{
title: 'Redeem Gifts',
link: 'https://accounts.pingcap.cn/points#/shop',
link: 'https://pingkai.cn/accounts/points#/shop',
},
{
title: 'About',
Expand All @@ -172,12 +172,12 @@ export const genUserProfileItems = ({ meData, redDots }) => {
},
{
title: 'Profile',
link: `https://tidb.net/my/profile`,
link: `https://pingkai.cn/tidbcommunity/my/profile`,
badge: redDots.companyInfo,
},
{
title: 'Account Settings',
link: `https://tidb.net/my/settings`,
link: `https://pingkai.cn/tidbcommunity/my/settings`,
},
];

Expand Down
Loading
Loading