Skip to content

Implement docker-compose.yml health checks #1107

Implement docker-compose.yml health checks

Implement docker-compose.yml health checks #1107

Workflow file for this run

name: Publish Documentation
on: push
jobs:
docs:
runs-on: ubuntu-latest
env:
DJANGO_SETTINGS_MODULE: 'backend.settings.test'
REDIS_PORT: 6379
REDIS_CONFIG_DB: 1
REDIS_CACHE_DB: 2
REDIS_HOST: localhost
SQL_PORT: 5432
SQL_USER: ractf
SQL_HOST: localhost
SQL_DATABASE: ractf
SQL_PASSWORD: postgres
services:
postgres:
image: postgres:12-alpine
env:
POSTGRES_PASSWORD: postgres
POSTGRES_EXTENSIONS: citext
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_DB: ractf
POSTGRES_USER: ractf
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis:5
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- uses: actions/setup-node@v2-beta
with:
node-version: '14'
- name: Cache Python modules
uses: actions/cache@v1
env:
cache-name: cache-node-modules
with:
path: ~/.pip
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-
restore-keys: |
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install Poetry
run: curl -sSL https://install.python-poetry.org | python3 -
- name: Disable Virtualenvs
run: $HOME/.local/bin/poetry config virtualenvs.create false
- name: Install Python Dependencies
run: $HOME/.local/bin/poetry install --no-interaction --no-ansi
env:
PIP_CACHE_DIR: ~/.pip
- name: Run Migrations
run: ./manage.py migrate
working-directory: ./src
- name: Generate OpenAPI schema
run: set -eo pipefail && ./src/manage.py getschema | tee openapi-schema.yml
- name: Publish API documentation to GitHub
uses: actions/upload-artifact@v2
with:
name: openapi-schema.yml
path: openapi-schema.yml
- name: Trigger docs-site build
if: github.ref == 'refs/heads/master'
run: |
curl -X POST ${{ secrets.WEBHOOK_URL }} \
-H 'Authorization: token ${{ secrets.WEBHOOK_TOKEN }}' \
--data '{"event_type": "deploy_docs_site"}'