diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..3ff578e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,29 @@ +name: ci +on: + push: + branches: + - master + - main +permissions: + contents: write +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Configure Git Credentials + run: | + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV + - uses: actions/cache@v4 + with: + key: mkdocs-material-${{ env.cache_id }} + path: .cache + restore-keys: | + mkdocs-material- + - run: pip install mkdocs-material + - run: mkdocs gh-deploy --force \ No newline at end of file diff --git a/docs/config.md b/docs/config.md new file mode 100644 index 0000000..af4abbf --- /dev/null +++ b/docs/config.md @@ -0,0 +1 @@ +# Configuration \ No newline at end of file diff --git a/docs/deployment.md b/docs/deployment.md new file mode 100644 index 0000000..8b8b3b6 --- /dev/null +++ b/docs/deployment.md @@ -0,0 +1,43 @@ +# Deployment + +## Clone the repositories + +First, we need to clone `brick-server-minimal`, `brick-server-playground`, `brick-server-frontend`, and `genie-brickified` repos into a same directory. + +```bash +mkdir brick +git clone https://github.com/BrickSchema/brick-example-server +git clone https://github.com/BrickSchema/playground +git clone +``` + +## Configuration + +Create a `.env` file in the playground directory. The file can be used to configure the playground server. +The detailed configurable items can be found [here](config.md). + +```bash +cd playground +touch .env + +``` + +## Deploy the server + +=== "Docker (recommended)" + + In the playground directory, run + + ```bash + docker-compose up --build -d # (1)! + ``` + + 1. make sure the context is correct if not using `docker-compose` but `docker build` + and make sure the `docker-compose` version is at least `v2` + +=== "Direct" + + (Not yet completed) + +Then, open `http://localhost:9000/brickapi/v1/docs`. If the swagger API page is shown, congratulations! +Now you can move to the [next step](init.md) in initialize playground. diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/init.md b/docs/init.md new file mode 100644 index 0000000..997939e --- /dev/null +++ b/docs/init.md @@ -0,0 +1,29 @@ +# Initialization + +## Register admin user + +=== "Username / Password" + + + +=== "Google OAuth2" + + Before using this, ensure that you have setup [Google OAuth2](config.md) in the configuration. + + Use the API `/brickapi/v1/auth/cookie/google/authorize` and the API will return a json response in the format + + ```json + { + "authorization_url": "https://accounts.google.com/o/oauth2/v2/auth?foo=bar" + } + ``` + + Open `authorization_url` in the browser and continue with your google account. + The page will be redirected back to the `FRONTEND_URL` entry in configuration. + By default, it is the url of the Swagger API if you didn't set it. + +!!! note + + You can also register the admin user in the frontend. + We recommand to do it in the Swagger API for convenience of debugging the setup. + \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..92e850c --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,20 @@ +theme: + name: material + features: + - content.code.copy + - content.code.annotate +site_name: Brick Server Playground +docs_dir: docs +markdown_extensions: + - admonition + - pymdownx.details + - pymdownx.highlight: + anchor_linenums: true + use_pygments: true + pygments_lang_class: true +# auto_title: true +# linenums: true + - pymdownx.inlinehilite + - pymdownx.superfences + - pymdownx.tabbed: + alternate_style: true \ No newline at end of file