├── .github └── workflows │ └── commitlint.yml ├── .gitignore ├── .gitlab-ci.yml ├── .pre-commit-config.yaml ├── .rstcheck.cfg ├── .rubocop.yml ├── .salt-lint ├── .travis.yml ├── .yamllint ├── AUTHORS.md ├── CHANGELOG.md ├── CODEOWNERS ├── FORMULA ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── bin ├── install-hooks └── kitchen ├── commitlint.config.js ├── django ├── _mapdata │ ├── _mapdata.jinja │ └── init.sls ├── apps │ └── poll │ │ ├── multi-host │ │ ├── app.sls │ │ ├── db.sls │ │ ├── files │ │ │ ├── my.cnf │ │ │ ├── poll-vhost.conf │ │ │ ├── settings.py │ │ │ └── wsgi.py │ │ ├── firewall.sls │ │ ├── loaddata.sls │ │ └── vhost.sls │ │ └── single-host │ │ ├── app.sls │ │ ├── db.sls │ │ ├── files │ │ ├── poll-vhost.conf │ │ ├── settings.py │ │ └── wsgi.py │ │ ├── firewall.sls │ │ ├── loaddata.sls │ │ └── vhost.sls ├── init.sls ├── map.jinja └── pip.sls ├── docs ├── AUTHORS.rst ├── CHANGELOG.rst └── README.rst ├── kitchen.yml ├── overstate.multi ├── overstate.single ├── pillar.example ├── pre-commit_semantic-release.sh ├── release-rules.js ├── release.config.js └── test └── integration ├── default ├── README.md └── inspec.yml └── share ├── README.md ├── inspec.yml └── libraries └── system.rb /.github/workflows/commitlint.yml: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # vim: ft=yaml 3 | --- 4 | name: Commitlint 5 | 'on': [pull_request] 6 | 7 | jobs: 8 | lint: 9 | runs-on: ubuntu-latest 10 | env: 11 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 12 | steps: 13 | - uses: actions/checkout@v2 14 | with: 15 | fetch-depth: 0 16 | - uses: wagoid/commitlint-github-action@v1 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a packager 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | .kitchen 49 | .kitchen.local.yml 50 | kitchen.local.yml 51 | junit-*.xml 52 | 53 | # Translations 54 | *.mo 55 | *.pot 56 | 57 | # Django stuff: 58 | *.log 59 | local_settings.py 60 | 61 | # Flask stuff: 62 | instance/ 63 | .webassets-cache 64 | 65 | # Scrapy stuff: 66 | .scrapy 67 | 68 | # Sphinx documentation 69 | docs/_build/ 70 | 71 | # PyBuilder 72 | target/ 73 | 74 | # Jupyter Notebook 75 | .ipynb_checkpoints 76 | 77 | # pyenv 78 | .python-version 79 | 80 | # celery beat schedule file 81 | celerybeat-schedule 82 | 83 | # SageMath parsed files 84 | *.sage.py 85 | 86 | # dotenv 87 | .env 88 | 89 | # virtualenv 90 | .venv 91 | venv/ 92 | ENV/ 93 | 94 | # visual studio 95 | .vs/ 96 | 97 | # Spyder project settings 98 | .spyderproject 99 | .spyproject 100 | 101 | # Rope project settings 102 | .ropeproject 103 | 104 | # mkdocs documentation 105 | /site 106 | 107 | # mypy 108 | .mypy_cache/ 109 | 110 | # Bundler 111 | .bundle/ 112 | 113 | # copied `.md` files used for conversion to `.rst` using `m2r` 114 | docs/*.md 115 | 116 | # Vim 117 | *.sw? 118 | 119 | ## Collected when centralising formulas (check and sort) 120 | # `collectd-formula` 121 | .pytest_cache/ 122 | /.idea/ 123 | Dockerfile.*_* 124 | ignore/ 125 | tmp/ 126 | 127 | # `salt-formula` -- Vagrant Specific files 128 | .vagrant 129 | top.sls 130 | !test/salt/pillar/top.sls 131 | 132 | # `suricata-formula` -- Platform binaries 133 | *.rpm 134 | *.deb 135 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # vim: ft=yaml 3 | --- 4 | ############################################################################### 5 | # Define all YAML node anchors 6 | ############################################################################### 7 | .node_anchors: 8 | # `only` (also used for `except` where applicable) 9 | only_branch_master_parent_repo: &only_branch_master_parent_repo 10 | - 'master@saltstack-formulas/django-formula' 11 | # `stage` 12 | stage_lint: &stage_lint 'lint' 13 | stage_release: &stage_release 'release' 14 | stage_test: &stage_test 'test' 15 | # `image` 16 | image_commitlint: &image_commitlint 'myii/ssf-commitlint:11' 17 | image_dindruby: &image_dindruby 'myii/ssf-dind-ruby:2.7.1-r3' 18 | image_precommit: &image_precommit 19 | name: 'myii/ssf-pre-commit:2.9.2' 20 | entrypoint: ['/bin/bash', '-c'] 21 | image_rubocop: &image_rubocop 'pipelinecomponents/rubocop:latest' 22 | image_semantic-release: &image_semanticrelease 'myii/ssf-semantic-release:15.14' 23 | # `services` 24 | services_docker_dind: &services_docker_dind 25 | - 'docker:dind' 26 | # `variables` 27 | # https://forum.gitlab.com/t/gitlab-com-ci-caching-rubygems/5627/3 28 | # https://bundler.io/v1.16/bundle_config.html 29 | variables_bundler: &variables_bundler 30 | BUNDLE_CACHE_PATH: '${CI_PROJECT_DIR}/.cache/bundler' 31 | BUNDLE_WITHOUT: 'production' 32 | # `cache` 33 | cache_bundler: &cache_bundler 34 | key: '${CI_JOB_STAGE}' 35 | paths: 36 | - '${BUNDLE_CACHE_PATH}' 37 | 38 | ############################################################################### 39 | # Define stages and global variables 40 | ############################################################################### 41 | stages: 42 | - *stage_lint 43 | - *stage_test 44 | - *stage_release 45 | variables: 46 | DOCKER_DRIVER: 'overlay2' 47 | 48 | ############################################################################### 49 | # `lint` stage: `commitlint`, `pre-commit` & `rubocop` (latest, failure allowed) 50 | ############################################################################### 51 | commitlint: 52 | stage: *stage_lint 53 | image: *image_commitlint 54 | script: 55 | # Add `upstream` remote to get access to `upstream/master` 56 | - 'git remote add upstream 57 | https://gitlab.com/saltstack-formulas/django-formula.git' 58 | - 'git fetch --all' 59 | # Set default commit hashes for `--from` and `--to` 60 | - 'export COMMITLINT_FROM="$(git merge-base upstream/master HEAD)"' 61 | - 'export COMMITLINT_TO="${CI_COMMIT_SHA}"' 62 | # `coqbot` adds a merge commit to test PRs on top of the latest commit in 63 | # the repo; amend this merge commit message to avoid failure 64 | - | 65 | if [ "${GITLAB_USER_LOGIN}" = "coqbot" ] \ 66 | && [ "${CI_COMMIT_BRANCH}" != "master" ]; then 67 | git commit --amend -m \ 68 | 'chore: reword coqbot merge commit message for commitlint' 69 | export COMMITLINT_TO=HEAD 70 | fi 71 | # Run `commitlint` 72 | - 'commitlint --from "${COMMITLINT_FROM}" 73 | --to "${COMMITLINT_TO}" 74 | --verbose' 75 | 76 | pre-commit: 77 | stage: *stage_lint 78 | image: *image_precommit 79 | # https://pre-commit.com/#gitlab-ci-example 80 | variables: 81 | PRE_COMMIT_HOME: '${CI_PROJECT_DIR}/.cache/pre-commit' 82 | cache: 83 | key: '${CI_JOB_NAME}' 84 | paths: 85 | - '${PRE_COMMIT_HOME}' 86 | script: 87 | - 'pre-commit run --all-files --color always --verbose' 88 | 89 | # Use a separate job for `rubocop` other than the one potentially run by `pre-commit` 90 | # - The `pre-commit` check will only be available for formulas that pass the default 91 | # `rubocop` check -- and must continue to do so 92 | # - This job is allowed to fail, so can be used for all formulas 93 | # - Furthermore, this job uses all of the latest `rubocop` features & cops, 94 | # which will help when upgrading the `rubocop` linter used in `pre-commit` 95 | rubocop: 96 | allow_failure: true 97 | stage: *stage_lint 98 | image: *image_rubocop 99 | script: 100 | - 'rubocop -d -P -S --enable-pending-cops' 101 | 102 | ############################################################################### 103 | # Define `test` template 104 | ############################################################################### 105 | .test_instance: &test_instance 106 | stage: *stage_test 107 | image: *image_dindruby 108 | services: *services_docker_dind 109 | variables: *variables_bundler 110 | cache: *cache_bundler 111 | before_script: 112 | # TODO: This should work from the env vars above automatically 113 | - 'bundle config set path "${BUNDLE_CACHE_PATH}"' 114 | - 'bundle config set without "${BUNDLE_WITHOUT}"' 115 | - 'bundle install' 116 | script: 117 | # Alternative value to consider: `${CI_JOB_NAME}` 118 | - 'bin/kitchen verify "${DOCKER_ENV_CI_JOB_NAME}"' 119 | 120 | ############################################################################### 121 | # Define `test` template (`allow_failure: true`) 122 | ############################################################################### 123 | .test_instance_failure_permitted: 124 | <<: *test_instance 125 | allow_failure: true 126 | 127 | ############################################################################### 128 | # `test` stage: each instance below uses the `test` template above 129 | ############################################################################### 130 | ## Define the rest of the matrix based on Kitchen testing 131 | # Make sure the instances listed below match up with 132 | # the `platforms` defined in `kitchen.yml` 133 | # yamllint disable rule:line-length 134 | # default-debian-11-tiamat-py3: {extends: '.test_instance'} 135 | # default-debian-10-tiamat-py3: {extends: '.test_instance'} 136 | # default-debian-9-tiamat-py3: {extends: '.test_instance'} 137 | # default-ubuntu-2204-tiamat-py3: {extends: '.test_instance_failure_permitted'} 138 | # default-ubuntu-2004-tiamat-py3: {extends: '.test_instance'} 139 | # default-ubuntu-1804-tiamat-py3: {extends: '.test_instance'} 140 | # default-centos-stream8-tiamat-py3: {extends: '.test_instance_failure_permitted'} 141 | # default-centos-7-tiamat-py3: {extends: '.test_instance'} 142 | # default-amazonlinux-2-tiamat-py3: {extends: '.test_instance'} 143 | # default-oraclelinux-8-tiamat-py3: {extends: '.test_instance'} 144 | # default-oraclelinux-7-tiamat-py3: {extends: '.test_instance'} 145 | # default-almalinux-8-tiamat-py3: {extends: '.test_instance'} 146 | # default-rockylinux-8-tiamat-py3: {extends: '.test_instance'} 147 | default-debian-11-master-py3: {extends: '.test_instance'} 148 | default-debian-10-master-py3: {extends: '.test_instance'} 149 | default-debian-9-master-py3: {extends: '.test_instance'} 150 | default-ubuntu-2204-master-py3: {extends: '.test_instance_failure_permitted'} 151 | default-ubuntu-2004-master-py3: {extends: '.test_instance'} 152 | default-ubuntu-1804-master-py3: {extends: '.test_instance'} 153 | default-centos-stream8-master-py3: {extends: '.test_instance_failure_permitted'} 154 | default-centos-7-master-py3: {extends: '.test_instance'} 155 | # default-fedora-36-master-py3: {extends: '.test_instance_failure_permitted'} 156 | # default-fedora-35-master-py3: {extends: '.test_instance'} 157 | default-opensuse-leap-153-master-py3: {extends: '.test_instance'} 158 | default-opensuse-tmbl-latest-master-py3: {extends: '.test_instance_failure_permitted'} 159 | default-amazonlinux-2-master-py3: {extends: '.test_instance'} 160 | default-oraclelinux-8-master-py3: {extends: '.test_instance'} 161 | default-oraclelinux-7-master-py3: {extends: '.test_instance'} 162 | default-arch-base-latest-master-py3: {extends: '.test_instance'} 163 | # default-gentoo-stage3-latest-master-py3: {extends: '.test_instance'} 164 | # default-gentoo-stage3-systemd-master-py3: {extends: '.test_instance'} 165 | default-almalinux-8-master-py3: {extends: '.test_instance'} 166 | default-rockylinux-8-master-py3: {extends: '.test_instance'} 167 | # default-debian-11-3004-1-py3: {extends: '.test_instance'} 168 | # default-debian-10-3004-1-py3: {extends: '.test_instance'} 169 | # default-debian-9-3004-1-py3: {extends: '.test_instance'} 170 | # default-ubuntu-2204-3004-1-py3: {extends: '.test_instance_failure_permitted'} 171 | # default-ubuntu-2004-3004-1-py3: {extends: '.test_instance'} 172 | # default-ubuntu-1804-3004-1-py3: {extends: '.test_instance'} 173 | # default-centos-stream8-3004-1-py3: {extends: '.test_instance_failure_permitted'} 174 | # default-centos-7-3004-1-py3: {extends: '.test_instance'} 175 | # default-fedora-36-3004-1-py3: {extends: '.test_instance_failure_permitted'} 176 | # default-fedora-35-3004-1-py3: {extends: '.test_instance'} 177 | # default-amazonlinux-2-3004-1-py3: {extends: '.test_instance'} 178 | # default-oraclelinux-8-3004-1-py3: {extends: '.test_instance'} 179 | # default-oraclelinux-7-3004-1-py3: {extends: '.test_instance'} 180 | # default-arch-base-latest-3004-1-py3: {extends: '.test_instance'} 181 | # default-gentoo-stage3-latest-3004-1-py3: {extends: '.test_instance'} 182 | # default-gentoo-stage3-systemd-3004-1-py3: {extends: '.test_instance'} 183 | # default-almalinux-8-3004-1-py3: {extends: '.test_instance'} 184 | # default-rockylinux-8-3004-1-py3: {extends: '.test_instance'} 185 | # default-opensuse-leap-153-3004-0-py3: {extends: '.test_instance'} 186 | # default-opensuse-tmbl-latest-3004-0-py3: {extends: '.test_instance_failure_permitted'} 187 | # default-debian-10-3003-4-py3: {extends: '.test_instance'} 188 | # default-debian-9-3003-4-py3: {extends: '.test_instance'} 189 | # default-ubuntu-2004-3003-4-py3: {extends: '.test_instance'} 190 | # default-ubuntu-1804-3003-4-py3: {extends: '.test_instance'} 191 | # default-centos-stream8-3003-4-py3: {extends: '.test_instance_failure_permitted'} 192 | # default-centos-7-3003-4-py3: {extends: '.test_instance'} 193 | # default-amazonlinux-2-3003-4-py3: {extends: '.test_instance'} 194 | # default-oraclelinux-8-3003-4-py3: {extends: '.test_instance'} 195 | # default-oraclelinux-7-3003-4-py3: {extends: '.test_instance'} 196 | # default-almalinux-8-3003-4-py3: {extends: '.test_instance'} 197 | # yamllint enable rule:line-length 198 | 199 | ############################################################################### 200 | # `release` stage: `semantic-release` 201 | ############################################################################### 202 | semantic-release: 203 | only: *only_branch_master_parent_repo 204 | stage: *stage_release 205 | image: *image_semanticrelease 206 | variables: 207 | MAINTAINER_TOKEN: '${GH_TOKEN}' 208 | script: 209 | # Update `AUTHORS.md` 210 | - '${HOME}/go/bin/maintainer contributor' 211 | # Run `semantic-release` 212 | - 'semantic-release' 213 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # vim: ft=yaml 3 | --- 4 | # See https://pre-commit.com for more information 5 | # See https://pre-commit.com/hooks.html for more hooks 6 | ci: 7 | autofix_commit_msg: | 8 | ci(pre-commit.ci): apply auto fixes from pre-commit.com hooks 9 | 10 | For more information, see https://pre-commit.ci 11 | autofix_prs: true 12 | autoupdate_branch: '' 13 | autoupdate_commit_msg: | 14 | ci(pre-commit.ci): perform `pre-commit` autoupdate 15 | autoupdate_schedule: quarterly 16 | skip: [] 17 | submodules: false 18 | default_stages: [commit] 19 | repos: 20 | - repo: https://github.com/dafyddj/commitlint-pre-commit-hook 21 | rev: v2.3.0 22 | hooks: 23 | - id: commitlint 24 | name: Check commit message using commitlint 25 | description: Lint commit message against @commitlint/config-conventional rules 26 | stages: [commit-msg] 27 | additional_dependencies: ['@commitlint/config-conventional@8.3.4'] 28 | - id: commitlint-travis 29 | stages: [manual] 30 | additional_dependencies: ['@commitlint/config-conventional@8.3.4'] 31 | always_run: true 32 | - repo: https://github.com/rubocop-hq/rubocop 33 | rev: v1.30.1 34 | hooks: 35 | - id: rubocop 36 | name: Check Ruby files with rubocop 37 | args: [--debug] 38 | always_run: true 39 | pass_filenames: false 40 | - repo: https://github.com/shellcheck-py/shellcheck-py 41 | rev: v0.8.0.4 42 | hooks: 43 | - id: shellcheck 44 | name: Check shell scripts with shellcheck 45 | files: ^.*\.(sh|bash|ksh)$ 46 | types: [] 47 | - repo: https://github.com/adrienverge/yamllint 48 | rev: v1.26.3 49 | hooks: 50 | - id: yamllint 51 | name: Check YAML syntax with yamllint 52 | args: [--strict, '.'] 53 | always_run: true 54 | pass_filenames: false 55 | - repo: https://github.com/warpnet/salt-lint 56 | rev: v0.8.0 57 | hooks: 58 | - id: salt-lint 59 | name: Check Salt files using salt-lint 60 | files: ^.*\.(sls|jinja|j2|tmpl|tst)$ 61 | - repo: https://github.com/myint/rstcheck 62 | rev: 3f929574 63 | hooks: 64 | - id: rstcheck 65 | name: Check reST files using rstcheck 66 | exclude: 'docs/CHANGELOG.rst' 67 | - repo: https://github.com/saltstack-formulas/mirrors-rst-lint 68 | rev: v1.3.2 69 | hooks: 70 | - id: rst-lint 71 | name: Check reST files using rst-lint 72 | exclude: | 73 | (?x)^( 74 | docs/CHANGELOG.rst| 75 | docs/TOFS_pattern.rst| 76 | )$ 77 | additional_dependencies: [pygments==2.9.0] 78 | -------------------------------------------------------------------------------- /.rstcheck.cfg: -------------------------------------------------------------------------------- 1 | [rstcheck] 2 | report=info 3 | ignore_language=rst 4 | ignore_messages=(Duplicate (ex|im)plicit target.*|Hyperlink target ".*" is not referenced\.$) 5 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # vim: ft=yaml 3 | --- 4 | # General overrides used across formulas in the org 5 | Layout/LineLength: 6 | # Increase from default of `80` 7 | # Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`) 8 | Max: 88 9 | Metrics/BlockLength: 10 | IgnoredMethods: 11 | - control 12 | - describe 13 | # Increase from default of `25` 14 | Max: 30 15 | Security/YAMLLoad: 16 | Exclude: 17 | - test/integration/**/_mapdata.rb 18 | 19 | # General settings across all cops in this formula 20 | AllCops: 21 | NewCops: enable 22 | 23 | # Any offenses that should be fixed, e.g. collected via. `rubocop --auto-gen-config` 24 | -------------------------------------------------------------------------------- /.salt-lint: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # vim: ft=yaml 3 | --- 4 | exclude_paths: [] 5 | rules: {} 6 | skip_list: 7 | # Using `salt-lint` for linting other files as well, such as Jinja macros/templates 8 | - 205 # Use ".sls" as a Salt State file extension 9 | # Skipping `207` and `208` because `210` is sufficient, at least for the time-being 10 | # I.e. Allows 3-digit unquoted codes to still be used, such as `644` and `755` 11 | - 207 # File modes should always be encapsulated in quotation marks 12 | - 208 # File modes should always contain a leading zero 13 | tags: [] 14 | verbosity: 1 15 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # vim: ft=yaml 3 | --- 4 | ################################################################################ 5 | # NOTE: This file is UNMAINTAINED; it is provided for references purposes only. 6 | # No guarantees are tendered that this structure will work after 2020. 7 | ################################################################################ 8 | # * https://en.wikipedia.org/wiki/Travis_CI: 9 | # - "... free open-source plans were removed in [sic] the end of 2020" 10 | # - https://blog.travis-ci.com/2020-11-02-travis-ci-new-billing 11 | # - https://ropensci.org/technotes/2020/11/19/moving-away-travis/ 12 | ################################################################################ 13 | ## Machine config 14 | os: 'linux' 15 | arch: 'amd64' 16 | dist: 'bionic' 17 | version: '~> 1.0' 18 | 19 | ## Language and cache config 20 | language: 'ruby' 21 | cache: 'bundler' 22 | 23 | ## Services config 24 | services: 25 | - docker 26 | 27 | ## Script to run for the test stage 28 | script: 29 | - bin/kitchen verify "${INSTANCE}" 30 | 31 | ## Stages and jobs matrix 32 | stages: 33 | - test 34 | # # As part of the switch away from Travis CI, ensure that the `release` stage 35 | # # is not run inadvertently 36 | # - name: 'release' 37 | # if: 'branch = master AND type != pull_request' 38 | jobs: 39 | include: 40 | ## Define the test stage that runs the linters (and testing matrix, if applicable) 41 | 42 | # Run all of the linters in a single job 43 | - language: 'node_js' 44 | node_js: 'lts/*' 45 | env: 'Lint' 46 | name: 'Lint: salt-lint, yamllint, rubocop, shellcheck & commitlint' 47 | before_install: 'skip' 48 | script: 49 | # Install and run `salt-lint` 50 | - pip install --user salt-lint 51 | - git ls-files -- '*.sls' '*.jinja' '*.j2' '*.tmpl' '*.tst' 52 | | xargs salt-lint 53 | # Install and run `yamllint` 54 | # Need at least `v1.17.0` for the `yaml-files` setting 55 | - pip install --user yamllint>=1.17.0 56 | - yamllint -s . 57 | # Install and run `rubocop` 58 | - gem install rubocop 59 | - rubocop -d 60 | # Run `shellcheck` (already pre-installed in Travis) 61 | - shellcheck --version 62 | - git ls-files -- '*.sh' '*.bash' '*.ksh' 63 | | xargs shellcheck 64 | # Install and run `commitlint` 65 | - npm i -D @commitlint/config-conventional 66 | @commitlint/travis-cli 67 | - commitlint-travis 68 | 69 | # Run `pre-commit` linters in a single job 70 | - language: 'python' 71 | env: 'Lint_pre-commit' 72 | name: 'Lint: pre-commit' 73 | before_install: 'skip' 74 | cache: 75 | directories: 76 | - $HOME/.cache/pre-commit 77 | script: 78 | # Install and run `pre-commit` 79 | - pip install pre-commit==2.7.1 80 | - pre-commit run --all-files --color always --verbose 81 | - pre-commit run --color always --hook-stage manual --verbose commitlint-travis 82 | 83 | ## Define the rest of the matrix based on Kitchen testing 84 | # Make sure the instances listed below match up with 85 | # the `platforms` defined in `kitchen.yml` 86 | # - env: INSTANCE=default-debian-11-tiamat-py3 87 | # - env: INSTANCE=default-debian-10-tiamat-py3 88 | # - env: INSTANCE=default-debian-9-tiamat-py3 89 | # - env: INSTANCE=default-ubuntu-2204-tiamat-py3 90 | # - env: INSTANCE=default-ubuntu-2004-tiamat-py3 91 | # - env: INSTANCE=default-ubuntu-1804-tiamat-py3 92 | # - env: INSTANCE=default-centos-stream8-tiamat-py3 93 | # - env: INSTANCE=default-centos-7-tiamat-py3 94 | # - env: INSTANCE=default-amazonlinux-2-tiamat-py3 95 | # - env: INSTANCE=default-oraclelinux-8-tiamat-py3 96 | # - env: INSTANCE=default-oraclelinux-7-tiamat-py3 97 | # - env: INSTANCE=default-almalinux-8-tiamat-py3 98 | # - env: INSTANCE=default-rockylinux-8-tiamat-py3 99 | - env: INSTANCE=default-debian-11-master-py3 100 | - env: INSTANCE=default-debian-10-master-py3 101 | - env: INSTANCE=default-debian-9-master-py3 102 | - env: INSTANCE=default-ubuntu-2204-master-py3 103 | - env: INSTANCE=default-ubuntu-2004-master-py3 104 | - env: INSTANCE=default-ubuntu-1804-master-py3 105 | - env: INSTANCE=default-centos-stream8-master-py3 106 | - env: INSTANCE=default-centos-7-master-py3 107 | # - env: INSTANCE=default-fedora-36-master-py3 108 | # - env: INSTANCE=default-fedora-35-master-py3 109 | - env: INSTANCE=default-opensuse-leap-153-master-py3 110 | - env: INSTANCE=default-opensuse-tmbl-latest-master-py3 111 | - env: INSTANCE=default-amazonlinux-2-master-py3 112 | - env: INSTANCE=default-oraclelinux-8-master-py3 113 | - env: INSTANCE=default-oraclelinux-7-master-py3 114 | - env: INSTANCE=default-arch-base-latest-master-py3 115 | # - env: INSTANCE=default-gentoo-stage3-latest-master-py3 116 | # - env: INSTANCE=default-gentoo-stage3-systemd-master-py3 117 | - env: INSTANCE=default-almalinux-8-master-py3 118 | - env: INSTANCE=default-rockylinux-8-master-py3 119 | # - env: INSTANCE=default-debian-11-3004-1-py3 120 | # - env: INSTANCE=default-debian-10-3004-1-py3 121 | # - env: INSTANCE=default-debian-9-3004-1-py3 122 | # - env: INSTANCE=default-ubuntu-2204-3004-1-py3 123 | # - env: INSTANCE=default-ubuntu-2004-3004-1-py3 124 | # - env: INSTANCE=default-ubuntu-1804-3004-1-py3 125 | # - env: INSTANCE=default-centos-stream8-3004-1-py3 126 | # - env: INSTANCE=default-centos-7-3004-1-py3 127 | # - env: INSTANCE=default-fedora-36-3004-1-py3 128 | # - env: INSTANCE=default-fedora-35-3004-1-py3 129 | # - env: INSTANCE=default-amazonlinux-2-3004-1-py3 130 | # - env: INSTANCE=default-oraclelinux-8-3004-1-py3 131 | # - env: INSTANCE=default-oraclelinux-7-3004-1-py3 132 | # - env: INSTANCE=default-arch-base-latest-3004-1-py3 133 | # - env: INSTANCE=default-gentoo-stage3-latest-3004-1-py3 134 | # - env: INSTANCE=default-gentoo-stage3-systemd-3004-1-py3 135 | # - env: INSTANCE=default-almalinux-8-3004-1-py3 136 | # - env: INSTANCE=default-rockylinux-8-3004-1-py3 137 | # - env: INSTANCE=default-opensuse-leap-153-3004-0-py3 138 | # - env: INSTANCE=default-opensuse-tmbl-latest-3004-0-py3 139 | # - env: INSTANCE=default-debian-10-3003-4-py3 140 | # - env: INSTANCE=default-debian-9-3003-4-py3 141 | # - env: INSTANCE=default-ubuntu-2004-3003-4-py3 142 | # - env: INSTANCE=default-ubuntu-1804-3003-4-py3 143 | # - env: INSTANCE=default-centos-stream8-3003-4-py3 144 | # - env: INSTANCE=default-centos-7-3003-4-py3 145 | # - env: INSTANCE=default-amazonlinux-2-3003-4-py3 146 | # - env: INSTANCE=default-oraclelinux-8-3003-4-py3 147 | # - env: INSTANCE=default-oraclelinux-7-3003-4-py3 148 | # - env: INSTANCE=default-almalinux-8-3003-4-py3 149 | 150 | ## Define the release stage that runs `semantic-release` 151 | - stage: 'release' 152 | language: 'node_js' 153 | node_js: 'lts/*' 154 | env: 'Release' 155 | name: 'Run semantic-release inc. file updates to AUTHORS, CHANGELOG & FORMULA' 156 | before_install: 'skip' 157 | script: 158 | # Update `AUTHORS.md` 159 | - export MAINTAINER_TOKEN=${GH_TOKEN} 160 | - go get github.com/myii/maintainer 161 | - maintainer contributor 162 | 163 | # Install all dependencies required for `semantic-release` 164 | - npm i -D @semantic-release/changelog@3 165 | @semantic-release/exec@3 166 | @semantic-release/git@7 167 | deploy: 168 | provider: 'script' 169 | # Opt-in to `dpl v2` to complete the Travis build config validation (beta) 170 | # * https://docs.travis-ci.com/user/build-config-validation 171 | # Deprecated `skip_cleanup` can now be avoided, `cleanup: false` is by default 172 | edge: true 173 | # Run `semantic-release` 174 | script: 'npx semantic-release@15.14' 175 | 176 | # Notification options: `always`, `never` or `change` 177 | notifications: 178 | webhooks: 179 | if: 'repo = saltstack-formulas/django-formula' 180 | urls: 181 | - https://saltstack-formulas.zulipchat.com/api/v1/external/travis?api_key=HsIq3o5QmLxdnVCKF9is0FUIpkpAY79P&stream=CI&topic=saltstack-formulas%2Fdjango-formula&ignore_pull_requests=true 182 | on_success: always # default: always 183 | on_failure: always # default: always 184 | on_start: always # default: never 185 | on_cancel: always # default: always 186 | on_error: always # default: always 187 | -------------------------------------------------------------------------------- /.yamllint: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # vim: ft=yaml 3 | --- 4 | # Extend the `default` configuration provided by `yamllint` 5 | extends: 'default' 6 | 7 | # Files to ignore completely 8 | # 1. All YAML files under directory `.bundle/`, introduced if gems are installed locally 9 | # 2. All YAML files under directory `.cache/`, introduced during the CI run 10 | # 3. All YAML files under directory `.git/` 11 | # 4. All YAML files under directory `node_modules/`, introduced during the CI run 12 | # 5. Any SLS files under directory `test/`, which are actually state files 13 | # 6. Any YAML files under directory `.kitchen/`, introduced during local testing 14 | # 7. `kitchen.vagrant.yml`, which contains Embedded Ruby (ERB) template syntax 15 | ignore: | 16 | .bundle/ 17 | .cache/ 18 | .git/ 19 | node_modules/ 20 | test/**/states/**/*.sls 21 | .kitchen/ 22 | kitchen.vagrant.yml 23 | 24 | yaml-files: 25 | # Default settings 26 | - '*.yaml' 27 | - '*.yml' 28 | - .salt-lint 29 | - .yamllint 30 | # SaltStack Formulas additional settings 31 | - '*.example' 32 | - test/**/*.sls 33 | 34 | rules: 35 | empty-values: 36 | forbid-in-block-mappings: true 37 | forbid-in-flow-mappings: true 38 | line-length: 39 | # Increase from default of `80` 40 | # Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`) 41 | max: 88 42 | octal-values: 43 | forbid-implicit-octal: true 44 | forbid-explicit-octal: true 45 | -------------------------------------------------------------------------------- /AUTHORS.md: -------------------------------------------------------------------------------- 1 | # Authors 2 | 3 | This list is sorted by the number of commits per contributor in _descending_ order. 4 | 5 | Avatar|Contributor|Contributions 6 | :-:|---|:-: 7 | @myii|[@myii](https://github.com/myii)|88 8 | @terminalmage|[@terminalmage](https://github.com/terminalmage)|24 9 | @whiteinge|[@whiteinge](https://github.com/whiteinge)|7 10 | @dafyddj|[@dafyddj](https://github.com/dafyddj)|3 11 | @nmadhok|[@nmadhok](https://github.com/nmadhok)|2 12 | @baby-gnu|[@baby-gnu](https://github.com/baby-gnu)|1 13 | @techhat|[@techhat](https://github.com/techhat)|1 14 | @noelmcloughlin|[@noelmcloughlin](https://github.com/noelmcloughlin)|1 15 | @puneetk|[@puneetk](https://github.com/puneetk)|1 16 | @rspt|[@rspt](https://github.com/rspt)|1 17 | 18 | --- 19 | 20 | Auto-generated by a [forked version](https://github.com/myii/maintainer) of [gaocegege/maintainer](https://github.com/gaocegege/maintainer) on 2022-02-12. 21 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [0.5.1](https://github.com/saltstack-formulas/django-formula/compare/v0.5.0...v0.5.1) (2022-02-12) 4 | 5 | 6 | ### Code Refactoring 7 | 8 | * **salt-lint:** fix violations ([f73f9ca](https://github.com/saltstack-formulas/django-formula/commit/f73f9cac2d22a0516b44b0b319481964997bc028)) 9 | 10 | 11 | ### Continuous Integration 12 | 13 | * update linters to latest versions [skip ci] ([6ebf288](https://github.com/saltstack-formulas/django-formula/commit/6ebf288fcc7cb837f8d9454967b37df73503d427)) 14 | * **3003.1:** update inc. AlmaLinux, Rocky & `rst-lint` [skip ci] ([8cbb4a6](https://github.com/saltstack-formulas/django-formula/commit/8cbb4a6f1721bed6b3f7ec50ea71b6256250d27e)) 15 | * **commitlint:** ensure `upstream/master` uses main repo URL [skip ci] ([85cb8f0](https://github.com/saltstack-formulas/django-formula/commit/85cb8f0d203cbd5f6818dbfe7c55586408027ba0)) 16 | * **gemfile:** allow rubygems proxy to be provided as an env var [skip ci] ([c8603c9](https://github.com/saltstack-formulas/django-formula/commit/c8603c9fc7a606f2cf161e6df8b2f8d7cbcb1536)) 17 | * **gemfile:** restrict `train` gem version until upstream fix [skip ci] ([0abff57](https://github.com/saltstack-formulas/django-formula/commit/0abff57230106983efc1b2a15adf8f5a3da74e64)) 18 | * **gemfile.lock:** add to repo with updated `Gemfile` [skip ci] ([b6a4ad6](https://github.com/saltstack-formulas/django-formula/commit/b6a4ad6a2b54141ca4f76da15eba5a8902a4b829)) 19 | * **gemfile+lock:** use `ssf` customised `inspec` repo [skip ci] ([228e51b](https://github.com/saltstack-formulas/django-formula/commit/228e51bd32755ee05b5cd6b86c45bbe9b101ec3b)) 20 | * **gemfile+lock:** use `ssf` customised `kitchen-docker` repo [skip ci] ([e293044](https://github.com/saltstack-formulas/django-formula/commit/e293044b1a7cc9bda4f4fd8447f70df4b820df27)) 21 | * **gitlab-ci:** add `rubocop` linter (with `allow_failure`) [skip ci] ([aee1b5d](https://github.com/saltstack-formulas/django-formula/commit/aee1b5dcf88466a3aaa4f1429c8f180a79bc7292)) 22 | * **gitlab-ci:** use GitLab CI as Travis CI replacement ([b797489](https://github.com/saltstack-formulas/django-formula/commit/b797489e4cd2ee20925d485c9188698a2bdaedda)) 23 | * **kitchen:** avoid using bootstrap for `master` instances [skip ci] ([894e51e](https://github.com/saltstack-formulas/django-formula/commit/894e51e48444d4e1ab0349eb82968c2aa6d06318)) 24 | * **kitchen:** move `provisioner` block & update `run_command` [skip ci] ([dcbcb96](https://github.com/saltstack-formulas/django-formula/commit/dcbcb96f81e19a93ec3515d16341579e16d2cabc)) 25 | * **kitchen:** use `saltimages` Docker Hub where available [skip ci] ([6496040](https://github.com/saltstack-formulas/django-formula/commit/649604030f5de1e5aa65032edff472aee3c8026d)) 26 | * **kitchen+ci:** update with `3004` pre-salted images/boxes [skip ci] ([39b44f7](https://github.com/saltstack-formulas/django-formula/commit/39b44f76819133ce8d71faa549b99cfaf8bf6d0d)) 27 | * **kitchen+ci:** update with latest `3003.2` pre-salted images [skip ci] ([dac2516](https://github.com/saltstack-formulas/django-formula/commit/dac25162c496e3a0489009b8be58270a794940f2)) 28 | * **kitchen+ci:** update with latest CVE pre-salted images [skip ci] ([2f29575](https://github.com/saltstack-formulas/django-formula/commit/2f29575658501c40c9b433ba1052b13e4b4fbd4f)) 29 | * **kitchen+ci:** use latest pre-salted images (after CVE) [skip ci] ([8de998a](https://github.com/saltstack-formulas/django-formula/commit/8de998ae05369fe2d0251ea9002065c34a04fa02)) 30 | * **kitchen+gitlab:** adjust matrix to add `3003` [skip ci] ([247495a](https://github.com/saltstack-formulas/django-formula/commit/247495a9d02bc4d5159ed6d432c833f6c32ff552)) 31 | * **kitchen+gitlab:** remove Ubuntu 16.04 & Fedora 32 (EOL) [skip ci] ([7fdcc68](https://github.com/saltstack-formulas/django-formula/commit/7fdcc6809e0ede6f9b22e7700920303a53c07333)) 32 | * **kitchen+gitlab:** update for new pre-salted images [skip ci] ([946d035](https://github.com/saltstack-formulas/django-formula/commit/946d035b596957e28de75f3a27a686240f452303)) 33 | * add `arch-master` to matrix and update `.travis.yml` [skip ci] ([2958879](https://github.com/saltstack-formulas/django-formula/commit/2958879d04794596715d93acb2f1d8ec833b2519)) 34 | * add Debian 11 Bullseye & update `yamllint` configuration [skip ci] ([e5f295d](https://github.com/saltstack-formulas/django-formula/commit/e5f295dd4cd06ebe953622cbf588a56ca356c49e)) 35 | * **kitchen+gitlab-ci:** use latest pre-salted images [skip ci] ([dca4e26](https://github.com/saltstack-formulas/django-formula/commit/dca4e2615319d860f13f97f1485f88eecb668137)) 36 | * **kitchen+travis:** remove `master-py2-arch-base-latest` [skip ci] ([d098b4b](https://github.com/saltstack-formulas/django-formula/commit/d098b4b40e6f88ec5e69ffe02ab876bb41e850ac)) 37 | * **pre-commit:** add to formula [skip ci] ([acf5bb5](https://github.com/saltstack-formulas/django-formula/commit/acf5bb5bb7ee692964a673e0fcacd1e40558a648)) 38 | * **pre-commit:** enable/disable `rstcheck` as relevant [skip ci] ([058a5d1](https://github.com/saltstack-formulas/django-formula/commit/058a5d1059895d751a0b6d9d438474f2535e6a10)) 39 | * **pre-commit:** finalise `rstcheck` configuration [skip ci] ([e0e5b69](https://github.com/saltstack-formulas/django-formula/commit/e0e5b69627433d23fdfd8b3386a2e84dc95cae2b)) 40 | * **pre-commit:** update hook for `rubocop` [skip ci] ([56b44ca](https://github.com/saltstack-formulas/django-formula/commit/56b44ca5c8266f06f44280dffa9d39eefee17e71)) 41 | * **travis:** add notifications => zulip [skip ci] ([047e6cb](https://github.com/saltstack-formulas/django-formula/commit/047e6cb2224268d8d202caed7dca7f5260b5af08)) 42 | * **travis:** quote pathspecs used with `git ls-files` [skip ci] ([b3d3503](https://github.com/saltstack-formulas/django-formula/commit/b3d3503715a786682d213625385d3a4f204ab8d8)) 43 | * **travis:** run `shellcheck` during lint job [skip ci] ([877cab5](https://github.com/saltstack-formulas/django-formula/commit/877cab5317a51de9e618fac56d77d5710163d8d4)) 44 | * **travis:** use `major.minor` for `semantic-release` version [skip ci] ([d9ad891](https://github.com/saltstack-formulas/django-formula/commit/d9ad891a49508842cfe241e5ab4e11086c89c90f)) 45 | * **travis:** use default matrix after `centos-6` image fix ([3c7b45a](https://github.com/saltstack-formulas/django-formula/commit/3c7b45a264cb16359926bf07a17bb2cd37e71be5)) 46 | * **workflows/commitlint:** add to repo [skip ci] ([ea8f09e](https://github.com/saltstack-formulas/django-formula/commit/ea8f09e07b3cf7d022c1ff6e51dee455c880937d)) 47 | 48 | 49 | ### Tests 50 | 51 | * standardise use of `share` suite & `_mapdata` state [skip ci] ([56cb1ec](https://github.com/saltstack-formulas/django-formula/commit/56cb1ec91b9767c01b4ec8ed820b6ddcb0599a25)) 52 | 53 | # [0.5.0](https://github.com/saltstack-formulas/django-formula/compare/v0.4.0...v0.5.0) (2019-11-25) 54 | 55 | 56 | ### Bug Fixes 57 | 58 | * **yamllint:** fix all errors ([773aab8](https://github.com/saltstack-formulas/django-formula/commit/773aab892cae3f69764514c776bc93209750007b)) 59 | 60 | 61 | ### Documentation 62 | 63 | * **changelog:** update according to standard structure ([07eec72](https://github.com/saltstack-formulas/django-formula/commit/07eec72c95f4eddde22f4720f92cee8557c60438)) 64 | * **readme:** modify according to standard structure ([94e3e89](https://github.com/saltstack-formulas/django-formula/commit/94e3e89716f42bd11bd498f18bc92aa9e13b7a4a)) 65 | * **readme:** move to `docs/` directory ([4db7d05](https://github.com/saltstack-formulas/django-formula/commit/4db7d05fe06dd91f9e54d5a870c7d0d8ae428961)) 66 | 67 | 68 | ### Features 69 | 70 | * **semantic-release:** implement for this formula ([77bc3a9](https://github.com/saltstack-formulas/django-formula/commit/77bc3a95cfb670a7b9b1cff3002b27aa42bb1d38)) 71 | 72 | ## [v0.4.0](https://github.com/saltstack-formulas/django-formula/tree/v0.4.0) (2015-06-22) 73 | **Merged pull requests:** 74 | 75 | - Fix Typo in Word Settings [\#5](https://github.com/saltstack-formulas/django-formula/pull/5) ([rspt](https://github.com/rspt)) 76 | - Change states to use short-dec style [\#4](https://github.com/saltstack-formulas/django-formula/pull/4) ([whiteinge](https://github.com/whiteinge)) 77 | - Update README.rst [\#3](https://github.com/saltstack-formulas/django-formula/pull/3) ([ghost](https://github.com/ghost)) 78 | - Some fixes to make this formula work on Ubuntu 14.04 LTS [\#2](https://github.com/saltstack-formulas/django-formula/pull/2) ([terminalmage](https://github.com/terminalmage)) 79 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners 2 | 3 | # SECTION: Owner(s) for everything in the repo, unless a later match takes precedence 4 | # ************************************************************************** 5 | # *** NO GLOBAL OWNER(S) SPECIFIED *** 6 | # *** Ideally this will be defined for a healthy, well-maintained repo *** 7 | # ************************************************************************** 8 | # FILE PATTERN OWNER(S) 9 | * @NONE 10 | 11 | # SECTION: Owner(s) for specific directories 12 | # FILE PATTERN OWNER(S) 13 | 14 | # SECTION: Owner(s) for files/directories related to `semantic-release` 15 | # FILE PATTERN OWNER(S) 16 | /.github/workflows/ @saltstack-formulas/ssf 17 | /bin/install-hooks @saltstack-formulas/ssf 18 | /bin/kitchen @saltstack-formulas/ssf 19 | /docs/AUTHORS.rst @saltstack-formulas/ssf 20 | /docs/CHANGELOG.rst @saltstack-formulas/ssf 21 | /docs/TOFS_pattern.rst @saltstack-formulas/ssf 22 | /*/_mapdata/ @saltstack-formulas/ssf 23 | /*/libsaltcli.jinja @saltstack-formulas/ssf 24 | /*/libtofs.jinja @saltstack-formulas/ssf 25 | /test/integration/**/_mapdata.rb @saltstack-formulas/ssf 26 | /test/integration/**/libraries/system.rb @saltstack-formulas/ssf 27 | /test/integration/**/inspec.yml @saltstack-formulas/ssf 28 | /test/integration/**/README.md @saltstack-formulas/ssf 29 | /test/salt/pillar/top.sls @saltstack-formulas/ssf 30 | /.gitignore @saltstack-formulas/ssf 31 | /.cirrus.yml @saltstack-formulas/ssf 32 | /.gitlab-ci.yml @saltstack-formulas/ssf 33 | /.pre-commit-config.yaml @saltstack-formulas/ssf 34 | /.rstcheck.cfg @saltstack-formulas/ssf 35 | /.rubocop.yml @saltstack-formulas/ssf 36 | /.salt-lint @saltstack-formulas/ssf 37 | /.travis.yml @saltstack-formulas/ssf 38 | /.yamllint @saltstack-formulas/ssf 39 | /AUTHORS.md @saltstack-formulas/ssf 40 | /CHANGELOG.md @saltstack-formulas/ssf 41 | /CODEOWNERS @saltstack-formulas/ssf 42 | /commitlint.config.js @saltstack-formulas/ssf 43 | /FORMULA @saltstack-formulas/ssf 44 | /Gemfile @saltstack-formulas/ssf 45 | /Gemfile.lock @saltstack-formulas/ssf 46 | /kitchen.yml @saltstack-formulas/ssf 47 | /kitchen.vagrant.yml @saltstack-formulas/ssf 48 | /kitchen.windows.yml @saltstack-formulas/ssf 49 | /pre-commit_semantic-release.sh @saltstack-formulas/ssf 50 | /release-rules.js @saltstack-formulas/ssf 51 | /release.config.js @saltstack-formulas/ssf 52 | 53 | # SECTION: Owner(s) for specific files 54 | # FILE PATTERN OWNER(S) 55 | -------------------------------------------------------------------------------- /FORMULA: -------------------------------------------------------------------------------- 1 | name: django 2 | os: Debian, Ubuntu, Raspbian, RedHat, Fedora, CentOS, Suse, openSUSE, Gentoo, Funtoo, Arch, Manjaro, Alpine, FreeBSD, OpenBSD, Solaris, SmartOS, Windows, MacOS 3 | os_family: Debian, RedHat, Suse, Gentoo, Arch, Alpine, FreeBSD, OpenBSD, Solaris, Windows, MacOS 4 | version: 0.5.1 5 | release: 1 6 | minimum_version: 2017.7 7 | summary: django formula 8 | description: Set up and configure the Django web application framework 9 | top_level_dir: django 10 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | source ENV.fetch('PROXY_RUBYGEMSORG', 'https://rubygems.org') 4 | 5 | # Install the `inspec` gem using `git` because versions after `4.22.22` 6 | # suppress diff output; this version fixes this for our uses. 7 | # rubocop:disable Layout/LineLength 8 | gem 'inspec', git: 'https://gitlab.com/saltstack-formulas/infrastructure/inspec', branch: 'ssf' 9 | # rubocop:enable Layout/LineLength 10 | 11 | # Install the `kitchen-docker` gem using `git` in order to gain a performance 12 | # improvement: avoid package installations which are already covered by the 13 | # `salt-image-builder` (i.e. the pre-salted images that we're using) 14 | # rubocop:disable Layout/LineLength 15 | gem 'kitchen-docker', git: 'https://gitlab.com/saltstack-formulas/infrastructure/kitchen-docker', branch: 'ssf' 16 | # rubocop:enable Layout/LineLength 17 | 18 | gem 'kitchen-inspec', '>= 2.5.0' 19 | gem 'kitchen-salt', '>= 0.7.2' 20 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GIT 2 | remote: https://gitlab.com/saltstack-formulas/infrastructure/inspec 3 | revision: aaef842906a5666f0fc0b4f186b4dd3498f5b28c 4 | branch: ssf 5 | specs: 6 | inspec (5.18.15) 7 | cookstyle 8 | faraday_middleware (>= 0.12.2, < 1.1) 9 | inspec-core (= 5.18.15) 10 | mongo (= 2.13.2) 11 | progress_bar (~> 1.3.3) 12 | rake 13 | train (~> 3.10) 14 | train-aws (~> 0.2) 15 | train-habitat (~> 0.1) 16 | train-winrm (~> 0.2) 17 | inspec-core (5.18.15) 18 | addressable (~> 2.4) 19 | chef-telemetry (~> 1.0, >= 1.0.8) 20 | faraday (>= 0.9.0, < 1.5) 21 | faraday_middleware (~> 1.0) 22 | hashie (>= 3.4, < 5.0) 23 | license-acceptance (>= 0.2.13, < 3.0) 24 | method_source (>= 0.8, < 2.0) 25 | mixlib-log (~> 3.0) 26 | multipart-post (~> 2.0) 27 | parallel (~> 1.9) 28 | parslet (>= 1.5, < 2.0) 29 | pry (~> 0.13) 30 | rspec (>= 3.9, <= 3.11) 31 | rspec-its (~> 1.2) 32 | rubyzip (>= 1.2.2, < 3.0) 33 | semverse (~> 3.0) 34 | sslshake (~> 1.2) 35 | thor (>= 0.20, < 2.0) 36 | tomlrb (>= 1.2, < 2.1) 37 | train-core (~> 3.10) 38 | tty-prompt (~> 0.17) 39 | tty-table (~> 0.10) 40 | 41 | GIT 42 | remote: https://gitlab.com/saltstack-formulas/infrastructure/kitchen-docker 43 | revision: 9a09bc1e571e25f3ccabf4725ca2048d970fff82 44 | branch: ssf 45 | specs: 46 | kitchen-docker (2.12.0) 47 | test-kitchen (>= 1.0.0) 48 | 49 | GEM 50 | remote: https://rubygems.org/ 51 | specs: 52 | activesupport (7.0.3.1) 53 | concurrent-ruby (~> 1.0, >= 1.0.2) 54 | i18n (>= 1.6, < 2) 55 | minitest (>= 5.1) 56 | tzinfo (~> 2.0) 57 | addressable (2.8.0) 58 | public_suffix (>= 2.0.2, < 5.0) 59 | ast (2.4.2) 60 | aws-eventstream (1.2.0) 61 | aws-partitions (1.607.0) 62 | aws-sdk-alexaforbusiness (1.56.0) 63 | aws-sdk-core (~> 3, >= 3.127.0) 64 | aws-sigv4 (~> 1.1) 65 | aws-sdk-amplify (1.32.0) 66 | aws-sdk-core (~> 3, >= 3.120.0) 67 | aws-sigv4 (~> 1.1) 68 | aws-sdk-apigateway (1.78.0) 69 | aws-sdk-core (~> 3, >= 3.127.0) 70 | aws-sigv4 (~> 1.1) 71 | aws-sdk-apigatewayv2 (1.42.0) 72 | aws-sdk-core (~> 3, >= 3.127.0) 73 | aws-sigv4 (~> 1.1) 74 | aws-sdk-applicationautoscaling (1.51.0) 75 | aws-sdk-core (~> 3, >= 3.112.0) 76 | aws-sigv4 (~> 1.1) 77 | aws-sdk-athena (1.55.0) 78 | aws-sdk-core (~> 3, >= 3.127.0) 79 | aws-sigv4 (~> 1.1) 80 | aws-sdk-autoscaling (1.63.0) 81 | aws-sdk-core (~> 3, >= 3.112.0) 82 | aws-sigv4 (~> 1.1) 83 | aws-sdk-batch (1.47.0) 84 | aws-sdk-core (~> 3, >= 3.112.0) 85 | aws-sigv4 (~> 1.1) 86 | aws-sdk-budgets (1.50.0) 87 | aws-sdk-core (~> 3, >= 3.127.0) 88 | aws-sigv4 (~> 1.1) 89 | aws-sdk-cloudformation (1.70.0) 90 | aws-sdk-core (~> 3, >= 3.127.0) 91 | aws-sigv4 (~> 1.1) 92 | aws-sdk-cloudfront (1.65.0) 93 | aws-sdk-core (~> 3, >= 3.127.0) 94 | aws-sigv4 (~> 1.1) 95 | aws-sdk-cloudhsm (1.39.0) 96 | aws-sdk-core (~> 3, >= 3.127.0) 97 | aws-sigv4 (~> 1.1) 98 | aws-sdk-cloudhsmv2 (1.42.0) 99 | aws-sdk-core (~> 3, >= 3.127.0) 100 | aws-sigv4 (~> 1.1) 101 | aws-sdk-cloudtrail (1.49.0) 102 | aws-sdk-core (~> 3, >= 3.127.0) 103 | aws-sigv4 (~> 1.1) 104 | aws-sdk-cloudwatch (1.64.0) 105 | aws-sdk-core (~> 3, >= 3.127.0) 106 | aws-sigv4 (~> 1.1) 107 | aws-sdk-cloudwatchevents (1.46.0) 108 | aws-sdk-core (~> 3, >= 3.112.0) 109 | aws-sigv4 (~> 1.1) 110 | aws-sdk-cloudwatchlogs (1.53.0) 111 | aws-sdk-core (~> 3, >= 3.127.0) 112 | aws-sigv4 (~> 1.1) 113 | aws-sdk-codecommit (1.51.0) 114 | aws-sdk-core (~> 3, >= 3.127.0) 115 | aws-sigv4 (~> 1.1) 116 | aws-sdk-codedeploy (1.49.0) 117 | aws-sdk-core (~> 3, >= 3.127.0) 118 | aws-sigv4 (~> 1.1) 119 | aws-sdk-codepipeline (1.53.0) 120 | aws-sdk-core (~> 3, >= 3.127.0) 121 | aws-sigv4 (~> 1.1) 122 | aws-sdk-cognitoidentity (1.31.0) 123 | aws-sdk-core (~> 3, >= 3.112.0) 124 | aws-sigv4 (~> 1.1) 125 | aws-sdk-cognitoidentityprovider (1.53.0) 126 | aws-sdk-core (~> 3, >= 3.112.0) 127 | aws-sigv4 (~> 1.1) 128 | aws-sdk-configservice (1.79.0) 129 | aws-sdk-core (~> 3, >= 3.127.0) 130 | aws-sigv4 (~> 1.1) 131 | aws-sdk-core (3.131.2) 132 | aws-eventstream (~> 1, >= 1.0.2) 133 | aws-partitions (~> 1, >= 1.525.0) 134 | aws-sigv4 (~> 1.1) 135 | jmespath (~> 1, >= 1.6.1) 136 | aws-sdk-costandusagereportservice (1.40.0) 137 | aws-sdk-core (~> 3, >= 3.127.0) 138 | aws-sigv4 (~> 1.1) 139 | aws-sdk-databasemigrationservice (1.53.0) 140 | aws-sdk-core (~> 3, >= 3.112.0) 141 | aws-sigv4 (~> 1.1) 142 | aws-sdk-dynamodb (1.75.0) 143 | aws-sdk-core (~> 3, >= 3.127.0) 144 | aws-sigv4 (~> 1.1) 145 | aws-sdk-ec2 (1.322.0) 146 | aws-sdk-core (~> 3, >= 3.127.0) 147 | aws-sigv4 (~> 1.1) 148 | aws-sdk-ecr (1.56.0) 149 | aws-sdk-core (~> 3, >= 3.127.0) 150 | aws-sigv4 (~> 1.1) 151 | aws-sdk-ecrpublic (1.12.0) 152 | aws-sdk-core (~> 3, >= 3.127.0) 153 | aws-sigv4 (~> 1.1) 154 | aws-sdk-ecs (1.100.0) 155 | aws-sdk-core (~> 3, >= 3.127.0) 156 | aws-sigv4 (~> 1.1) 157 | aws-sdk-efs (1.54.0) 158 | aws-sdk-core (~> 3, >= 3.127.0) 159 | aws-sigv4 (~> 1.1) 160 | aws-sdk-eks (1.75.0) 161 | aws-sdk-core (~> 3, >= 3.127.0) 162 | aws-sigv4 (~> 1.1) 163 | aws-sdk-elasticache (1.78.0) 164 | aws-sdk-core (~> 3, >= 3.127.0) 165 | aws-sigv4 (~> 1.1) 166 | aws-sdk-elasticbeanstalk (1.51.0) 167 | aws-sdk-core (~> 3, >= 3.127.0) 168 | aws-sigv4 (~> 1.1) 169 | aws-sdk-elasticloadbalancing (1.40.0) 170 | aws-sdk-core (~> 3, >= 3.127.0) 171 | aws-sigv4 (~> 1.1) 172 | aws-sdk-elasticloadbalancingv2 (1.78.0) 173 | aws-sdk-core (~> 3, >= 3.127.0) 174 | aws-sigv4 (~> 1.1) 175 | aws-sdk-elasticsearchservice (1.65.0) 176 | aws-sdk-core (~> 3, >= 3.127.0) 177 | aws-sigv4 (~> 1.1) 178 | aws-sdk-emr (1.53.0) 179 | aws-sdk-core (~> 3, >= 3.121.2) 180 | aws-sigv4 (~> 1.1) 181 | aws-sdk-eventbridge (1.24.0) 182 | aws-sdk-core (~> 3, >= 3.112.0) 183 | aws-sigv4 (~> 1.1) 184 | aws-sdk-firehose (1.48.0) 185 | aws-sdk-core (~> 3, >= 3.127.0) 186 | aws-sigv4 (~> 1.1) 187 | aws-sdk-glue (1.88.0) 188 | aws-sdk-core (~> 3, >= 3.112.0) 189 | aws-sigv4 (~> 1.1) 190 | aws-sdk-guardduty (1.58.0) 191 | aws-sdk-core (~> 3, >= 3.127.0) 192 | aws-sigv4 (~> 1.1) 193 | aws-sdk-iam (1.69.0) 194 | aws-sdk-core (~> 3, >= 3.127.0) 195 | aws-sigv4 (~> 1.1) 196 | aws-sdk-kafka (1.50.0) 197 | aws-sdk-core (~> 3, >= 3.127.0) 198 | aws-sigv4 (~> 1.1) 199 | aws-sdk-kinesis (1.41.0) 200 | aws-sdk-core (~> 3, >= 3.127.0) 201 | aws-sigv4 (~> 1.1) 202 | aws-sdk-kms (1.57.0) 203 | aws-sdk-core (~> 3, >= 3.127.0) 204 | aws-sigv4 (~> 1.1) 205 | aws-sdk-lambda (1.84.0) 206 | aws-sdk-core (~> 3, >= 3.127.0) 207 | aws-sigv4 (~> 1.1) 208 | aws-sdk-mq (1.40.0) 209 | aws-sdk-core (~> 3, >= 3.120.0) 210 | aws-sigv4 (~> 1.1) 211 | aws-sdk-networkfirewall (1.17.0) 212 | aws-sdk-core (~> 3, >= 3.127.0) 213 | aws-sigv4 (~> 1.1) 214 | aws-sdk-networkmanager (1.24.0) 215 | aws-sdk-core (~> 3, >= 3.127.0) 216 | aws-sigv4 (~> 1.1) 217 | aws-sdk-organizations (1.59.0) 218 | aws-sdk-core (~> 3, >= 3.112.0) 219 | aws-sigv4 (~> 1.1) 220 | aws-sdk-ram (1.26.0) 221 | aws-sdk-core (~> 3, >= 3.112.0) 222 | aws-sigv4 (~> 1.1) 223 | aws-sdk-rds (1.148.0) 224 | aws-sdk-core (~> 3, >= 3.127.0) 225 | aws-sigv4 (~> 1.1) 226 | aws-sdk-redshift (1.84.0) 227 | aws-sdk-core (~> 3, >= 3.127.0) 228 | aws-sigv4 (~> 1.1) 229 | aws-sdk-route53 (1.63.0) 230 | aws-sdk-core (~> 3, >= 3.127.0) 231 | aws-sigv4 (~> 1.1) 232 | aws-sdk-route53domains (1.40.0) 233 | aws-sdk-core (~> 3, >= 3.127.0) 234 | aws-sigv4 (~> 1.1) 235 | aws-sdk-route53resolver (1.37.0) 236 | aws-sdk-core (~> 3, >= 3.127.0) 237 | aws-sigv4 (~> 1.1) 238 | aws-sdk-s3 (1.114.0) 239 | aws-sdk-core (~> 3, >= 3.127.0) 240 | aws-sdk-kms (~> 1) 241 | aws-sigv4 (~> 1.4) 242 | aws-sdk-s3control (1.43.0) 243 | aws-sdk-core (~> 3, >= 3.122.0) 244 | aws-sigv4 (~> 1.1) 245 | aws-sdk-secretsmanager (1.46.0) 246 | aws-sdk-core (~> 3, >= 3.112.0) 247 | aws-sigv4 (~> 1.1) 248 | aws-sdk-securityhub (1.67.0) 249 | aws-sdk-core (~> 3, >= 3.127.0) 250 | aws-sigv4 (~> 1.1) 251 | aws-sdk-servicecatalog (1.60.0) 252 | aws-sdk-core (~> 3, >= 3.112.0) 253 | aws-sigv4 (~> 1.1) 254 | aws-sdk-ses (1.41.0) 255 | aws-sdk-core (~> 3, >= 3.120.0) 256 | aws-sigv4 (~> 1.1) 257 | aws-sdk-shield (1.48.0) 258 | aws-sdk-core (~> 3, >= 3.127.0) 259 | aws-sigv4 (~> 1.1) 260 | aws-sdk-signer (1.32.0) 261 | aws-sdk-core (~> 3, >= 3.120.0) 262 | aws-sigv4 (~> 1.1) 263 | aws-sdk-simpledb (1.29.0) 264 | aws-sdk-core (~> 3, >= 3.120.0) 265 | aws-sigv2 (~> 1.0) 266 | aws-sdk-sms (1.40.0) 267 | aws-sdk-core (~> 3, >= 3.127.0) 268 | aws-sigv4 (~> 1.1) 269 | aws-sdk-sns (1.53.0) 270 | aws-sdk-core (~> 3, >= 3.127.0) 271 | aws-sigv4 (~> 1.1) 272 | aws-sdk-sqs (1.51.1) 273 | aws-sdk-core (~> 3, >= 3.127.0) 274 | aws-sigv4 (~> 1.1) 275 | aws-sdk-ssm (1.137.0) 276 | aws-sdk-core (~> 3, >= 3.127.0) 277 | aws-sigv4 (~> 1.1) 278 | aws-sdk-states (1.39.0) 279 | aws-sdk-core (~> 3, >= 3.112.0) 280 | aws-sigv4 (~> 1.1) 281 | aws-sdk-synthetics (1.19.0) 282 | aws-sdk-core (~> 3, >= 3.121.2) 283 | aws-sigv4 (~> 1.1) 284 | aws-sdk-transfer (1.34.0) 285 | aws-sdk-core (~> 3, >= 3.112.0) 286 | aws-sigv4 (~> 1.1) 287 | aws-sdk-waf (1.43.0) 288 | aws-sdk-core (~> 3, >= 3.122.0) 289 | aws-sigv4 (~> 1.1) 290 | aws-sigv2 (1.1.0) 291 | aws-sigv4 (1.5.0) 292 | aws-eventstream (~> 1, >= 1.0.2) 293 | azure_graph_rbac (0.17.2) 294 | ms_rest_azure (~> 0.12.0) 295 | azure_mgmt_key_vault (0.17.7) 296 | ms_rest_azure (~> 0.12.0) 297 | azure_mgmt_resources (0.18.2) 298 | ms_rest_azure (~> 0.12.0) 299 | azure_mgmt_security (0.19.0) 300 | ms_rest_azure (~> 0.12.0) 301 | azure_mgmt_storage (0.23.0) 302 | ms_rest_azure (~> 0.12.0) 303 | bcrypt_pbkdf (1.1.0) 304 | bson (4.15.0) 305 | builder (3.2.4) 306 | chef-config (17.10.0) 307 | addressable 308 | chef-utils (= 17.10.0) 309 | fuzzyurl 310 | mixlib-config (>= 2.2.12, < 4.0) 311 | mixlib-shellout (>= 2.0, < 4.0) 312 | tomlrb (~> 1.2) 313 | chef-telemetry (1.1.1) 314 | chef-config 315 | concurrent-ruby (~> 1.0) 316 | chef-utils (17.10.0) 317 | concurrent-ruby 318 | coderay (1.1.3) 319 | concurrent-ruby (1.1.10) 320 | cookstyle (7.32.1) 321 | rubocop (= 1.25.1) 322 | declarative (0.0.20) 323 | diff-lcs (1.5.0) 324 | docker-api (2.2.0) 325 | excon (>= 0.47.0) 326 | multi_json 327 | domain_name (0.5.20190701) 328 | unf (>= 0.0.5, < 1.0.0) 329 | ed25519 (1.3.0) 330 | erubi (1.10.0) 331 | excon (0.92.3) 332 | faraday (1.4.3) 333 | faraday-em_http (~> 1.0) 334 | faraday-em_synchrony (~> 1.0) 335 | faraday-excon (~> 1.1) 336 | faraday-net_http (~> 1.0) 337 | faraday-net_http_persistent (~> 1.1) 338 | multipart-post (>= 1.2, < 3) 339 | ruby2_keywords (>= 0.0.4) 340 | faraday-cookie_jar (0.0.7) 341 | faraday (>= 0.8.0) 342 | http-cookie (~> 1.0.0) 343 | faraday-em_http (1.0.0) 344 | faraday-em_synchrony (1.0.0) 345 | faraday-excon (1.1.0) 346 | faraday-net_http (1.0.1) 347 | faraday-net_http_persistent (1.2.0) 348 | faraday_middleware (1.0.0) 349 | faraday (~> 1.0) 350 | ffi (1.15.5) 351 | fuzzyurl (0.9.0) 352 | google-api-client (0.52.0) 353 | addressable (~> 2.5, >= 2.5.1) 354 | googleauth (~> 0.9) 355 | httpclient (>= 2.8.1, < 3.0) 356 | mini_mime (~> 1.0) 357 | representable (~> 3.0) 358 | retriable (>= 2.0, < 4.0) 359 | rexml 360 | signet (~> 0.12) 361 | googleauth (0.14.0) 362 | faraday (>= 0.17.3, < 2.0) 363 | jwt (>= 1.4, < 3.0) 364 | memoist (~> 0.16) 365 | multi_json (~> 1.11) 366 | os (>= 0.9, < 2.0) 367 | signet (~> 0.14) 368 | gssapi (1.3.1) 369 | ffi (>= 1.0.1) 370 | gyoku (1.4.0) 371 | builder (>= 2.1.2) 372 | rexml (~> 3.0) 373 | hashie (4.1.0) 374 | highline (2.0.3) 375 | http-cookie (1.0.5) 376 | domain_name (~> 0.5) 377 | httpclient (2.8.3) 378 | i18n (1.12.0) 379 | concurrent-ruby (~> 1.0) 380 | inifile (3.0.0) 381 | jmespath (1.6.1) 382 | json (2.6.2) 383 | jwt (2.4.1) 384 | kitchen-inspec (2.6.1) 385 | hashie (>= 3.4, <= 5.0) 386 | inspec (>= 2.2.64, < 7.0) 387 | test-kitchen (>= 2.7, < 4) 388 | kitchen-salt (0.7.2) 389 | hashie (>= 3.5) 390 | test-kitchen (>= 1.4) 391 | license-acceptance (2.1.13) 392 | pastel (~> 0.7) 393 | tomlrb (>= 1.2, < 3.0) 394 | tty-box (~> 0.6) 395 | tty-prompt (~> 0.20) 396 | little-plugger (1.1.4) 397 | logging (2.3.1) 398 | little-plugger (~> 1.1) 399 | multi_json (~> 1.14) 400 | memoist (0.16.2) 401 | method_source (1.0.0) 402 | mini_mime (1.1.2) 403 | minitest (5.16.2) 404 | mixlib-config (3.0.27) 405 | tomlrb 406 | mixlib-install (3.12.19) 407 | mixlib-shellout 408 | mixlib-versioning 409 | thor 410 | mixlib-log (3.0.9) 411 | mixlib-shellout (3.2.7) 412 | chef-utils 413 | mixlib-versioning (1.2.12) 414 | mongo (2.13.2) 415 | bson (>= 4.8.2, < 5.0.0) 416 | ms_rest (0.7.6) 417 | concurrent-ruby (~> 1.0) 418 | faraday (>= 0.9, < 2.0.0) 419 | timeliness (~> 0.3.10) 420 | ms_rest_azure (0.12.0) 421 | concurrent-ruby (~> 1.0) 422 | faraday (>= 0.9, < 2.0.0) 423 | faraday-cookie_jar (~> 0.0.6) 424 | ms_rest (~> 0.7.6) 425 | multi_json (1.15.0) 426 | multipart-post (2.2.3) 427 | net-scp (3.0.0) 428 | net-ssh (>= 2.6.5, < 7.0.0) 429 | net-ssh (6.1.0) 430 | net-ssh-gateway (2.0.0) 431 | net-ssh (>= 4.0.0) 432 | nori (2.6.0) 433 | options (2.3.2) 434 | os (1.1.4) 435 | parallel (1.22.1) 436 | parser (3.1.2.0) 437 | ast (~> 2.4.1) 438 | parslet (1.8.2) 439 | pastel (0.8.0) 440 | tty-color (~> 0.5) 441 | progress_bar (1.3.3) 442 | highline (>= 1.6, < 3) 443 | options (~> 2.3.0) 444 | pry (0.14.1) 445 | coderay (~> 1.1) 446 | method_source (~> 1.0) 447 | public_suffix (4.0.7) 448 | rainbow (3.1.1) 449 | rake (13.0.6) 450 | regexp_parser (2.5.0) 451 | representable (3.2.0) 452 | declarative (< 0.1.0) 453 | trailblazer-option (>= 0.1.1, < 0.2.0) 454 | uber (< 0.2.0) 455 | retriable (3.1.2) 456 | rexml (3.2.5) 457 | rspec (3.11.0) 458 | rspec-core (~> 3.11.0) 459 | rspec-expectations (~> 3.11.0) 460 | rspec-mocks (~> 3.11.0) 461 | rspec-core (3.11.0) 462 | rspec-support (~> 3.11.0) 463 | rspec-expectations (3.11.0) 464 | diff-lcs (>= 1.2.0, < 2.0) 465 | rspec-support (~> 3.11.0) 466 | rspec-its (1.3.0) 467 | rspec-core (>= 3.0.0) 468 | rspec-expectations (>= 3.0.0) 469 | rspec-mocks (3.11.1) 470 | diff-lcs (>= 1.2.0, < 2.0) 471 | rspec-support (~> 3.11.0) 472 | rspec-support (3.11.0) 473 | rubocop (1.25.1) 474 | parallel (~> 1.10) 475 | parser (>= 3.1.0.0) 476 | rainbow (>= 2.2.2, < 4.0) 477 | regexp_parser (>= 1.8, < 3.0) 478 | rexml 479 | rubocop-ast (>= 1.15.1, < 2.0) 480 | ruby-progressbar (~> 1.7) 481 | unicode-display_width (>= 1.4.0, < 3.0) 482 | rubocop-ast (1.19.1) 483 | parser (>= 3.1.1.0) 484 | ruby-progressbar (1.11.0) 485 | ruby2_keywords (0.0.5) 486 | rubyntlm (0.6.3) 487 | rubyzip (2.3.2) 488 | semverse (3.0.2) 489 | signet (0.17.0) 490 | addressable (~> 2.8) 491 | faraday (>= 0.17.5, < 3.a) 492 | jwt (>= 1.5, < 3.0) 493 | multi_json (~> 1.10) 494 | sslshake (1.3.1) 495 | strings (0.2.1) 496 | strings-ansi (~> 0.2) 497 | unicode-display_width (>= 1.5, < 3.0) 498 | unicode_utils (~> 1.4) 499 | strings-ansi (0.2.0) 500 | test-kitchen (3.3.1) 501 | bcrypt_pbkdf (~> 1.0) 502 | chef-utils (>= 16.4.35) 503 | ed25519 (~> 1.2) 504 | license-acceptance (>= 1.0.11, < 3.0) 505 | mixlib-install (~> 3.6) 506 | mixlib-shellout (>= 1.2, < 4.0) 507 | net-scp (>= 1.1, < 4.0) 508 | net-ssh (>= 2.9, < 7.0) 509 | net-ssh-gateway (>= 1.2, < 3.0) 510 | thor (>= 0.19, < 2.0) 511 | winrm (~> 2.0) 512 | winrm-elevated (~> 1.0) 513 | winrm-fs (~> 1.1) 514 | thor (1.2.1) 515 | timeliness (0.3.10) 516 | tomlrb (1.3.0) 517 | trailblazer-option (0.1.2) 518 | train (3.10.1) 519 | activesupport (>= 6.0.3.1) 520 | azure_graph_rbac (~> 0.16) 521 | azure_mgmt_key_vault (~> 0.17) 522 | azure_mgmt_resources (~> 0.15) 523 | azure_mgmt_security (~> 0.18) 524 | azure_mgmt_storage (~> 0.18) 525 | docker-api (>= 1.26, < 3.0) 526 | google-api-client (>= 0.23.9, <= 0.52.0) 527 | googleauth (>= 0.6.6, <= 0.14.0) 528 | inifile (~> 3.0) 529 | train-core (= 3.10.1) 530 | train-winrm (~> 0.2) 531 | train-aws (0.2.24) 532 | aws-sdk-alexaforbusiness (~> 1.0) 533 | aws-sdk-amplify (~> 1.32.0) 534 | aws-sdk-apigateway (~> 1.0) 535 | aws-sdk-apigatewayv2 (~> 1.0) 536 | aws-sdk-applicationautoscaling (>= 1.46, < 1.52) 537 | aws-sdk-athena (~> 1.0) 538 | aws-sdk-autoscaling (>= 1.22, < 1.64) 539 | aws-sdk-batch (>= 1.36, < 1.48) 540 | aws-sdk-budgets (~> 1.0) 541 | aws-sdk-cloudformation (~> 1.0) 542 | aws-sdk-cloudfront (~> 1.0) 543 | aws-sdk-cloudhsm (~> 1.0) 544 | aws-sdk-cloudhsmv2 (~> 1.0) 545 | aws-sdk-cloudtrail (~> 1.8) 546 | aws-sdk-cloudwatch (~> 1.13) 547 | aws-sdk-cloudwatchevents (>= 1.36, < 1.47) 548 | aws-sdk-cloudwatchlogs (~> 1.13) 549 | aws-sdk-codecommit (~> 1.0) 550 | aws-sdk-codedeploy (~> 1.0) 551 | aws-sdk-codepipeline (~> 1.0) 552 | aws-sdk-cognitoidentity (>= 1.26, < 1.32) 553 | aws-sdk-cognitoidentityprovider (>= 1.46, < 1.54) 554 | aws-sdk-configservice (~> 1.21) 555 | aws-sdk-core (~> 3.0) 556 | aws-sdk-costandusagereportservice (~> 1.6) 557 | aws-sdk-databasemigrationservice (>= 1.42, < 1.54) 558 | aws-sdk-dynamodb (~> 1.31) 559 | aws-sdk-ec2 (~> 1.70) 560 | aws-sdk-ecr (~> 1.18) 561 | aws-sdk-ecrpublic (~> 1.3) 562 | aws-sdk-ecs (~> 1.30) 563 | aws-sdk-efs (~> 1.0) 564 | aws-sdk-eks (~> 1.9) 565 | aws-sdk-elasticache (~> 1.0) 566 | aws-sdk-elasticbeanstalk (~> 1.0) 567 | aws-sdk-elasticloadbalancing (~> 1.8) 568 | aws-sdk-elasticloadbalancingv2 (~> 1.0) 569 | aws-sdk-elasticsearchservice (~> 1.0) 570 | aws-sdk-emr (~> 1.53.0) 571 | aws-sdk-eventbridge (~> 1.24.0) 572 | aws-sdk-firehose (~> 1.0) 573 | aws-sdk-glue (>= 1.71, < 1.89) 574 | aws-sdk-guardduty (~> 1.31) 575 | aws-sdk-iam (~> 1.13) 576 | aws-sdk-kafka (~> 1.0) 577 | aws-sdk-kinesis (~> 1.0) 578 | aws-sdk-kms (~> 1.13) 579 | aws-sdk-lambda (~> 1.0) 580 | aws-sdk-mq (~> 1.40.0) 581 | aws-sdk-networkfirewall (>= 1.6.0) 582 | aws-sdk-networkmanager (>= 1.13.0) 583 | aws-sdk-organizations (>= 1.17, < 1.60) 584 | aws-sdk-ram (>= 1.21, < 1.27) 585 | aws-sdk-rds (~> 1.43) 586 | aws-sdk-redshift (~> 1.0) 587 | aws-sdk-route53 (~> 1.0) 588 | aws-sdk-route53domains (~> 1.0) 589 | aws-sdk-route53resolver (~> 1.0) 590 | aws-sdk-s3 (~> 1.30) 591 | aws-sdk-s3control (~> 1.43.0) 592 | aws-sdk-secretsmanager (>= 1.42, < 1.47) 593 | aws-sdk-securityhub (~> 1.0) 594 | aws-sdk-servicecatalog (>= 1.48, < 1.61) 595 | aws-sdk-ses (~> 1.41.0) 596 | aws-sdk-shield (~> 1.30) 597 | aws-sdk-signer (~> 1.32.0) 598 | aws-sdk-simpledb (~> 1.29.0) 599 | aws-sdk-sms (~> 1.0) 600 | aws-sdk-sns (~> 1.9) 601 | aws-sdk-sqs (~> 1.10) 602 | aws-sdk-ssm (~> 1.0) 603 | aws-sdk-states (>= 1.35, < 1.40) 604 | aws-sdk-synthetics (~> 1.19.0) 605 | aws-sdk-transfer (>= 1.26, < 1.35) 606 | aws-sdk-waf (~> 1.43.0) 607 | train-core (3.10.1) 608 | addressable (~> 2.5) 609 | ffi (!= 1.13.0) 610 | json (>= 1.8, < 3.0) 611 | mixlib-shellout (>= 2.0, < 4.0) 612 | net-scp (>= 1.2, < 4.0) 613 | net-ssh (>= 2.9, < 7.0) 614 | train-habitat (0.2.22) 615 | train-winrm (0.2.13) 616 | winrm (>= 2.3.6, < 3.0) 617 | winrm-elevated (~> 1.2.2) 618 | winrm-fs (~> 1.0) 619 | tty-box (0.7.0) 620 | pastel (~> 0.8) 621 | strings (~> 0.2.0) 622 | tty-cursor (~> 0.7) 623 | tty-color (0.6.0) 624 | tty-cursor (0.7.1) 625 | tty-prompt (0.23.1) 626 | pastel (~> 0.8) 627 | tty-reader (~> 0.8) 628 | tty-reader (0.9.0) 629 | tty-cursor (~> 0.7) 630 | tty-screen (~> 0.8) 631 | wisper (~> 2.0) 632 | tty-screen (0.8.1) 633 | tty-table (0.12.0) 634 | pastel (~> 0.8) 635 | strings (~> 0.2.0) 636 | tty-screen (~> 0.8) 637 | tzinfo (2.0.4) 638 | concurrent-ruby (~> 1.0) 639 | uber (0.1.0) 640 | unf (0.1.4) 641 | unf_ext 642 | unf_ext (0.0.8.2) 643 | unicode-display_width (2.2.0) 644 | unicode_utils (1.4.0) 645 | winrm (2.3.6) 646 | builder (>= 2.1.2) 647 | erubi (~> 1.8) 648 | gssapi (~> 1.2) 649 | gyoku (~> 1.0) 650 | httpclient (~> 2.2, >= 2.2.0.2) 651 | logging (>= 1.6.1, < 3.0) 652 | nori (~> 2.0) 653 | rubyntlm (~> 0.6.0, >= 0.6.3) 654 | winrm-elevated (1.2.3) 655 | erubi (~> 1.8) 656 | winrm (~> 2.0) 657 | winrm-fs (~> 1.0) 658 | winrm-fs (1.3.5) 659 | erubi (~> 1.8) 660 | logging (>= 1.6.1, < 3.0) 661 | rubyzip (~> 2.0) 662 | winrm (~> 2.0) 663 | wisper (2.0.1) 664 | 665 | PLATFORMS 666 | ruby 667 | 668 | DEPENDENCIES 669 | inspec! 670 | kitchen-docker! 671 | kitchen-inspec (>= 2.5.0) 672 | kitchen-salt (>= 0.7.2) 673 | 674 | BUNDLED WITH 675 | 2.1.2 676 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, and 10 | distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by the copyright 13 | owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all other entities 16 | that control, are controlled by, or are under common control with that entity. 17 | For the purposes of this definition, "control" means (i) the power, direct or 18 | indirect, to cause the direction or management of such entity, whether by 19 | contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the 20 | outstanding shares, or (iii) beneficial ownership of such entity. 21 | 22 | "You" (or "Your") shall mean an individual or Legal Entity exercising 23 | permissions granted by this License. 24 | 25 | "Source" form shall mean the preferred form for making modifications, including 26 | but not limited to software source code, documentation source, and configuration 27 | files. 28 | 29 | "Object" form shall mean any form resulting from mechanical transformation or 30 | translation of a Source form, including but not limited to compiled object code, 31 | generated documentation, and conversions to other media types. 32 | 33 | "Work" shall mean the work of authorship, whether in Source or Object form, made 34 | available under the License, as indicated by a copyright notice that is included 35 | in or attached to the work (an example is provided in the Appendix below). 36 | 37 | "Derivative Works" shall mean any work, whether in Source or Object form, that 38 | is based on (or derived from) the Work and for which the editorial revisions, 39 | annotations, elaborations, or other modifications represent, as a whole, an 40 | original work of authorship. For the purposes of this License, Derivative Works 41 | shall not include works that remain separable from, or merely link (or bind by 42 | name) to the interfaces of, the Work and Derivative Works thereof. 43 | 44 | "Contribution" shall mean any work of authorship, including the original version 45 | of the Work and any modifications or additions to that Work or Derivative Works 46 | thereof, that is intentionally submitted to Licensor for inclusion in the Work 47 | by the copyright owner or by an individual or Legal Entity authorized to submit 48 | on behalf of the copyright owner. For the purposes of this definition, 49 | "submitted" means any form of electronic, verbal, or written communication sent 50 | to the Licensor or its representatives, including but not limited to 51 | communication on electronic mailing lists, source code control systems, and 52 | issue tracking systems that are managed by, or on behalf of, the Licensor for 53 | the purpose of discussing and improving the Work, but excluding communication 54 | that is conspicuously marked or otherwise designated in writing by the copyright 55 | owner as "Not a Contribution." 56 | 57 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf 58 | of whom a Contribution has been received by Licensor and subsequently 59 | incorporated within the Work. 60 | 61 | 2. Grant of Copyright License. 62 | 63 | Subject to the terms and conditions of this License, each Contributor hereby 64 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 65 | irrevocable copyright license to reproduce, prepare Derivative Works of, 66 | publicly display, publicly perform, sublicense, and distribute the Work and such 67 | Derivative Works in Source or Object form. 68 | 69 | 3. Grant of Patent License. 70 | 71 | Subject to the terms and conditions of this License, each Contributor hereby 72 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 73 | irrevocable (except as stated in this section) patent license to make, have 74 | made, use, offer to sell, sell, import, and otherwise transfer the Work, where 75 | such license applies only to those patent claims licensable by such Contributor 76 | that are necessarily infringed by their Contribution(s) alone or by combination 77 | of their Contribution(s) with the Work to which such Contribution(s) was 78 | submitted. If You institute patent litigation against any entity (including a 79 | cross-claim or counterclaim in a lawsuit) alleging that the Work or a 80 | Contribution incorporated within the Work constitutes direct or contributory 81 | patent infringement, then any patent licenses granted to You under this License 82 | for that Work shall terminate as of the date such litigation is filed. 83 | 84 | 4. Redistribution. 85 | 86 | You may reproduce and distribute copies of the Work or Derivative Works thereof 87 | in any medium, with or without modifications, and in Source or Object form, 88 | provided that You meet the following conditions: 89 | 90 | You must give any other recipients of the Work or Derivative Works a copy of 91 | this License; and 92 | You must cause any modified files to carry prominent notices stating that You 93 | changed the files; and 94 | You must retain, in the Source form of any Derivative Works that You distribute, 95 | all copyright, patent, trademark, and attribution notices from the Source form 96 | of the Work, excluding those notices that do not pertain to any part of the 97 | Derivative Works; and 98 | If the Work includes a "NOTICE" text file as part of its distribution, then any 99 | Derivative Works that You distribute must include a readable copy of the 100 | attribution notices contained within such NOTICE file, excluding those notices 101 | that do not pertain to any part of the Derivative Works, in at least one of the 102 | following places: within a NOTICE text file distributed as part of the 103 | Derivative Works; within the Source form or documentation, if provided along 104 | with the Derivative Works; or, within a display generated by the Derivative 105 | Works, if and wherever such third-party notices normally appear. The contents of 106 | the NOTICE file are for informational purposes only and do not modify the 107 | License. You may add Your own attribution notices within Derivative Works that 108 | You distribute, alongside or as an addendum to the NOTICE text from the Work, 109 | provided that such additional attribution notices cannot be construed as 110 | modifying the License. 111 | You may add Your own copyright statement to Your modifications and may provide 112 | additional or different license terms and conditions for use, reproduction, or 113 | distribution of Your modifications, or for any such Derivative Works as a whole, 114 | provided Your use, reproduction, and distribution of the Work otherwise complies 115 | with the conditions stated in this License. 116 | 117 | 5. Submission of Contributions. 118 | 119 | Unless You explicitly state otherwise, any Contribution intentionally submitted 120 | for inclusion in the Work by You to the Licensor shall be under the terms and 121 | conditions of this License, without any additional terms or conditions. 122 | Notwithstanding the above, nothing herein shall supersede or modify the terms of 123 | any separate license agreement you may have executed with Licensor regarding 124 | such Contributions. 125 | 126 | 6. Trademarks. 127 | 128 | This License does not grant permission to use the trade names, trademarks, 129 | service marks, or product names of the Licensor, except as required for 130 | reasonable and customary use in describing the origin of the Work and 131 | reproducing the content of the NOTICE file. 132 | 133 | 7. Disclaimer of Warranty. 134 | 135 | Unless required by applicable law or agreed to in writing, Licensor provides the 136 | Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, 137 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, 138 | including, without limitation, any warranties or conditions of TITLE, 139 | NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are 140 | solely responsible for determining the appropriateness of using or 141 | redistributing the Work and assume any risks associated with Your exercise of 142 | permissions under this License. 143 | 144 | 8. Limitation of Liability. 145 | 146 | In no event and under no legal theory, whether in tort (including negligence), 147 | contract, or otherwise, unless required by applicable law (such as deliberate 148 | and grossly negligent acts) or agreed to in writing, shall any Contributor be 149 | liable to You for damages, including any direct, indirect, special, incidental, 150 | or consequential damages of any character arising as a result of this License or 151 | out of the use or inability to use the Work (including but not limited to 152 | damages for loss of goodwill, work stoppage, computer failure or malfunction, or 153 | any and all other commercial damages or losses), even if such Contributor has 154 | been advised of the possibility of such damages. 155 | 156 | 9. Accepting Warranty or Additional Liability. 157 | 158 | While redistributing the Work or Derivative Works thereof, You may choose to 159 | offer, and charge a fee for, acceptance of support, warranty, indemnity, or 160 | other liability obligations and/or rights consistent with this License. However, 161 | in accepting such obligations, You may act only on Your own behalf and on Your 162 | sole responsibility, not on behalf of any other Contributor, and only if You 163 | agree to indemnify, defend, and hold each Contributor harmless for any liability 164 | incurred by, or claims asserted against, such Contributor by reason of your 165 | accepting any such warranty or additional liability. 166 | 167 | END OF TERMS AND CONDITIONS 168 | 169 | APPENDIX: How to apply the Apache License to your work 170 | 171 | To apply the Apache License to your work, attach the following boilerplate 172 | notice, with the fields enclosed by brackets "[]" replaced with your own 173 | identifying information. (Don't include the brackets!) The text should be 174 | enclosed in the appropriate comment syntax for the file format. We also 175 | recommend that a file or class name and description of purpose be included on 176 | the same "printed page" as the copyright notice for easier identification within 177 | third-party archives. 178 | 179 | Copyright [yyyy] [name of copyright owner] 180 | 181 | Licensed under the Apache License, Version 2.0 (the "License"); 182 | you may not use this file except in compliance with the License. 183 | You may obtain a copy of the License at 184 | 185 | http://www.apache.org/licenses/LICENSE-2.0 186 | 187 | Unless required by applicable law or agreed to in writing, software 188 | distributed under the License is distributed on an "AS IS" BASIS, 189 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 190 | See the License for the specific language governing permissions and 191 | limitations under the License. 192 | -------------------------------------------------------------------------------- /bin/install-hooks: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | set -o nounset # Treat unset variables as an error and immediately exit 3 | set -o errexit # If a command fails exit the whole script 4 | 5 | if [ "${DEBUG:-false}" = "true" ]; then 6 | set -x # Run the entire script in debug mode 7 | fi 8 | 9 | if ! command -v pre-commit >/dev/null 2>&1; then 10 | echo "pre-commit not found: please install or check your PATH" >&2 11 | echo "See https://pre-commit.com/#installation" >&2 12 | exit 1 13 | fi 14 | 15 | pre-commit install --install-hooks 16 | pre-commit install --hook-type commit-msg --install-hooks 17 | -------------------------------------------------------------------------------- /bin/kitchen: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'kitchen' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require 'pathname' 12 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path('bundle', __dir__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort( 22 | 'Your `bin/bundle` was not generated by Bundler, ' \ 23 | 'so this binstub cannot run. Replace `bin/bundle` by running ' \ 24 | '`bundle binstubs bundler --force`, then run this command again.' 25 | ) 26 | end 27 | end 28 | 29 | require 'rubygems' 30 | require 'bundler/setup' 31 | 32 | load Gem.bin_path('test-kitchen', 'kitchen') 33 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['@commitlint/config-conventional'], 3 | rules: { 4 | 'body-max-line-length': [2, 'always', 120], 5 | 'footer-max-line-length': [2, 'always', 120], 6 | 'header-max-length': [2, 'always', 72], 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /django/_mapdata/_mapdata.jinja: -------------------------------------------------------------------------------- 1 | # yamllint disable rule:indentation rule:line-length 2 | # {{ grains.get("osfinger", grains.os) }} 3 | --- 4 | {#- use salt.slsutil.serialize to avoid encoding errors on some platforms #} 5 | {{ salt["slsutil.serialize"]( 6 | "yaml", 7 | map, 8 | default_flow_style=False, 9 | allow_unicode=True, 10 | ) 11 | | regex_replace("^\s+'$", "'", multiline=True) 12 | | trim 13 | }} 14 | -------------------------------------------------------------------------------- /django/_mapdata/init.sls: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # vim: ft=sls 3 | --- 4 | {#- Get the `tplroot` from `tpldir` #} 5 | {%- set tplroot = tpldir.split("/")[0] %} 6 | {%- from tplroot ~ "/map.jinja" import django with context %} 7 | 8 | {%- set _mapdata = { 9 | "values": django, 10 | } %} 11 | {%- do salt["log.debug"]("### MAP.JINJA DUMP ###\n" ~ _mapdata | yaml(False)) %} 12 | 13 | {%- set output_dir = "/temp" if grains.os_family == "Windows" else "/tmp" %} 14 | {%- set output_file = output_dir ~ "/salt_mapdata_dump.yaml" %} 15 | 16 | {{ tplroot }}-mapdata-dump: 17 | file.managed: 18 | - name: {{ output_file }} 19 | - source: salt://{{ tplroot }}/_mapdata/_mapdata.jinja 20 | - template: jinja 21 | - context: 22 | map: {{ _mapdata | yaml }} 23 | -------------------------------------------------------------------------------- /django/apps/poll/multi-host/app.sls: -------------------------------------------------------------------------------- 1 | {% set poll_venv = salt['pillar.get']('django_apps:poll-multi:venv') %} 2 | {% set poll_proj = salt['pillar.get']('django_apps:poll-multi:proj') %} 3 | {% set poll_settings = salt['pillar.get']('django_apps:poll-multi:settings') %} 4 | 5 | include: 6 | - git 7 | - pip 8 | - virtualenv 9 | - mysql.python 10 | 11 | empty_venv: 12 | virtualenv.managed: 13 | - name: /var/www/BASELINE 14 | - require: 15 | - pkg: virtualenv 16 | 17 | poll_venv: 18 | virtualenv.managed: 19 | - name: {{ poll_venv }} 20 | - system_site_packages: True 21 | - require: 22 | - pkg: virtualenv 23 | 24 | poll: 25 | git.latest: 26 | - name: https://github.com/terminalmage/django-tutorial.git 27 | - target: {{ poll_proj }} 28 | - force: True 29 | - require: 30 | - pkg: git 31 | - virtualenv: poll_venv 32 | 33 | poll_pkgs: 34 | pip.installed: 35 | - bin_env: {{ poll_venv }} 36 | - requirements: {{ poll_proj }}/requirements.txt 37 | - require: 38 | - git: poll 39 | - pkg: pip 40 | - virtualenv: poll_venv 41 | 42 | {% set db_server = salt['pillar.get']('django_apps:poll-multi:minion_roles:database', 'django-db') %} 43 | # Get salt['mine.get'](db_server, 'network.interfaces')[db_server]['eth0']['inet'][0]['address'] 44 | {% set db_server_ip = salt['mine.get'](db_server, 'network.interfaces').get(db_server, {}).get('eth0', {}).get('inet', [{}])[0].get('address') %} 45 | {% if db_server_ip %} 46 | poll_settings: 47 | file.managed: 48 | - name: {{ poll_proj }}/poll/settings.py 49 | - source: salt://django/apps/poll/multi-host/files/settings.py 50 | - template: jinja 51 | - context: 52 | db_server_ip: {{ db_server_ip }} 53 | - require: 54 | - git: poll 55 | - pkg: mysql-python 56 | {% endif %} 57 | 58 | poll_wsgi: 59 | file.managed: 60 | - name: {{ poll_proj }}/poll/wsgi.py 61 | - source: salt://django/apps/poll/multi-host/files/wsgi.py 62 | - template: jinja 63 | - require: 64 | - git: poll 65 | 66 | poll_syncdb: 67 | module.run: 68 | - name: django.syncdb 69 | - settings_module: {{ poll_settings }} 70 | - bin_env: {{ poll_venv }} 71 | - pythonpath: {{ poll_proj }} 72 | - require: 73 | - file: poll_settings 74 | - pip: poll_pkgs 75 | 76 | poll_collectstatic: 77 | module.run: 78 | - name: django.collectstatic 79 | - settings_module: {{ poll_settings }} 80 | - bin_env: {{ poll_venv }} 81 | - pythonpath: {{ poll_proj }} 82 | - require: 83 | - file: poll_settings 84 | - pip: poll_pkgs 85 | -------------------------------------------------------------------------------- /django/apps/poll/multi-host/db.sls: -------------------------------------------------------------------------------- 1 | include: 2 | - mysql.server 3 | - mysql.python 4 | 5 | # Remove the "test" database 6 | mysql_remove_testdb: 7 | mysql_database: 8 | - absent 9 | - name: test 10 | 11 | /etc/mysql/my.cnf: 12 | file: 13 | - managed 14 | - source: salt://django/apps/poll/multi-host/files/my.cnf 15 | - watch_in: 16 | - service: mysqld 17 | 18 | {% for name, db in salt['pillar.get']('django_apps:poll-multi:DATABASES', {}).iteritems() %} 19 | polldb: 20 | mysql_database: 21 | - present 22 | - name: {{ db.get('NAME') }} 23 | - require: 24 | - service: mysqld 25 | - pkg: mysql-python 26 | 27 | 28 | {% for webhost in salt['pillar.get']('django_apps:poll-multi:minion_roles:webhosts', []) %} 29 | {% for host, ifaces in salt['mine.get'](webhost, 'network.interfaces').iteritems() %} 30 | 31 | ######## Get first IP of eth0 32 | {% set client_ip = ifaces.get('eth0', {}).get('inet', [{}])[0].get('address') %} 33 | {% if client_ip %} 34 | polldb_user_{{ client_ip }}: 35 | mysql_user: 36 | - present 37 | - name: {{ db.get('USER') }} 38 | - host: {{ client_ip }} 39 | - password: {{ db.get('PASSWORD') }} 40 | - require: 41 | - mysql_database: polldb 42 | 43 | polldb_grants_{{ client_ip }}: 44 | mysql_grants: 45 | - present 46 | - grant: all privileges 47 | - database: {{ db.get('NAME') }}.* 48 | - user: {{ db.get('USER') }} 49 | - host: {{ client_ip }} 50 | - require: 51 | - mysql_user: polldb_user_{{ client_ip }} 52 | {% endif %} 53 | 54 | {% endfor %} 55 | {% endfor %} 56 | 57 | {% endfor %} 58 | -------------------------------------------------------------------------------- /django/apps/poll/multi-host/files/my.cnf: -------------------------------------------------------------------------------- 1 | # 2 | # The MySQL database server configuration file. 3 | # 4 | # You can copy this to one of: 5 | # - "/etc/mysql/my.cnf" to set global options, 6 | # - "~/.my.cnf" to set user-specific options. 7 | # 8 | # One can use all long options that the program supports. 9 | # Run program with --help to get a list of available options and with 10 | # --print-defaults to see which it would actually understand and use. 11 | # 12 | # For explanations see 13 | # http://dev.mysql.com/doc/mysql/en/server-system-variables.html 14 | 15 | # This will be passed to all mysql clients 16 | # It has been reported that passwords should be enclosed with ticks/quotes 17 | # escpecially if they contain "#" chars... 18 | # Remember to edit /etc/mysql/debian.cnf when changing the socket location. 19 | [client] 20 | port = 3306 21 | socket = /var/run/mysqld/mysqld.sock 22 | 23 | # Here is entries for some specific programs 24 | # The following values assume you have at least 32M ram 25 | 26 | # This was formally known as [safe_mysqld]. Both versions are currently parsed. 27 | [mysqld_safe] 28 | socket = /var/run/mysqld/mysqld.sock 29 | nice = 0 30 | 31 | [mysqld] 32 | # 33 | # * Basic Settings 34 | # 35 | user = mysql 36 | pid-file = /var/run/mysqld/mysqld.pid 37 | socket = /var/run/mysqld/mysqld.sock 38 | port = 3306 39 | basedir = /usr 40 | datadir = /var/lib/mysql 41 | tmpdir = /tmp 42 | lc-messages-dir = /usr/share/mysql 43 | skip-external-locking 44 | # 45 | # Instead of skip-networking the default is now to listen only on 46 | # localhost which is more compatible and is not less secure. 47 | bind-address = 0.0.0.0 48 | # 49 | # * Fine Tuning 50 | # 51 | key_buffer = 16M 52 | max_allowed_packet = 16M 53 | thread_stack = 192K 54 | thread_cache_size = 8 55 | # This replaces the startup script and checks MyISAM tables if needed 56 | # the first time they are touched 57 | myisam-recover = BACKUP 58 | #max_connections = 100 59 | #table_cache = 64 60 | #thread_concurrency = 10 61 | # 62 | # * Query Cache Configuration 63 | # 64 | query_cache_limit = 1M 65 | query_cache_size = 16M 66 | # 67 | # * Logging and Replication 68 | # 69 | # Both location gets rotated by the cronjob. 70 | # Be aware that this log type is a performance killer. 71 | # As of 5.1 you can enable the log at runtime! 72 | #general_log_file = /var/log/mysql/mysql.log 73 | #general_log = 1 74 | # 75 | # Error log - should be very few entries. 76 | # 77 | log_error = /var/log/mysql/error.log 78 | # 79 | # Here you can see queries with especially long duration 80 | #log_slow_queries = /var/log/mysql/mysql-slow.log 81 | #long_query_time = 2 82 | #log-queries-not-using-indexes 83 | # 84 | # The following can be used as easy to replay backup logs or for replication. 85 | # note: if you are setting up a replication slave, see README.Debian about 86 | # other settings you may need to change. 87 | #server-id = 1 88 | #log_bin = /var/log/mysql/mysql-bin.log 89 | expire_logs_days = 10 90 | max_binlog_size = 100M 91 | #binlog_do_db = include_database_name 92 | #binlog_ignore_db = include_database_name 93 | # 94 | # * InnoDB 95 | # 96 | # InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/. 97 | # Read the manual for more InnoDB related options. There are many! 98 | # 99 | # * Security Features 100 | # 101 | # Read the manual, too, if you want chroot! 102 | # chroot = /var/lib/mysql/ 103 | # 104 | # For generating SSL certificates I recommend the OpenSSL GUI "tinyca". 105 | # 106 | # ssl-ca=/etc/mysql/cacert.pem 107 | # ssl-cert=/etc/mysql/server-cert.pem 108 | # ssl-key=/etc/mysql/server-key.pem 109 | 110 | 111 | 112 | [mysqldump] 113 | quick 114 | quote-names 115 | max_allowed_packet = 16M 116 | 117 | [mysql] 118 | #no-auto-rehash # faster start of mysql but no tab completition 119 | 120 | [isamchk] 121 | key_buffer = 16M 122 | 123 | # 124 | # * IMPORTANT: Additional settings that can override those from this file! 125 | # The files must end with '.cnf', otherwise they'll be ignored. 126 | # 127 | !includedir /etc/mysql/conf.d/ 128 | -------------------------------------------------------------------------------- /django/apps/poll/multi-host/files/poll-vhost.conf: -------------------------------------------------------------------------------- 1 | # Listen for virtual host requests on all IP addresses 2 | NameVirtualHost *:80 3 | 4 | 5 | ServerName example.com 6 | DocumentRoot {{ salt['pillar.get']('django_apps:poll-multi:proj') }}/templates 7 | 8 | 9 | Options -Indexes +FollowSymLinks 10 | Order allow,deny 11 | Allow from all 12 | AllowOverride None 13 | 14 | 15 | Alias /static {{ salt['pillar.get']('django_apps:poll-multi:proj') }}/staticroot 16 | WSGIScriptAlias / {{ salt['pillar.get']('django_apps:poll-multi:proj') }}/poll/wsgi.py 17 | 18 | -------------------------------------------------------------------------------- /django/apps/poll/multi-host/files/settings.py: -------------------------------------------------------------------------------- 1 | # Django settings for poll project. 2 | 3 | DEBUG = True 4 | TEMPLATE_DEBUG = DEBUG 5 | 6 | ADMINS = ( 7 | # ('Your Name', 'your_email@example.com'), 8 | ) 9 | MANAGERS = ADMINS 10 | 11 | {% set db_server = salt['pillar.get']('django_apps:poll-multi:minion_roles:database', 'django-db') %} 12 | DATABASES = { 13 | {% for name, db in salt['pillar.get']('django_apps:poll-multi:DATABASES', {}).items() %} 14 | '{{ name }}': { 15 | 'ENGINE': '{{ db.get('ENGINE', '') }}', 16 | 'NAME': '{{ db.get('NAME', '') }}', 17 | 'USER': '{{ db.get('USER', '') }}', 18 | 'PASSWORD': '{{ db.get('PASSWORD', '') }}', 19 | {# Get salt['mine.get'](db_server, 'network.interfaces')[db_server]['eth0']['inet'][0]['address'] #} 20 | 'HOST': '{{ salt['mine.get'](db_server, 'network.interfaces').get(db_server, {}).get('eth0', {}).get('inet', [{}])[0].get('address') }}', 21 | 'PORT': '{{ db.get('PORT', '') }}', 22 | }, 23 | {% endfor %} 24 | } 25 | 26 | # Hosts/domain names that are valid for this site; required if DEBUG is False 27 | # See https://docs.djangoproject.com/en/1.4/ref/settings/#allowed-hosts 28 | ALLOWED_HOSTS = [] 29 | 30 | # Local time zone for this installation. Choices can be found here: 31 | # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name 32 | # although not all choices may be available on all operating systems. 33 | # In a Windows environment this must be set to your system time zone. 34 | TIME_ZONE = 'America/Chicago' 35 | 36 | # Language code for this installation. All choices can be found here: 37 | # http://www.i18nguy.com/unicode/language-identifiers.html 38 | LANGUAGE_CODE = 'en-us' 39 | 40 | SITE_ID = 1 41 | 42 | # If you set this to False, Django will make some optimizations so as not 43 | # to load the internationalization machinery. 44 | USE_I18N = True 45 | 46 | # If you set this to False, Django will not format dates, numbers and 47 | # calendars according to the current locale. 48 | USE_L10N = True 49 | 50 | # If you set this to False, Django will not use timezone-aware datetimes. 51 | USE_TZ = True 52 | 53 | # Absolute filesystem path to the directory that will hold user-uploaded files. 54 | # Example: "/home/media/media.lawrence.com/media/" 55 | MEDIA_ROOT = '{{ salt['pillar.get']('django_apps:poll-multi:MEDIA_ROOT') }}' 56 | 57 | # URL that handles the media served from MEDIA_ROOT. Make sure to use a 58 | # trailing slash. 59 | # Examples: "http://media.lawrence.com/media/", "http://example.com/media/" 60 | MEDIA_URL = '{{ salt['pillar.get']('django_apps:poll-multi:MEDIA_URL') }}' 61 | 62 | # Absolute path to the directory static files should be collected to. 63 | # Don't put anything in this directory yourself; store your static files 64 | # in apps' "static/" subdirectories and in STATICFILES_DIRS. 65 | # Example: "/home/media/media.lawrence.com/static/" 66 | STATIC_ROOT = '{{ salt['pillar.get']('django_apps:poll-multi:STATIC_ROOT') }}' 67 | 68 | # URL prefix for static files. 69 | # Example: "http://media.lawrence.com/static/" 70 | STATIC_URL = '{{ salt['pillar.get']('django_apps:poll-multi:STATIC_URL', '/static/') }}' 71 | 72 | # Additional locations of static files 73 | STATICFILES_DIRS = ( 74 | # Put strings here, like "/home/html/static" or "C:/www/django/static". 75 | # Always use forward slashes, even on Windows. 76 | # Don't forget to use absolute paths, not relative paths. 77 | {% for dir in salt['pillar.get']('django_apps:poll-multi:STATICFILES_DIRS') %} 78 | '{{ dir }}', 79 | {% endfor %} 80 | ) 81 | 82 | # List of finder classes that know how to find static files in 83 | # various locations. 84 | STATICFILES_FINDERS = ( 85 | 'django.contrib.staticfiles.finders.FileSystemFinder', 86 | 'django.contrib.staticfiles.finders.AppDirectoriesFinder', 87 | #'django.contrib.staticfiles.finders.DefaultStorageFinder', 88 | ) 89 | 90 | # Make this unique, and don't share it with anybody. 91 | SECRET_KEY = '{{ salt['pillar.get']('django_apps:poll-multi:SECRET_KEY') }}' 92 | 93 | # List of callables that know how to import templates from various sources. 94 | TEMPLATE_LOADERS = ( 95 | 'django.template.loaders.filesystem.Loader', 96 | 'django.template.loaders.app_directories.Loader', 97 | #'django.template.loaders.eggs.Loader', 98 | ) 99 | 100 | MIDDLEWARE_CLASSES = ( 101 | 'django.middleware.common.CommonMiddleware', 102 | 'django.contrib.sessions.middleware.SessionMiddleware', 103 | 'django.middleware.csrf.CsrfViewMiddleware', 104 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 105 | 'django.contrib.messages.middleware.MessageMiddleware', 106 | # Uncomment the next line for simple clickjacking protection: 107 | # 'django.middleware.clickjacking.XFrameOptionsMiddleware', 108 | ) 109 | 110 | ROOT_URLCONF = '{{ salt['pillar.get']('django_apps:poll-multi:ROOT_URLCONF') }}' 111 | 112 | # Python dotted path to the WSGI application used by Django's runserver. 113 | WSGI_APPLICATION = 'polls.wsgi.application' 114 | 115 | TEMPLATE_DIRS = ( 116 | # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". 117 | # Always use forward slashes, even on Windows. 118 | # Don't forget to use absolute paths, not relative paths. 119 | {% for dir in salt['pillar.get']('django_apps:poll-multi:TEMPLATE_DIRS') %} 120 | '{{ dir }}', 121 | {% endfor %} 122 | ) 123 | 124 | INSTALLED_APPS = ( 125 | 'django.contrib.auth', 126 | 'django.contrib.contenttypes', 127 | 'django.contrib.sessions', 128 | 'django.contrib.sites', 129 | 'django.contrib.messages', 130 | 'django.contrib.staticfiles', 131 | # Uncomment the next line to enable the admin: 132 | 'django.contrib.admin', 133 | # Uncomment the next line to enable admin documentation: 134 | # 'django.contrib.admindocs', 135 | 'poll.polls', 136 | ) 137 | 138 | # A sample logging configuration. The only tangible logging 139 | # performed by this configuration is to send an email to 140 | # the site admins on every HTTP 500 error when DEBUG=False. 141 | # See http://docs.djangoproject.com/en/dev/topics/logging for 142 | # more details on how to customize your logging configuration. 143 | LOGGING = { 144 | 'version': 1, 145 | 'disable_existing_loggers': False, 146 | 'filters': { 147 | 'require_debug_false': { 148 | '()': 'django.utils.log.RequireDebugFalse' 149 | } 150 | }, 151 | 'handlers': { 152 | 'mail_admins': { 153 | 'level': 'ERROR', 154 | 'filters': ['require_debug_false'], 155 | 'class': 'django.utils.log.AdminEmailHandler' 156 | } 157 | }, 158 | 'loggers': { 159 | 'django.request': { 160 | 'handlers': ['mail_admins'], 161 | 'level': 'ERROR', 162 | 'propagate': True, 163 | }, 164 | } 165 | } 166 | -------------------------------------------------------------------------------- /django/apps/poll/multi-host/files/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for poll project. 3 | 4 | This module contains the WSGI application used by Django's development server 5 | and any production WSGI deployments. It should expose a module-level variable 6 | named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover 7 | this application via the ``WSGI_APPLICATION`` setting. 8 | 9 | Usually you will have the standard Django WSGI application here, but it also 10 | might make sense to replace the whole Django WSGI application with a custom one 11 | that later delegates to the Django one. For example, you could introduce WSGI 12 | middleware here, or combine a Django application with an application of another 13 | framework. 14 | 15 | """ 16 | import os 17 | import site 18 | import sys 19 | 20 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ salt['pillar.get']('django_apps:poll-multi:settings') }}") 21 | 22 | {% set poll_sitepackages = salt['cmd.exec_code']( 23 | salt['pillar.get']('django_apps:poll-multi:venv') ~ '/bin/python', 24 | 'from distutils import sysconfig; print sysconfig.get_python_lib()' 25 | ) %} 26 | 27 | site.addsitedir('{{ poll_sitepackages }}') 28 | 29 | sys.path.append('{{ salt['pillar.get']('django_apps:poll-multi:proj') }}') 30 | 31 | # This application object is used by any WSGI server configured to use this 32 | # file. This includes Django's development server, if the WSGI_APPLICATION 33 | # setting points here. 34 | from django.core.wsgi import get_wsgi_application 35 | application = get_wsgi_application() 36 | 37 | # Apply WSGI middleware here. 38 | # from helloworld.wsgi import HelloWorldApplication 39 | # application = HelloWorldApplication(application) 40 | -------------------------------------------------------------------------------- /django/apps/poll/multi-host/firewall.sls: -------------------------------------------------------------------------------- 1 | iptables: 2 | pkg.installed: [] 3 | 4 | # Set the index so we can try to insert this at the right offset 5 | {% set ipt_idx = salt['cmd.run']('iptables -L INPUT --line-numbers -n | grep ACCEPT | grep "tcp dpt:22" | awk "{print \$1}"') %} 6 | {% set ipt_idx = ipt_idx if ipt_idx else '0' %} 7 | 8 | iptables -I INPUT {{ ipt_idx }} -p tcp --dport 80 -m state --state NEW -j ACCEPT: 9 | cmd.run: 10 | - unless: 'iptables -L INPUT -n | grep ACCEPT | grep "tcp dpt:80"' 11 | - require: 12 | - pkg: iptables 13 | -------------------------------------------------------------------------------- /django/apps/poll/multi-host/loaddata.sls: -------------------------------------------------------------------------------- 1 | {% set poll_venv = salt['pillar.get']('django_apps:poll-multi:venv') %} 2 | {% set poll_proj = salt['pillar.get']('django_apps:poll-multi:proj') %} 3 | {% set poll_settings = salt['pillar.get']('django_apps:poll-multi:settings') %} 4 | 5 | poll_loaddata: 6 | module.run: 7 | - name: django.loaddata 8 | - fixtures: ' {{ poll_proj }}/poll/fixtures/poll.json' 9 | - settings_module: {{ poll_settings }} 10 | - bin_env: {{ poll_venv }} 11 | - pythonpath: {{ poll_proj }} 12 | -------------------------------------------------------------------------------- /django/apps/poll/multi-host/vhost.sls: -------------------------------------------------------------------------------- 1 | {% from "apache/map.jinja" import apache with context %} 2 | 3 | include: 4 | - apache 5 | - apache.mod_wsgi 6 | {% if grains['os'] == 'CentOS' %} 7 | - django.apps.poll.multi-host.firewall 8 | {% endif %} 9 | 10 | poll-vhost: 11 | file.managed: 12 | - name: {{ apache.vhostdir }}/poll-vhost.conf 13 | - source: salt://django/apps/poll/multi-host/files/poll-vhost.conf 14 | - template: jinja 15 | - require: 16 | - pkg: apache 17 | - pkg: mod_wsgi 18 | - watch_in: 19 | - service: apache 20 | 21 | 22 | {# Remove the default site (and enable the app's site if necesssary) #} 23 | {% if grains.os_family == 'Debian' %} 24 | a2ensite poll-vhost.conf: 25 | cmd.run: 26 | - require: 27 | - pkg: apache 28 | - file: poll-vhost 29 | 30 | # TODO: Check other Debian/Ubuntu releases and make this more accurate 31 | {% set osrelease = grains['osrelease'] %} 32 | {% if grains['os'] == 'Ubuntu' and osrelease|float >= 14.04 %} 33 | {% set default_site = '000-default' %} 34 | {% else %} 35 | {% set default_site = 'default' %} 36 | {% endif %} 37 | 38 | a2dissite {{ default_site }}: 39 | cmd.run: 40 | - require: 41 | - pkg: apache 42 | 43 | service apache2 reload: 44 | cmd.run: 45 | - onchanges: 46 | - cmd: a2ensite poll-vhost.conf 47 | - cmd: a2dissite {{ default_site }} 48 | {% elif grains.os_family == 'RedHat' %} 49 | {{ apache.vhostdir }}/welcome.conf: 50 | file.absent: 51 | - require: 52 | - pkg: apache 53 | {% endif %} 54 | -------------------------------------------------------------------------------- /django/apps/poll/single-host/app.sls: -------------------------------------------------------------------------------- 1 | {% set poll_venv = salt['pillar.get']('django_apps:poll-single:venv') %} 2 | {% set poll_proj = salt['pillar.get']('django_apps:poll-single:proj') %} 3 | {% set poll_settings = salt['pillar.get']('django_apps:poll-single:settings') %} 4 | 5 | include: 6 | - git 7 | - pip 8 | - virtualenv 9 | 10 | empty_venv: 11 | virtualenv.managed: 12 | - name: /var/www/BASELINE 13 | - require: 14 | - pkg: virtualenv 15 | 16 | poll_venv: 17 | virtualenv.managed: 18 | - name: {{ poll_venv }} 19 | - system_site_packages: True 20 | - require: 21 | - pkg: virtualenv 22 | 23 | poll_gitsource: 24 | git.latest: 25 | - name: https://github.com/terminalmage/django-tutorial.git 26 | - target: {{ poll_proj }} 27 | - force: True 28 | - require: 29 | - pkg: git 30 | - virtualenv: poll_venv 31 | 32 | poll_pkgs: 33 | pip.installed: 34 | - bin_env: {{ poll_venv }} 35 | - requirements: {{ poll_proj }}/requirements.txt 36 | - require: 37 | - git: poll_gitsource 38 | - pkg: pip 39 | - virtualenv: poll_venv 40 | 41 | poll_settings: 42 | file.managed: 43 | - name: {{ poll_proj }}/poll/settings.py 44 | - source: salt://django/apps/poll/single-host/files/settings.py 45 | - template: jinja 46 | - require: 47 | - git: poll_gitsource 48 | 49 | poll_wsgi: 50 | file.managed: 51 | - name: {{ poll_proj }}/poll/wsgi.py 52 | - source: salt://django/apps/poll/single-host/files/wsgi.py 53 | - template: jinja 54 | - require: 55 | - git: poll_gitsource 56 | 57 | poll_syncdb: 58 | module.run: 59 | - name: django.syncdb 60 | - settings_module: {{ poll_settings }} 61 | - bin_env: {{ poll_venv }} 62 | - pythonpath: {{ poll_proj }} 63 | - require: 64 | - file: poll_settings 65 | - pip: poll_pkgs 66 | 67 | poll_collectstatic: 68 | module.run: 69 | - name: django.collectstatic 70 | - settings_module: {{ poll_settings }} 71 | - bin_env: {{ poll_venv }} 72 | - pythonpath: {{ poll_proj }} 73 | - require: 74 | - file: poll_settings 75 | - pip: poll_pkgs 76 | -------------------------------------------------------------------------------- /django/apps/poll/single-host/db.sls: -------------------------------------------------------------------------------- 1 | include: 2 | - mysql.server 3 | - mysql.python 4 | 5 | # Remove the "test" database 6 | mysql_remove_testdb: 7 | mysql_database.absent: 8 | - name: test 9 | 10 | {% for name, db in salt['pillar.get']('django_apps:poll-single:DATABASES', {}).iteritems() %} 11 | polldb: 12 | mysql_database.present: 13 | - name: {{ db.get('NAME') }} 14 | - require: 15 | - service: mysqld 16 | - pkg: mysql-python 17 | 18 | polldb_user: 19 | mysql_user.present: 20 | - name: {{ db.get('USER') }} 21 | - host: {{ db.get('HOST') }} 22 | - password: {{ db.get('PASSWORD') }} 23 | - require: 24 | - mysql_database: polldb 25 | 26 | polldb_grants: 27 | mysql_grants.present: 28 | - grant: all privileges 29 | - database: {{ db.get('NAME') }}.* 30 | - user: {{ db.get('USER') }} 31 | - host: {{ db.get('HOST') }} 32 | - require: 33 | - mysql_user: polldb_user 34 | {% endfor %} 35 | -------------------------------------------------------------------------------- /django/apps/poll/single-host/files/poll-vhost.conf: -------------------------------------------------------------------------------- 1 | # Listen for virtual host requests on all IP addresses 2 | NameVirtualHost *:80 3 | 4 | 5 | ServerName example.com 6 | DocumentRoot {{ salt['pillar.get']('django_apps:poll-single:proj') }}/templates 7 | 8 | 9 | Options -Indexes +FollowSymLinks 10 | Order allow,deny 11 | Allow from all 12 | AllowOverride None 13 | 14 | 15 | Alias /static {{ salt['pillar.get']('django_apps:poll-single:proj') }}/staticroot 16 | WSGIScriptAlias / {{ salt['pillar.get']('django_apps:poll-single:proj') }}/poll/wsgi.py 17 | 18 | -------------------------------------------------------------------------------- /django/apps/poll/single-host/files/settings.py: -------------------------------------------------------------------------------- 1 | # Django settings for poll project. 2 | 3 | DEBUG = True 4 | TEMPLATE_DEBUG = DEBUG 5 | 6 | ADMINS = ( 7 | # ('Your Name', 'your_email@example.com'), 8 | ) 9 | MANAGERS = ADMINS 10 | 11 | DATABASES = { 12 | {% for name, db in salt['pillar.get']('django_apps:poll-single:DATABASES', {}).items() %} 13 | '{{ name }}': { 14 | 'ENGINE': '{{ db.get('ENGINE', '') }}', 15 | 'NAME': '{{ db.get('NAME', '') }}', 16 | 'USER': '{{ db.get('USER', '') }}', 17 | 'PASSWORD': '{{ db.get('PASSWORD', '') }}', 18 | 'HOST': '{{ db.get('HOST', '') }}', 19 | 'PORT': '{{ db.get('PORT', '') }}', 20 | }, 21 | {% endfor %} 22 | } 23 | 24 | # Hosts/domain names that are valid for this site; required if DEBUG is False 25 | # See https://docs.djangoproject.com/en/1.4/ref/settings/#allowed-hosts 26 | ALLOWED_HOSTS = [] 27 | 28 | # Local time zone for this installation. Choices can be found here: 29 | # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name 30 | # although not all choices may be available on all operating systems. 31 | # In a Windows environment this must be set to your system time zone. 32 | TIME_ZONE = 'America/Chicago' 33 | 34 | # Language code for this installation. All choices can be found here: 35 | # http://www.i18nguy.com/unicode/language-identifiers.html 36 | LANGUAGE_CODE = 'en-us' 37 | 38 | SITE_ID = 1 39 | 40 | # If you set this to False, Django will make some optimizations so as not 41 | # to load the internationalization machinery. 42 | USE_I18N = True 43 | 44 | # If you set this to False, Django will not format dates, numbers and 45 | # calendars according to the current locale. 46 | USE_L10N = True 47 | 48 | # If you set this to False, Django will not use timezone-aware datetimes. 49 | USE_TZ = True 50 | 51 | # Absolute filesystem path to the directory that will hold user-uploaded files. 52 | # Example: "/home/media/media.lawrence.com/media/" 53 | MEDIA_ROOT = '{{ salt['pillar.get']('django_apps:poll-single:MEDIA_ROOT') }}' 54 | 55 | # URL that handles the media served from MEDIA_ROOT. Make sure to use a 56 | # trailing slash. 57 | # Examples: "http://media.lawrence.com/media/", "http://example.com/media/" 58 | MEDIA_URL = '{{ salt['pillar.get']('django_apps:poll-single:MEDIA_URL') }}' 59 | 60 | # Absolute path to the directory static files should be collected to. 61 | # Don't put anything in this directory yourself; store your static files 62 | # in apps' "static/" subdirectories and in STATICFILES_DIRS. 63 | # Example: "/home/media/media.lawrence.com/static/" 64 | STATIC_ROOT = '{{ salt['pillar.get']('django_apps:poll-single:STATIC_ROOT') }}' 65 | 66 | # URL prefix for static files. 67 | # Example: "http://media.lawrence.com/static/" 68 | STATIC_URL = '{{ salt['pillar.get']('django_apps:poll-single:STATIC_URL', '/static/') }}' 69 | 70 | # Additional locations of static files 71 | STATICFILES_DIRS = ( 72 | # Put strings here, like "/home/html/static" or "C:/www/django/static". 73 | # Always use forward slashes, even on Windows. 74 | # Don't forget to use absolute paths, not relative paths. 75 | {% for dir in salt['pillar.get']('django_apps:poll-single:STATICFILES_DIRS') %} 76 | '{{ dir }}', 77 | {% endfor %} 78 | ) 79 | 80 | # List of finder classes that know how to find static files in 81 | # various locations. 82 | STATICFILES_FINDERS = ( 83 | 'django.contrib.staticfiles.finders.FileSystemFinder', 84 | 'django.contrib.staticfiles.finders.AppDirectoriesFinder', 85 | #'django.contrib.staticfiles.finders.DefaultStorageFinder', 86 | ) 87 | 88 | # Make this unique, and don't share it with anybody. 89 | SECRET_KEY = '{{ salt['pillar.get']('django_apps:poll-single:SECRET_KEY') }}' 90 | 91 | # List of callables that know how to import templates from various sources. 92 | TEMPLATE_LOADERS = ( 93 | 'django.template.loaders.filesystem.Loader', 94 | 'django.template.loaders.app_directories.Loader', 95 | #'django.template.loaders.eggs.Loader', 96 | ) 97 | 98 | MIDDLEWARE_CLASSES = ( 99 | 'django.middleware.common.CommonMiddleware', 100 | 'django.contrib.sessions.middleware.SessionMiddleware', 101 | 'django.middleware.csrf.CsrfViewMiddleware', 102 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 103 | 'django.contrib.messages.middleware.MessageMiddleware', 104 | # Uncomment the next line for simple clickjacking protection: 105 | # 'django.middleware.clickjacking.XFrameOptionsMiddleware', 106 | ) 107 | 108 | ROOT_URLCONF = '{{ salt['pillar.get']('django_apps:poll-single:ROOT_URLCONF') }}' 109 | 110 | # Python dotted path to the WSGI application used by Django's runserver. 111 | WSGI_APPLICATION = 'poll.wsgi.application' 112 | 113 | TEMPLATE_DIRS = ( 114 | # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". 115 | # Always use forward slashes, even on Windows. 116 | # Don't forget to use absolute paths, not relative paths. 117 | {% for dir in salt['pillar.get']('django_apps:poll-single:TEMPLATE_DIRS') %} 118 | '{{ dir }}', 119 | {% endfor %} 120 | ) 121 | 122 | INSTALLED_APPS = ( 123 | 'django.contrib.auth', 124 | 'django.contrib.contenttypes', 125 | 'django.contrib.sessions', 126 | 'django.contrib.sites', 127 | 'django.contrib.messages', 128 | 'django.contrib.staticfiles', 129 | # Uncomment the next line to enable the admin: 130 | 'django.contrib.admin', 131 | # Uncomment the next line to enable admin documentation: 132 | # 'django.contrib.admindocs', 133 | 'poll.polls', 134 | ) 135 | 136 | # A sample logging configuration. The only tangible logging 137 | # performed by this configuration is to send an email to 138 | # the site admins on every HTTP 500 error when DEBUG=False. 139 | # See http://docs.djangoproject.com/en/dev/topics/logging for 140 | # more details on how to customize your logging configuration. 141 | LOGGING = { 142 | 'version': 1, 143 | 'disable_existing_loggers': False, 144 | 'filters': { 145 | 'require_debug_false': { 146 | '()': 'django.utils.log.RequireDebugFalse' 147 | } 148 | }, 149 | 'handlers': { 150 | 'mail_admins': { 151 | 'level': 'ERROR', 152 | 'filters': ['require_debug_false'], 153 | 'class': 'django.utils.log.AdminEmailHandler' 154 | } 155 | }, 156 | 'loggers': { 157 | 'django.request': { 158 | 'handlers': ['mail_admins'], 159 | 'level': 'ERROR', 160 | 'propagate': True, 161 | }, 162 | } 163 | } 164 | -------------------------------------------------------------------------------- /django/apps/poll/single-host/files/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for poll project. 3 | 4 | This module contains the WSGI application used by Django's development server 5 | and any production WSGI deployments. It should expose a module-level variable 6 | named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover 7 | this application via the ``WSGI_APPLICATION`` setting. 8 | 9 | Usually you will have the standard Django WSGI application here, but it also 10 | might make sense to replace the whole Django WSGI application with a custom one 11 | that later delegates to the Django one. For example, you could introduce WSGI 12 | middleware here, or combine a Django application with an application of another 13 | framework. 14 | 15 | """ 16 | import os 17 | import site 18 | import sys 19 | 20 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ salt['pillar.get']('django_apps:poll-single:settings') }}") 21 | 22 | {% set poll_sitepackages = salt['cmd.exec_code']( 23 | salt['pillar.get']('django_apps:poll-single:venv') ~ '/bin/python', 24 | 'from distutils import sysconfig; print sysconfig.get_python_lib()' 25 | ) %} 26 | 27 | site.addsitedir('{{ poll_sitepackages }}') 28 | 29 | sys.path.append('{{ salt['pillar.get']('django_apps:poll-single:proj') }}') 30 | 31 | # This application object is used by any WSGI server configured to use this 32 | # file. This includes Django's development server, if the WSGI_APPLICATION 33 | # setting points here. 34 | from django.core.wsgi import get_wsgi_application 35 | application = get_wsgi_application() 36 | 37 | # Apply WSGI middleware here. 38 | # from helloworld.wsgi import HelloWorldApplication 39 | # application = HelloWorldApplication(application) 40 | -------------------------------------------------------------------------------- /django/apps/poll/single-host/firewall.sls: -------------------------------------------------------------------------------- 1 | iptables: 2 | pkg.installed: [] 3 | 4 | # Set the index so we can try to insert this at the right offset 5 | {% set ipt_idx = salt['cmd.run']('iptables -L INPUT --line-numbers -n | grep ACCEPT | grep "tcp dpt:22" | awk "{print \$1}"') %} 6 | {% set ipt_idx = ipt_idx if ipt_idx else '0' %} 7 | 8 | iptables -I INPUT {{ ipt_idx }} -p tcp --dport 80 -m state --state NEW -j ACCEPT: 9 | cmd.run: 10 | - unless: 'iptables -L INPUT -n | grep ACCEPT | grep "tcp dpt:80"' 11 | - require: 12 | - pkg: iptables 13 | -------------------------------------------------------------------------------- /django/apps/poll/single-host/loaddata.sls: -------------------------------------------------------------------------------- 1 | {% set poll_venv = salt['pillar.get']('django_apps:poll-single:venv') %} 2 | {% set poll_proj = salt['pillar.get']('django_apps:poll-single:proj') %} 3 | {% set poll_settings = salt['pillar.get']('django_apps:poll-single:settings') %} 4 | 5 | poll_loaddata: 6 | module.run: 7 | - name: django.loaddata 8 | - fixtures: ' {{ poll_proj }}/poll/fixtures/poll.json' 9 | - settings_module: {{ poll_settings }} 10 | - bin_env: {{ poll_venv }} 11 | - pythonpath: {{ poll_proj }} 12 | -------------------------------------------------------------------------------- /django/apps/poll/single-host/vhost.sls: -------------------------------------------------------------------------------- 1 | {% from "apache/map.jinja" import apache with context %} 2 | 3 | include: 4 | - apache 5 | - apache.mod_wsgi 6 | {% if grains['os'] == 'CentOS' %} 7 | - django.apps.poll.single-host.firewall 8 | {% endif %} 9 | 10 | poll-vhost: 11 | file.managed: 12 | - name: {{ apache.vhostdir }}/poll-vhost.conf 13 | - source: salt://django/apps/poll/single-host/files/poll-vhost.conf 14 | - template: jinja 15 | - require: 16 | - pkg: apache 17 | - pkg: mod_wsgi 18 | - watch_in: 19 | - service: apache 20 | 21 | 22 | {# Remove the default site (and enable the app's site if necesssary) #} 23 | {% if grains.os_family == 'Debian' %} 24 | a2ensite poll-vhost.conf: 25 | cmd.run: 26 | - require: 27 | - pkg: apache 28 | - file: poll-vhost 29 | 30 | # TODO: Check other Debian/Ubuntu releases and make this more accurate 31 | {% set osrelease = grains['osrelease'] %} 32 | {% if grains['os'] == 'Ubuntu' and osrelease|float >= 14.04 %} 33 | {% set default_site = '000-default' %} 34 | {% else %} 35 | {% set default_site = 'default' %} 36 | {% endif %} 37 | 38 | a2dissite {{ default_site }}: 39 | cmd.run: 40 | - require: 41 | - pkg: apache 42 | 43 | service apache2 reload: 44 | cmd.run: 45 | - onchanges: 46 | - cmd: a2ensite poll-vhost.conf 47 | - cmd: a2dissite {{ default_site }} 48 | {% elif grains.os_family == 'RedHat' %} 49 | {{ apache.vhostdir }}/welcome.conf: 50 | file.absent: 51 | - require: 52 | - pkg: apache 53 | {% endif %} 54 | -------------------------------------------------------------------------------- /django/init.sls: -------------------------------------------------------------------------------- 1 | {% from "django/map.jinja" import django with context %} 2 | 3 | django: 4 | pkg.installed: 5 | - name: {{ django.pkg }} 6 | -------------------------------------------------------------------------------- /django/map.jinja: -------------------------------------------------------------------------------- 1 | {% set lookup_table = { 2 | 'Debian': { 3 | 'pkg': 'python-django', 4 | }, 5 | 'RedHat': { 6 | 'pkg': 'python-django', 7 | }, 8 | 'CentOS-6': { 9 | 'pkg': 'Django14', 10 | }, 11 | } %} 12 | 13 | {# Use osfinger to do the lookup and fall back to os_family #} 14 | {% set django = salt['grains.filter_by'](lookup_table, 15 | merge=salt['pillar.get']('django:lookup')) %} 16 | -------------------------------------------------------------------------------- /django/pip.sls: -------------------------------------------------------------------------------- 1 | {% from "django/map.jinja" import django with context %} 2 | 3 | django_pip: 4 | pip.installed: 5 | - name: {{ salt['pillar.get']('django:lookup:pip', 'Django') }} 6 | -------------------------------------------------------------------------------- /docs/AUTHORS.rst: -------------------------------------------------------------------------------- 1 | .. role:: raw-html-m2r(raw) 2 | :format: html 3 | 4 | 5 | Authors 6 | ======= 7 | 8 | This list is sorted by the number of commits per contributor in *descending* order. 9 | 10 | .. list-table:: 11 | :header-rows: 1 12 | 13 | * - Avatar 14 | - Contributor 15 | - Contributions 16 | * - :raw-html-m2r:`@myii` 17 | - `@myii `_ 18 | - 88 19 | * - :raw-html-m2r:`@terminalmage` 20 | - `@terminalmage `_ 21 | - 24 22 | * - :raw-html-m2r:`@whiteinge` 23 | - `@whiteinge `_ 24 | - 7 25 | * - :raw-html-m2r:`@dafyddj` 26 | - `@dafyddj `_ 27 | - 3 28 | * - :raw-html-m2r:`@nmadhok` 29 | - `@nmadhok `_ 30 | - 2 31 | * - :raw-html-m2r:`@baby-gnu` 32 | - `@baby-gnu `_ 33 | - 1 34 | * - :raw-html-m2r:`@techhat` 35 | - `@techhat `_ 36 | - 1 37 | * - :raw-html-m2r:`@noelmcloughlin` 38 | - `@noelmcloughlin `_ 39 | - 1 40 | * - :raw-html-m2r:`@puneetk` 41 | - `@puneetk `_ 42 | - 1 43 | * - :raw-html-m2r:`@rspt` 44 | - `@rspt `_ 45 | - 1 46 | 47 | 48 | ---- 49 | 50 | Auto-generated by a `forked version `_ of `gaocegege/maintainer `_ on 2022-02-12. 51 | -------------------------------------------------------------------------------- /docs/CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | 2 | Changelog 3 | ========= 4 | 5 | `0.5.1 `_ (2022-02-12) 6 | -------------------------------------------------------------------------------------------------------- 7 | 8 | Code Refactoring 9 | ^^^^^^^^^^^^^^^^ 10 | 11 | 12 | * **salt-lint:** fix violations (\ `f73f9ca `_\ ) 13 | 14 | Continuous Integration 15 | ^^^^^^^^^^^^^^^^^^^^^^ 16 | 17 | 18 | * update linters to latest versions [skip ci] (\ `6ebf288 `_\ ) 19 | * **3003.1:** update inc. AlmaLinux, Rocky & ``rst-lint`` [skip ci] (\ `8cbb4a6 `_\ ) 20 | * **commitlint:** ensure ``upstream/master`` uses main repo URL [skip ci] (\ `85cb8f0 `_\ ) 21 | * **gemfile:** allow rubygems proxy to be provided as an env var [skip ci] (\ `c8603c9 `_\ ) 22 | * **gemfile:** restrict ``train`` gem version until upstream fix [skip ci] (\ `0abff57 `_\ ) 23 | * **gemfile.lock:** add to repo with updated ``Gemfile`` [skip ci] (\ `b6a4ad6 `_\ ) 24 | * **gemfile+lock:** use ``ssf`` customised ``inspec`` repo [skip ci] (\ `228e51b `_\ ) 25 | * **gemfile+lock:** use ``ssf`` customised ``kitchen-docker`` repo [skip ci] (\ `e293044 `_\ ) 26 | * **gitlab-ci:** add ``rubocop`` linter (with ``allow_failure``\ ) [skip ci] (\ `aee1b5d `_\ ) 27 | * **gitlab-ci:** use GitLab CI as Travis CI replacement (\ `b797489 `_\ ) 28 | * **kitchen:** avoid using bootstrap for ``master`` instances [skip ci] (\ `894e51e `_\ ) 29 | * **kitchen:** move ``provisioner`` block & update ``run_command`` [skip ci] (\ `dcbcb96 `_\ ) 30 | * **kitchen:** use ``saltimages`` Docker Hub where available [skip ci] (\ `6496040 `_\ ) 31 | * **kitchen+ci:** update with ``3004`` pre-salted images/boxes [skip ci] (\ `39b44f7 `_\ ) 32 | * **kitchen+ci:** update with latest ``3003.2`` pre-salted images [skip ci] (\ `dac2516 `_\ ) 33 | * **kitchen+ci:** update with latest CVE pre-salted images [skip ci] (\ `2f29575 `_\ ) 34 | * **kitchen+ci:** use latest pre-salted images (after CVE) [skip ci] (\ `8de998a `_\ ) 35 | * **kitchen+gitlab:** adjust matrix to add ``3003`` [skip ci] (\ `247495a `_\ ) 36 | * **kitchen+gitlab:** remove Ubuntu 16.04 & Fedora 32 (EOL) [skip ci] (\ `7fdcc68 `_\ ) 37 | * **kitchen+gitlab:** update for new pre-salted images [skip ci] (\ `946d035 `_\ ) 38 | * add ``arch-master`` to matrix and update ``.travis.yml`` [skip ci] (\ `2958879 `_\ ) 39 | * add Debian 11 Bullseye & update ``yamllint`` configuration [skip ci] (\ `e5f295d `_\ ) 40 | * **kitchen+gitlab-ci:** use latest pre-salted images [skip ci] (\ `dca4e26 `_\ ) 41 | * **kitchen+travis:** remove ``master-py2-arch-base-latest`` [skip ci] (\ `d098b4b `_\ ) 42 | * **pre-commit:** add to formula [skip ci] (\ `acf5bb5 `_\ ) 43 | * **pre-commit:** enable/disable ``rstcheck`` as relevant [skip ci] (\ `058a5d1 `_\ ) 44 | * **pre-commit:** finalise ``rstcheck`` configuration [skip ci] (\ `e0e5b69 `_\ ) 45 | * **pre-commit:** update hook for ``rubocop`` [skip ci] (\ `56b44ca `_\ ) 46 | * **travis:** add notifications => zulip [skip ci] (\ `047e6cb `_\ ) 47 | * **travis:** quote pathspecs used with ``git ls-files`` [skip ci] (\ `b3d3503 `_\ ) 48 | * **travis:** run ``shellcheck`` during lint job [skip ci] (\ `877cab5 `_\ ) 49 | * **travis:** use ``major.minor`` for ``semantic-release`` version [skip ci] (\ `d9ad891 `_\ ) 50 | * **travis:** use default matrix after ``centos-6`` image fix (\ `3c7b45a `_\ ) 51 | * **workflows/commitlint:** add to repo [skip ci] (\ `ea8f09e `_\ ) 52 | 53 | Tests 54 | ^^^^^ 55 | 56 | 57 | * standardise use of ``share`` suite & ``_mapdata`` state [skip ci] (\ `56cb1ec `_\ ) 58 | 59 | `0.5.0 `_ (2019-11-25) 60 | -------------------------------------------------------------------------------------------------------- 61 | 62 | Bug Fixes 63 | ^^^^^^^^^ 64 | 65 | 66 | * **yamllint:** fix all errors (\ `773aab8 `_\ ) 67 | 68 | Documentation 69 | ^^^^^^^^^^^^^ 70 | 71 | 72 | * **changelog:** update according to standard structure (\ `07eec72 `_\ ) 73 | * **readme:** modify according to standard structure (\ `94e3e89 `_\ ) 74 | * **readme:** move to ``docs/`` directory (\ `4db7d05 `_\ ) 75 | 76 | Features 77 | ^^^^^^^^ 78 | 79 | 80 | * **semantic-release:** implement for this formula (\ `77bc3a9 `_\ ) 81 | 82 | `v0.4.0 `_ (2015-06-22) 83 | --------------------------------------------------------------------------------------------- 84 | 85 | **Merged pull requests:** 86 | 87 | 88 | * Fix Typo in Word Settings `#5 `_ (\ `rspt `_\ ) 89 | * Change states to use short-dec style `#4 `_ (\ `whiteinge `_\ ) 90 | * Update README.rst `#3 `_ (\ `ghost `_\ ) 91 | * Some fixes to make this formula work on Ubuntu 14.04 LTS `#2 `_ (\ `terminalmage `_\ ) 92 | -------------------------------------------------------------------------------- /docs/README.rst: -------------------------------------------------------------------------------- 1 | .. _readme: 2 | 3 | django 4 | ====== 5 | 6 | |img_travis| |img_sr| 7 | 8 | .. |img_travis| image:: https://travis-ci.com/saltstack-formulas/django-formula.svg?branch=master 9 | :alt: Travis CI Build Status 10 | :scale: 100% 11 | :target: https://travis-ci.com/saltstack-formulas/django-formula 12 | .. |img_sr| image:: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg 13 | :alt: Semantic Release 14 | :scale: 100% 15 | :target: https://github.com/semantic-release/semantic-release 16 | 17 | Set up and configure the Django web application framework. 18 | 19 | .. contents:: **Table of Contents** 20 | 21 | General notes 22 | ------------- 23 | 24 | See the full `SaltStack Formulas installation and usage instructions 25 | `_. 26 | 27 | If you are interested in writing or contributing to formulas, please pay attention to the `Writing Formula Section 28 | `_. 29 | 30 | If you want to use this formula, please pay attention to the ``FORMULA`` file and/or ``git tag``, 31 | which contains the currently released version. This formula is versioned according to `Semantic Versioning `_. 32 | 33 | See `Formula Versioning Section `_ for more details. 34 | 35 | If you need (non-default) configuration, please pay attention to the ``pillar.example`` file and/or `Special notes`_ section. 36 | 37 | Contributing to this repo 38 | ------------------------- 39 | 40 | **Commit message formatting is significant!!** 41 | 42 | Please see `How to contribute `_ for more details. 43 | 44 | Special notes 45 | ------------- 46 | 47 | None 48 | 49 | Available states 50 | ---------------- 51 | 52 | .. contents:: 53 | :local: 54 | 55 | ``django`` 56 | ^^^^^^^^^^ 57 | 58 | Install Django from the system package manager. Note, the Django version 59 | available varies by platform. 60 | 61 | Example usage:: 62 | 63 | include: 64 | - django 65 | 66 | mysite: 67 | git: 68 | - latest 69 | - name: git@git.example.com/mysite 70 | - target: /var/www/mysite 71 | - require: 72 | - pkg: django 73 | 74 | ``django.pip`` 75 | ^^^^^^^^^^^^^^ 76 | 77 | Install Django via pip. 78 | 79 | Example usage:: 80 | 81 | include: 82 | - django.pip 83 | 84 | mysite: 85 | git: 86 | - latest 87 | - name: git@git.example.com/mysite 88 | - target: /var/www/mysite 89 | - require: 90 | - pip: django_pip 91 | 92 | 93 | Full-stack App Deployment 94 | ------------------------- 95 | 96 | This formula also provides an example of how Salt can be used to deploy a 97 | Django app in a single command, using the `OverState System`_. It installs 98 | Django into a virtualenv, using pip with a requirements.txt. 99 | 100 | .. _`OverState System`: http://docs.saltstack.com/en/latest/topics/tutorials/states_pt5.html#states-overstate 101 | 102 | This example makes use of the following three files: 103 | 104 | * `pillar.example`_ - Pillar data 105 | * `overstate.single`_ - Single-host OverState deployment stages 106 | * `overstate.multi`_ - Multi-host OverState deployment stages 107 | 108 | .. _pillar.example: https://github.com/saltstack-formulas/django-formula/blob/master/pillar.example 109 | .. _overstate.single: https://github.com/saltstack-formulas/django-formula/blob/master/overstate.single 110 | .. _overstate.multi: https://github.com/saltstack-formulas/django-formula/blob/master/overstate.multi 111 | 112 | Deploying this example will require that the relevant files from above (the 113 | Pillar data and appropriate OverState config file) are copied to the Master and 114 | edited as necessary. The Pillar data will need to be available to all involved 115 | minions. 116 | 117 | Additionally, this example makes use of several other Salt formulae: 118 | 119 | * `apache-formula`_ 120 | * `git-formula`_ 121 | * `mysql-formula`_ 122 | * `pip-formula`_ 123 | * `virtualenv-formula`_ 124 | 125 | .. _apache-formula: https://github.com/saltstack-formulas/apache-formula.git 126 | .. _git-formula: https://github.com/saltstack-formulas/git-formula.git 127 | .. _mysql-formula: https://github.com/saltstack-formulas/mysql-formula.git 128 | .. _pip-formula: https://github.com/saltstack-formulas/pip-formula.git 129 | .. _virtualenv-formula: https://github.com/saltstack-formulas/virtualenv-formula.git 130 | 131 | An easy way to use these would be to add them as gitfs sources. It is not 132 | recommended to add the master copy of the repo (the one within the 133 | `saltstack-formulas`_ account), as others may be pushing to this repository. 134 | Instead, it's safer to fork the repository on GitHub, and use the fork as a 135 | gitfs remote. For example: 136 | 137 | .. _saltstack-formulas: https://github.com/saltstack-formulas 138 | 139 | .. code-block:: yaml 140 | 141 | gitfs_remotes: 142 | - https://github.com/yourusername/django-formula.git 143 | - https://github.com/yourusername/apache-formula.git 144 | - https://github.com/yourusername/git-formula.git 145 | - https://github.com/yourusername/mysql-formula.git 146 | - https://github.com/yourusername/pip-formula.git 147 | - https://github.com/yourusername/virtualenv-formula.git 148 | 149 | 150 | It is also a good idea, though not mandatory, to create a branch and use that 151 | to make any needed changes. This allows you to pull from the 152 | `saltstack-formulas`_ version of the repo into your local fork's ``master`` 153 | branch, and evaluate the changes without causing conflicts with whatever 154 | changes you made. 155 | 156 | .. code-block:: bash 157 | 158 | $ git branch 159 | * master 160 | $ git checkout -b deployment 161 | Switched to a new branch 'deployment' 162 | $ git push -u origin deployment 163 | 164 | This would need to be repeated for each gitfs remote. 165 | 166 | To deploy the entire stack (Apache, MySQL, Django, application) to a single 167 | host, run the following command: 168 | 169 | .. code-block:: bash 170 | 171 | # salt-run state.over deployment /path/to/overstate.single 172 | 173 | To deploy using one database server (and one or more web servers), run the 174 | following command: 175 | 176 | .. code-block:: bash 177 | 178 | # salt-run state.over deployment /path/to/overstate.multi 179 | 180 | .. note:: 181 | 182 | If you did not create a separate ``deployment`` branch as recommended above, 183 | then replace ``deployment`` with ``base`` in the above ``salt-run`` 184 | commands. 185 | 186 | 187 | Other Tips 188 | ---------- 189 | 190 | Create ``settings.py`` using data from Pillar 191 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 192 | 193 | The easiest way to create Django's ``settings.py`` file using data from Pillar 194 | is to simply transform a dictionary in YAML into a dictionary in Python. 195 | 196 | ``/srv/salt/mysite.sls``:: 197 | 198 | include: 199 | - django.pip 200 | 201 | mysite: 202 | git: 203 | - latest 204 | - name: git@git.example.com/mysite 205 | - target: /var/www/mysite 206 | - require: 207 | - pip: django_pip 208 | 209 | mysite_settings: 210 | file: 211 | - managed 212 | - name: /var/www/mysite/settings.py 213 | - contents: | 214 | globals().update({{ salt['pillar.get']('mysite:settings') | python() | indent(8) }}) 215 | - require: 216 | - git: mysite 217 | 218 | ``/srv/pillar/mysite.sls``:: 219 | 220 | mysite: 221 | settings: 222 | ROOT_URLCONF: mysite.urls 223 | SECRET_KEY: 'gith!)on!_dq0=2l(otd67%#0urmrk6_d0!zu)i9fn=!8_g5(c' 224 | DATABASES: 225 | default: 226 | ENGINE: django.db.backends.mysql 227 | NAME: mysitedb 228 | USER: mysiteuser 229 | PASSWORD: mysitepass 230 | HOST: localhost 231 | PORT: 3306 232 | TEMPLATE_DIRS: 233 | - /var/www/mysite/django-tutorial/templates 234 | STATICFILES_DIRS: 235 | - /var/www/mysite/django-tutorial/static 236 | STATIC_ROOT: /var/www/mysite/django-tutorial/staticroot 237 | 238 | Create ``settings.py`` with a template file 239 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 240 | 241 | A more traditional (and flexible) method of creating the ``settings.py`` file 242 | is to actually create the file as a template. 243 | 244 | ``/srv/salt/mysite/mysite.sls``:: 245 | 246 | include: 247 | - django.pip 248 | 249 | mysite: 250 | git: 251 | - latest 252 | - name: git@git.example.com/mysite 253 | - target: /var/www/mysite 254 | - require: 255 | - pip: django_pip 256 | 257 | mysite_settings: 258 | file: 259 | - managed 260 | - name: /var/www/mysite/settings.py 261 | - source: salt://mysite/files/settings-tmpl.py 262 | - template: jinja 263 | - require: 264 | - git: mysite 265 | 266 | ``/srv/salt/mysite/files/settings-tmpl.py``:: 267 | 268 | {# Data can be defined inline, in Grains, in Pillar, etc #} 269 | 270 | {% set db_settings = { 271 | 'default': { 272 | 'ENGINE': 'django.db.backends.mysql', 273 | 'HOST': 'localhost', 274 | 'NAME': 'polldb', 275 | 'PASSWORD': 'pollpass', 276 | 'PORT': 3306, 277 | 'USER': 'polluser', 278 | } 279 | } %} 280 | 281 | {% set staticfiles_dirs_settings = [ 282 | '/var/www/poll/django-tutorial/static', 283 | ] %} 284 | 285 | {% set template_dirs_settings = [ 286 | '/var/www/poll/django-tutorial/templates', 287 | ] %} 288 | 289 | ROOT_URLCONF = mysite.urls 290 | 291 | {# Have Salt automatically generate the SECRET_KEY for this minion #} 292 | SECRET_KEY = '{{ salt['grains.get_or_set_hash']('mysite:SECRET_KEY', 50) }}' 293 | 294 | DATABASES = {{ db_settings | python() }} 295 | 296 | TEMPLATE_DIRS = {{ template_dirs_settings | python() }} 297 | 298 | STATICFILES_DIRS = {{ staticfiles_dirs_settings | python() }} 299 | 300 | STATIC_ROOT = /var/www/mysite/django-tutorial/staticroot 301 | 302 | Run ``syncdb`` or ``collectstatic`` automatically 303 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 304 | 305 | A wait state can be used to trigger ``django-admin.py syncdb`` or 306 | ``django-admin.py collectstatic`` automatically. The following example runs 307 | both commands whenever the Git repository containing the "mysite" Django 308 | project is updated. 309 | 310 | :: 311 | 312 | include: 313 | - django.pip 314 | 315 | mysite: 316 | git: 317 | - latest 318 | - name: git@git.example.com/mysite 319 | - target: /var/www/mysite 320 | - require: 321 | - pip: django_pip 322 | 323 | mysite_syncdb: 324 | module: 325 | - wait 326 | - name: django.syncdb 327 | - settings_module: "mysite.settings" 328 | - bin_env: /path/to/virtualenv # optional 329 | - pythonpath: /path/to/mysite_project # optional 330 | - watch: 331 | - git: mysite 332 | 333 | mysite_collectstatic: 334 | module: 335 | - wait 336 | - name: django.collectstatic 337 | - settings_module: "mysite.settings" 338 | - bin_env: /path/to/virtualenv # optional 339 | - pythonpath: /path/to/mysite_project # optional 340 | - watch: 341 | - git: mysite 342 | 343 | Testing 344 | ------- 345 | 346 | Linux testing is done with ``kitchen-salt``. 347 | 348 | Requirements 349 | ^^^^^^^^^^^^ 350 | 351 | * Ruby 352 | * Docker 353 | 354 | .. code-block:: bash 355 | 356 | $ gem install bundler 357 | $ bundle install 358 | $ bin/kitchen test [platform] 359 | 360 | Where ``[platform]`` is the platform name defined in ``kitchen.yml``, 361 | e.g. ``debian-9-2019-2-py3``. 362 | 363 | ``bin/kitchen converge`` 364 | ^^^^^^^^^^^^^^^^^^^^^^^^ 365 | 366 | Creates the docker instance and runs the ``django.pip`` main state, ready for testing. 367 | 368 | ``bin/kitchen verify`` 369 | ^^^^^^^^^^^^^^^^^^^^^^ 370 | 371 | Runs the ``inspec`` tests on the actual instance. 372 | 373 | ``bin/kitchen destroy`` 374 | ^^^^^^^^^^^^^^^^^^^^^^^ 375 | 376 | Removes the docker instance. 377 | 378 | ``bin/kitchen test`` 379 | ^^^^^^^^^^^^^^^^^^^^ 380 | 381 | Runs all of the stages above in one go: i.e. ``destroy`` + ``converge`` + ``verify`` + ``destroy``. 382 | 383 | ``bin/kitchen login`` 384 | ^^^^^^^^^^^^^^^^^^^^^ 385 | 386 | Gives you SSH access to the instance for manual testing. 387 | -------------------------------------------------------------------------------- /kitchen.yml: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # vim: ft=yaml 3 | --- 4 | # For help on this file's format, see https://kitchen.ci/ 5 | driver: 6 | name: docker 7 | use_sudo: false 8 | privileged: true 9 | run_command: /usr/lib/systemd/systemd 10 | 11 | provisioner: 12 | name: salt_solo 13 | log_level: debug 14 | salt_install: none 15 | require_chef: false 16 | formula: django 17 | salt_copy_filter: 18 | - .kitchen 19 | - .git 20 | 21 | platforms: 22 | ## SALT `tiamat` 23 | - name: debian-11-tiamat-py3 24 | driver: 25 | image: saltimages/salt-tiamat-py3:debian-11 26 | run_command: /lib/systemd/systemd 27 | - name: debian-10-tiamat-py3 28 | driver: 29 | image: saltimages/salt-tiamat-py3:debian-10 30 | run_command: /lib/systemd/systemd 31 | - name: debian-9-tiamat-py3 32 | driver: 33 | image: saltimages/salt-tiamat-py3:debian-9 34 | run_command: /lib/systemd/systemd 35 | - name: ubuntu-2204-tiamat-py3 36 | driver: 37 | image: saltimages/salt-tiamat-py3:ubuntu-22.04 38 | run_command: /lib/systemd/systemd 39 | - name: ubuntu-2004-tiamat-py3 40 | driver: 41 | image: saltimages/salt-tiamat-py3:ubuntu-20.04 42 | run_command: /lib/systemd/systemd 43 | - name: ubuntu-1804-tiamat-py3 44 | driver: 45 | image: saltimages/salt-tiamat-py3:ubuntu-18.04 46 | run_command: /lib/systemd/systemd 47 | - name: centos-stream8-tiamat-py3 48 | driver: 49 | image: saltimages/salt-tiamat-py3:centos-stream8 50 | - name: centos-7-tiamat-py3 51 | driver: 52 | image: saltimages/salt-tiamat-py3:centos-7 53 | - name: amazonlinux-2-tiamat-py3 54 | driver: 55 | image: saltimages/salt-tiamat-py3:amazonlinux-2 56 | - name: oraclelinux-8-tiamat-py3 57 | driver: 58 | image: saltimages/salt-tiamat-py3:oraclelinux-8 59 | - name: oraclelinux-7-tiamat-py3 60 | driver: 61 | image: saltimages/salt-tiamat-py3:oraclelinux-7 62 | - name: almalinux-8-tiamat-py3 63 | driver: 64 | image: saltimages/salt-tiamat-py3:almalinux-8 65 | - name: rockylinux-8-tiamat-py3 66 | driver: 67 | image: saltimages/salt-tiamat-py3:rockylinux-8 68 | 69 | ## SALT `master` 70 | - name: debian-11-master-py3 71 | driver: 72 | image: saltimages/salt-master-py3:debian-11 73 | run_command: /lib/systemd/systemd 74 | - name: debian-10-master-py3 75 | driver: 76 | image: saltimages/salt-master-py3:debian-10 77 | run_command: /lib/systemd/systemd 78 | - name: debian-9-master-py3 79 | driver: 80 | image: saltimages/salt-master-py3:debian-9 81 | run_command: /lib/systemd/systemd 82 | - name: ubuntu-2204-master-py3 83 | driver: 84 | image: saltimages/salt-master-py3:ubuntu-22.04 85 | run_command: /lib/systemd/systemd 86 | - name: ubuntu-2004-master-py3 87 | driver: 88 | image: saltimages/salt-master-py3:ubuntu-20.04 89 | run_command: /lib/systemd/systemd 90 | - name: ubuntu-1804-master-py3 91 | driver: 92 | image: saltimages/salt-master-py3:ubuntu-18.04 93 | run_command: /lib/systemd/systemd 94 | - name: centos-stream8-master-py3 95 | driver: 96 | image: saltimages/salt-master-py3:centos-stream8 97 | - name: centos-7-master-py3 98 | driver: 99 | image: saltimages/salt-master-py3:centos-7 100 | - name: fedora-36-master-py3 101 | driver: 102 | image: saltimages/salt-master-py3:fedora-36 103 | - name: fedora-35-master-py3 104 | driver: 105 | image: saltimages/salt-master-py3:fedora-35 106 | - name: opensuse-leap-153-master-py3 107 | driver: 108 | image: saltimages/salt-master-py3:opensuse-leap-15.3 109 | # Workaround to avoid intermittent failures on `opensuse-leap-15.3`: 110 | # => SCP did not finish successfully (255): (Net::SCP::Error) 111 | transport: 112 | max_ssh_sessions: 1 113 | - name: opensuse-tmbl-latest-master-py3 114 | driver: 115 | image: saltimages/salt-master-py3:opensuse-tumbleweed-latest 116 | # Workaround to avoid intermittent failures on `opensuse-tumbleweed`: 117 | # => SCP did not finish successfully (255): (Net::SCP::Error) 118 | transport: 119 | max_ssh_sessions: 1 120 | - name: amazonlinux-2-master-py3 121 | driver: 122 | image: saltimages/salt-master-py3:amazonlinux-2 123 | - name: oraclelinux-8-master-py3 124 | driver: 125 | image: saltimages/salt-master-py3:oraclelinux-8 126 | - name: oraclelinux-7-master-py3 127 | driver: 128 | image: saltimages/salt-master-py3:oraclelinux-7 129 | - name: arch-base-latest-master-py3 130 | driver: 131 | image: saltimages/salt-master-py3:arch-base-latest 132 | - name: gentoo-stage3-latest-master-py3 133 | driver: 134 | image: saltimages/salt-master-py3:gentoo-stage3-latest 135 | run_command: /sbin/init 136 | - name: gentoo-stage3-systemd-master-py3 137 | driver: 138 | image: saltimages/salt-master-py3:gentoo-stage3-systemd 139 | - name: almalinux-8-master-py3 140 | driver: 141 | image: saltimages/salt-master-py3:almalinux-8 142 | - name: rockylinux-8-master-py3 143 | driver: 144 | image: saltimages/salt-master-py3:rockylinux-8 145 | 146 | ## SALT `3004.1` 147 | - name: debian-11-3004-1-py3 148 | driver: 149 | image: saltimages/salt-3004.1-py3:debian-11 150 | run_command: /lib/systemd/systemd 151 | - name: debian-10-3004-1-py3 152 | driver: 153 | image: saltimages/salt-3004.1-py3:debian-10 154 | run_command: /lib/systemd/systemd 155 | - name: debian-9-3004-1-py3 156 | driver: 157 | image: saltimages/salt-3004.1-py3:debian-9 158 | run_command: /lib/systemd/systemd 159 | - name: ubuntu-2204-3004-1-py3 160 | driver: 161 | image: saltimages/salt-3004.1-py3:ubuntu-22.04 162 | run_command: /lib/systemd/systemd 163 | - name: ubuntu-2004-3004-1-py3 164 | driver: 165 | image: saltimages/salt-3004.1-py3:ubuntu-20.04 166 | run_command: /lib/systemd/systemd 167 | - name: ubuntu-1804-3004-1-py3 168 | driver: 169 | image: saltimages/salt-3004.1-py3:ubuntu-18.04 170 | run_command: /lib/systemd/systemd 171 | - name: centos-stream8-3004-1-py3 172 | driver: 173 | image: saltimages/salt-3004.1-py3:centos-stream8 174 | - name: centos-7-3004-1-py3 175 | driver: 176 | image: saltimages/salt-3004.1-py3:centos-7 177 | - name: fedora-36-3004-1-py3 178 | driver: 179 | image: saltimages/salt-3004.1-py3:fedora-36 180 | - name: fedora-35-3004-1-py3 181 | driver: 182 | image: saltimages/salt-3004.1-py3:fedora-35 183 | - name: amazonlinux-2-3004-1-py3 184 | driver: 185 | image: saltimages/salt-3004.1-py3:amazonlinux-2 186 | - name: oraclelinux-8-3004-1-py3 187 | driver: 188 | image: saltimages/salt-3004.1-py3:oraclelinux-8 189 | - name: oraclelinux-7-3004-1-py3 190 | driver: 191 | image: saltimages/salt-3004.1-py3:oraclelinux-7 192 | - name: arch-base-latest-3004-1-py3 193 | driver: 194 | image: saltimages/salt-3004.1-py3:arch-base-latest 195 | - name: gentoo-stage3-latest-3004-1-py3 196 | driver: 197 | image: saltimages/salt-3004.1-py3:gentoo-stage3-latest 198 | run_command: /sbin/init 199 | - name: gentoo-stage3-systemd-3004-1-py3 200 | driver: 201 | image: saltimages/salt-3004.1-py3:gentoo-stage3-systemd 202 | - name: almalinux-8-3004-1-py3 203 | driver: 204 | image: saltimages/salt-3004.1-py3:almalinux-8 205 | - name: rockylinux-8-3004-1-py3 206 | driver: 207 | image: saltimages/salt-3004.1-py3:rockylinux-8 208 | 209 | ## SALT `3004.0` 210 | - name: opensuse-leap-153-3004-0-py3 211 | driver: 212 | image: saltimages/salt-3004.0-py3:opensuse-leap-15.3 213 | # Workaround to avoid intermittent failures on `opensuse-leap-15.3`: 214 | # => SCP did not finish successfully (255): (Net::SCP::Error) 215 | transport: 216 | max_ssh_sessions: 1 217 | - name: opensuse-tmbl-latest-3004-0-py3 218 | driver: 219 | image: saltimages/salt-3004.0-py3:opensuse-tumbleweed-latest 220 | # Workaround to avoid intermittent failures on `opensuse-tumbleweed`: 221 | # => SCP did not finish successfully (255): (Net::SCP::Error) 222 | transport: 223 | max_ssh_sessions: 1 224 | 225 | ## SALT `3003.4` 226 | - name: debian-10-3003-4-py3 227 | driver: 228 | image: saltimages/salt-3003.4-py3:debian-10 229 | run_command: /lib/systemd/systemd 230 | - name: debian-9-3003-4-py3 231 | driver: 232 | image: saltimages/salt-3003.4-py3:debian-9 233 | run_command: /lib/systemd/systemd 234 | - name: ubuntu-2004-3003-4-py3 235 | driver: 236 | image: saltimages/salt-3003.4-py3:ubuntu-20.04 237 | run_command: /lib/systemd/systemd 238 | - name: ubuntu-1804-3003-4-py3 239 | driver: 240 | image: saltimages/salt-3003.4-py3:ubuntu-18.04 241 | run_command: /lib/systemd/systemd 242 | - name: centos-stream8-3003-4-py3 243 | driver: 244 | image: saltimages/salt-3003.4-py3:centos-stream8 245 | - name: centos-7-3003-4-py3 246 | driver: 247 | image: saltimages/salt-3003.4-py3:centos-7 248 | - name: amazonlinux-2-3003-4-py3 249 | driver: 250 | image: saltimages/salt-3003.4-py3:amazonlinux-2 251 | - name: oraclelinux-8-3003-4-py3 252 | driver: 253 | image: saltimages/salt-3003.4-py3:oraclelinux-8 254 | - name: oraclelinux-7-3003-4-py3 255 | driver: 256 | image: saltimages/salt-3003.4-py3:oraclelinux-7 257 | - name: almalinux-8-3003-4-py3 258 | driver: 259 | image: saltimages/salt-3003.4-py3:almalinux-8 260 | 261 | verifier: 262 | # https://www.inspec.io/ 263 | name: inspec 264 | sudo: true 265 | reporter: 266 | # cli, documentation, html, progress, json, json-min, json-rspec, junit 267 | - cli 268 | 269 | suites: 270 | - name: default 271 | provisioner: 272 | state_top: 273 | base: 274 | '*': 275 | - django._mapdata 276 | - django.pip 277 | pillars: 278 | top.sls: 279 | base: 280 | '*': 281 | - django 282 | pillars_from_files: 283 | django.sls: pillar.example 284 | verifier: 285 | inspec_tests: 286 | - path: test/integration/default 287 | -------------------------------------------------------------------------------- /overstate.multi: -------------------------------------------------------------------------------- 1 | mine_interfaces: 2 | match: 'django-*' 3 | function: 4 | mine.send: 5 | - network.interfaces 6 | 7 | mysql: 8 | match: 'django-db' 9 | require: 10 | - mine_interfaces 11 | sls: 12 | - django.apps.poll.multi-host.db 13 | 14 | app: 15 | match: 'django-web*' 16 | require: 17 | - mysql 18 | sls: 19 | - django.apps.poll.multi-host.app 20 | - django.apps.poll.multi-host.vhost 21 | 22 | load_db: 23 | match: 'django-web1' 24 | require: 25 | - app 26 | sls: 27 | - django.apps.poll.multi-host.loaddata 28 | -------------------------------------------------------------------------------- /overstate.single: -------------------------------------------------------------------------------- 1 | mysql: 2 | match: 'django-web1' 3 | sls: 4 | - django.apps.poll.single-host.db 5 | 6 | app: 7 | match: 'django-web1' 8 | require: 9 | - mysql 10 | sls: 11 | - django.apps.poll.single-host.vhost 12 | - django.apps.poll.single-host.app 13 | 14 | load_db: 15 | match: 'django-web1' 16 | require: 17 | - app 18 | sls: 19 | - django.apps.poll.single-host.loaddata 20 | -------------------------------------------------------------------------------- /pillar.example: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # vim: ft=yaml 3 | --- 4 | django: 5 | lookup: 6 | pkg: python-django 7 | pip: Django 8 | 9 | 10 | # Django Application Deployment 11 | django_apps: 12 | 13 | poll-single: 14 | venv: /var/www/poll 15 | proj: /var/www/poll/django-tutorial 16 | settings: poll.settings 17 | ROOT_URLCONF: poll.urls 18 | SECRET_KEY: 'gith!)on!_dq0=2l(otd67%#0urmrk6_d0!zu)i9fn=!8_g5(c' 19 | DATABASES: 20 | default: 21 | ENGINE: django.db.backends.mysql 22 | NAME: polldb 23 | USER: polluser 24 | PASSWORD: pollpass 25 | HOST: localhost 26 | PORT: 3306 27 | TEMPLATE_DIRS: 28 | - /var/www/poll/django-tutorial/templates 29 | STATICFILES_DIRS: 30 | - /var/www/poll/django-tutorial/static 31 | STATIC_ROOT: /var/www/poll/django-tutorial/staticroot 32 | 33 | poll-multi: 34 | minion_roles: 35 | database: django-db 36 | webhosts: 37 | - django-web1 38 | - django-web2 39 | venv: /var/www/poll 40 | proj: /var/www/poll/django-tutorial 41 | settings: poll.settings 42 | ROOT_URLCONF: poll.urls 43 | SECRET_KEY: 'gith!)on!_dq0=2l(otd67%#0urmrk6_d0!zu)i9fn=!8_g5(c' 44 | DATABASES: 45 | default: 46 | ENGINE: django.db.backends.mysql 47 | NAME: polldb 48 | USER: polluser 49 | PASSWORD: pollpass 50 | PORT: 3306 51 | TEMPLATE_DIRS: 52 | - /var/www/poll/django-tutorial/templates 53 | STATICFILES_DIRS: 54 | - /var/www/poll/django-tutorial/static 55 | STATIC_ROOT: /var/www/poll/django-tutorial/staticroot 56 | -------------------------------------------------------------------------------- /pre-commit_semantic-release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ############################################################################### 4 | # (A) Update `FORMULA` with `${nextRelease.version}` 5 | ############################################################################### 6 | sed -i -e "s_^\(version:\).*_\1 ${1}_" FORMULA 7 | 8 | 9 | ############################################################################### 10 | # (B) Use `m2r2` to convert automatically produced `.md` docs to `.rst` 11 | ############################################################################### 12 | 13 | # Install `m2r2` 14 | pip3 install m2r2 15 | 16 | # Copy and then convert the `.md` docs 17 | cp ./*.md docs/ 18 | cd docs/ || exit 19 | m2r2 --overwrite ./*.md 20 | 21 | # Change excess `H1` headings to `H2` in converted `CHANGELOG.rst` 22 | sed -i -e '/^=.*$/s/=/-/g' CHANGELOG.rst 23 | sed -i -e '1,4s/-/=/g' CHANGELOG.rst 24 | 25 | # Use for debugging output, when required 26 | # cat AUTHORS.rst 27 | # cat CHANGELOG.rst 28 | 29 | # Return back to the main directory 30 | cd .. 31 | -------------------------------------------------------------------------------- /release-rules.js: -------------------------------------------------------------------------------- 1 | // No release is triggered for the types commented out below. 2 | // Commits using these types will be incorporated into the next release. 3 | // 4 | // NOTE: Any changes here must be reflected in `CONTRIBUTING.md`. 5 | module.exports = [ 6 | {breaking: true, release: 'major'}, 7 | // {type: 'build', release: 'patch'}, 8 | // {type: 'chore', release: 'patch'}, 9 | // {type: 'ci', release: 'patch'}, 10 | {type: 'docs', release: 'patch'}, 11 | {type: 'feat', release: 'minor'}, 12 | {type: 'fix', release: 'patch'}, 13 | {type: 'perf', release: 'patch'}, 14 | {type: 'refactor', release: 'patch'}, 15 | {type: 'revert', release: 'patch'}, 16 | {type: 'style', release: 'patch'}, 17 | {type: 'test', release: 'patch'}, 18 | ]; 19 | -------------------------------------------------------------------------------- /release.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | branch: 'master', 3 | repositoryUrl: 'https://github.com/saltstack-formulas/django-formula', 4 | plugins: [ 5 | ['@semantic-release/commit-analyzer', { 6 | preset: 'angular', 7 | releaseRules: './release-rules.js', 8 | }], 9 | '@semantic-release/release-notes-generator', 10 | ['@semantic-release/changelog', { 11 | changelogFile: 'CHANGELOG.md', 12 | changelogTitle: '# Changelog', 13 | }], 14 | ['@semantic-release/exec', { 15 | prepareCmd: 'sh ./pre-commit_semantic-release.sh ${nextRelease.version}', 16 | }], 17 | ['@semantic-release/git', { 18 | assets: ['*.md', 'docs/*.rst', 'FORMULA'], 19 | }], 20 | '@semantic-release/github', 21 | ], 22 | generateNotes: { 23 | preset: 'angular', 24 | writerOpts: { 25 | // Required due to upstream bug preventing all types being displayed. 26 | // Bug: https://github.com/conventional-changelog/conventional-changelog/issues/317 27 | // Fix: https://github.com/conventional-changelog/conventional-changelog/pull/410 28 | transform: (commit, context) => { 29 | const issues = [] 30 | 31 | commit.notes.forEach(note => { 32 | note.title = `BREAKING CHANGES` 33 | }) 34 | 35 | // NOTE: Any changes here must be reflected in `CONTRIBUTING.md`. 36 | if (commit.type === `feat`) { 37 | commit.type = `Features` 38 | } else if (commit.type === `fix`) { 39 | commit.type = `Bug Fixes` 40 | } else if (commit.type === `perf`) { 41 | commit.type = `Performance Improvements` 42 | } else if (commit.type === `revert`) { 43 | commit.type = `Reverts` 44 | } else if (commit.type === `docs`) { 45 | commit.type = `Documentation` 46 | } else if (commit.type === `style`) { 47 | commit.type = `Styles` 48 | } else if (commit.type === `refactor`) { 49 | commit.type = `Code Refactoring` 50 | } else if (commit.type === `test`) { 51 | commit.type = `Tests` 52 | } else if (commit.type === `build`) { 53 | commit.type = `Build System` 54 | // } else if (commit.type === `chore`) { 55 | // commit.type = `Maintenance` 56 | } else if (commit.type === `ci`) { 57 | commit.type = `Continuous Integration` 58 | } else { 59 | return 60 | } 61 | 62 | if (commit.scope === `*`) { 63 | commit.scope = `` 64 | } 65 | 66 | if (typeof commit.hash === `string`) { 67 | commit.shortHash = commit.hash.substring(0, 7) 68 | } 69 | 70 | if (typeof commit.subject === `string`) { 71 | let url = context.repository 72 | ? `${context.host}/${context.owner}/${context.repository}` 73 | : context.repoUrl 74 | if (url) { 75 | url = `${url}/issues/` 76 | // Issue URLs. 77 | commit.subject = commit.subject.replace(/#([0-9]+)/g, (_, issue) => { 78 | issues.push(issue) 79 | return `[#${issue}](${url}${issue})` 80 | }) 81 | } 82 | if (context.host) { 83 | // User URLs. 84 | commit.subject = commit.subject.replace(/\B@([a-z0-9](?:-?[a-z0-9/]){0,38})/g, (_, username) => { 85 | if (username.includes('/')) { 86 | return `@${username}` 87 | } 88 | 89 | return `[@${username}](${context.host}/${username})` 90 | }) 91 | } 92 | } 93 | 94 | // remove references that already appear in the subject 95 | commit.references = commit.references.filter(reference => { 96 | if (issues.indexOf(reference.issue) === -1) { 97 | return true 98 | } 99 | 100 | return false 101 | }) 102 | 103 | return commit 104 | }, 105 | }, 106 | }, 107 | }; 108 | -------------------------------------------------------------------------------- /test/integration/default/README.md: -------------------------------------------------------------------------------- 1 | # InSpec Profile: `default` 2 | 3 | This shows the implementation of the `default` InSpec [profile](https://github.com/inspec/inspec/blob/master/docs/profiles.md). 4 | 5 | ## Verify a profile 6 | 7 | InSpec ships with built-in features to verify a profile structure. 8 | 9 | ```bash 10 | $ inspec check default 11 | Summary 12 | ------- 13 | Location: default 14 | Profile: profile 15 | Controls: 4 16 | Timestamp: 2019-06-24T23:09:01+00:00 17 | Valid: true 18 | 19 | Errors 20 | ------ 21 | 22 | Warnings 23 | -------- 24 | ``` 25 | 26 | ## Execute a profile 27 | 28 | To run all **supported** controls on a local machine use `inspec exec /path/to/profile`. 29 | 30 | ```bash 31 | $ inspec exec default 32 | .. 33 | 34 | Finished in 0.0025 seconds (files took 0.12449 seconds to load) 35 | 8 examples, 0 failures 36 | ``` 37 | 38 | ## Execute a specific control from a profile 39 | 40 | To run one control from the profile use `inspec exec /path/to/profile --controls name`. 41 | 42 | ```bash 43 | $ inspec exec default --controls package 44 | . 45 | 46 | Finished in 0.0025 seconds (files took 0.12449 seconds to load) 47 | 1 examples, 0 failures 48 | ``` 49 | 50 | See an [example control here](https://github.com/inspec/inspec/blob/master/examples/profile/controls/example.rb). 51 | -------------------------------------------------------------------------------- /test/integration/default/inspec.yml: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # vim: ft=yaml 3 | --- 4 | name: default 5 | title: django formula 6 | maintainer: SaltStack Formulas 7 | license: Apache-2.0 8 | summary: Verify that the django formula is setup and configured correctly 9 | depends: 10 | - name: share 11 | path: test/integration/share 12 | supports: 13 | - platform-name: debian 14 | - platform-name: ubuntu 15 | - platform-name: centos 16 | - platform-name: fedora 17 | - platform-name: opensuse 18 | - platform-name: suse 19 | - platform-name: freebsd 20 | - platform-name: openbsd 21 | - platform-name: amazon 22 | - platform-name: oracle 23 | - platform-name: arch 24 | - platform-name: gentoo 25 | - platform-name: almalinux 26 | - platform-name: rocky 27 | - platform-name: mac_os_x 28 | - platform: windows 29 | -------------------------------------------------------------------------------- /test/integration/share/README.md: -------------------------------------------------------------------------------- 1 | # InSpec Profile: `share` 2 | 3 | This shows the implementation of the `share` InSpec [profile](https://github.com/inspec/inspec/blob/master/docs/profiles.md). 4 | 5 | Its goal is to share the libraries between all profiles. 6 | 7 | ## Libraries 8 | 9 | ### `system` 10 | 11 | The `system` library provides easy access to system dependent information: 12 | 13 | - `system.platform`: based on `inspec.platform`, modify to values that are more consistent from a SaltStack perspective 14 | - `system.platform[:family]` provide a family name for Arch and Gentoo 15 | - `system.platform[:name]` append `linux` to both `amazon` and `oracle`; ensure Windows platforms are resolved as simply `windows` 16 | - `system.platform[:release]` tweak Arch, Amazon Linux, Gentoo, openSUSE and Windows: 17 | - `Arch` is always `base-latest` 18 | - `Amazon Linux` release `2018` is resolved as `1` 19 | - `Gentoo` release is trimmed to its major version number and then the init system is appended (i.e. `sysv` or `sysd`) 20 | - `openSUSE` is resolved as `tumbleweed` if the `platform[:release]` is in date format 21 | - `Windows` uses the widely-used release number (e.g. `8.1` or `2019-server`) in place of the actual system release version 22 | - `system.platform[:finger]` is the concatenation of the name and the major release number (except for Ubuntu, which gives `ubuntu-20.04` for example) 23 | -------------------------------------------------------------------------------- /test/integration/share/inspec.yml: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # vim: ft=yaml 3 | --- 4 | name: share 5 | title: InSpec shared resources 6 | maintainer: SaltStack Formulas 7 | license: Apache-2.0 8 | summary: shared resources 9 | supports: 10 | - platform-name: debian 11 | - platform-name: ubuntu 12 | - platform-name: centos 13 | - platform-name: fedora 14 | - platform-name: opensuse 15 | - platform-name: suse 16 | - platform-name: freebsd 17 | - platform-name: openbsd 18 | - platform-name: amazon 19 | - platform-name: oracle 20 | - platform-name: arch 21 | - platform-name: gentoo 22 | - platform-name: almalinux 23 | - platform-name: rocky 24 | - platform-name: mac_os_x 25 | - platform: windows 26 | -------------------------------------------------------------------------------- /test/integration/share/libraries/system.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # system.rb -- InSpec resources for system values 4 | # Author: Daniel Dehennin 5 | # Copyright (C) 2020 Daniel Dehennin 6 | 7 | # rubocop:disable Metrics/ClassLength 8 | class SystemResource < Inspec.resource(1) 9 | name 'system' 10 | 11 | attr_reader :platform 12 | 13 | def initialize 14 | super 15 | @platform = build_platform 16 | end 17 | 18 | private 19 | 20 | def build_platform 21 | { 22 | family: build_platform_family, 23 | name: build_platform_name, 24 | release: build_platform_release, 25 | finger: build_platform_finger, 26 | codename: build_platform_codename 27 | } 28 | end 29 | 30 | def build_platform_family 31 | case inspec.platform[:name] 32 | when 'arch', 'gentoo' 33 | inspec.platform[:name] 34 | else 35 | inspec.platform[:family] 36 | end 37 | end 38 | 39 | def build_platform_name 40 | case inspec.platform[:name] 41 | when 'amazon', 'oracle', 'rocky' 42 | "#{inspec.platform[:name]}linux" 43 | when /^windows_/ 44 | inspec.platform[:family] 45 | else 46 | inspec.platform[:name] 47 | end 48 | end 49 | 50 | # rubocop:disable Metrics/MethodLength,Metrics/AbcSize,Metrics/CyclomaticComplexity 51 | def build_platform_release 52 | case inspec.platform[:name] 53 | when 'amazon' 54 | # `2018` relase is named `1` in `kitchen.yml` 55 | inspec.platform[:release].gsub(/2018.*/, '1') 56 | when 'arch' 57 | 'base-latest' 58 | when 'gentoo' 59 | "#{inspec.platform[:release].split('.')[0]}-#{derive_gentoo_init_system}" 60 | when 'mac_os_x' 61 | inspec.command('sw_vers -productVersion').stdout.to_s 62 | when 'opensuse' 63 | # rubocop:disable Style/NumericLiterals,Layout/LineLength 64 | inspec.platform[:release].to_i > 20210101 ? 'tumbleweed' : inspec.platform[:release] 65 | # rubocop:enable Style/NumericLiterals,Layout/LineLength 66 | when 'windows_8.1_pro' 67 | '8.1' 68 | when 'windows_server_2022_datacenter' 69 | '2022-server' 70 | when 'windows_server_2019_datacenter' 71 | '2019-server' 72 | when 'windows_server_2016_datacenter' 73 | '2016-server' 74 | else 75 | inspec.platform[:release] 76 | end 77 | end 78 | # rubocop:enable Metrics/MethodLength,Metrics/AbcSize,Metrics/CyclomaticComplexity 79 | 80 | def derive_gentoo_init_system 81 | inspec.command('systemctl').exist? ? 'sysd' : 'sysv' 82 | end 83 | 84 | def build_platform_finger 85 | "#{build_platform_name}-#{build_finger_release}" 86 | end 87 | 88 | def build_finger_release 89 | case inspec.platform[:name] 90 | when 'ubuntu' 91 | build_platform_release.split('.').slice(0, 2).join('.') 92 | else 93 | build_platform_release.split('.')[0] 94 | end 95 | end 96 | 97 | # rubocop:disable Metrics/MethodLength,Metrics/CyclomaticComplexity 98 | def build_platform_codename 99 | case build_platform_finger 100 | when 'ubuntu-22.04' 101 | 'jammy' 102 | when 'ubuntu-20.04' 103 | 'focal' 104 | when 'ubuntu-18.04' 105 | 'bionic' 106 | when 'debian-11' 107 | 'bullseye' 108 | when 'debian-10' 109 | 'buster' 110 | when 'debian-9' 111 | 'stretch' 112 | when 'almalinux-8' 113 | "AlmaLinux #{build_platform_release} (Arctic Sphynx)" 114 | when 'amazonlinux-2' 115 | 'Amazon Linux 2' 116 | when 'arch-base-latest' 117 | 'Arch Linux' 118 | when 'centos-7' 119 | 'CentOS Linux 7 (Core)' 120 | when 'centos-8' 121 | 'CentOS Stream 8' 122 | when 'opensuse-tumbleweed' 123 | 'openSUSE Tumbleweed' 124 | when 'opensuse-15' 125 | "openSUSE Leap #{build_platform_release}" 126 | when 'oraclelinux-8', 'oraclelinux-7' 127 | "Oracle Linux Server #{build_platform_release}" 128 | when 'gentoo-2-sysd', 'gentoo-2-sysv' 129 | 'Gentoo/Linux' 130 | when 'rockylinux-8' 131 | "Rocky Linux #{build_platform_release} (Green Obsidian)" 132 | else 133 | '' 134 | end 135 | end 136 | # rubocop:enable Metrics/MethodLength,Metrics/CyclomaticComplexity 137 | end 138 | # rubocop:enable Metrics/ClassLength 139 | --------------------------------------------------------------------------------