diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 900b909..d9f8196 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,3 +42,20 @@ jobs: - name: Build and publish if: success() run: docker buildx build --platform linux/amd64,linux/arm64 --output type=image,push=true -t ${{env.DOCKER_REGISTRY_URL}}/${{env.DOCKER_ORG_NAME}}/${{ env.DOCKER_IMAGE_NAME }}:${{ env.DOCKER_IMAGE_TAG }} -t ${{ env.DOCKER_REGISTRY_URL }}/${{ env.DOCKER_ORG_NAME }}/${{ env.DOCKER_IMAGE_NAME }}:latest . + + publish-documentation: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: "Setup Python" + uses: actions/setup-python@v4.3.1 + with: + python-version: 3.11 + + - name: "Install docs dependencies" + run: pip install -r requirements/docs.txt + + - name: "Build doc and update github pages" + run: mike deploy --push --update-aliases ${{ env.DOCKER_IMAGE_TAG }} latest diff --git a/docker-compose.yml b/docker-compose.yml index 19659c8..f75c53f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.6" services: shopeat-api: - image: shopeat + image: sylvanld/shopeat command: api-start environment: SHOPEAT_API_HOST: "0.0.0.0" @@ -14,7 +14,7 @@ services: - 8000:8000 shopeat-notifier: - image: shopeat + image: sylvanld/shopeat command: notifier-start environment: SHOPEAT_NOTIFIER_HOST: 0.0.0.0 diff --git a/docs/docker-image.md b/docs/docker-image.md new file mode 100644 index 0000000..d511e40 --- /dev/null +++ b/docs/docker-image.md @@ -0,0 +1,57 @@ +## Shopeat docker image + +``` +docker pull sylvanld/shopeat:{imageTag} +``` + +Have a look at dockerhub to find [available image tags](https://hub.docker.com/r/sylvanld/shopeat/tags). + +### Example usage with docker-compose + +```yaml +version: "3.6" + +services: + shopeat-api: + image: sylvanld/shopeat + command: api-start + environment: + SHOPEAT_API_HOST: "0.0.0.0" + SHOPEAT_API_PORT: 8000 + SHOPEAT_AMQP_BROKER_URL: amqp://rabbit:password@rabbitmq + SHOPEAT_JWT_SECRET: tartampion + SHOPEAT_DATABASE_URL: "postgresql+asyncpg://postgres:password@database/shopeat" + ports: + - 8000:8000 + + shopeat-notifier: + image: sylvanld/shopeat + command: notifier-start + environment: + SHOPEAT_NOTIFIER_HOST: 0.0.0.0 + SHOPEAT_NOTIFIER_PORT: 7000 + SHOPEAT_JWT_SECRET: tartampion + SHOPEAT_AMQP_BROKER_URL: amqp://rabbit:password@rabbitmq + ports: + - 7000:7000 + restart: always + + database: + image: postgres:alpine3.17 + ports: + - 5432:5432 + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + restart: always + + rabbitmq: + image: rabbitmq:3-management + ports: + - 5672:5672 + - 15672:15672 + environment: + RABBITMQ_DEFAULT_USER: rabbit + RABBITMQ_DEFAULT_PASS: password + restart: always +``` diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..000ea34 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,17 @@ +# Welcome to MkDocs + +For full documentation visit [mkdocs.org](https://www.mkdocs.org). + +## Commands + +* `mkdocs new [dir-name]` - Create a new project. +* `mkdocs serve` - Start the live-reloading docs server. +* `mkdocs build` - Build the documentation site. +* `mkdocs -h` - Print help message and exit. + +## Project layout + + mkdocs.yml # The configuration file. + docs/ + index.md # The documentation homepage. + ... # Other markdown pages, images and other files. diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..5b05900 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,9 @@ +site_name: ShopEat +theme: + name: material +plugins: + - mike: +extra: + version: + default: 0.0.1 + provider: mike diff --git a/requirements/docs.txt b/requirements/docs.txt new file mode 100644 index 0000000..e08ad28 --- /dev/null +++ b/requirements/docs.txt @@ -0,0 +1,4 @@ +mkdocs>=1.4.2 +mkdocs-material>=8.5.11 +mkdocs-material-extensions>=1.1.1 +mike>=1.1.2 diff --git a/shopeat/__main__.py b/shopeat/__main__.py index c9608f2..b27c2b8 100644 --- a/shopeat/__main__.py +++ b/shopeat/__main__.py @@ -6,6 +6,15 @@ def CLI(): ... +@CLI.command("api-specs") +@click.option("--pretty", is_flag=True, help="Properly indent JSON to make it human readable") +def print_openapi_schema(pretty: bool): + import json + import shopeat.api.asgi + indent = 4 if pretty else None + print(json.dumps(shopeat.api.asgi.app.openapi(), indent=indent)) + + @CLI.command("api-start") def start_api(): import uvicorn