From 1a2121e80534dc4e1191bb8466fa9146f88a0d4e Mon Sep 17 00:00:00 2001 From: Liu Yihao Date: Fri, 16 Aug 2024 03:01:20 +0800 Subject: [PATCH] docs: deploy (WIP) --- docs/config/index.md | 41 +++++++++++++++++++++++++++++++---------- docs/deployment.md | 16 ++++++++++------ pyproject.toml | 3 +++ 3 files changed, 44 insertions(+), 16 deletions(-) diff --git a/docs/config/index.md b/docs/config/index.md index 2d53579..13db0ae 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -1,29 +1,50 @@ # Configuration -Usually a `.env` file is created in the project root directory. +## Setup + +### Env File + +Usually a `.env` file is created in the directory **`projects/sbos-playground`**. The file can be used to configure the playground server. -For example, if the default server port should be changed from `9000` to `10000`, -the following line can be added in the `.env` file: +!!! warning + + Make sure you place the `.env` file in the correct directory. + + +!!! example + + If the default server port should be changed from `9000` to `10000`, + the following line can be added in the `.env` file: + + ```dotenv title=".env" + SERVER_PORT=10000 + ``` -```dotenv title=".env" -SERVER_PORT=10000 -``` +### Environment Variables Alternatively, environment variables can also be used, and its priority is higher. -```bash -export SERVER_PORT=10000 -``` +!!! example + + ```bash + export SERVER_PORT=10000 + ``` + +### Other + +Configuration can also be setup in other places. For detailed environment variables precedence rules, check the section [Environment Variables Precedence](#environment-variables-precedence). + +## Configuration List + !!! note If docker-compose is used to deploy the service, and the configuration entry is not listed in the compose file, the entry should be added to the "environment" section manually. -## Configuration List There are three types of configurations: diff --git a/docs/deployment.md b/docs/deployment.md index 28a0fe8..6d08514 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -11,12 +11,9 @@ cd playground ## Configuration -Create a `.env` file in the project root directory. The file can be used to configure the playground server. -The detailed configurable items can be found [here](config/index.md). +Playground can be configured with various options. +Please follow this [guide](config/index.md) to configure it. -```bash -touch .env -``` ## Deploy the server @@ -32,8 +29,15 @@ touch .env and make sure the `docker-compose` version is at least `v2` === "Direct" - + (Not yet completed) + + The project is managed by `poetry` and `poe`. + + ```bash + poetry install + poe + ``` 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/pyproject.toml b/pyproject.toml index 0c2ce48..4f0b13b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,6 +28,9 @@ cwd = "projects/sbos-playground" cmd = "docker compose -f docker-compose.yml -f docker-compose-dev.yml up -d --build" cwd = "projects/sbos-playground" +[tool.poe.tasks."playground:dev:local"] +cmd = "python -m sbos.playground serve" + [tool.poe.tasks."_playground:prod"] cmd = "docker compose up -d" cwd = "projects/sbos-playground"