|
| 1 | +# Development guide |
| 2 | + |
| 3 | +This doc describes how to bootstrap and run the project locally. |
| 4 | + |
| 5 | +## Setup |
| 6 | + |
| 7 | +### 1. Clone the repo |
| 8 | +```shell |
| 9 | +git clone https://github.com/codex-team/codex.docs |
| 10 | +``` |
| 11 | + |
| 12 | +### 2. Install dependencies |
| 13 | + |
| 14 | +```shell |
| 15 | +yarn install |
| 16 | +``` |
| 17 | + |
| 18 | +### 3. Create separate config file for local overrides |
| 19 | + |
| 20 | +```shell |
| 21 | +touch docs-config.local.yaml |
| 22 | +``` |
| 23 | + |
| 24 | +### 4. Run the application |
| 25 | + |
| 26 | +```shell |
| 27 | +yarn dev |
| 28 | +``` |
| 29 | + |
| 30 | +## Starting docs with MongoDB |
| 31 | + |
| 32 | +By default, the application uses a local database powered by [nedb](https://www.npmjs.com/package/nedb). |
| 33 | +In order to use MongoDB, follow these steps: |
| 34 | + |
| 35 | + |
| 36 | +### 1. Run MongoDB instance with docker-compose |
| 37 | + |
| 38 | +```shell |
| 39 | +docker-compose -f docker-compose.dev.yml up mongodb |
| 40 | +``` |
| 41 | + |
| 42 | +### 2. Setup MongoDB driver in docs-config.local.yaml |
| 43 | + |
| 44 | +```yaml |
| 45 | +database: |
| 46 | + driver: mongodb |
| 47 | + mongodb: |
| 48 | + uri: mongodb://localhost:27017/docs |
| 49 | +``` |
| 50 | +
|
| 51 | +### 3. Run the application |
| 52 | +
|
| 53 | +```shell |
| 54 | +yarn dev |
| 55 | +``` |
| 56 | + |
| 57 | +## Convert local database to MongoDB |
| 58 | + |
| 59 | +There is small CLI tool to convert local database to MongoDB in [bin/db-converter](./bin/db-converter/README.md). |
| 60 | +Check it out for more details. |
| 61 | + |
| 62 | +Run it with |
| 63 | + |
| 64 | +```shell |
| 65 | +node bin/db-converter --db-path=./db --mongodb-uri=mongodb://localhost:27017/docs |
| 66 | +``` |
| 67 | + |
| 68 | +## Using S3 uploads driver |
| 69 | + |
| 70 | +Uploads driver is used to store files uploaded by users. |
| 71 | +By default, the application uses local filesystem to store files, but S3 driver is also available. |
| 72 | + |
| 73 | +### 1. Get credentials for S3 bucket |
| 74 | +Create a S3 bucket and get access key and secret key (or use existing ones) |
| 75 | + |
| 76 | +### 2. Setup S3 driver in docs-config.local.yaml |
| 77 | + |
| 78 | +```yaml |
| 79 | +uploads: |
| 80 | + driver: "s3" |
| 81 | + s3: |
| 82 | + bucket: example.codex.so |
| 83 | + region: "eu-central-1" |
| 84 | + baseUrl: "http://example.codex.so.s3-website.eu-central-1.amazonaws.com" |
| 85 | + keyPrefix: "docs-test" |
| 86 | + accessKeyId: "<secret>" |
| 87 | + secretAccessKey: "<secret> |
| 88 | +``` |
| 89 | +
|
| 90 | +### 3. Run the application |
| 91 | +
|
| 92 | +```shell |
| 93 | +yarn dev |
| 94 | +``` |
0 commit comments