diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml new file mode 100644 index 0000000..42a5375 --- /dev/null +++ b/.github/workflows/commitlint.yml @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +name: Commitlint +'on': [pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: wagoid/commitlint-github-action@v1 diff --git a/.gitignore b/.gitignore index 0bbb03c..6995110 100644 --- a/.gitignore +++ b/.gitignore @@ -105,7 +105,7 @@ ENV/ .mypy_cache/ # Bundler -Gemfile.lock +.bundle/ # copied `.md` files used for conversion to `.rst` using `m2r` docs/*.md diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..5b8ea2a --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,154 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +############################################################################### +# Define all YAML node anchors +############################################################################### +.node_anchors: + # `only` (also used for `except` where applicable) + only_branch_master_parent_repo: &only_branch_master_parent_repo + - 'master@saltstack-formulas/redis-formula' + # `stage` + stage_lint: &stage_lint 'lint' + stage_release: &stage_release 'release' + stage_test: &stage_test 'test' + # `image` + image_commitlint: &image_commitlint 'myii/ssf-commitlint:11' + image_dindruby: &image_dindruby 'myii/ssf-dind-ruby:2.7.1-r3' + image_precommit: &image_precommit + name: 'myii/ssf-pre-commit:2.9.2' + entrypoint: ['/bin/bash', '-c'] + image_semantic-release: &image_semanticrelease 'myii/ssf-semantic-release:15.14' + # `services` + services_docker_dind: &services_docker_dind + - 'docker:dind' + # `variables` + # https://forum.gitlab.com/t/gitlab-com-ci-caching-rubygems/5627/3 + # https://bundler.io/v1.16/bundle_config.html + variables_bundler: &variables_bundler + BUNDLE_CACHE_PATH: '${CI_PROJECT_DIR}/.cache/bundler' + BUNDLE_WITHOUT: 'production' + # `cache` + cache_bundler: &cache_bundler + key: '${CI_JOB_STAGE}' + paths: + - '${BUNDLE_CACHE_PATH}' + +############################################################################### +# Define stages and global variables +############################################################################### +stages: + - *stage_lint + - *stage_test + - *stage_release +variables: + DOCKER_DRIVER: 'overlay2' + +############################################################################### +# `lint` stage: `commitlint` & `pre-commit` +############################################################################### +commitlint: + stage: *stage_lint + image: *image_commitlint + script: + # Add `upstream` remote to get access to `upstream/master` + - 'git remote add upstream ${CI_PROJECT_URL}.git' + - 'git fetch --all' + # Set default commit hashes for `--from` and `--to` + - 'export COMMITLINT_FROM="$(git merge-base upstream/master HEAD)"' + - 'export COMMITLINT_TO="${CI_COMMIT_SHA}"' + # `coqbot` adds a merge commit to test PRs on top of the latest commit in + # the repo; amend this merge commit message to avoid failure + - | + if [ "${GITLAB_USER_LOGIN}" = "coqbot" ] \ + && [ "${CI_COMMIT_BRANCH}" != "master" ]; then + git commit --amend -m \ + 'chore: reword coqbot merge commit message for commitlint' + export COMMITLINT_TO=HEAD + fi + # Run `commitlint` + - 'commitlint --from "${COMMITLINT_FROM}" + --to "${COMMITLINT_TO}" + --verbose' + +pre-commit: + stage: *stage_lint + image: *image_precommit + # https://pre-commit.com/#gitlab-ci-example + variables: + PRE_COMMIT_HOME: '${CI_PROJECT_DIR}/.cache/pre-commit' + cache: + key: '${CI_JOB_NAME}' + paths: + - '${PRE_COMMIT_HOME}' + script: + - 'pre-commit run --all-files --color always --verbose' + +############################################################################### +# Define `test` template +############################################################################### +.test_instance: + stage: *stage_test + image: *image_dindruby + services: *services_docker_dind + variables: *variables_bundler + cache: *cache_bundler + before_script: + # TODO: This should work from the env vars above automatically + - 'bundle config set path "${BUNDLE_CACHE_PATH}"' + - 'bundle config set without "${BUNDLE_WITHOUT}"' + - 'bundle install' + script: + # Alternative value to consider: `${CI_JOB_NAME}` + - 'bin/kitchen verify "${DOCKER_ENV_CI_JOB_NAME}"' + +############################################################################### +# `test` stage: each instance below uses the `test` template above +############################################################################### +## Define the rest of the matrix based on Kitchen testing +# Make sure the instances listed below match up with +# the `platforms` defined in `kitchen.yml` +default-debian-10-master-py3: {extends: '.test_instance'} +# default-ubuntu-1804-master-py3: {extends: '.test_instance'} +# default-centos-8-master-py3: {extends: '.test_instance'} +# default-fedora-31-master-py3: {extends: '.test_instance'} +# default-opensuse-leap-151-master-py3: {extends: '.test_instance'} +# default-amazonlinux-2-master-py3: {extends: '.test_instance'} +# default-debian-10-2019-2-py3: {extends: '.test_instance'} +# default-debian-9-2019-2-py3: {extends: '.test_instance'} +# default-ubuntu-1804-2019-2-py3: {extends: '.test_instance'} +default-centos-8-2019-2-py3: {extends: '.test_instance'} +default-fedora-31-2019-2-py3: {extends: '.test_instance'} +# default-opensuse-leap-151-2019-2-py3: {extends: '.test_instance'} +# default-centos-7-2019-2-py2: {extends: '.test_instance'} +# default-amazonlinux-2-2019-2-py3: {extends: '.test_instance'} +# default-arch-base-latest-2019-2-py2: {extends: '.test_instance'} +# default-fedora-30-2018-3-py3: {extends: '.test_instance'} +# default-debian-9-2018-3-py2: {extends: '.test_instance'} +# default-ubuntu-1604-2018-3-py2: {extends: '.test_instance'} +# default-centos-7-2018-3-py2: {extends: '.test_instance'} +# default-opensuse-leap-151-2018-3-py2: {extends: '.test_instance'} +# default-amazonlinux-1-2018-3-py2: {extends: '.test_instance'} +# default-arch-base-latest-2018-3-py2: {extends: '.test_instance'} +# default-debian-8-2017-7-py2: {extends: '.test_instance'} +# default-ubuntu-1604-2017-7-py2: {extends: '.test_instance'} +# default-centos-6-2017-7-py2: {extends: '.test_instance'} +# default-fedora-30-2017-7-py2: {extends: '.test_instance'} +# default-opensuse-leap-151-2017-7-py2: {extends: '.test_instance'} +# default-amazonlinux-1-2017-7-py2: {extends: '.test_instance'} +# default-arch-base-latest-2017-7-py2: {extends: '.test_instance'} + +############################################################################### +# `release` stage: `semantic-release` +############################################################################### +semantic-release: + only: *only_branch_master_parent_repo + stage: *stage_release + image: *image_semanticrelease + variables: + MAINTAINER_TOKEN: '${GH_TOKEN}' + script: + # Update `AUTHORS.md` + - '${HOME}/go/bin/maintainer contributor' + # Run `semantic-release` + - 'semantic-release' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..0efdb51 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +default_stages: [commit] +repos: + - repo: https://github.com/dafyddj/commitlint-pre-commit-hook + rev: v2.3.0 + hooks: + - id: commitlint + name: Check commit message using commitlint + description: Lint commit message against @commitlint/config-conventional rules + stages: [commit-msg] + additional_dependencies: ['@commitlint/config-conventional@8.3.4'] + - id: commitlint-travis + stages: [manual] + additional_dependencies: ['@commitlint/config-conventional@8.3.4'] + always_run: true + - repo: https://github.com/adithyabsk/mirrors-rubocop + rev: v0.91.0 + hooks: + - id: rubocop + name: Check Ruby files with rubocop + args: [--debug] + always_run: true + pass_filenames: false + - repo: https://github.com/jumanjihouse/pre-commit-hooks + rev: 2.1.3 + hooks: + - id: shellcheck + name: Check shell scripts with shellcheck + files: ^.*\.(sh|bash|ksh)$ + types: [] + args: [] + - repo: https://github.com/adrienverge/yamllint.git + rev: v1.23.0 + hooks: + - id: yamllint + name: Check YAML syntax with yamllint + args: [--strict, '.'] + always_run: true + pass_filenames: false + - repo: https://github.com/warpnet/salt-lint + rev: v0.3.0 + hooks: + - id: salt-lint + name: Check Salt files using salt-lint + files: ^.*\.(sls|jinja|j2|tmpl|tst)$ + - repo: https://github.com/myint/rstcheck + rev: 3f929574 + hooks: + - id: rstcheck + name: Check reST files using rstcheck + exclude: 'docs/CHANGELOG.rst' + args: [--report=warning] diff --git a/.rstcheck.cfg b/.rstcheck.cfg new file mode 100644 index 0000000..05856dc --- /dev/null +++ b/.rstcheck.cfg @@ -0,0 +1,3 @@ +[rstcheck] +report=error +ignore_language=rst diff --git a/.rubocop.yml b/.rubocop.yml index bdae9aa..7fd75ac 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,9 +2,15 @@ # vim: ft=yaml --- # General overrides used across formulas in the org -Metrics/LineLength: +Layout/LineLength: # Increase from default of `80` # Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`) Max: 88 +Metrics/BlockLength: + ExcludedMethods: + - control + - describe + # Increase from default of `25` + Max: 30 # Any offenses that should be fixed, e.g. collected via. `rubocop --auto-gen-config` diff --git a/.salt-lint b/.salt-lint index a539954..3715677 100644 --- a/.salt-lint +++ b/.salt-lint @@ -2,6 +2,7 @@ # vim: ft=yaml --- exclude_paths: [] +rules: {} skip_list: # Using `salt-lint` for linting other files as well, such as Jinja macros/templates - 205 # Use ".sls" as a Salt State file extension diff --git a/.travis.yml b/.travis.yml index 4e3f22d..dcc9a8e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,28 @@ # -*- coding: utf-8 -*- # vim: ft=yaml --- +################################################################################ +# NOTE: This file is UNMAINTAINED; it is provided for references purposes only. +# No guarantees are tendered that this structure will work after 2020. +################################################################################ +# * https://en.wikipedia.org/wiki/Travis_CI: +# - "... free open-source plans were removed in [sic] the end of 2020" +# - https://blog.travis-ci.com/2020-11-02-travis-ci-new-billing +# - https://ropensci.org/technotes/2020/11/19/moving-away-travis/ +################################################################################ ## Machine config -dist: bionic -sudo: required -services: - - docker +os: 'linux' +arch: 'amd64' +dist: 'bionic' +version: '~> 1.0' ## Language and cache config -language: ruby -cache: bundler +language: 'ruby' +cache: 'bundler' + +## Services config +services: + - docker ## Script to run for the test stage script: @@ -18,23 +31,25 @@ script: ## Stages and jobs matrix stages: - test - - name: release - if: branch = master AND type != pull_request + # # As part of the switch away from Travis CI, ensure that the `release` stage + # # is not run inadvertently + # - name: 'release' + # if: 'branch = master AND type != pull_request' jobs: include: ## Define the test stage that runs the linters (and testing matrix, if applicable) # Run all of the linters in a single job - - language: node_js - node_js: lts/* - env: Lint - name: 'Lint: salt-lint, yamllint, rubocop & commitlint' - before_install: skip + - language: 'node_js' + node_js: 'lts/*' + env: 'Lint' + name: 'Lint: salt-lint, yamllint, rubocop, shellcheck & commitlint' + before_install: 'skip' script: # Install and run `salt-lint` - pip install --user salt-lint - - git ls-files | grep '\.sls$\|\.jinja$\|\.j2$\|\.tmpl$' - | xargs -I {} salt-lint {} + - git ls-files -- '*.sls' '*.jinja' '*.j2' '*.tmpl' '*.tst' + | xargs salt-lint # Install and run `yamllint` # Need at least `v1.17.0` for the `yaml-files` setting - pip install --user yamllint>=1.17.0 @@ -42,50 +57,69 @@ jobs: # Install and run `rubocop` - gem install rubocop - rubocop -d + # Run `shellcheck` (already pre-installed in Travis) + - shellcheck --version + - git ls-files -- '*.sh' '*.bash' '*.ksh' + | xargs shellcheck # Install and run `commitlint` - - npm install @commitlint/config-conventional -D - - npm install @commitlint/travis-cli -D + - npm i -D @commitlint/config-conventional + @commitlint/travis-cli - commitlint-travis + # Run `pre-commit` linters in a single job + - language: 'python' + env: 'Lint_pre-commit' + name: 'Lint: pre-commit' + before_install: 'skip' + cache: + directories: + - $HOME/.cache/pre-commit + script: + # Install and run `pre-commit` + - pip install pre-commit==2.7.1 + - pre-commit run --all-files --color always --verbose + - pre-commit run --color always --hook-stage manual --verbose commitlint-travis + ## Define the rest of the matrix based on Kitchen testing # Make sure the instances listed below match up with # the `platforms` defined in `kitchen.yml` - - env: INSTANCE=default-debian-10-develop-py3 - # - env: INSTANCE=default-ubuntu-1804-develop-py3 - # - env: INSTANCE=default-centos-7-develop-py3 - # - env: INSTANCE=default-fedora-30-develop-py3 - # - env: INSTANCE=default-opensuse-leap-15-develop-py3 - # - env: INSTANCE=default-amazonlinux-2-develop-py2 - # - env: INSTANCE=default-arch-base-latest-develop-py2 + - env: INSTANCE=default-debian-10-master-py3 + # - env: INSTANCE=default-ubuntu-1804-master-py3 + # - env: INSTANCE=default-centos-8-master-py3 + # - env: INSTANCE=default-fedora-31-master-py3 + # - env: INSTANCE=default-opensuse-leap-151-master-py3 + # - env: INSTANCE=default-amazonlinux-2-master-py3 + # - env: INSTANCE=default-debian-10-2019-2-py3 # - env: INSTANCE=default-debian-9-2019-2-py3 # - env: INSTANCE=default-ubuntu-1804-2019-2-py3 - - env: INSTANCE=default-centos-7-2019-2-py3 - - env: INSTANCE=default-fedora-30-2019-2-py3 - # - env: INSTANCE=default-opensuse-leap-15-2019-2-py3 - # - env: INSTANCE=default-amazonlinux-2-2019-2-py2 + - env: INSTANCE=default-centos-8-2019-2-py3 + - env: INSTANCE=default-fedora-31-2019-2-py3 + # - env: INSTANCE=default-opensuse-leap-151-2019-2-py3 + # - env: INSTANCE=default-centos-7-2019-2-py2 + # - env: INSTANCE=default-amazonlinux-2-2019-2-py3 # - env: INSTANCE=default-arch-base-latest-2019-2-py2 - - env: INSTANCE=default-debian-9-2018-3-py2 - - env: INSTANCE=default-ubuntu-1604-2018-3-py2 + # - env: INSTANCE=default-fedora-30-2018-3-py3 + # - env: INSTANCE=default-debian-9-2018-3-py2 + # - env: INSTANCE=default-ubuntu-1604-2018-3-py2 # - env: INSTANCE=default-centos-7-2018-3-py2 - # - env: INSTANCE=default-fedora-29-2018-3-py2 - # - env: INSTANCE=default-opensuse-leap-15-2018-3-py2 - # - env: INSTANCE=default-amazonlinux-2-2018-3-py2 + # - env: INSTANCE=default-opensuse-leap-151-2018-3-py2 + # - env: INSTANCE=default-amazonlinux-1-2018-3-py2 # - env: INSTANCE=default-arch-base-latest-2018-3-py2 # - env: INSTANCE=default-debian-8-2017-7-py2 # - env: INSTANCE=default-ubuntu-1604-2017-7-py2 - - env: INSTANCE=default-centos-6-2017-7-py2 - # - env: INSTANCE=default-fedora-29-2017-7-py2 - # - env: INSTANCE=default-opensuse-leap-15-2017-7-py2 - # - env: INSTANCE=default-amazonlinux-2-2017-7-py2 + # - env: INSTANCE=default-centos-6-2017-7-py2 + # - env: INSTANCE=default-fedora-30-2017-7-py2 + # - env: INSTANCE=default-opensuse-leap-151-2017-7-py2 + # - env: INSTANCE=default-amazonlinux-1-2017-7-py2 # - env: INSTANCE=default-arch-base-latest-2017-7-py2 ## Define the release stage that runs `semantic-release` - - stage: release - language: node_js - node_js: lts/* - env: Release + - stage: 'release' + language: 'node_js' + node_js: 'lts/*' + env: 'Release' name: 'Run semantic-release inc. file updates to AUTHORS, CHANGELOG & FORMULA' - before_install: skip + before_install: 'skip' script: # Update `AUTHORS.md` - export MAINTAINER_TOKEN=${GH_TOKEN} @@ -93,12 +127,26 @@ jobs: - maintainer contributor # Install all dependencies required for `semantic-release` - - npm install @semantic-release/changelog@3 -D - - npm install @semantic-release/exec@3 -D - - npm install @semantic-release/git@7 -D + - npm i -D @semantic-release/changelog@3 + @semantic-release/exec@3 + @semantic-release/git@7 deploy: - provider: script - skip_cleanup: true - script: - # Run `semantic-release` - - npx semantic-release@15 + provider: 'script' + # Opt-in to `dpl v2` to complete the Travis build config validation (beta) + # * https://docs.travis-ci.com/user/build-config-validation + # Deprecated `skip_cleanup` can now be avoided, `cleanup: false` is by default + edge: true + # Run `semantic-release` + script: 'npx semantic-release@15.14' + +# Notification options: `always`, `never` or `change` +notifications: + webhooks: + if: 'repo = saltstack-formulas/redis-formula' + urls: + - https://saltstack-formulas.zulipchat.com/api/v1/external/travis?api_key=HsIq3o5QmLxdnVCKF9is0FUIpkpAY79P&stream=CI&topic=saltstack-formulas%2Fredis-formula&ignore_pull_requests=true + on_success: always # default: always + on_failure: always # default: always + on_start: always # default: never + on_cancel: always # default: always + on_error: always # default: always diff --git a/.yamllint b/.yamllint index 740beca..73bcbe2 100644 --- a/.yamllint +++ b/.yamllint @@ -9,6 +9,7 @@ extends: default # 2. Any SLS files under directory `test/`, which are actually state files # 3. Any YAML files under directory `.kitchen/`, introduced during local testing ignore: | + .cache/ node_modules/ test/**/states/**/*.sls .kitchen/ diff --git a/AUTHORS.md b/AUTHORS.md index d6cb7ae..97a8462 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -4,12 +4,12 @@ This list is sorted by the number of commits per contributor in _descending_ ord Avatar|Contributor|Contributions :-:|---|:-: -@benKenob1|[@benKenob1](https://github.com/benKenob1)|51 -@myii|[@myii](https://github.com/myii)|24 +@myii|[@myii](https://github.com/myii)|64 @gravyboat|[@gravyboat](https://github.com/gravyboat)|14 @nmadhok|[@nmadhok](https://github.com/nmadhok)|13 @alex-leonhardt|[@alex-leonhardt](https://github.com/alex-leonhardt)|9 @aboe76|[@aboe76](https://github.com/aboe76)|9 +@noelmcloughlin|[@noelmcloughlin](https://github.com/noelmcloughlin)|6 @alfredopalhares|[@alfredopalhares](https://github.com/alfredopalhares)|5 @techhat|[@techhat](https://github.com/techhat)|5 @stp-ip|[@stp-ip](https://github.com/stp-ip)|5 @@ -21,11 +21,13 @@ Avatar|Contributor|Contributions @myoung34|[@myoung34](https://github.com/myoung34)|3 @amontalban|[@amontalban](https://github.com/amontalban)|2 @bkmit|[@bkmit](https://github.com/bkmit)|2 +@dafyddj|[@dafyddj](https://github.com/dafyddj)|2 @dmyerscough|[@dmyerscough](https://github.com/dmyerscough)|2 @envintus|[@envintus](https://github.com/envintus)|2 @DrDarch|[@DrDarch](https://github.com/DrDarch)|2 @joshboon|[@joshboon](https://github.com/joshboon)|2 @roock|[@roock](https://github.com/roock)|2 +@stamak|[@stamak](https://github.com/stamak)|2 @stevendgonzales|[@stevendgonzales](https://github.com/stevendgonzales)|2 @abednarik|[@abednarik](https://github.com/abednarik)|2 @puneetk|[@puneetk](https://github.com/puneetk)|2 @@ -35,11 +37,10 @@ Avatar|Contributor|Contributions @ezheidtmann|[@ezheidtmann](https://github.com/ezheidtmann)|1 @syphernl|[@syphernl](https://github.com/syphernl)|1 @mattbarto|[@mattbarto](https://github.com/mattbarto)|1 -@stamak|[@stamak](https://github.com/stamak)|1 @kevops|[@kevops](https://github.com/kevops)|1 @mskim5383|[@mskim5383](https://github.com/mskim5383)|1 @tmandry|[@tmandry](https://github.com/tmandry)|1 --- -Auto-generated by a [forked version](https://github.com/myii/maintainer) of [gaocegege/maintainer](https://github.com/gaocegege/maintainer) on 2019-10-11. +Auto-generated by a [forked version](https://github.com/myii/maintainer) of [gaocegege/maintainer](https://github.com/gaocegege/maintainer) on 2020-12-16. diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d8d665..53d46a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,61 @@ # Changelog +# [0.27.0](https://github.com/saltstack-formulas/redis-formula/compare/v0.26.2...v0.27.0) (2020-12-16) + + +### Bug Fixes + +* **defaults:** fix `yamllint` violation [skip ci] ([90093e2](https://github.com/saltstack-formulas/redis-formula/commit/90093e2592a039ca8ab382a88d5f0682dd70f6a8)) +* **init:** convert to metastate; add clean state ([ca5f5aa](https://github.com/saltstack-formulas/redis-formula/commit/ca5f5aadbb33e2ebcda82595221232cdde12ba2a)) +* **release.config.js:** use full commit hash in commit link [skip ci] ([9c0b42a](https://github.com/saltstack-formulas/redis-formula/commit/9c0b42a3b64768d0e75ed1e06cc9d4a4aed54036)) + + +### Code Refactoring + +* **server:** simplify install.sls ([f86a718](https://github.com/saltstack-formulas/redis-formula/commit/f86a718bddf7da40e7f57d5480160b78432cb7c8)) + + +### Continuous Integration + +* **gemfile:** restrict `train` gem version until upstream fix [skip ci] ([adff150](https://github.com/saltstack-formulas/redis-formula/commit/adff15056572fc3b3198d405e944032b0e55498b)) +* **gemfile.lock:** add to repo with updated `Gemfile` [skip ci] ([e7f1305](https://github.com/saltstack-formulas/redis-formula/commit/e7f13054514241858b3e24da8c972c71262f1e46)) +* **gitlab-ci:** use GitLab CI as Travis CI replacement ([38840b7](https://github.com/saltstack-formulas/redis-formula/commit/38840b7cbf4754faed3d8ebcc13fc26911043a40)) +* **kitchen:** avoid using bootstrap for `master` instances [skip ci] ([7957381](https://github.com/saltstack-formulas/redis-formula/commit/7957381a36185ee1fda6dda86c037b7cdd59bbd1)) +* **kitchen:** use `debian-10-master-py3` instead of `develop` [skip ci] ([e01a263](https://github.com/saltstack-formulas/redis-formula/commit/e01a263f3fc91c47e9d389987cdd0907bedf0996)) +* **kitchen:** use `develop` image until `master` is ready (`amazonlinux`) [skip ci] ([769ec90](https://github.com/saltstack-formulas/redis-formula/commit/769ec907a94e66d53472a3f77d3ef132c42f289c)) +* **kitchen:** use `saltimages` Docker Hub where available [skip ci] ([8bf0065](https://github.com/saltstack-formulas/redis-formula/commit/8bf0065b4f7ac57380aec2a5d61ec7b9d3f4bc9c)) +* **kitchen+travis:** remove `master-py2-arch-base-latest` [skip ci] ([a0d6394](https://github.com/saltstack-formulas/redis-formula/commit/a0d63945ba9860f597e55829ae88a9b57b260bcc)) +* **kitchen+travis:** upgrade matrix after `2019.2.2` release [skip ci] ([0d7108e](https://github.com/saltstack-formulas/redis-formula/commit/0d7108e0ef48b57a2900e0b52c6ce4eecca5e3f0)) +* **pre-commit:** add to formula [skip ci] ([b48efa9](https://github.com/saltstack-formulas/redis-formula/commit/b48efa9fe371f433b3f4cf1fd8fc3e5f9770d33a)) +* **pre-commit:** enable/disable `rstcheck` as relevant [skip ci] ([d180e9b](https://github.com/saltstack-formulas/redis-formula/commit/d180e9b40e9e7ae7d84605458be3e0ef428aed19)) +* **pre-commit:** finalise `rstcheck` configuration [skip ci] ([13311ce](https://github.com/saltstack-formulas/redis-formula/commit/13311ced4ac193e58deb9e8a3a24b1390f75f5fb)) +* **travis:** add notifications => zulip [skip ci] ([6e49f55](https://github.com/saltstack-formulas/redis-formula/commit/6e49f55c1ffd8e9f9cf31149c803f81da4271bb8)) +* **travis:** apply changes from build config validation [skip ci] ([503fa20](https://github.com/saltstack-formulas/redis-formula/commit/503fa20cfbb17560c9e8c53786125dfa5dbf9d62)) +* **travis:** opt-in to `dpl v2` to complete build config validation [skip ci] ([a3efd1f](https://github.com/saltstack-formulas/redis-formula/commit/a3efd1f94d38c1f238ddfaf357afb9e83bdf7369)) +* **travis:** quote pathspecs used with `git ls-files` [skip ci] ([da71c9d](https://github.com/saltstack-formulas/redis-formula/commit/da71c9d60458079d71a775abbfaadf2a0ea99665)) +* **travis:** run `shellcheck` during lint job [skip ci] ([e63b945](https://github.com/saltstack-formulas/redis-formula/commit/e63b945e615c7a35cf87f86d2885a1349814332a)) +* **travis:** update `salt-lint` config for `v0.0.10` [skip ci] ([b317fec](https://github.com/saltstack-formulas/redis-formula/commit/b317fec818f243acd45d184e30ac34aa5313b37d)) +* **travis:** use `major.minor` for `semantic-release` version [skip ci] ([fe02b53](https://github.com/saltstack-formulas/redis-formula/commit/fe02b53ebde0595a03fd6f3f4b77d0826f060363)) +* **travis:** use build config validation (beta) [skip ci] ([a0ffb8a](https://github.com/saltstack-formulas/redis-formula/commit/a0ffb8adc0e4f31f5893e12ffc33120ec89c78f6)) +* **workflows/commitlint:** add to repo [skip ci] ([b9b286b](https://github.com/saltstack-formulas/redis-formula/commit/b9b286b7efa71435f6804dbc351e1615e11f221a)) + + +### Documentation + +* **contributing:** remove to use org-level file instead [skip ci] ([a803116](https://github.com/saltstack-formulas/redis-formula/commit/a803116832161bfdf10085cc3788fbfdf5963b4d)) +* **readme:** fix `rstcheck` violation & standardise [skip ci] ([ca32bfd](https://github.com/saltstack-formulas/redis-formula/commit/ca32bfdc1d2016deda4a074103d0bbea6b553a6a)) +* **readme:** update link to `CONTRIBUTING` [skip ci] ([bd011b8](https://github.com/saltstack-formulas/redis-formula/commit/bd011b8e06017cd8c78a4a53a2a49889d6c7ab48)) + + +### Features + +* **suse:** basic opensuse support; tidyup ([f29f544](https://github.com/saltstack-formulas/redis-formula/commit/f29f544f6cbb87dbb3f568eae9f352cb75af1f90)) + + +### Performance Improvements + +* **travis:** improve `salt-lint` invocation [skip ci] ([186796b](https://github.com/saltstack-formulas/redis-formula/commit/186796b70d656b4c3c27d8934eccb92458f7ec02)) + ## [0.26.2](https://github.com/saltstack-formulas/redis-formula/compare/v0.26.1...v0.26.2) (2019-10-11) diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..ef5bffa --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,48 @@ +# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners + +# SECTION: Owner(s) for everything in the repo, unless a later match takes precedence +# ************************************************************************** +# *** NO GLOBAL OWNER(S) SPECIFIED *** +# *** Ideally this will be defined for a healthy, well-maintained repo *** +# ************************************************************************** +# FILE PATTERN OWNER(S) +* @NONE + +# SECTION: Owner(s) for specific directories +# FILE PATTERN OWNER(S) + +# SECTION: Owner(s) for files/directories related to `semantic-release` +# FILE PATTERN OWNER(S) +/.github/workflows/ @saltstack-formulas/ssf +/bin/install-hooks @saltstack-formulas/ssf +/bin/kitchen @saltstack-formulas/ssf +/docs/AUTHORS.rst @saltstack-formulas/ssf +/docs/CHANGELOG.rst @saltstack-formulas/ssf +/docs/TOFS_pattern.rst @saltstack-formulas/ssf +/*/libsaltcli.jinja @saltstack-formulas/ssf +/*/libtofs.jinja @saltstack-formulas/ssf +/test/integration/**/inspec.yml @saltstack-formulas/ssf +/test/integration/**/README.md @saltstack-formulas/ssf +/.gitignore @saltstack-formulas/ssf +/.cirrus.yml @saltstack-formulas/ssf +/.gitlab-ci.yml @saltstack-formulas/ssf +/.pre-commit-config.yaml @saltstack-formulas/ssf +/.rstcheck.cfg @saltstack-formulas/ssf +/.rubocop.yml @saltstack-formulas/ssf +/.salt-lint @saltstack-formulas/ssf +/.travis.yml @saltstack-formulas/ssf +/.yamllint @saltstack-formulas/ssf +/AUTHORS.md @saltstack-formulas/ssf +/CHANGELOG.md @saltstack-formulas/ssf +/CODEOWNERS @saltstack-formulas/ssf +/commitlint.config.js @saltstack-formulas/ssf +/FORMULA @saltstack-formulas/ssf +/Gemfile @saltstack-formulas/ssf +/Gemfile.lock @saltstack-formulas/ssf +/kitchen.yml @saltstack-formulas/ssf +/pre-commit_semantic-release.sh @saltstack-formulas/ssf +/release-rules.js @saltstack-formulas/ssf +/release.config.js @saltstack-formulas/ssf + +# SECTION: Owner(s) for specific files +# FILE PATTERN OWNER(S) diff --git a/FORMULA b/FORMULA index b33a647..d885a04 100644 --- a/FORMULA +++ b/FORMULA @@ -1,7 +1,7 @@ name: redis os: Debian, Ubuntu, RedHat, Fedora, CentOS os_family: Debian, RedHat -version: 0.26.2 +version: 0.27.0 release: 1 minimum_version: 2017.7 summary: template formula diff --git a/Gemfile b/Gemfile index 5a232b6..82c4a31 100644 --- a/Gemfile +++ b/Gemfile @@ -2,6 +2,11 @@ source 'https://rubygems.org' -gem 'kitchen-docker', '>= 2.9' -gem 'kitchen-inspec', '>= 1.1' -gem 'kitchen-salt', '>= 0.6.0' +# Use the latest version of `inspec` prior to `4.23.4`, which introduces a +# regression where the diff isn't displayed when comparing using `eq`. +gem 'inspec', '~> 4.22.22' +# Install the `kitchen-docker` gem from GitHub because the latest version +# currently available (`2.10.0`) doesn't include a recent fix for Gentoo. +gem 'kitchen-docker', github: 'test-kitchen/kitchen-docker', ref: '41e80fe' +gem 'kitchen-inspec', '>= 2.2.1' +gem 'kitchen-salt', '>= 0.6.3' diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..19bf26d --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,530 @@ +GIT + remote: https://github.com/test-kitchen/kitchen-docker.git + revision: 41e80fed3a7cc86323e19c16a5a340cebf7e5848 + ref: 41e80fe + specs: + kitchen-docker (2.10.0) + test-kitchen (>= 1.0.0) + +GEM + remote: https://rubygems.org/ + specs: + activesupport (5.2.4.4) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + aws-eventstream (1.1.0) + aws-partitions (1.386.0) + aws-sdk-apigateway (1.55.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-apigatewayv2 (1.29.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-athena (1.33.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-autoscaling (1.22.0) + aws-sdk-core (~> 3, >= 3.52.1) + aws-sigv4 (~> 1.1) + aws-sdk-budgets (1.36.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-cloudformation (1.44.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-cloudfront (1.46.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-cloudhsm (1.27.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-cloudhsmv2 (1.30.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-cloudtrail (1.29.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-cloudwatch (1.45.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-cloudwatchlogs (1.38.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-codecommit (1.40.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-codedeploy (1.37.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-codepipeline (1.37.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-configservice (1.53.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-core (3.109.1) + aws-eventstream (~> 1, >= 1.0.2) + aws-partitions (~> 1, >= 1.239.0) + aws-sigv4 (~> 1.1) + jmespath (~> 1.0) + aws-sdk-costandusagereportservice (1.28.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-dynamodb (1.55.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-ec2 (1.202.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-ecr (1.39.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-ecs (1.70.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-efs (1.36.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-eks (1.45.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-elasticache (1.44.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-elasticbeanstalk (1.39.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-elasticloadbalancing (1.29.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-elasticloadbalancingv2 (1.53.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-elasticsearchservice (1.43.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-firehose (1.35.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-guardduty (1.42.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-iam (1.46.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-kafka (1.29.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-kinesis (1.30.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-kms (1.39.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-lambda (1.51.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-organizations (1.17.0) + aws-sdk-core (~> 3, >= 3.39.0) + aws-sigv4 (~> 1.0) + aws-sdk-rds (1.104.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-redshift (1.50.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-route53 (1.44.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-route53domains (1.28.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-route53resolver (1.21.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-s3 (1.83.1) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.1) + aws-sdk-securityhub (1.35.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-ses (1.36.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-sms (1.27.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-sns (1.34.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-sqs (1.34.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-ssm (1.95.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sigv4 (1.2.2) + aws-eventstream (~> 1, >= 1.0.2) + azure_graph_rbac (0.17.2) + ms_rest_azure (~> 0.12.0) + azure_mgmt_key_vault (0.17.6) + ms_rest_azure (~> 0.12.0) + azure_mgmt_resources (0.18.0) + ms_rest_azure (~> 0.12.0) + azure_mgmt_security (0.18.2) + ms_rest_azure (~> 0.12.0) + azure_mgmt_storage (0.22.0) + ms_rest_azure (~> 0.12.0) + bcrypt_pbkdf (1.0.1) + builder (3.2.4) + chef-config (16.6.14) + addressable + chef-utils (= 16.6.14) + fuzzyurl + mixlib-config (>= 2.2.12, < 4.0) + mixlib-shellout (>= 2.0, < 4.0) + tomlrb (~> 1.2) + chef-telemetry (1.0.14) + chef-config + concurrent-ruby (~> 1.0) + ffi-yajl (~> 2.2) + chef-utils (16.6.14) + coderay (1.1.3) + concurrent-ruby (1.1.7) + declarative (0.0.20) + declarative-option (0.1.0) + diff-lcs (1.4.4) + docker-api (2.0.0) + excon (>= 0.47.0) + multi_json + domain_name (0.5.20190701) + unf (>= 0.0.5, < 1.0.0) + ecma-re-validator (0.2.1) + regexp_parser (~> 1.2) + ed25519 (1.2.4) + erubi (1.9.0) + excon (0.78.0) + faraday (0.17.3) + multipart-post (>= 1.2, < 3) + faraday-cookie_jar (0.0.7) + faraday (>= 0.8.0) + http-cookie (~> 1.0.0) + faraday_middleware (0.12.2) + faraday (>= 0.7.4, < 1.0) + ffi (1.13.1) + ffi-yajl (2.3.4) + libyajl2 (~> 1.2) + fuzzyurl (0.9.0) + google-api-client (0.44.0) + addressable (~> 2.5, >= 2.5.1) + googleauth (~> 0.9) + httpclient (>= 2.8.1, < 3.0) + mini_mime (~> 1.0) + representable (~> 3.0) + retriable (>= 2.0, < 4.0) + signet (~> 0.12) + googleauth (0.13.0) + faraday (>= 0.17.3, < 2.0) + jwt (>= 1.4, < 3.0) + memoist (~> 0.16) + multi_json (~> 1.11) + os (>= 0.9, < 2.0) + signet (~> 0.14) + gssapi (1.3.0) + ffi (>= 1.0.1) + gyoku (1.3.1) + builder (>= 2.1.2) + hana (1.3.6) + hashie (3.6.0) + http-cookie (1.0.3) + domain_name (~> 0.5) + httpclient (2.8.3) + i18n (1.8.5) + concurrent-ruby (~> 1.0) + inifile (3.0.0) + inspec (4.22.22) + faraday_middleware (~> 0.12.2) + inspec-core (= 4.22.22) + train (~> 3.0) + train-aws (~> 0.1) + train-habitat (~> 0.1) + train-winrm (~> 0.2) + inspec-core (4.22.22) + addressable (~> 2.4) + chef-telemetry (~> 1.0) + faraday (>= 0.9.0) + hashie (~> 3.4) + json_schemer (>= 0.2.1, < 0.2.12) + license-acceptance (>= 0.2.13, < 2.0) + method_source (>= 0.8, < 2.0) + mixlib-log (~> 3.0) + multipart-post (~> 2.0) + parallel (~> 1.9) + parslet (~> 1.5) + pry (~> 0.13) + rspec (~> 3.9) + rspec-its (~> 1.2) + rubyzip (~> 1.2, >= 1.2.2) + semverse (~> 3.0) + sslshake (~> 1.2) + thor (>= 0.20, < 2.0) + tomlrb (~> 1.2.0) + train-core (~> 3.0) + tty-prompt (~> 0.17) + tty-table (~> 0.10) + jmespath (1.4.0) + json (2.3.1) + json_schemer (0.2.11) + ecma-re-validator (~> 0.2) + hana (~> 1.3) + regexp_parser (~> 1.5) + uri_template (~> 0.7) + jwt (2.2.2) + kitchen-inspec (2.2.1) + hashie (~> 3.4) + inspec (>= 2.2.64, < 5.0) + test-kitchen (>= 2.7, < 3) + kitchen-salt (0.6.3) + hashie (>= 3.5) + test-kitchen (>= 1.4) + libyajl2 (1.2.0) + license-acceptance (1.0.19) + pastel (~> 0.7) + tomlrb (~> 1.2) + tty-box (~> 0.3) + tty-prompt (~> 0.18) + little-plugger (1.1.4) + logging (2.3.0) + little-plugger (~> 1.1) + multi_json (~> 1.14) + memoist (0.16.2) + method_source (1.0.0) + mini_mime (1.0.2) + minitest (5.14.2) + mixlib-config (3.0.9) + tomlrb + mixlib-install (3.12.3) + mixlib-shellout + mixlib-versioning + thor + mixlib-log (3.0.9) + mixlib-shellout (3.1.6) + chef-utils + mixlib-versioning (1.2.12) + ms_rest (0.7.6) + concurrent-ruby (~> 1.0) + faraday (>= 0.9, < 2.0.0) + timeliness (~> 0.3.10) + ms_rest_azure (0.12.0) + concurrent-ruby (~> 1.0) + faraday (>= 0.9, < 2.0.0) + faraday-cookie_jar (~> 0.0.6) + ms_rest (~> 0.7.6) + multi_json (1.15.0) + multipart-post (2.1.1) + net-scp (3.0.0) + net-ssh (>= 2.6.5, < 7.0.0) + net-ssh (6.1.0) + net-ssh-gateway (2.0.0) + net-ssh (>= 4.0.0) + nori (2.6.0) + os (1.1.1) + parallel (1.19.2) + parslet (1.8.2) + pastel (0.8.0) + tty-color (~> 0.5) + pry (0.13.1) + coderay (~> 1.1) + method_source (~> 1.0) + public_suffix (4.0.6) + regexp_parser (1.8.2) + representable (3.0.4) + declarative (< 0.1.0) + declarative-option (< 0.2.0) + uber (< 0.2.0) + retriable (3.1.2) + rspec (3.9.0) + rspec-core (~> 3.9.0) + rspec-expectations (~> 3.9.0) + rspec-mocks (~> 3.9.0) + rspec-core (3.9.3) + rspec-support (~> 3.9.3) + rspec-expectations (3.9.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.9.0) + rspec-its (1.3.0) + rspec-core (>= 3.0.0) + rspec-expectations (>= 3.0.0) + rspec-mocks (3.9.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.9.0) + rspec-support (3.9.4) + rubyntlm (0.6.2) + rubyzip (1.3.0) + semverse (3.0.0) + signet (0.14.0) + addressable (~> 2.3) + faraday (>= 0.17.3, < 2.0) + jwt (>= 1.5, < 3.0) + multi_json (~> 1.10) + sslshake (1.3.1) + strings (0.2.0) + strings-ansi (~> 0.2) + unicode-display_width (~> 1.5) + unicode_utils (~> 1.4) + strings-ansi (0.2.0) + test-kitchen (2.7.2) + bcrypt_pbkdf (~> 1.0) + ed25519 (~> 1.2) + license-acceptance (>= 1.0.11, < 3.0) + mixlib-install (~> 3.6) + mixlib-shellout (>= 1.2, < 4.0) + net-scp (>= 1.1, < 4.0) + net-ssh (>= 2.9, < 7.0) + net-ssh-gateway (>= 1.2, < 3.0) + thor (>= 0.19, < 2.0) + winrm (~> 2.0) + winrm-elevated (~> 1.0) + winrm-fs (~> 1.1) + thor (1.0.1) + thread_safe (0.3.6) + timeliness (0.3.10) + tomlrb (1.2.9) + train (3.3.27) + activesupport (>= 5.2.4.3, < 6.0.0) + azure_graph_rbac (~> 0.16) + azure_mgmt_key_vault (~> 0.17) + azure_mgmt_resources (~> 0.15) + azure_mgmt_security (~> 0.18) + azure_mgmt_storage (~> 0.18) + docker-api (>= 1.26, < 3.0) + google-api-client (>= 0.23.9, < 0.44.1) + googleauth (>= 0.6.6, < 0.13.1) + inifile (~> 3.0) + train-core (= 3.3.27) + train-winrm (~> 0.2) + train-aws (0.1.18) + aws-sdk-apigateway (~> 1.0) + aws-sdk-apigatewayv2 (~> 1.0) + aws-sdk-athena (~> 1.0) + aws-sdk-autoscaling (~> 1.22.0) + aws-sdk-budgets (~> 1.0) + aws-sdk-cloudformation (~> 1.0) + aws-sdk-cloudfront (~> 1.0) + aws-sdk-cloudhsm (~> 1.0) + aws-sdk-cloudhsmv2 (~> 1.0) + aws-sdk-cloudtrail (~> 1.8) + aws-sdk-cloudwatch (~> 1.13) + aws-sdk-cloudwatchlogs (~> 1.13) + aws-sdk-codecommit (~> 1.0) + aws-sdk-codedeploy (~> 1.0) + aws-sdk-codepipeline (~> 1.0) + aws-sdk-configservice (~> 1.21) + aws-sdk-core (~> 3.0) + aws-sdk-costandusagereportservice (~> 1.6) + aws-sdk-dynamodb (~> 1.31) + aws-sdk-ec2 (~> 1.70) + aws-sdk-ecr (~> 1.18) + aws-sdk-ecs (~> 1.30) + aws-sdk-efs (~> 1.0) + aws-sdk-eks (~> 1.9) + aws-sdk-elasticache (~> 1.0) + aws-sdk-elasticbeanstalk (~> 1.0) + aws-sdk-elasticloadbalancing (~> 1.8) + aws-sdk-elasticloadbalancingv2 (~> 1.0) + aws-sdk-elasticsearchservice (~> 1.0) + aws-sdk-firehose (~> 1.0) + aws-sdk-guardduty (~> 1.31) + aws-sdk-iam (~> 1.13) + aws-sdk-kafka (~> 1.0) + aws-sdk-kinesis (~> 1.0) + aws-sdk-kms (~> 1.13) + aws-sdk-lambda (~> 1.0) + aws-sdk-organizations (~> 1.17.0) + aws-sdk-rds (~> 1.43) + aws-sdk-redshift (~> 1.0) + aws-sdk-route53 (~> 1.0) + aws-sdk-route53domains (~> 1.0) + aws-sdk-route53resolver (~> 1.0) + aws-sdk-s3 (~> 1.30) + aws-sdk-securityhub (~> 1.0) + aws-sdk-ses (~> 1.0) + aws-sdk-sms (~> 1.0) + aws-sdk-sns (~> 1.9) + aws-sdk-sqs (~> 1.10) + aws-sdk-ssm (~> 1.0) + train-core (3.3.27) + addressable (~> 2.5) + ffi (!= 1.13.0) + json (>= 1.8, < 3.0) + mixlib-shellout (>= 2.0, < 4.0) + net-scp (>= 1.2, < 4.0) + net-ssh (>= 2.9, < 7.0) + train-habitat (0.2.13) + train-winrm (0.2.11) + winrm (~> 2.0) + winrm-elevated (~> 1.2.2) + winrm-fs (~> 1.0) + tty-box (0.6.0) + pastel (~> 0.8) + strings (~> 0.2.0) + tty-cursor (~> 0.7) + tty-color (0.5.2) + tty-cursor (0.7.1) + tty-prompt (0.22.0) + pastel (~> 0.8) + tty-reader (~> 0.8) + tty-reader (0.8.0) + tty-cursor (~> 0.7) + tty-screen (~> 0.8) + wisper (~> 2.0) + tty-screen (0.8.1) + tty-table (0.12.0) + pastel (~> 0.8) + strings (~> 0.2.0) + tty-screen (~> 0.8) + tzinfo (1.2.7) + thread_safe (~> 0.1) + uber (0.1.0) + unf (0.1.4) + unf_ext + unf_ext (0.0.7.7) + unicode-display_width (1.7.0) + unicode_utils (1.4.0) + uri_template (0.7.0) + winrm (2.3.5) + builder (>= 2.1.2) + erubi (~> 1.8) + gssapi (~> 1.2) + gyoku (~> 1.0) + httpclient (~> 2.2, >= 2.2.0.2) + logging (>= 1.6.1, < 3.0) + nori (~> 2.0) + rubyntlm (~> 0.6.0, >= 0.6.1) + winrm-elevated (1.2.2) + erubi (~> 1.8) + winrm (~> 2.0) + winrm-fs (~> 1.0) + winrm-fs (1.3.3) + erubi (~> 1.8) + logging (>= 1.6.1, < 3.0) + rubyzip (~> 1.1) + winrm (~> 2.0) + wisper (2.0.1) + +PLATFORMS + ruby + +DEPENDENCIES + inspec (~> 4.22.22) + kitchen-docker! + kitchen-inspec (>= 2.2.1) + kitchen-salt (>= 0.6.3) + +BUNDLED WITH + 2.1.2 diff --git a/bin/install-hooks b/bin/install-hooks new file mode 100755 index 0000000..840bb6c --- /dev/null +++ b/bin/install-hooks @@ -0,0 +1,16 @@ +#!/usr/bin/env sh +set -o nounset # Treat unset variables as an error and immediately exit +set -o errexit # If a command fails exit the whole script + +if [ "${DEBUG:-false}" = "true" ]; then + set -x # Run the entire script in debug mode +fi + +if ! command -v pre-commit >/dev/null 2>&1; then + echo "pre-commit not found: please install or check your PATH" >&2 + echo "See https://pre-commit.com/#installation" >&2 + exit 1 +fi + +pre-commit install --install-hooks +pre-commit install --hook-type commit-msg --install-hooks diff --git a/commitlint.config.js b/commitlint.config.js index 2f9d1aa..4eb37f4 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -1,3 +1,8 @@ module.exports = { extends: ['@commitlint/config-conventional'], + rules: { + 'body-max-line-length': [2, 'always', 120], + 'footer-max-line-length': [2, 'always', 120], + 'header-max-length': [2, 'always', 72], + }, }; diff --git a/docs/AUTHORS.rst b/docs/AUTHORS.rst index 0cd44f2..4d6258a 100644 --- a/docs/AUTHORS.rst +++ b/docs/AUTHORS.rst @@ -13,12 +13,9 @@ This list is sorted by the number of commits per contributor in *descending* ord * - Avatar - Contributor - Contributions - * - :raw-html-m2r:`@benKenob1` - - `@benKenob1 `_ - - 51 * - :raw-html-m2r:`@myii` - `@myii `_ - - 24 + - 64 * - :raw-html-m2r:`@gravyboat` - `@gravyboat `_ - 14 @@ -31,6 +28,9 @@ This list is sorted by the number of commits per contributor in *descending* ord * - :raw-html-m2r:`@aboe76` - `@aboe76 `_ - 9 + * - :raw-html-m2r:`@noelmcloughlin` + - `@noelmcloughlin `_ + - 6 * - :raw-html-m2r:`@alfredopalhares` - `@alfredopalhares `_ - 5 @@ -64,6 +64,9 @@ This list is sorted by the number of commits per contributor in *descending* ord * - :raw-html-m2r:`@bkmit` - `@bkmit `_ - 2 + * - :raw-html-m2r:`@dafyddj` + - `@dafyddj `_ + - 2 * - :raw-html-m2r:`@dmyerscough` - `@dmyerscough `_ - 2 @@ -79,6 +82,9 @@ This list is sorted by the number of commits per contributor in *descending* ord * - :raw-html-m2r:`@roock` - `@roock `_ - 2 + * - :raw-html-m2r:`@stamak` + - `@stamak `_ + - 2 * - :raw-html-m2r:`@stevendgonzales` - `@stevendgonzales `_ - 2 @@ -106,9 +112,6 @@ This list is sorted by the number of commits per contributor in *descending* ord * - :raw-html-m2r:`@mattbarto` - `@mattbarto `_ - 1 - * - :raw-html-m2r:`@stamak` - - `@stamak `_ - - 1 * - :raw-html-m2r:`@kevops` - `@kevops `_ - 1 @@ -122,4 +125,4 @@ This list is sorted by the number of commits per contributor in *descending* ord ---- -Auto-generated by a `forked version `_ of `gaocegege/maintainer `_ on 2019-10-11. +Auto-generated by a `forked version `_ of `gaocegege/maintainer `_ on 2020-12-16. diff --git a/docs/CHANGELOG.rst b/docs/CHANGELOG.rst index f595c52..9329c75 100644 --- a/docs/CHANGELOG.rst +++ b/docs/CHANGELOG.rst @@ -2,6 +2,69 @@ Changelog ========= +`0.27.0 `_ (2020-12-16) +---------------------------------------------------------------------------------------------------------- + +Bug Fixes +^^^^^^^^^ + + +* **defaults:** fix ``yamllint`` violation [skip ci] (\ `90093e2 `_\ ) +* **init:** convert to metastate; add clean state (\ `ca5f5aa `_\ ) +* **release.config.js:** use full commit hash in commit link [skip ci] (\ `9c0b42a `_\ ) + +Code Refactoring +^^^^^^^^^^^^^^^^ + + +* **server:** simplify install.sls (\ `f86a718 `_\ ) + +Continuous Integration +^^^^^^^^^^^^^^^^^^^^^^ + + +* **gemfile:** restrict ``train`` gem version until upstream fix [skip ci] (\ `adff150 `_\ ) +* **gemfile.lock:** add to repo with updated ``Gemfile`` [skip ci] (\ `e7f1305 `_\ ) +* **gitlab-ci:** use GitLab CI as Travis CI replacement (\ `38840b7 `_\ ) +* **kitchen:** avoid using bootstrap for ``master`` instances [skip ci] (\ `7957381 `_\ ) +* **kitchen:** use ``debian-10-master-py3`` instead of ``develop`` [skip ci] (\ `e01a263 `_\ ) +* **kitchen:** use ``develop`` image until ``master`` is ready (\ ``amazonlinux``\ ) [skip ci] (\ `769ec90 `_\ ) +* **kitchen:** use ``saltimages`` Docker Hub where available [skip ci] (\ `8bf0065 `_\ ) +* **kitchen+travis:** remove ``master-py2-arch-base-latest`` [skip ci] (\ `a0d6394 `_\ ) +* **kitchen+travis:** upgrade matrix after ``2019.2.2`` release [skip ci] (\ `0d7108e `_\ ) +* **pre-commit:** add to formula [skip ci] (\ `b48efa9 `_\ ) +* **pre-commit:** enable/disable ``rstcheck`` as relevant [skip ci] (\ `d180e9b `_\ ) +* **pre-commit:** finalise ``rstcheck`` configuration [skip ci] (\ `13311ce `_\ ) +* **travis:** add notifications => zulip [skip ci] (\ `6e49f55 `_\ ) +* **travis:** apply changes from build config validation [skip ci] (\ `503fa20 `_\ ) +* **travis:** opt-in to ``dpl v2`` to complete build config validation [skip ci] (\ `a3efd1f `_\ ) +* **travis:** quote pathspecs used with ``git ls-files`` [skip ci] (\ `da71c9d `_\ ) +* **travis:** run ``shellcheck`` during lint job [skip ci] (\ `e63b945 `_\ ) +* **travis:** update ``salt-lint`` config for ``v0.0.10`` [skip ci] (\ `b317fec `_\ ) +* **travis:** use ``major.minor`` for ``semantic-release`` version [skip ci] (\ `fe02b53 `_\ ) +* **travis:** use build config validation (beta) [skip ci] (\ `a0ffb8a `_\ ) +* **workflows/commitlint:** add to repo [skip ci] (\ `b9b286b `_\ ) + +Documentation +^^^^^^^^^^^^^ + + +* **contributing:** remove to use org-level file instead [skip ci] (\ `a803116 `_\ ) +* **readme:** fix ``rstcheck`` violation & standardise [skip ci] (\ `ca32bfd `_\ ) +* **readme:** update link to ``CONTRIBUTING`` [skip ci] (\ `bd011b8 `_\ ) + +Features +^^^^^^^^ + + +* **suse:** basic opensuse support; tidyup (\ `f29f544 `_\ ) + +Performance Improvements +^^^^^^^^^^^^^^^^^^^^^^^^ + + +* **travis:** improve ``salt-lint`` invocation [skip ci] (\ `186796b `_\ ) + `0.26.2 `_ (2019-10-11) ---------------------------------------------------------------------------------------------------------- diff --git a/docs/CONTRIBUTING.rst b/docs/CONTRIBUTING.rst deleted file mode 100644 index b7da8f4..0000000 --- a/docs/CONTRIBUTING.rst +++ /dev/null @@ -1,159 +0,0 @@ -.. _contributing: - -How to contribute -================= - -This document will eventually outline all aspects of guidance to make your contributing experience a fruitful and enjoyable one. -What it already contains is information about *commit message formatting* and how that directly affects the numerous automated processes that are used for this repo. -It also covers how to contribute to this *formula's documentation*. - -.. contents:: **Table of Contents** - -Overview --------- - -Submitting a pull request is more than just code! -To achieve a quality product, the *tests* and *documentation* need to be updated as well. -An excellent pull request will include these in the changes, wherever relevant. - -Commit message formatting -------------------------- - -Since every type of change requires making Git commits, -we will start by covering the importance of ensuring that all of your commit -messages are in the correct format. - -Automation of multiple processes -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -This formula uses `semantic-release `_ for automating numerous processes such as bumping the version number appropriately, creating new tags/releases and updating the changelog. -The entire process relies on the structure of commit messages to determine the version bump, which is then used for the rest of the automation. - -Full details are available in the upstream docs regarding the `Angular Commit Message Conventions `_. -The key factor is that the first line of the commit message must follow this format: - -.. code-block:: - - type(scope): subject - - -* E.g. ``docs(contributing): add commit message formatting instructions``. - -Besides the version bump, the changelog and release notes are formatted accordingly. -So based on the example above: - -.. - - .. raw:: html - -

Documentation

- - * **contributing:** add commit message formatting instructions - - -* The ``type`` translates into a ``Documentation`` sub-heading. -* The ``(scope):`` will be shown in bold text without the brackets. -* The ``subject`` follows the ``scope`` as standard text. - -Linting commit messages in Travis CI -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -This formula uses `commitlint `_ for checking commit messages during CI testing. -This ensures that they are in accordance with the ``semantic-release`` settings. - -For more details about the default settings, refer back to the ``commitlint`` `reference rules `_. - -Relationship between commit type and version bump -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -This formula applies some customisations to the defaults, as outlined in the table below, -based upon the `type `_ of the commit: - -.. list-table:: - :name: commit-type-vs-version-bump - :header-rows: 1 - :stub-columns: 0 - :widths: 1,2,3,1,1 - - * - Type - - Heading - - Description - - Bump (default) - - Bump (custom) - * - ``build`` - - Build System - - Changes related to the build system - - – - - - * - ``chore`` - - – - - Changes to the build process or auxiliary tools and libraries such as - documentation generation - - – - - - * - ``ci`` - - Continuous Integration - - Changes to the continuous integration configuration - - – - - - * - ``docs`` - - Documentation - - Documentation only changes - - – - - 0.0.1 - * - ``feat`` - - Features - - A new feature - - 0.1.0 - - - * - ``fix`` - - Bug Fixes - - A bug fix - - 0.0.1 - - - * - ``perf`` - - Performance Improvements - - A code change that improves performance - - 0.0.1 - - - * - ``refactor`` - - Code Refactoring - - A code change that neither fixes a bug nor adds a feature - - – - - 0.0.1 - * - ``revert`` - - Reverts - - A commit used to revert a previous commit - - – - - 0.0.1 - * - ``style`` - - Styles - - Changes that do not affect the meaning of the code (white-space, - formatting, missing semi-colons, etc.) - - – - - 0.0.1 - * - ``test`` - - Tests - - Adding missing or correcting existing tests - - – - - 0.0.1 - -Use ``BREAKING CHANGE`` to trigger a ``major`` version change -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Adding ``BREAKING CHANGE`` to the footer of the extended description of the commit message will **always** trigger a ``major`` version change, no matter which type has been used. -This will be appended to the changelog and release notes as well. -To preserve good formatting of these notes, the following format is prescribed: - -* ``BREAKING CHANGE: .`` - -An example of that: - -.. code-block:: git - - ... - - BREAKING CHANGE: With the removal of all of the `.sls` files under - `template package`, this formula no longer supports the installation of - packages. - diff --git a/docs/README.rst b/docs/README.rst index 79fad3c..2c0c0ba 100644 --- a/docs/README.rst +++ b/docs/README.rst @@ -3,7 +3,7 @@ redis-formula ============= -|img_travis| |img_sr| +|img_travis| |img_sr| |img_pc| .. |img_travis| image:: https://travis-ci.com/saltstack-formulas/redis-formula.svg?branch=master :alt: Travis CI Build Status @@ -13,10 +13,15 @@ redis-formula :alt: Semantic Release :scale: 100% :target: https://github.com/semantic-release/semantic-release +.. |img_pc| image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white + :alt: pre-commit + :scale: 100% + :target: https://github.com/pre-commit/pre-commit Formula to install and configure redis. .. contents:: **Table of Contents** + :depth: 1 General notes ------------- @@ -37,7 +42,23 @@ Contributing to this repo **Commit message formatting is significant!!** -Please see :ref:`How to contribute ` for more details. +Please see `How to contribute `_ for more details. + +pre-commit +^^^^^^^^^^ + +`pre-commit `_ is configured for this formula, which you may optionally use to ease the steps involved in submitting your changes. +First install the ``pre-commit`` package manager using the appropriate `method `_, then run ``bin/install-hooks`` and +now ``pre-commit`` will run automatically on each ``git commit``. :: + + $ bin/install-hooks + pre-commit installed at .git/hooks/pre-commit + pre-commit installed at .git/hooks/commit-msg + +Special notes +------------- + +None. Todo ---- @@ -48,12 +69,25 @@ Available states ---------------- .. contents:: - :local: - + :local: ``redis`` ^^^^^^^^^ +*Meta-state (This is a state that includes other states)*. + +This state installs the Redis server solution (see https://redis.io) + +``redis.clean`` +^^^^^^^^^^^^^^^^ + +*Meta-state (This is a state that includes other states)*. + +Stop Redis daemon and remove redis server solution. + +``redis.common`` +^^^^^^^^^^^^^^^^ + Install redis only ``redis.server`` @@ -74,6 +108,13 @@ For options that aren't in the template (timeout, for example in redis-2.8 templ extra_opts: timeout: 10 +``redis.server.clean`` +^^^^^^^^^^^^^^^^^^^^^^ + +*Meta-state (This is a state that includes other states)*. + +Stop Redis daemon and remove redis package/archive. + ``redis.sentinel`` ^^^^^^^^^^^^^^^^^^ @@ -102,7 +143,7 @@ e.g. ``debian-9-2019-2-py3``. ``bin/kitchen converge`` ^^^^^^^^^^^^^^^^^^^^^^^^ -Creates the docker instance and runs the ``template`` main state, ready for testing. +Creates the docker instance and runs the ``redis`` main states, ready for testing. ``bin/kitchen verify`` ^^^^^^^^^^^^^^^^^^^^^^ @@ -123,4 +164,3 @@ Runs all of the stages above in one go: i.e. ``destroy`` + ``converge`` + ``veri ^^^^^^^^^^^^^^^^^^^^^ Gives you SSH access to the instance for manual testing. - diff --git a/kitchen.yml b/kitchen.yml index 2d82071..24e5aa0 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -11,97 +11,70 @@ driver: # Make sure the platforms listed below match up with # the `env.matrix` instances defined in `.travis.yml` platforms: - ## SALT `develop` - - name: debian-10-develop-py3 - driver: - image: netmanagers/salt-develop-py3:debian-10 - provision_command: - - curl -o bootstrap-salt.sh -L https://bootstrap.saltstack.com - - sh bootstrap-salt.sh -XdPbfrq -x python3 git develop - - name: ubuntu-1804-develop-py3 - driver: - image: netmanagers/salt-develop-py3:ubuntu-18.04 - provision_command: - - curl -o bootstrap-salt.sh -L https://bootstrap.saltstack.com - - sh bootstrap-salt.sh -XdPbfrq -x python3 git develop - - name: centos-7-develop-py3 - driver: - image: netmanagers/salt-develop-py3:centos-7 - provision_command: - - curl -o bootstrap-salt.sh -L https://bootstrap.saltstack.com - - sh bootstrap-salt.sh -XdPbfrq -x python3 git develop - - name: fedora-30-develop-py3 - driver: - image: netmanagers/salt-develop-py3:fedora-30 - provision_command: - - curl -o bootstrap-salt.sh -L https://bootstrap.saltstack.com - - sh bootstrap-salt.sh -XdPbfrq -x python3 git develop - - name: opensuse-leap-15-develop-py3 - driver: - image: opensuse/leap:15 - provision_command: - # yamllint disable-line rule:line-length - - zypper install -y glibc-locale net-tools net-tools-deprecated python-xml python3-pip - - systemctl enable sshd.service + ## SALT `master` + - name: debian-10-master-py3 + driver: + image: saltimages/salt-master-py3:debian-10 + - name: ubuntu-1804-master-py3 + driver: + image: saltimages/salt-master-py3:ubuntu-18.04 + - name: centos-8-master-py3 + driver: + image: saltimages/salt-master-py3:centos-8 + - name: fedora-31-master-py3 + driver: + image: saltimages/salt-master-py3:fedora-31 + - name: opensuse-leap-151-master-py3 + driver: + image: netmanagers/salt-master-py3:opensuse-leap-15.1 run_command: /usr/lib/systemd/systemd - provisioner: - salt_bootstrap_options: -XdPfrq -x python3 git develop - salt_install: bootstrap - # Workaround to avoid intermittent failures on `opensuse-leap-15`: + # Workaround to avoid intermittent failures on `opensuse-leap-15.1`: # => SCP did not finish successfully (255): (Net::SCP::Error) transport: max_ssh_sessions: 1 - - name: amazonlinux-2-develop-py2 - driver: - image: netmanagers/salt-develop-py2:amazonlinux-2 - provision_command: - - curl -o bootstrap-salt.sh -L https://bootstrap.saltstack.com - - sh bootstrap-salt.sh -XdPbfrq -x python2 git develop - - name: arch-base-latest-develop-py2 - driver: - image: netmanagers/salt-develop-py2:arch-base-latest - provision_command: - - curl -o bootstrap-salt.sh -L https://bootstrap.saltstack.com - - sh bootstrap-salt.sh -XdPbfrq -x python2 git develop - run_command: /usr/lib/systemd/systemd + - name: amazonlinux-2-master-py3 + driver: + image: saltimages/salt-master-py3:amazonlinux-2 ## SALT `2019.2` + - name: debian-10-2019-2-py3 + driver: + image: saltimages/salt-2019.2-py3:debian-10 - name: debian-9-2019-2-py3 driver: - image: netmanagers/salt-2019.2-py3:debian-9 + image: saltimages/salt-2019.2-py3:debian-9 - name: ubuntu-1804-2019-2-py3 driver: - image: netmanagers/salt-2019.2-py3:ubuntu-18.04 - - name: centos-7-2019-2-py3 + image: saltimages/salt-2019.2-py3:ubuntu-18.04 + - name: centos-8-2019-2-py3 driver: - image: netmanagers/salt-2019.2-py3:centos-7 - - name: fedora-30-2019-2-py3 + image: saltimages/salt-2019.2-py3:centos-8 + - name: fedora-31-2019-2-py3 driver: - image: netmanagers/salt-2019.2-py3:fedora-30 - - name: opensuse-leap-15-2019-2-py3 + image: saltimages/salt-2019.2-py3:fedora-31 + - name: opensuse-leap-151-2019-2-py3 driver: - image: opensuse/leap:15 - provision_command: - # yamllint disable-line rule:line-length - - zypper install -y glibc-locale net-tools net-tools-deprecated python-xml python3-pip - - systemctl enable sshd.service + image: netmanagers/salt-2019.2-py3:opensuse-leap-15.1 run_command: /usr/lib/systemd/systemd - provisioner: - salt_bootstrap_options: -XdPfrq -x python3 git 2019.2 - salt_install: bootstrap - # Workaround to avoid intermittent failures on `opensuse-leap-15`: + # Workaround to avoid intermittent failures on `opensuse-leap-15.1`: # => SCP did not finish successfully (255): (Net::SCP::Error) transport: max_ssh_sessions: 1 - - name: amazonlinux-2-2019-2-py2 + - name: centos-7-2019-2-py2 + driver: + image: netmanagers/salt-2019.2-py2:centos-7 + - name: amazonlinux-2-2019-2-py3 driver: - image: netmanagers/salt-2019.2-py2:amazonlinux-2 + image: saltimages/salt-2019.2-py3:amazonlinux-2 - name: arch-base-latest-2019-2-py2 driver: - image: netmanagers/salt-2019.2-py2:arch-base-latest + image: saltimages/salt-2019.2-py2:arch-base-latest run_command: /usr/lib/systemd/systemd ## SALT `2018.3` + - name: fedora-30-2018-3-py3 + driver: + image: netmanagers/salt-2018.3-py3:fedora-30 - name: debian-9-2018-3-py2 driver: image: netmanagers/salt-2018.3-py2:debian-9 @@ -111,27 +84,18 @@ platforms: - name: centos-7-2018-3-py2 driver: image: netmanagers/salt-2018.3-py2:centos-7 - - name: fedora-29-2018-3-py2 - driver: - image: netmanagers/salt-2018.3-py2:fedora-29 - - name: opensuse-leap-15-2018-3-py2 + - name: opensuse-leap-151-2018-3-py2 driver: - image: opensuse/leap:15 - provision_command: - # yamllint disable-line rule:line-length - - zypper install -y glibc-locale net-tools net-tools-deprecated python-xml python2-pip - - systemctl enable sshd.service + image: netmanagers/salt-2018.3-py2:opensuse-leap-15.1 run_command: /usr/lib/systemd/systemd - provisioner: - salt_bootstrap_options: -XdPfrq -x python2 git 2018.3 - salt_install: bootstrap - # Workaround to avoid intermittent failures on `opensuse-leap-15`: + # Workaround to avoid intermittent failures on `opensuse-leap-15.1`: # => SCP did not finish successfully (255): (Net::SCP::Error) transport: max_ssh_sessions: 1 - - name: amazonlinux-2-2018-3-py2 + - name: amazonlinux-1-2018-3-py2 driver: - image: netmanagers/salt-2018.3-py2:amazonlinux-2 + image: netmanagers/salt-2018.3-py2:amazonlinux-1 + run_command: /sbin/init - name: arch-base-latest-2018-3-py2 driver: image: netmanagers/salt-2018.3-py2:arch-base-latest @@ -148,27 +112,21 @@ platforms: driver: image: netmanagers/salt-2017.7-py2:centos-6 run_command: /sbin/init - - name: fedora-29-2017-7-py2 + - name: fedora-30-2017-7-py2 driver: - image: netmanagers/salt-2017.7-py2:fedora-29 - - name: opensuse-leap-15-2017-7-py2 + image: netmanagers/salt-2017.7-py2:fedora-30 + - name: opensuse-leap-151-2017-7-py2 driver: - image: opensuse/leap:15 - provision_command: - # yamllint disable-line rule:line-length - - zypper install -y glibc-locale net-tools net-tools-deprecated python-xml python2-pip - - systemctl enable sshd.service + image: netmanagers/salt-2017.7-py2:opensuse-leap-15.1 run_command: /usr/lib/systemd/systemd - provisioner: - salt_bootstrap_options: -XdPfrq -x python2 git 2017.7 - salt_install: bootstrap - # Workaround to avoid intermittent failures on `opensuse-leap-15`: + # Workaround to avoid intermittent failures on `opensuse-leap-15.1`: # => SCP did not finish successfully (255): (Net::SCP::Error) transport: max_ssh_sessions: 1 - - name: amazonlinux-2-2017-7-py2 + - name: amazonlinux-1-2017-7-py2 driver: - image: netmanagers/salt-2017.7-py2:amazonlinux-2 + image: netmanagers/salt-2017.7-py2:amazonlinux-1 + run_command: /sbin/init - name: arch-base-latest-2017-7-py2 driver: image: netmanagers/salt-2017.7-py2:arch-base-latest @@ -198,7 +156,7 @@ suites: state_top: base: '*': - - redis + - redis.common - redis.server pillars: top.sls: diff --git a/pillar.example b/pillar.example index 9a5d94a..c520cca 100644 --- a/pillar.example +++ b/pillar.example @@ -94,3 +94,15 @@ redis: # default port is 6379 and default quorum is 2 mymaster3: ip: 3.3.3.3 + + # Multiple-instances management. + # Note: Tested on debian stretch only. + instances: + # Special value, if you want to override something for all your instances + _default: + bind: 0.0.0.0 + # Now, we define each instance, with its differences + cache: + port: 6380 + sessions: + port: 6381 diff --git a/pre-commit_semantic-release.sh b/pre-commit_semantic-release.sh index 9d34d74..458b7b6 100755 --- a/pre-commit_semantic-release.sh +++ b/pre-commit_semantic-release.sh @@ -11,12 +11,12 @@ sed -i -e "s_^\(version:\).*_\1 ${1}_" FORMULA ############################################################################### # Install `m2r` -sudo -H pip install m2r +pip3 install m2r # Copy and then convert the `.md` docs -cp *.md docs/ -cd docs/ -m2r --overwrite *.md +cp ./*.md docs/ +cd docs/ || exit +m2r --overwrite ./*.md # Change excess `H1` headings to `H2` in converted `CHANGELOG.rst` sed -i -e '/^=.*$/s/=/-/g' CHANGELOG.rst diff --git a/redis/clean.sls b/redis/clean.sls new file mode 100644 index 0000000..019548e --- /dev/null +++ b/redis/clean.sls @@ -0,0 +1,2 @@ +include: + - redis.server.clean diff --git a/redis/common.sls b/redis/common.sls index 8170f5e..7b80087 100644 --- a/redis/common.sls +++ b/redis/common.sls @@ -4,7 +4,7 @@ {% set install_from = redis_settings.install_from -%} -{% if install_from == 'source' %} +{% if install_from in ('source', 'archive') %} {% set version = redis_settings.version|default('2.8.8') -%} {% set checksum = redis_settings.checksum|default('sha1=aa811f399db58c92c8ec5e48271d307e9ab8eb81') -%} {% set root = redis_settings.root|default('/usr/local') -%} @@ -28,6 +28,7 @@ get-redis: - name: {{ root }}/redis-{{ version }}.tar.gz - source: http://download.redis.io/releases/redis-{{ version }}.tar.gz - source_hash: {{ checksum }} + - makedirs: True - require: - pkg: redis-dependencies cmd.wait: @@ -67,7 +68,42 @@ install-redis: - name: {{ redis_settings.pkg_name }} {% if redis_settings.version is defined %} - version: {{ redis_settings.version }} + - ignore_epoch: True {% endif %} + {%- if grains.os_family|lower == 'suse' %} + {# this is basically a workaround for faulty packaging #} +install-redis-log: + group.present: + - name: {{ redis_settings.group }} + user.present: + - name: {{ redis_settings.user }} + - gid_from_name: True + - home: {{ redis_settings.home }} + - require: + - group: install-redis-log + file.directory: + - name: /var/log/redis + - mode: 755 + - user: {{ redis_settings.user }} + - group: {{ redis_settings.group }} + - recurse: + - user + - group + - mode + - makedirs: True + - require: + - user: install-redis-log + +install-redis-service: + file.replace: + - name: /usr/lib/systemd/system/redis@.service + - pattern: ^Type=notify + - repl: Type=simple + cmd.run: + - name: systemctl daemon-reload + - require: + - file: install-redis-log + {% endif %} {% endif %} diff --git a/redis/defaults.yaml b/redis/defaults.yaml index 20ccd4a..eae66de 100644 --- a/redis/defaults.yaml +++ b/redis/defaults.yaml @@ -2,6 +2,15 @@ # vim: ft=yaml --- redis: + instances: + _default: + cfg_name: /etc/redis/redis-{name}.conf + svc_name: redis-server@{name} + pidfile: /var/run/redis-{name}/redis-server.pid + logfile: /var/log/redis/redis-server-{name}.log + dbfilename: dump-{name}.rdb + svc_state: running + svc_onboot: true appendfilename: appendonly.aof appendonly: 'no' appendfsync: everysec @@ -10,6 +19,8 @@ redis: aof_load_truncated: 'yes' bin: /usr/local/bin/redis-server bind: 127.0.0.1 + cfg_name: /etc/redis/redis.conf + cfg_version: '3.2' database_count: 16 root_dir: /var/lib/redis dbfilename: dump.rdb @@ -55,3 +66,10 @@ redis: group: redis pidfile: /var/run/redis/sentinel.pid daemonize: 'yes' + + retry_option: + # https://docs.saltstack.com/en/latest/ref/states/requisites.html#retrying-states + attempts: 3 + until: true + interval: 60 + splay: 10 diff --git a/redis/files/default/systemd.ini.jinja b/redis/files/default/systemd.ini.jinja new file mode 100644 index 0000000..959ad17 --- /dev/null +++ b/redis/files/default/systemd.ini.jinja @@ -0,0 +1,19 @@ +######################################################### +# File managed by Salt. Changes risk being overwritten. +######################################################### +[Unit] +Description={{ desc }} +Wants=network-online.target +After= +Documentation=https://github.com/saltstack-formulas/prometheus-formula + +[Service] +User={{ user }} +Group={{ group }} +WorkingDirectory={{ workdir }} +ExecStart={{ start }} +ExecStop={{ stop }} +PIDFile=/var/run/{{ name }}.pid + +[Install] +WantedBy=multi-user.target diff --git a/redis/files/macros.jinja b/redis/files/macros.jinja new file mode 100644 index 0000000..0ae45e4 --- /dev/null +++ b/redis/files/macros.jinja @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# vim: ft=jinja +# +# Collection of common macros + +{%- macro format_kwargs(kwarg) -%} + {%- if kwarg and kwarg is mapping %} + + {%- filter indent(4) %} + {%- for k, v in kwarg|dictsort() %} +- {{ k }}: {{ v }} + {%- endfor %} + {%- endfilter %} + + {%- endif %} +{%- endmacro %} diff --git a/redis/files/redis-3.2.conf.multi.jinja b/redis/files/redis-3.2.conf.multi.jinja new file mode 100644 index 0000000..c5981cf --- /dev/null +++ b/redis/files/redis-3.2.conf.multi.jinja @@ -0,0 +1,269 @@ +# Redis config +{%- if redis_settings.include is defined %} +{%- for include in redis_settings.include %} +include {{ include }} +{%- endfor %} +{%- endif %} +{%- if redis_settings.daemonize is defined %} +daemonize {{ redis_settings.daemonize }} +{%- else %} +daemonize yes +{%- endif %} +{%- if redis_settings.supervised is defined %} +supervised {{ redis_settings.supervised }} +{%- endif %} + +pidfile {{ redis_settings.pidfile }} +port {{ redis_settings.port }} + +{% if redis_settings.bind is defined %} +bind {{ redis_settings.bind }} +{% endif -%} + +{% if redis_settings.unixsocket is defined %} +unixsocket {{ redis_settings.unixsocket }} +unixsocketperm {{ redis_settings.unixsocketperm }} +{% endif -%} + +{% if redis_settings.tcp_backlog is defined and redis_settings.tcp_backlog > 0 %} +tcp-backlog {{ redis_settings.tcp_backlog }} +{% endif -%} + +{%- if redis_settings.timeout is defined %} +timeout {{ redis_settings.timeout }} +{%- endif %} + +tcp-keepalive {{ redis_settings.tcp_keepalive }} + +loglevel {{ redis_settings.loglevel }} + +{% if redis_settings.syslog is defined %} +syslog-enabled yes +syslog-ident {{ redis_settings.syslog.ident }} +syslog-facility {{ redis_settings.syslog.facility }} +{% if redis_settings.syslog.nologfile is defined %} +logfile "" +{% else %} +logfile {{ redis_settings.logfile }} +{% endif -%} +{% else %} +logfile {{ redis_settings.logfile }} +{% endif -%} + +databases {{ redis_settings.database_count }} + +{% for s in redis_settings.snapshots -%} +save {{ s }} +{% endfor %} + +stop-writes-on-bgsave-error {{ redis_settings.stop_writes_on_bgsave_error }} + +rdbcompression {{ redis_settings.rdbcompression }} +rdbchecksum {{ redis_settings.rdbchecksum }} + +dbfilename {{ redis_settings.dbfilename }} +dir {{ redis_settings.root_dir }} + +{% if redis_settings.slaveof is defined %} +slaveof {{ redis_settings.slaveof.masterip }} {{ redis_settings.slaveof.masterport }} +{% endif -%} + +{% if redis_settings.masterauth is defined %} +masterauth {{ redis_settings.masterauth }} +{% endif -%} + +slave-serve-stale-data {{ redis_settings.slave_serve_stale_data }} +slave-read-only {{ redis_settings.slave_read_only }} + +{%- if redis_settings.repl_diskless_sync is defined %} +repl-diskless-sync {{ redis_settings.repl_diskless_sync }} +{%- endif %} + +{%- if redis_settings.repl_diskless_sync_delay is defined %} +repl-diskless-sync-delay {{ redis_settings.repl_diskless_sync_delay }} +{%- endif %} + +{% if redis_settings.repl_ping_slave_period is defined %} +repl-ping-slave-period {{ redis_settings.repl_ping_slave_period }} +{% endif -%} + +{% if redis_settings.repl_timeout is defined %} +repl-timeout {{ redis_settings.repl_timeout }} +{% endif -%} + +repl-disable-tcp-nodelay {{ redis_settings.repl_disable_tcp_nodelay }} + +{% if redis_settings.repl_backlog_size is defined %} +repl-backlog-size {{ redis_settings.repl_backlog_size }} +{% endif -%} + +{% if redis_settings.repl_backlog_ttl is defined %} +repl-backlog-ttl {{ redis_settings.repl_backlog_ttl }} +{% endif -%} + +slave-priority {{ redis_settings.slave_priority }} + +{% if redis_settings.min_slaves_to_write is defined %} +min-slaves-to-write {{ redis_settings.min_slaves_to_write }} +{% endif -%} + +{% if redis_settings.min_slaves_max_lag is defined %} +min-slaves-max-lag {{ redis_settings.min_slaves_max_lag }} +{% endif -%} + +{%- if redis_settings.slave_announce_ip is defined %} +slave-announce-ip {{ redis_settings.slave_announce_ip }} +{%- endif %} +{%- if redis_settings.slave_announce_port is defined %} +slave-announce-port {{ redis_settings.slave_announce_port }} +{%- endif %} + +{% if redis_settings.pass is defined %} +requirepass {{ redis_settings.pass }} +{% endif -%} + +{% if redis_settings.rename_command is defined %} +{% for k, v in redis_settings.rename_command.items() %} +rename-command {{ k }} {{ v }} +{% endfor %} +{% endif -%} + +{% if redis_settings.maxclients is defined %} +maxclients {{ redis_settings.maxclients }} +{% endif -%} + +{% if redis_settings.maxmemory is defined %} +maxmemory {{ redis_settings.maxmemory }} +maxmemory-policy {{ redis_settings.maxmemory_policy }} +maxmemory-samples {{ redis_settings.maxmemory_samples }} +{% endif %} + +appendonly {{ redis_settings.appendonly }} +appendfilename {{ redis_settings.appendfilename }} +appendfsync {{ redis_settings.appendfsync }} + +no-appendfsync-on-rewrite {{ redis_settings.no_appendfsync_on_rewrite }} +auto-aof-rewrite-percentage {{ redis_settings.auto_aof_rewrite_percentage }} + +auto-aof-rewrite-min-size {{ redis_settings.auto_aof_rewrite_min_size }} + +{%- if redis_settings.aof_load_truncated is defined %} +aof-load-truncated {{ redis_settings.aof_load_truncated }} +{%- endif %} + +lua-time-limit {{ redis_settings.lua_time_limit }} + +{%- if redis_settings.cluster_enabled is defined %} +cluster-enabled {{ redis_settings.cluster_enabled }} +{%- endif %} +{%- if redis_settings.cluster_config_file is defined %} +cluster-config-file {{ redis_settings.cluster_config_file }} +{%- endif %} +{%- if redis_settings.cluster_node_timeout is defined %} +cluster-node-timeout {{ redis_settings.cluster_node_timeout }} +{%- endif %} +{%- if redis_settings.cluster_slave_validity_factor is defined %} +cluster-slave-validity-factor {{ redis_settings.cluster_slave_validity_factor }} +{%- endif %} +{%- if redis_settings.cluster_migration_barrier is defined %} +cluster-migration-barrier {{ redis_settings.cluster_migration_barrier }} +{%- endif %} +{%- if redis_settings.cluster_require_full_coverage is defined %} +cluster-require-full-coverage {{ redis_settings.cluster_require_full_coverage }} +{%- endif %} + +slowlog-log-slower-than {{ redis_settings.slowlog_log_slower_than }} +slowlog-max-len {{ redis_settings.slowlog_max_len }} + +notify-keyspace-events {{ redis_settings.notify_keyspace_events }} + +{%- if redis_settings.latency_monitor_threshold is defined %} +latency-monitor-threshold {{ redis_settings.latency_monitor_threshold }} +{%- else %} +latency-monitor-threshold 0 +{%- endif %} + +{%- if redis_settings.extra_opts is defined %} +{%- for option,value in redis_settings.extra_opts.items() %} +{{ option }} {{ value }} +{%- endfor %} +{%- endif %} + +############################### ADVANCED CONFIG ############################### + +{%- if redis_settings.hash_max_ziplist_entries is defined %} +hash-max-ziplist-entries {{ redis_settings.hash_max_ziplist_entries }} +{%- else %} +hash-max-ziplist-entries 512 +{%- endif %} +{%- if redis_settings.hash_max_ziplist_value is defined %} +hash-max-ziplist-value {{ redis_settings.hash_max_ziplist_value }} +{%- else %} +hash-max-ziplist-value 64 +{%- endif %} +{%- if redis_settings.list_max_ziplist_entries is defined %} +list-max-ziplist-entries {{ redis_settings.list_max_ziplist_entries }} +{%- else %} +list-max-ziplist-entries 512 +{%- endif %} +{%- if redis_settings.list_max_ziplist_value is defined %} +list-max-ziplist-value {{ redis_settings.list_max_ziplist_value }} +{%- else %} +list-max-ziplist-value 64 +{%- endif %} +{%- if redis_settings.list_max_ziplist_size is defined %} +list-max-ziplist-size {{ redis_settings.list_max_ziplist_size }} +{%- else %} +list-max-ziplist-size -2 +{%- endif %} +{%- if redis_settings.list_compress_depth is defined %} +list-compress-depth {{ redis_settings.list_compress_depth }} +{%- else %} +list-compress-depth 0 +{%- endif %} +{%- if redis_settings.set_max_intset_entries is defined %} +set-max-intset-entries {{ redis_settings.set_max_intset_entries }} +{%- else %} +set-max-intset-entries 512 +{%- endif %} +{%- if redis_settings.zset_max_ziplist_entries is defined %} +zset-max-ziplist-entries {{ redis_settings.zset_max_ziplist_entries }} +{%- else %} +zset-max-ziplist-entries 128 +{%- endif %} +{%- if redis_settings.zset_max_ziplist_value is defined %} +zset-max-ziplist-value {{ redis_settings.zset_max_ziplist_value }} +{%- else %} +zset-max-ziplist-value 64 +{%- endif %} +{%- if redis_settings.activerehashing is defined %} +activerehashing {{ redis_settings.activerehashing }} +{%- else %} +activerehashing yes +{%- endif %} +{%- if redis_settings.client_output_buffer_limit is defined %} +{%- for class,options in redis_settings.client_output_buffer_limit.items() %} +client-output-buffer-limit {{ class }} {{ options }} +{%- endfor %} +{%- else %} +client-output-buffer-limit normal 0 0 0 +client-output-buffer-limit slave 256mb 64mb 60 +client-output-buffer-limit pubsub 32mb 8mb 60 +{%- endif %} +{%- if redis_settings.hz is defined %} +hz {{ redis_settings.hz }} +{%- else %} +hz 10 +{%- endif %} +{%- if redis_settings.aof_rewrite_incremental_fsync is defined %} +aof-rewrite-incremental-fsync {{ redis_settings.aof_rewrite_incremental_fsync }} +{%- else %} +aof-rewrite-incremental-fsync yes +{%- endif %} + +{%- if redis_settings['protected-mode'] is defined %} +protected-mode {{ redis_settings['protected-mode'] }} +{%- else %} +protected-mode yes +{%- endif %} + diff --git a/redis/files/redis-server@.service b/redis/files/redis-server@.service new file mode 100644 index 0000000..249f83c --- /dev/null +++ b/redis/files/redis-server@.service @@ -0,0 +1,73 @@ +# Templated service file for redis-server(1) +# +# Each instance of redis-server requires its own configuration file: +# +# $ cp /etc/redis/redis.conf /etc/redis/redis-myname.conf +# $ chown redis:redis /etc/redis/redis-myname.conf +# +# Ensure each instance is using their own database: +# +# $ sed -i -e 's@^dbfilename .*@dbfilename dump-myname.rdb@' /etc/redis/redis-myname.conf +# +# We then listen exlusively on UNIX sockets to avoid TCP port collisions: +# +# $ sed -i -e 's@^port .*@port 0@' /etc/redis/redis-myname.conf +# $ sed -i -e 's@^\(# \)\{0,1\}unixsocket .*@unixsocket /var/run/redis-myname/redis-server.sock@' /etc/redis/redis-myname.conf +# +# ... and ensure we are logging, etc. in a unique location: +# +# $ sed -i -e 's@^logfile .*@logfile /var/log/redis/redis-server-myname.log@' /etc/redis/redis-myname.conf +# $ sed -i -e 's@^pidfile .*@pidfile /run/redis-myname/redis-server.pid@' /etc/redis/redis-myname.conf +# +# We can then start the service as follows, validating we are using our own +# configuration: +# +# $ systemctl start redis-server@myname.service +# $ redis-cli -s /var/run/redis-myname/redis-server.sock info | grep config_file +# +# -- Chris Lamb Mon, 09 Oct 2017 22:17:24 +0100 +[Unit] +Description=Advanced key-value store (%I) +After=network.target +Documentation=http://redis.io/documentation, man:redis-server(1) + +[Service] +Type=forking +ExecStart=/usr/bin/redis-server /etc/redis/redis-%i.conf +ExecStop=/bin/kill -s TERM $MAINPID +PIDFile=/run/redis-%i/redis-server.pid +TimeoutStopSec=0 +Restart=always +User=redis +Group=redis +RuntimeDirectory=redis-%i +RuntimeDirectoryMode=2755 + +UMask=007 +PrivateTmp=yes +LimitNOFILE=65535 +PrivateDevices=yes +ProtectHome=yes +ReadOnlyDirectories=/ +ReadWriteDirectories=-/var/lib/redis +ReadWriteDirectories=-/var/log/redis +ReadWriteDirectories=-/var/run/redis-%i + +NoNewPrivileges=true +CapabilityBoundingSet=CAP_SETGID CAP_SETUID CAP_SYS_RESOURCE +MemoryDenyWriteExecute=true +ProtectKernelModules=true +ProtectKernelTunables=true +ProtectControlGroups=true +RestrictRealtime=true +RestrictNamespaces=true +RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX + +# redis-server can write to its own config file when in cluster mode so we +# permit writing there by default. If you are not using this feature, it is +# recommended that you replace the following lines with "ProtectSystem=full". +ProtectSystem=true +ReadWriteDirectories=-/etc/redis + +[Install] +WantedBy=multi-user.target diff --git a/redis/init.sls b/redis/init.sls index 156df3b..94088f2 100644 --- a/redis/init.sls +++ b/redis/init.sls @@ -1,2 +1,3 @@ include: - redis.common + - redis.server diff --git a/redis/instances.sls b/redis/instances.sls new file mode 100644 index 0000000..fc2de36 --- /dev/null +++ b/redis/instances.sls @@ -0,0 +1,61 @@ +{% from "redis/map.jinja" import redis_settings with context %} + +include: + - redis.server + +{% set cfg_version = redis_settings.cfg_version -%} +{% set install_from = redis_settings.install_from -%} +{% set user = redis_settings.user -%} +{% set group = redis_settings.group -%} + +redis_systemd_template: + file.managed: + - name: /lib/systemd/system/redis-server@.service + - replace: False + - source: salt://redis/files/redis-server@.service + +{% for instance_name, instance_options in redis_settings.instances|default({})|dictsort %} +{% if instance_name != '_default' %} +{% set config = {} %} +{% do config.update(redis_settings) %} +{% for key, value in redis_settings.instances.get('_default')|dictsort %} +{% do config.update({key: (value|string).format(name=instance_name)}) %} +{% endfor %} +{% do config.update(instance_options) %} + +redis_root_dir {{ instance_name }}: + file.directory: + - name: {{ config.root_dir }} + - mode: 755 + - user: {{ user }} + - group: {{ group }} + - makedirs: True + - require_in: + - service: redis_service {{ instance_name }} + +redis_config {{ instance_name }}: + file.managed: + - name: {{ config.cfg_name }} + - template: jinja +{% if redis_settings.source_path is not defined %} + - source: salt://redis/files/redis-{{ cfg_version }}.conf.multi.jinja +{% else %} + - source: {{ config.source_path }} +{% endif %} + - defaults: + redis_settings: {{ config|json }} + +redis_service {{ instance_name }}: + service.{{ config.svc_state }}: + {% if install_from == 'source' %} + - name: {{ config.svc_name }}_{{ config.port }} + {% else %} + - name: {{ config.svc_name }} + {% endif %} + - enable: {{ config.svc_onboot }} + - require: + - file: redis_systemd_template + - watch: + - file: {{ config.cfg_name }} +{% endif %} +{% endfor %} diff --git a/redis/osfamilymap.yaml b/redis/osfamilymap.yaml index 21451e1..c94c187 100644 --- a/redis/osfamilymap.yaml +++ b/redis/osfamilymap.yaml @@ -5,8 +5,6 @@ Debian: pkg_name: redis-server python_dev_package: python-dev svc_name: redis-server - cfg_name: /etc/redis/redis.conf - cfg_version: '3.2' logfile: /var/log/redis/redis-server.log pidfile: /var/run/redis/redis-server.pid sentinel_pkg: redis-server @@ -44,3 +42,18 @@ FreeBSD: pidfile: /var/run/redis/redis.pid overcommit_memory: false root_dir: /var/db/redis +Suse: + cfg_name: /etc/redis/default.conf + pkg_name: redis + python_dev_package: python-devel + svc_name: redis@default + logfile: /var/log/redis/default.log + pidfile: /var/run/redis/default.pid + sentinel_pkg: redis + sentinel_service: redis-sentinel + sentinel_cfg: /etc/redis-sentinel.conf + sentinel_logfile: /var/log/redis/sentinel.log + sentinel: + pidfile: /var/run/redis/sentinel.pid + disable_transparent_huge_pages: true + systemd_type: simple diff --git a/redis/server.sls b/redis/server.sls deleted file mode 100644 index 34e67b9..0000000 --- a/redis/server.sls +++ /dev/null @@ -1,130 +0,0 @@ -include: - - redis.common - - -{% from "redis/map.jinja" import redis_settings with context %} - -{% set cfg_version = redis_settings.cfg_version -%} -{% set cfg_name = redis_settings.cfg_name -%} -{% set install_from = redis_settings.install_from -%} -{% set svc_name = redis_settings.svc_name -%} -{% set svc_state = redis_settings.svc_state -%} -{% set svc_onboot = redis_settings.svc_onboot -%} -{% set overcommit_memory = redis_settings.overcommit_memory -%} -{% set port = redis_settings.port -%} - - -{% if install_from == 'source' %} - - -{% set user = redis_settings.user -%} -{% set group = redis_settings.group -%} -{% set home = redis_settings.home -%} -{% set bin = redis_settings.bin -%} - -redis_group: - group.present: - - name: {{ group }} - - -redis_user: - user.present: - - name: {{ user }} - - gid_from_name: True - - home: {{ home }} - - require: - - group: redis_group - - -redis-init-script: - file.managed: - - name: /etc/init/redis-server.conf - - template: jinja - - source: salt://redis/files/upstart.conf.jinja - - mode: '0750' - - user: root - - group: root - - context: - conf: /etc/redis/redis.conf - user: {{ user }} - bin: {{ bin }} - - require: - - sls: redis.common - - -redis-log-dir: - file.directory: - - name: /var/log/redis - - mode: 755 - - user: {{ user }} - - group: {{ group }} - - makedirs: True - - require: - - user: redis_user - -{% if grains['os_family'] == 'Arch' %} -{% set user = redis_settings.user -%} -{% set group = redis_settings.group -%} -redis-log-dir: - file.directory: - - name: /var/log/redis - - mode: 755 - - user: {{ user }} - - group: {{ group }} - - makedirs: True -{% endif %} -{% endif %} - -redis_config: - file.managed: - - name: {{ cfg_name }} - - template: jinja -{% if redis_settings.source_path is not defined %} - - source: salt://redis/files/redis-{{ cfg_version }}.conf.jinja -{% else %} - - source: {{ redis_settings.source_path }} -{% endif %} - -{% if install_from == 'source' %} -redis-initd: - file.managed: - - name: /etc/init.d/redis - - template: jinja - - source: salt://redis/files/redis_initd.jinja - - mode: '0777' - - user: root - - group: root - - require: - - file: redis_config - - require_in: - - file: redis_service -{% endif %} - -{% if redis_settings.disable_transparent_huge_pages is defined and redis_settings.disable_transparent_huge_pages %} -redis_disable_transparent_huge_pages: - cmd.run: - - name: echo "never" > /sys/kernel/mm/transparent_hugepage/enabled - -{% endif %} -redis_service: - service.{{ svc_state }}: - {% if install_from == 'source' %} - - name: {{ svc_name }}_{{ port }} - {% else %} - - name: {{ svc_name }} - {% endif %} - - enable: {{ svc_onboot }} - - watch: - - file: {{ cfg_name }} - - -{% if overcommit_memory == True %} -redis_overcommit_memory: - sysctl.present: - - name: vm.overcommit_memory - - value: 1 - {% if grains['os_family'] == 'Arch' %} - - require_in: - - service: redis_service - {% endif %} -{% endif %} diff --git a/redis/server/clean.sls b/redis/server/clean.sls new file mode 100644 index 0000000..edf9061 --- /dev/null +++ b/redis/server/clean.sls @@ -0,0 +1,44 @@ + +{%- from "redis/map.jinja" import redis_settings as r with context %} + +redis-server-service-clean: + service.dead: + {%- if r.install_from in ('source', 'archive') %} + - name: {{ r.svc_name }}_{{ r.port }} + {%- else %} + - name: {{ r.svc_name }} + {%- endif %} + - enable: false + - require_in: + - user: redis-server-clean + - file: redis-server-clean + +redis-server-clean: + {%- if r.install_from in ('source', 'archive') %} + + user.absent: + - name: {{ r.user }} + group.absent: + - name: {{ r.group }} + - require: + - user: redis-server-clean + file.absent: + - names: + - /etc/init/redis-server.conf + - {{ r.cfg_name }} + - /etc/init.d/redis + - {{ r.root|default('/usr/local') }} + - /etc/redis + - /var/log/redis + - /var/lib/redis + - /usr/lib/systemd/system/redis* + - /lib/systemd/system/redis* + - /var/run/redis + - /var/run/redis_6379.pid + + {%- else %} + + pkg.removed: + - name: {{ r.pkg_name }} + + {%- endif %} diff --git a/redis/server/init.sls b/redis/server/init.sls new file mode 100644 index 0000000..d3e5518 --- /dev/null +++ b/redis/server/init.sls @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +include: + - .install diff --git a/redis/server/install.sls b/redis/server/install.sls new file mode 100644 index 0000000..c3c9c32 --- /dev/null +++ b/redis/server/install.sls @@ -0,0 +1,101 @@ +include: + - redis.common + +{% from "redis/map.jinja" import redis_settings as r with context %} + + {%- if r.install_from in ('source', 'archive') %} + +redis_user_group: + group.present: + - name: {{ r.group }} + user.present: + - name: {{ r.user }} + - gid_from_name: True + - home: {{ r.home }} + - require: + - group: redis_user_group + file.managed: + - name: /etc/init/redis-server.conf + - template: jinja + - source: salt://redis/files/upstart.conf.jinja + - mode: '0750' + - user: root + - group: root + - makedirs: True + - context: + conf: /etc/redis/redis.conf + user: {{ r.user }} + bin: {{ r.bin }} + - require: + - sls: redis.common + +redis-log-dir: + file.directory: + - name: /var/log/redis + - mode: 755 + - user: {{ r.user }} + - group: {{ r.group }} + - recurse: + - user + - group + - mode + - makedirs: True + - require: + - user: redis_user_group + + {%- endif %} + +redis_config: + file.managed: + - name: {{ r.cfg_name }} + - template: jinja + {% if r.source_path is not defined %} + - source: salt://redis/files/redis-{{ r.cfg_version }}.conf.jinja + {% else %} + - source: {{ r.source_path }} + {%- endif %} + - makedirs: True + + {%- if r.install_from in ('source', 'archive') %} +redis-initd: + file.managed: + - name: /etc/init.d/redis + - template: jinja + - source: salt://redis/files/redis_initd.jinja + - mode: '0777' + - user: root + - group: root + - require: + - file: redis_config + - require_in: + - file: redis_service + {%- endif %} + + {% if r.disable_transparent_huge_pages is defined and r.disable_transparent_huge_pages %} +redis_disable_transparent_huge_pages: + cmd.run: + - name: echo "never" > /sys/kernel/mm/transparent_hugepage/enabled + {%- endif %} + +redis_service: + service.{{ r.svc_state }}: + {% if r.install_from in ('source', 'archive') %} + - name: {{ r.svc_name }}_{{ r.port }} + {% else %} + - name: {{ r.svc_name }} + {% endif %} + - enable: {{ r.svc_onboot }} + - watch: + - file: redis_config + - retry: {{ r.retry_option|json }} + + {% if r.overcommit_memory == True %} +redis_overcommit_memory: + sysctl.present: + - name: vm.overcommit_memory + - value: 1 + {% if grains['os_family'] == 'Arch' %} + - require_in: + - service: redis_service + {% endif %} + {%- endif %} diff --git a/release.config.js b/release.config.js index afa0cb1..8a2692f 100644 --- a/release.config.js +++ b/release.config.js @@ -1,5 +1,6 @@ module.exports = { branch: 'master', + repositoryUrl: 'https://github.com/saltstack-formulas/redis-formula', plugins: [ ['@semantic-release/commit-analyzer', { preset: 'angular', @@ -63,7 +64,7 @@ module.exports = { } if (typeof commit.hash === `string`) { - commit.hash = commit.hash.substring(0, 7) + commit.shortHash = commit.hash.substring(0, 7) } if (typeof commit.subject === `string`) {