From 6683724d05182e89971042144f5eb629ef5fdb09 Mon Sep 17 00:00:00 2001 From: Just van den Broecke Date: Tue, 25 May 2021 22:50:23 +0200 Subject: [PATCH] #8 first working version docs service w redeploy --- .github/workflows/deploy.docs.yml | 32 ++++++++++++++++++++++ .github/workflows/deploy.pygeoapi_test.yml | 2 +- .github/workflows/deploy.traefik.yml | 2 +- README.md | 3 +- ansible/deploy.yml | 4 +++ services/docs/Dockerfile | 2 +- services/docs/README.md | 8 ++---- services/docs/docker-compose.yml | 4 +-- 8 files changed, 46 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/deploy.docs.yml diff --git a/.github/workflows/deploy.docs.yml b/.github/workflows/deploy.docs.yml new file mode 100644 index 0000000..6155e42 --- /dev/null +++ b/.github/workflows/deploy.docs.yml @@ -0,0 +1,32 @@ +# Ansible workflow for single service deployment. +# Uses: https://github.com/dawidd6/action-ansible-playbook +# Options: https://github.com/dawidd6/action-ansible-playbook/blob/master/main.js +# Author: Just van den Broecke - 2021 +# +name: Docs Deploy ⚙️ + +# Trigger only when services/docs subdir changed +on: + push: + paths: + - 'services/docs/**' + +jobs: + main: + runs-on: ubuntu-20.04 + + steps: + - name: Checkout ✅ + uses: actions/checkout@v2 + + - name: Run playbook ⚙ + uses: dawidd6/action-ansible-playbook@v2 + with: + playbook: deploy.yml + directory: ./ansible + key: ${{secrets.ANSIBLE_SSH_PRIVATE_KEY}} + inventory: ${{secrets.ANSIBLE_INVENTORY_PROD}} + vault_password: ${{secrets.ANSIBLE_VAULT_PASSWORD}} + options: | + --tags docs + --verbose diff --git a/.github/workflows/deploy.pygeoapi_test.yml b/.github/workflows/deploy.pygeoapi_test.yml index 3a311de..eebb645 100644 --- a/.github/workflows/deploy.pygeoapi_test.yml +++ b/.github/workflows/deploy.pygeoapi_test.yml @@ -5,7 +5,7 @@ # name: pygeoapi test Deploy ⚙️ -# Trigger only when service/traefik subdir changed +# Trigger only when services/pygeoapi_test subdir changed on: push: paths: diff --git a/.github/workflows/deploy.traefik.yml b/.github/workflows/deploy.traefik.yml index 904068f..898cfcb 100644 --- a/.github/workflows/deploy.traefik.yml +++ b/.github/workflows/deploy.traefik.yml @@ -5,7 +5,7 @@ # name: Traefik Deploy ⚙️ -# Trigger only when service/traefik subdir changed +# Trigger only when services/traefik subdir changed on: push: paths: diff --git a/README.md b/README.md index be09c95..3c80af8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ [![Traefik Deploy](https://github.com/Geonovum/ogc-api-testbed/actions/workflows/deploy.traefik.yml/badge.svg)](https://github.com/Geonovum/ogc-api-testbed/actions/workflows/deploy.traefik.yml) [![pygeoapi_test Deploy](https://github.com/Geonovum/ogc-api-testbed/actions/workflows/deploy.pygeoapi_test.yml/badge.svg)](https://github.com/Geonovum/ogc-api-testbed/actions/workflows/deploy.pygeoapi_test.yml) +[![docs Deploy](https://github.com/Geonovum/ogc-api-testbed/actions/workflows/deploy.docs.yml/badge.svg)](https://github.com/Geonovum/ogc-api-testbed/actions/workflows/deploy.docs.yml) [![Gitter](https://img.shields.io/gitter/room/Geonovum/ogc-api-testbed.svg?style=flat-square)](https://gitter.im/Geonovum/ogc-api-testbed) # OGC API Testbed @@ -39,7 +40,7 @@ The operational stack is composed with the following components: * [Traefik](https://traefik.io/) a frontend proxy/load-balancer and SSL (HTTPS) endpoint. * [pygeoapi](https://pygeoapi.io/) a Python server implementation of the OGC API suite of standards. * to be determined: [GeoServer](http://geoserver.org/), [ldproxy](https://interactive-instruments.github.io/ldproxy/), ... -* [mkdocs](https://www.mkdocs.org/) for live documentation +* [mkdocs](https://www.mkdocs.org/) for website and live documentation * both an experimental and stable stack instance is available The above setup has been used with success in several projects like diff --git a/ansible/deploy.yml b/ansible/deploy.yml index 979a86a..a822aec 100644 --- a/ansible/deploy.yml +++ b/ansible/deploy.yml @@ -23,3 +23,7 @@ - name: "pygeoapi_test" shell: "cd {{ services_home }}/pygeoapi_test && ./stop.sh && docker pull geopython/pygeoapi:latest && ./start.sh && docker ps" tags: pygeoapi_test + + - name: "docs" + shell: "cd {{ services_home }}/docs && ./deploy.sh && docker ps" + tags: docs diff --git a/services/docs/Dockerfile b/services/docs/Dockerfile index 402ce6f..16cc6e9 100644 --- a/services/docs/Dockerfile +++ b/services/docs/Dockerfile @@ -10,4 +10,4 @@ WORKDIR /docs/ EXPOSE 8000 -CMD ["mkdocs", "serve"] +CMD ["mkdocs", "serve", "-a", "0.0.0.0:8000"] diff --git a/services/docs/README.md b/services/docs/README.md index 0bddc76..04bbb7e 100644 --- a/services/docs/README.md +++ b/services/docs/README.md @@ -1,8 +1,6 @@ -# Demo service for pygeoapi - test +# Docs -Runs latest GitHub `main` branch of `pygeoapi` using -its [Docker Image from DockerHub](https://cloud.docker.com/u/geopython/repository/docker/geopython/pygeoapi). -with a [local config file](local.config.yml). +Runs main website, landing page, using mkdocs. ## Deployment @@ -12,7 +10,7 @@ when committed/pushed. A GitHub Action invokes an Ansible Playbook. See the following deployment files: -* [GitHub Action](../../.github/workflows/deploy.pygeoapi_test.yml) +* [GitHub Action](../../.github/workflows/deploy.docs.yml) * [Ansible Playbook](../../ansible/deploy.yml) The Ansible Playbook can also be invoked directly. diff --git a/services/docs/docker-compose.yml b/services/docs/docker-compose.yml index beeb455..555e828 100644 --- a/services/docs/docker-compose.yml +++ b/services/docs/docker-compose.yml @@ -20,7 +20,7 @@ services: - "traefik.docker.network=service-network" # SSL/https router - - "traefik.http.routers.docs_https.rule=Host(`${TRAEFIK_SSL_DOMAIN}`) && PathPrefix(`/docs`)" + - "traefik.http.routers.docs_https.rule=Host(`${TRAEFIK_SSL_DOMAIN}`)" - "traefik.http.routers.docs_https.entrypoints=https" - "traefik.http.routers.docs_https.tls=${TRAEFIK_USE_TLS}" - "traefik.http.routers.docs_https.tls.certresolver=${TRAEFIK_SSL_CERT_RESOLVER}" @@ -28,7 +28,7 @@ services: - "traefik.http.routers.docs_https.middlewares=secure-headers@file" # local http router - - "traefik.http.routers.docs_http.rule=Host(`localhost`) && PathPrefixStrip(`/docs`)" + - "traefik.http.routers.docs_http.rule=Host(`localhost`)" - "traefik.http.routers.docs_http.entrypoints=http" networks: