Skip to content

Commit

Permalink
fix: deploy docker_test fn
Browse files Browse the repository at this point in the history
  • Loading branch information
SolidZORO committed Jun 9, 2020
1 parent f6259b1 commit c501324
Show file tree
Hide file tree
Showing 5 changed files with 735 additions and 1,272 deletions.
3 changes: 2 additions & 1 deletion packages/leaa-api/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ JWT_SECRET_KEY=xxxxxxxx
# (60 * 60 * 24) * 30d = 2592000
SERVER_COOKIE_EXPIRES_SECOND=2592000

# `DB_HOST` At <production> Please input docker's `service_name`, At <development> Please input `localhost`
DB_TYPE=mysql
DB_HOST=prod_mysql
DB_PORT=3306
Expand Down Expand Up @@ -52,7 +53,7 @@ GRAVATAR_TYPE=monsterid
# DOCKER --------
DOCKER_NETWORK_NAME=web

DOCKER_NODE_CONTAINER_NAME=prod_api
DOCKER_NODE_CONTAINER_NAME=api
DOCKER_NODE_PORT=5000
DOCKER_NODE_NPM_REGISTRY=https://registry.npm.taobao.org
DOCKER_NODE_NPM_DISTURL=https://npm.taobao.org/dist
14 changes: 8 additions & 6 deletions packages/leaa-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,18 @@ yarn insatll && yarn seed --nuke
yarn dev
```

## **DATABASE**

leaa-api uses `mysql` driver, and I recommended to use mysql at `docker`, [dockerrr](https://github.com/SolidZORO/dockerrr) is a docker scaffolding that I used when developing leaa-api.

## **DEPLOY**

more step see `deploy.sh`
More detailed you can see `./deploy.sh`

## **TIPS**

starting from `v1.0.4`, the api also supports `i18n`.

the currently available languages are 🇺🇸 English (en-US) and 🇨🇳 Chinese (zh-CN). The default is English.
Starting from `v1.0.4`, the api also supports `i18n`.

to request Chinese, please set req.header.lang, e.g. `req.heard.lang = 'zh-CN'`
The currently available languages are 🇺🇸 English (en-US) and 🇨🇳 Chinese (zh-CN). The default is English. to request Chinese, please set req.header.lang, e.g. `req.heard.lang = 'zh-CN'`

more config @see `leaa-api/src/modules/i18n/i18n.service.ts`
More config detailed you can see `leaa-api/src/modules/i18n/i18n.service.ts`
8 changes: 4 additions & 4 deletions packages/leaa-api/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@ platform_test() {
}

platform_test_docker() {
if [ -f "${__DEPLOY__}/.env.production" ]; then
if [ -f "${__DEPLOY__}/.env" ]; then
# shellcheck disable=SC2028
echo '\n✨ Already .env.production, Do not copy.\n'
echo '\n✨ Already .env, Do not copy.\n'
else
cp -f ./.env.production ${__DEPLOY__}
cp -f ./.env ${__DEPLOY__}
fi

cp -f ./docker-compose.yml ${__DEPLOY__}
cd ${__DEPLOY__} || exit

docker-compose --env-file ./.env.production up
docker-compose up
}

platform_heroku() {
Expand Down
10 changes: 5 additions & 5 deletions packages/leaa-api/src/utils/cli.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ export const envInfoForCli = ({
const serverBaseByEmoji = `✨✨ \x1b[00;44;9m${serverBaseByText}\x1b[0m ✨✨`;
const serverEnv = `${NODE_ENV !== 'production' ? '🚀' : '🔰'} ${(NODE_ENV || 'NOT-ENV').toUpperCase()}`;

console.log(`\n\n> 🌈 DEBUG ${config.DEBUG_MODE ? '✅' : ''} / DEMO ${config.DEMO_MODE ? '✅' : ''}`);
console.log(`\n\n\n> 🌈 DEBUG ${config.DEBUG_MODE ? '✅' : '⛔️'} / DEMO ${config.DEMO_MODE ? '✅' : '⛔️'}`);

console.log(`\n\n> ${serverEnv} / URL`, serverBaseByEmoji);
console.log(`\n> ${serverEnv} / URL`, serverBaseByEmoji);

console.log('\n> 📮 ENVDATA');
console.log(' - NAME ', config.SERVER_NAME);
console.log(' - VERSION ', `v${pkg.version}`);
console.log('\n> 📮 ENVINFO');
console.log(' - NAME ', `${config.SERVER_NAME} v${pkg.version}`);
console.log('');
console.log(' - DIRNAME ', DIRNAME);
console.log(' - PUBLIC ', PUBLIC_PATH);
console.log('');
Expand Down
Loading

0 comments on commit c501324

Please sign in to comment.