|
| 1 | +# Admin System |
| 2 | + |
| 3 | +[Demo](https://sls-admin.yugasun.com/) |
| 4 | + |
| 5 | +This is an admin system developed by [Serverless Components](https://github.com/serverless/components). |
| 6 | + |
| 7 | +This template includes: |
| 8 | + |
| 9 | +- **Serverless RESTful API**: Using |
| 10 | + [@serverless/tencent-egg](https://github.com/serverless-components/tencent-egg) |
| 11 | + component, it contains a Servelress Cloud Function and a single API Gateway |
| 12 | + endpoint. |
| 13 | + |
| 14 | +- **Serverless website using Vue.js**: |
| 15 | + [@serverless/tencent-website](https://github.com/serverless-components/tencent-website), |
| 16 | + it deploys all static files to Cloud Object Storage, and config CDN domain. |
| 17 | + |
| 18 | +> **Notice**: The frontend project is initialed by [@vue/cli](https://cli.vuejs.org/) which is official standard tooling for Vue.js development. |
| 19 | +
|
| 20 | +### Content |
| 21 | + |
| 22 | +1. [Prepare](#Prepare) |
| 23 | +2. [Download](#Download) |
| 24 | +3. [Bootstrap](#Bootstrap) |
| 25 | +4. [Deploy](#Deploy) |
| 26 | +5. [Development](#Development) |
| 27 | + |
| 28 | +### Prepare |
| 29 | + |
| 30 | +Before all below steps, you should install |
| 31 | +[Serverless Framework](https://www.github.com/serverless/serverless) globally: |
| 32 | + |
| 33 | +```bash |
| 34 | +$ npm i serverless -g |
| 35 | +``` |
| 36 | + |
| 37 | +### Download |
| 38 | + |
| 39 | +Severless cli is very convenient, it can download templates in any github |
| 40 | +project. |
| 41 | + |
| 42 | +```bash |
| 43 | +$ serverless create --template-url https://github.com/yugasun/serverless-admin-system |
| 44 | +``` |
| 45 | + |
| 46 | +### Bootstrap |
| 47 | + |
| 48 | +Copy `.env.example` file to `.env` in project root: |
| 49 | + |
| 50 | +Add the access keys of a |
| 51 | +[Tencent CAM Role](https://bash.cloud.tencent.com/cam/capi) with |
| 52 | +`AdministratorAccess` in the `.env` file, like below: |
| 53 | + |
| 54 | +```dotenv |
| 55 | +# .env |
| 56 | +TENCENT_SECRET_ID=xxx |
| 57 | +TENCENT_SECRET_KEY=xxx |
| 58 | +
|
| 59 | +REGION=ap-guangzhou |
| 60 | +VPC_ID=xxx |
| 61 | +SUBNET_ID=xxx |
| 62 | +``` |
| 63 | + |
| 64 | +Install the NPM dependencies: |
| 65 | + |
| 66 | +```bash |
| 67 | +$ npm run bootstrap |
| 68 | +``` |
| 69 | + |
| 70 | +### Deploy |
| 71 | + |
| 72 | +Deploy via the `serverless` command: |
| 73 | + |
| 74 | +```bash |
| 75 | +$ serverless deploy |
| 76 | +``` |
| 77 | + |
| 78 | +Use the `--debug` flag if you'd like to learn what's happening behind the |
| 79 | +scenes: |
| 80 | + |
| 81 | +```bash |
| 82 | +$ serverless deploy --debug |
| 83 | +``` |
| 84 | + |
| 85 | +### Development |
| 86 | + |
| 87 | +After your first deployment, you will be able to run the frontend locally and |
| 88 | +have it communicate to the live backend in the cloud. |
| 89 | + |
| 90 | +```bash |
| 91 | +$ yarn start |
| 92 | +``` |
| 93 | + |
| 94 | +### Notice |
| 95 | + |
| 96 | +Because this project, you should create a [MySQL](https://bash.cloud.tencent.com/cdb) and [Redis](https://bash.cloud.tencent.com/redis) on Tencent Cloud. |
| 97 | + |
| 98 | +And you should create a `.env` file in `backend` |
| 99 | +folder, and set all required parameters like `.env.example`. |
| 100 | + |
| 101 | +### License |
| 102 | + |
| 103 | +MIT |
0 commit comments