Skip to content

Commit

Permalink
Merge pull request #278 from codex-team/v2
Browse files Browse the repository at this point in the history
CodeX Docs v2.0.0 🤩
  • Loading branch information
nikmel2803 authored Nov 16, 2022
2 parents 698c09c + b6dfd14 commit 882971c
Show file tree
Hide file tree
Showing 101 changed files with 14,719 additions and 2,063 deletions.
15 changes: 0 additions & 15 deletions .codexdocsrc.sample

This file was deleted.

1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*
!public
!src
src/test
!package.json
!yarn.lock
!webpack.config.js
Expand Down
8 changes: 0 additions & 8 deletions .env.sample

This file was deleted.

23 changes: 16 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,26 @@ on:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Get full image name
id: base_image_name
env:
BASE_IMAGE_NAME: ${{ github.repository }}
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
echo "image_name=${REGISTRY}/${BASE_IMAGE_NAME}" >> $GITHUB_OUTPUT
else
echo "image_name=${REGISTRY}/${BASE_IMAGE_NAME}-stage" >> $GITHUB_OUTPUT
fi
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
Expand All @@ -30,13 +40,12 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
images: ${{ steps.base_image_name.outputs.image_name }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value={{branch}}-{{sha}}-{{date 'X'}},enable=${{ startsWith(github.ref, 'refs/heads') }}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{version}},prefix=v
type=semver,pattern=v{{major}}.{{minor}},prefix=v
- name: Build and push image
uses: docker/build-push-action@v3
Expand Down
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ typings/

# Database files
.db/
db/
.testdb/

# Cache of babel and others
Expand All @@ -74,9 +75,13 @@ typings/
.DS_Store

# Uploads
/public/uploads
/uploads
/public/uploads_test

# Compiled files
/dist/*
/public/dist/*

*.local.yaml

static-build
8 changes: 8 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*
!public/**/*
public/uploads
!dist/**/*
!package.json
!README.md
!yarn.lock
!LICENSE
94 changes: 94 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Development guide

This doc describes how to bootstrap and run the project locally.

## Setup

### 1. Clone the repo
```shell
git clone https://github.com/codex-team/codex.docs
```

### 2. Install dependencies

```shell
yarn install
```

### 3. Create separate config file for local overrides

```shell
touch docs-config.local.yaml
```

### 4. Run the application

```shell
yarn dev
```

## Starting docs with MongoDB

By default, the application uses a local database powered by [nedb](https://www.npmjs.com/package/nedb).
In order to use MongoDB, follow these steps:


### 1. Run MongoDB instance with docker-compose

```shell
docker-compose -f docker-compose.dev.yml up mongodb
```

### 2. Setup MongoDB driver in docs-config.local.yaml

```yaml
database:
driver: mongodb
mongodb:
uri: mongodb://localhost:27017/docs
```
### 3. Run the application
```shell
yarn dev
```

## Convert local database to MongoDB

There is small CLI tool to convert local database to MongoDB in [bin/db-converter](./bin/db-converter/README.md).
Check it out for more details.

Run it with

```shell
node bin/db-converter --db-path=./db --mongodb-uri=mongodb://localhost:27017/docs
```

## Using S3 uploads driver

Uploads driver is used to store files uploaded by users.
By default, the application uses local filesystem to store files, but S3 driver is also available.

### 1. Get credentials for S3 bucket
Create a S3 bucket and get access key and secret key (or use existing ones)

### 2. Setup S3 driver in docs-config.local.yaml

```yaml
uploads:
driver: "s3"
s3:
bucket: example.codex.so
region: "eu-central-1"
baseUrl: "http://example.codex.so.s3-website.eu-central-1.amazonaws.com"
keyPrefix: "docs-test"
accessKeyId: "<secret>"
secretAccessKey: "<secret>
```
### 3. Run the application
```shell
yarn dev
```
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Here is our [Demo Application](https://docs-demo.codex.so/) where you can try Co

1. [Getting Started](https://docs.codex.so/getting-started)
2. [Configuration](https://docs.codex.so/configuration)
3. [Deployment](https://docs.codex.so/deployment)
3. [Kubernetes deployment](https://docs.codex.so/k8s-deployment)
4. [Authentication](https://docs.codex.so/authentication)
5. [Writing](https://docs.codex.so/writing)
6. [How to enable analytics](https://docs.codex.so/yandex-metrica)
Expand Down Expand Up @@ -66,6 +66,10 @@ docker-compose up

We have the ready-to-use [Helm chart](https://github.com/codex-team/codex.docs.chart) to deploy project in Kubernetes

## Development

See documentation for developers in [DEVELOPMENT.md](./DEVELOPMENT.md).

# About CodeX

<img align="right" width="120" height="120" src="https://codex.so/public/app/img/codex-logo.svg" hspace="50">
Expand Down
14 changes: 14 additions & 0 deletions bin/db-converter/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": [
"codex"
],
"env": {
"es2022": true
},
"parser": "@babel/eslint-parser",
"parserOptions": {
"requireConfigFile": false,
"sourceType": "module",
"allowImportExportEverywhere": true
}
}
2 changes: 2 additions & 0 deletions bin/db-converter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.yarn/unplugged
.yarn/build-state.yml
Loading

0 comments on commit 882971c

Please sign in to comment.