├── .chef └── config.rb ├── .gitignore ├── .gitmodules ├── .travis.yml ├── .travis ├── build.sh ├── common.sh ├── deploy.sh └── setup.sh ├── AUTHORS.md ├── AUTHORS_CHEF.md ├── Berksfile ├── Berksfile.lock ├── CHANGELOG.md ├── CHANGELOG_CHEF.md ├── CONTRIBUTORS.md ├── CONTRIBUTORS_CHEF.md ├── Dockerfile-dev ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── README.rst ├── README_CHEF.md ├── Rakefile ├── Vagrantfile ├── certificates └── README.md ├── chefignore ├── config ├── berks-config.json ├── rake.rb └── spork-config.yml ├── data_bags └── README.md ├── docker-compose-mac.yml ├── docker-compose.yml ├── docker-sync.yml ├── docs ├── CHANGELOG_sphinx_deployment.md ├── Dockerfile ├── Dockerfile-dev ├── LICENSE_sphinx_deployment ├── Makefile ├── README.md ├── README_sphinx_deployment.md ├── _static │ ├── .gitkeep │ ├── Toolchain │ │ ├── edit-remove-query.png │ │ ├── edit-time-2.png │ │ ├── edit-time.png │ │ ├── new-jira-connection-form.png │ │ ├── new-jira-connection.png │ │ ├── query-by-assignee.png │ │ ├── query-by-sprint.png │ │ ├── select-projects.png │ │ ├── start-button.png │ │ ├── starting-tracking-time.png │ │ ├── stop-button.png │ │ └── structure-of-queries.png │ ├── built-in-ide │ │ └── teracy_codebox_screenshot.png │ ├── databases-guide │ │ ├── mysql_workbench.png │ │ ├── pgadmin.png │ │ └── phpMyAdmin.png │ ├── favicon.png │ ├── php-dev-guide │ │ ├── LAMP_info.png │ │ └── LEMP_info.png │ └── workflow │ │ ├── clone-fork-url.png │ │ ├── clone-official-url.png │ │ ├── conflict-mark.png │ │ ├── conflict-resolved.png │ │ ├── create-pull-request-form.png │ │ ├── fork-1.png │ │ ├── fork-2.png │ │ ├── fork-3.png │ │ ├── git-conflict.png │ │ ├── git-remote-info.png │ │ ├── project.png │ │ ├── select-repo-to-merge.png │ │ ├── send-pull-request-form.png │ │ ├── sign-in.png │ │ ├── submit-pull-request-code-1.png │ │ ├── submit-pull-request-code-2.png │ │ ├── submit-pull-request-code.png │ │ ├── submit-pull-request-issue.png │ │ └── workflow-with-git.png ├── _templates │ ├── .gitkeep │ └── layout.html ├── advanced_usage.rst ├── android_training.rst ├── basic_usage.rst ├── built_in_ide.rst ├── c_c++_training.rst ├── conf.py ├── databases_guide.rst ├── django_training.rst ├── docker-compose-mac.yml ├── docker-compose.prod.yml ├── docker-compose.yml ├── docker-sync.yml ├── docker.rst ├── docs_guide.rst ├── extending_teracy_dev.rst ├── faqs.rst ├── firefox_addon_dev_guide.rst ├── getting_started.rst ├── git_training.rst ├── html_css_training.rst ├── index.rst ├── intro.rst ├── ios_training.rst ├── java_training.rst ├── js_training.rst ├── most_used_git_commands.rst ├── nodejs_dev_guide.rst ├── objective_c_training.rst ├── php_dev_guide.rst ├── python_dev_guide.rst ├── release.rst ├── release_process.rst ├── requirements.txt ├── rsync_exclude ├── ruby_dev_guide.rst ├── semantic_versioning.rst ├── sphinx_deployment.mk ├── style_standards.rst ├── teracy_dev_development.rst ├── tool_chain.rst └── workflow.rst ├── environment.sh ├── environments └── README.md ├── home ├── .docker │ └── .gitkeep └── .gitkeep ├── lib ├── provisioner.rb └── utility.rb ├── main-cookbooks ├── README.md └── teracy-dev │ ├── .gitkeep │ ├── CHANGELOG.md │ ├── README.md │ ├── attributes │ └── default.rb │ ├── definitions │ └── .gitkeep │ ├── files │ └── default │ │ ├── .gitkeep │ │ └── nginx │ │ └── certs │ │ ├── README.md │ │ ├── default.crt │ │ ├── default.csr │ │ ├── default.key │ │ └── default.pass.key │ ├── libraries │ ├── .gitkeep │ └── helpers.rb │ ├── metadata.rb │ ├── providers │ └── .gitkeep │ ├── recipes │ ├── aliases.rb │ ├── default.rb │ ├── directories.rb │ ├── docker.rb │ ├── docker_machine.rb │ ├── docker_registry.rb │ ├── env_vars.rb │ ├── inotify.rb │ └── proxy.rb │ ├── resources │ └── .gitkeep │ └── templates │ └── default │ └── .gitkeep ├── nodes └── README.md ├── provisioners └── shells │ └── ip.sh ├── resources ├── README.md └── project-template │ ├── .gitignore │ ├── AUTHORS.md │ ├── CHANGELOG.md │ ├── CONTRIBUTORS.md │ ├── LICENSE │ └── README.md ├── roles └── README.md ├── scripts ├── Download-File.ps1 ├── rbenv.sh ├── setup_working_env_mac.sh ├── setup_working_env_ubuntu.sh └── setup_working_env_windows.bat ├── shared └── .gitkeep ├── spec ├── fixture │ ├── config.json │ ├── config_override.json │ ├── org_project.json │ ├── project1.json │ └── project2.json └── utility_spec.rb ├── test └── knife.rb ├── vagrant_config.json ├── vendor-cookbooks ├── compat_resource │ ├── CHANGELOG.md │ ├── CONTRIBUTING.md │ ├── MAINTAINERS.md │ ├── README.md │ ├── files │ │ └── lib │ │ │ ├── chef_compat │ │ │ ├── copied_from_chef.rb │ │ │ ├── copied_from_chef │ │ │ │ └── chef │ │ │ │ │ ├── constants.rb │ │ │ │ │ ├── delayed_evaluator.rb │ │ │ │ │ ├── dsl │ │ │ │ │ ├── core.rb │ │ │ │ │ ├── declare_resource.rb │ │ │ │ │ ├── platform_introspection.rb │ │ │ │ │ ├── recipe.rb │ │ │ │ │ └── universal.rb │ │ │ │ │ ├── mixin │ │ │ │ │ ├── lazy_module_include.rb │ │ │ │ │ ├── notifying_block.rb │ │ │ │ │ ├── params_validate.rb │ │ │ │ │ ├── powershell_out.rb │ │ │ │ │ └── properties.rb │ │ │ │ │ ├── property.rb │ │ │ │ │ ├── provider.rb │ │ │ │ │ ├── provider │ │ │ │ │ ├── apt_repository.rb │ │ │ │ │ ├── apt_update.rb │ │ │ │ │ ├── noop.rb │ │ │ │ │ ├── support │ │ │ │ │ │ └── yum_repo.erb │ │ │ │ │ ├── systemd_unit.rb │ │ │ │ │ └── yum_repository.rb │ │ │ │ │ ├── resource.rb │ │ │ │ │ ├── resource │ │ │ │ │ ├── action_class.rb │ │ │ │ │ ├── apt_repository.rb │ │ │ │ │ ├── apt_update.rb │ │ │ │ │ ├── systemd_unit.rb │ │ │ │ │ └── yum_repository.rb │ │ │ │ │ └── resource_builder.rb │ │ │ ├── mixin │ │ │ │ └── properties.rb │ │ │ ├── monkeypatches.rb │ │ │ ├── monkeypatches │ │ │ │ ├── chef.rb │ │ │ │ └── chef │ │ │ │ │ ├── exceptions.rb │ │ │ │ │ ├── log.rb │ │ │ │ │ ├── mixin │ │ │ │ │ └── params_validate.rb │ │ │ │ │ ├── node.rb │ │ │ │ │ ├── property.rb │ │ │ │ │ ├── provider.rb │ │ │ │ │ ├── recipe.rb │ │ │ │ │ ├── recipe_hook.rb │ │ │ │ │ ├── resource.rb │ │ │ │ │ ├── resource │ │ │ │ │ └── lwrp_base.rb │ │ │ │ │ ├── resource_builder.rb │ │ │ │ │ ├── resource_collection.rb │ │ │ │ │ ├── resource_collection │ │ │ │ │ ├── resource_list.rb │ │ │ │ │ └── resource_set.rb │ │ │ │ │ ├── run_context.rb │ │ │ │ │ └── runner.rb │ │ │ ├── property.rb │ │ │ ├── recipe.rb │ │ │ ├── resource.rb │ │ │ └── resource │ │ │ │ └── lwrp_base.rb │ │ │ ├── chef_upstream_version.rb │ │ │ └── compat_resource.rb │ ├── libraries │ │ └── autoload.rb │ └── metadata.json ├── docker │ ├── CHANGELOG.md │ ├── CONTRIBUTING.md │ ├── MAINTAINERS.md │ ├── README.md │ ├── libraries │ │ ├── _autoload.rb │ │ ├── docker_base.rb │ │ ├── docker_container.rb │ │ ├── docker_exec.rb │ │ ├── docker_image.rb │ │ ├── docker_installation_binary.rb │ │ ├── docker_installation_package.rb │ │ ├── docker_installation_script.rb │ │ ├── docker_installation_tarball.rb │ │ ├── docker_network.rb │ │ ├── docker_registry.rb │ │ ├── docker_service.rb │ │ ├── docker_service_base.rb │ │ ├── docker_service_manager_execute.rb │ │ ├── docker_service_manager_systemd.rb │ │ ├── docker_service_manager_sysvinit_debian.rb │ │ ├── docker_service_manager_sysvinit_rhel.rb │ │ ├── docker_service_manager_upstart.rb │ │ ├── docker_tag.rb │ │ ├── docker_volume.rb │ │ ├── helpers_auth.rb │ │ ├── helpers_base.rb │ │ ├── helpers_container.rb │ │ ├── helpers_image.rb │ │ ├── helpers_installation_binary.rb │ │ ├── helpers_installation_package.rb │ │ ├── helpers_installation_tarball.rb │ │ ├── helpers_network.rb │ │ ├── helpers_service.rb │ │ └── matchers.rb │ ├── metadata.json │ └── templates │ │ └── default │ │ ├── default │ │ ├── docker-wait-ready.erb │ │ └── docker.erb │ │ ├── sysconfig │ │ └── docker.erb │ │ ├── systemd │ │ ├── docker.service-override.erb │ │ ├── docker.service.erb │ │ ├── docker.socket-override.erb │ │ ├── docker.socket.erb │ │ └── tmpfiles.d.conf.erb │ │ ├── sysvinit │ │ ├── docker-debian.erb │ │ └── docker-rhel.erb │ │ └── upstart │ │ └── docker.conf.erb ├── docker_compose │ ├── HISTORY.md │ ├── LICENSE │ ├── README.md │ ├── attributes │ │ └── default.rb │ ├── chefignore │ ├── metadata.json │ ├── recipes │ │ ├── default.rb │ │ └── installation.rb │ └── resources │ │ └── application.rb ├── magic_shell │ ├── CHANGELOG.md │ ├── README.md │ ├── libraries │ │ └── matchers.rb │ ├── metadata.json │ ├── providers │ │ ├── alias.rb │ │ └── environment.rb │ └── resources │ │ ├── alias.rb │ │ └── environment.rb └── vim │ ├── CHANGELOG.md │ ├── CONTRIBUTING.md │ ├── MAINTAINERS.md │ ├── README.md │ ├── attributes │ ├── default.rb │ └── source.rb │ ├── metadata.json │ └── recipes │ ├── default.rb │ ├── package.rb │ ├── source.rb │ └── source_rhel.rb └── workspace └── .gitkeep /.chef/config.rb: -------------------------------------------------------------------------------- 1 | # Configurable Variables (Change these to not depend on environment variables!) 2 | my_orgname = ENV['OPSCODE_ORGNAME'] 3 | my_chef_server_url = ENV['KNIFE_CHEF_SERVER'] 4 | my_cookbook_copyright = ENV['KNIFE_COOKBOOK_COPYRIGHT'] 5 | my_cookbook_license = ENV['KNIFE_COOKBOOK_LICENSE'] 6 | my_cookbook_email = ENV['KNIFE_COOKBOOK_EMAIL'] 7 | 8 | 9 | # Configuration 10 | current_dir = File.dirname(__FILE__) 11 | node_name ENV['OPSCODE_USER'] 12 | client_key "#{ENV['KNIFE_CLIENT_KEY_FOLDER']}/#{ENV['OPSCODE_USER']}.pem" 13 | validation_client_name "#{my_orgname}-validator" 14 | validation_key "#{ENV['KNIFE_VALIDATION_KEY_FOLDER']}/#{my_orgname}-validator.pem" 15 | chef_server_url my_chef_server_url 16 | 17 | # Caching 18 | cache_type 'BasicFile' 19 | cache_options( :path => ENV['KNIFE_CACHE_PATH'] ) 20 | 21 | # Logging 22 | log_level :info 23 | log_location STDOUT 24 | 25 | # Cookbooks 26 | cookbook_path ["#{current_dir}/../main-cookbooks"] 27 | cookbook_copyright my_cookbook_copyright 28 | cookbook_license my_cookbook_license 29 | cookbook_email my_cookbook_email 30 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "test/foodcritic/customink"] 2 | path = test/foodcritic/customink 3 | url = git://github.com/customink-webops/foodcritic-rules.git 4 | [submodule "test/foodcritic/etsy"] 5 | path = test/foodcritic/etsy 6 | url = git://github.com/etsy/foodcritic-rules.git 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | group: deprecated-2017Q2 # see: https://blog.travis-ci.com/2017-06-21-trusty-updates-2017-Q2-launch 2 | services: 3 | - docker 4 | env: 5 | matrix: 6 | - BUILD_TYPE=dev CI_REGISTRY_IMAGE=$DEV_DOCKER_IMAGE 7 | - BUILD_TYPE=docs CI_REGISTRY_IMAGE=$DOCS_DOCKER_IMAGE 8 | global: 9 | - DOCKER_FILE=Dockerfile-dev 10 | - IMAGE_TAG_PREFIX=dev_ 11 | - CI_BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ") 12 | before_install: 13 | - git submodule update --init --recursive 14 | install: true 15 | before_script: 16 | - chmod ugo+x ./.travis/build.sh 17 | - chmod ugo+x ./.travis/deploy.sh 18 | - git config --global user.name "Teracy Bot" 19 | - git config --global user.email "teracy.com@gmail.com" 20 | - export REPO_URL="https://$GH_TOKEN@github.com/$GH_REPO.git" 21 | - . ./.travis/setup.sh 22 | - echo $DEPLOY_HTML_DIR 23 | - export TAG=`if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo $TRAVIS_BRANCH | sed -e 's/[\/]/-/g' | sed -e 's/[\#]//g'; fi` 24 | - export CONTAINER_IMAGE=$CI_REGISTRY_IMAGE:$IMAGE_TAG_PREFIX$TAG 25 | script: 26 | - ./.travis/build.sh 27 | after_success: 28 | - ./.travis/deploy.sh 29 | notifications: 30 | slack: 31 | rooms: 32 | secure: 7rOCiLQZBvSATaFhw/6AgLRo/dGtoume8t0Bmaao5Tp7RKe99qLdN672OzY8aQzxWvP6pexcTvgcVaIIIEk808F7l6tTsz4HRp1TNwxeb0q6kiW0ZgTGS7KvRe17sSpcLUv26T1/flaLbmOaRoqNm/e77onenuuEgM5LTIkc11s= 33 | on_success: change 34 | -------------------------------------------------------------------------------- /.travis/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | . ./.travis/common.sh 6 | 7 | if [[ $BUILD_TYPE == "dev" ]]; then 8 | docker_build 9 | docker run --rm -v $(pwd):/opt/app $CONTAINER_IMAGE rake build 10 | docker run --rm -v $(pwd):/opt/app $CONTAINER_IMAGE bundle exec rspec 11 | elif [[ $BUILD_TYPE == "docs" ]]; then 12 | cd docs 13 | docker_build 14 | docker run -v $(pwd):/opt/app $CONTAINER_IMAGE make generate 15 | cd .. 16 | else 17 | echo 'Wrong build type: $BUILD_TYPE'; 18 | exit 1; 19 | fi -------------------------------------------------------------------------------- /.travis/common.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function docker_build { 4 | docker build -f $DOCKER_FILE \ 5 | --build-arg CI_BUILD_ID=$TRAVIS_BUILD_ID \ 6 | --build-arg CI_BUILD_REF=$TRAVIS_COMMIT \ 7 | --build-arg CI_BUILD_REF_NAME=$TRAVIS_BRANCH \ 8 | --build-arg CI_BUILD_TIME=$CI_BUILD_TIME \ 9 | --build-arg CI_REGISTRY_IMAGE=$CI_REGISTRY_IMAGE \ 10 | --build-arg CI_PROJECT_NAME=$TRAVIS_REPO_SLUG \ 11 | --pull -t $CONTAINER_IMAGE . 12 | } 13 | -------------------------------------------------------------------------------- /.travis/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . ./.travis/common.sh 4 | 5 | docker login -u=$DOCKER_USERNAME -p=$DOCKER_PASSWORD 6 | 7 | function deploy_docs { 8 | cd docs 9 | make setup_gh_pages 10 | make deploy 11 | cd .. 12 | } 13 | 14 | function deploy_docker_img { 15 | docker push $CONTAINER_IMAGE 16 | } 17 | 18 | deploy_docker_img 19 | 20 | if [[ $BUILD_TYPE == "docs" ]]; then 21 | 22 | # build teracy-dev-docs distributed Docker image 23 | cd docs 24 | export DOCKER_FILE=Dockerfile 25 | export IMAGE_TAG_PREFIX="" 26 | export CONTAINER_IMAGE=$CI_REGISTRY_IMAGE:$IMAGE_TAG_PREFIX$TAG 27 | docker_build 28 | deploy_docker_img 29 | cd .. 30 | # allow this to be failed 31 | deploy_docs 32 | fi 33 | -------------------------------------------------------------------------------- /.travis/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #setup travis-ci configuration basing one the being-built branch 4 | 5 | if [[ $TRAVIS_BRANCH == 'master' ]] ; then 6 | export DEPLOY_HTML_DIR=docs 7 | else 8 | export DEPLOY_HTML_DIR=docs/$TRAVIS_BRANCH 9 | fi 10 | -------------------------------------------------------------------------------- /AUTHORS.md: -------------------------------------------------------------------------------- 1 | Authors 2 | ======= 3 | 4 | Hoat Le - hoatle@teracy.com 5 | -------------------------------------------------------------------------------- /AUTHORS_CHEF.md: -------------------------------------------------------------------------------- 1 | Authors 2 | ======= 3 | 4 | Hoat Le - hoatle@teracy.com 5 | -------------------------------------------------------------------------------- /Berksfile: -------------------------------------------------------------------------------- 1 | source "https://supermarket.chef.io" 2 | 3 | cookbook 'vim', '~> 2.0' 4 | cookbook 'magic_shell', '~> 1.0' 5 | cookbook 'docker', '~> 2.15' 6 | cookbook 'docker_compose', '~> 0.1' 7 | cookbook 'compat_resource', '~> 12.19.0' 8 | -------------------------------------------------------------------------------- /Berksfile.lock: -------------------------------------------------------------------------------- 1 | DEPENDENCIES 2 | compat_resource (~> 12.19.0) 3 | docker (~> 2.15) 4 | docker_compose (~> 0.1) 5 | magic_shell (~> 1.0) 6 | vim (~> 2.0) 7 | 8 | GRAPH 9 | compat_resource (12.19.0) 10 | docker (2.15.6) 11 | docker_compose (0.1.1) 12 | magic_shell (1.0.0) 13 | vim (2.0.2) 14 | -------------------------------------------------------------------------------- /CHANGELOG_CHEF.md: -------------------------------------------------------------------------------- 1 | Change Log 2 | ========== 3 | 4 | [0.1.0][] 5 | --------- 6 | 7 | Initial release with TDD workflow thanks to 8 | http://neverstopbuilding.net/chef-best-practices-a-series/ 9 | 10 | 11 | [0.1.0]: https://issues.teracy.org/secure/ReleaseNote.jspa?projectId=10412&version=10001 12 | -------------------------------------------------------------------------------- /CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | Contributors 2 | ============ 3 | 4 | (in no particular order) 5 | 6 | - vinhtran 7 | - phuonglm 8 | - datphan 9 | - jtimberman 10 | - hoavt 11 | - tucq88 12 | - adamhjk 13 | - mattray 14 | - Seth Vargo 15 | - hoale 16 | - cuzen1 17 | - Bryan McLellan 18 | - Smxsm 19 | 20 | see: 21 | 22 | - https://github.com/teracyhq/dev/graphs/contributors 23 | - https://www.openhub.net/p/teracy-dev/contributors 24 | -------------------------------------------------------------------------------- /CONTRIBUTORS_CHEF.md: -------------------------------------------------------------------------------- 1 | Contributors 2 | ============ 3 | -------------------------------------------------------------------------------- /Dockerfile-dev: -------------------------------------------------------------------------------- 1 | FROM ruby:2.4.0 2 | 3 | LABEL authors="hoatle " 4 | 5 | RUN useradd --user-group --create-home --shell /bin/false app && mkdir -p /opt/app 6 | 7 | ENV HOME=/home/app TERM=xterm-256color APP=/opt/app 8 | 9 | # add more arguments from CI to the image so that `$ env` should reveal more info 10 | ARG CI_BUILD_ID 11 | ARG CI_BUILD_REF 12 | ARG CI_REGISTRY_IMAGE 13 | ARG CI_PROJECT_NAME 14 | ARG CI_BUILD_REF_NAME 15 | ARG CI_BUILD_TIME 16 | 17 | ENV CI_BUILD_ID=$CI_BUILD_ID CI_BUILD_REF=$CI_BUILD_REF CI_REGISTRY_IMAGE=$CI_REGISTRY_IMAGE \ 18 | CI_PROJECT_NAME=$CI_PROJECT_NAME CI_BUILD_REF_NAME=$CI_BUILD_REF_NAME CI_BUILD_TIME=$CI_BUILD_TIME 19 | 20 | ADD Gemfile Gemfile.lock $APP/ 21 | 22 | RUN chown -R app $APP && chgrp -R app $APP \ 23 | && chown -R app /usr/local 24 | 25 | WORKDIR $APP 26 | 27 | USER app 28 | 29 | RUN bundle install 30 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'http://rubygems.org' 2 | 3 | ruby '2.4.0' 4 | 5 | gem 'rake', '~> 11.3' 6 | 7 | group:development do 8 | gem 'chef', '~> 13.1' 9 | gem 'chefspec', '~> 7.1' 10 | gem 'foodcritic', '~> 8.1' 11 | gem 'knife-spork', '~> 1.6' 12 | gem 'berkshelf', '~> 5.2' 13 | gem "rspec" 14 | end 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) Teracy, Inc. and individual contributors. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 14 | 3. Neither the name of Teracy, Inc. nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without 16 | specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | teracy-dev 2 | ========== 3 | 4 | .. image:: https://travis-ci.org/teracyhq/dev.svg?branch=develop 5 | :target: https://travis-ci.org/teracyhq/dev 6 | 7 | Issues board: https://waffle.io/teracyhq/all?source=teracyhq%2Fdev 8 | 9 | 10 | The only truly universal productive software development platform for all! 11 | 12 | 13 | ``teracy-dev`` is created to set up a universal development platform which has the same development 14 | workflow on Mac, Linux and Windows with good developer experience and productivity in mind. 15 | 16 | We leverage Docker workflow for our software development and we use ``vagrant``, ``virtualbox``, and 17 | ``chef`` to install and configure any necessary packages. 18 | 19 | By using this approach, we can work in a consistent development environment and workflow. 20 | We do not have to install tons of development stuff on the host machine **manually** to get started. 21 | 22 | .. note:: We are using the https://github.com/acme101 project to show the best practices from ``teracy-dev`` applied for organizations. 23 | 24 | 25 | Features 26 | -------- 27 | 28 | - fully automated managed servers on your local machine (by leveraging ``vagrant`` + ``chef`` 29 | provisioner). This saves you a lot of time and money to work on many virtual private servers (VPS) 30 | on your local machine before deploying applications on the production servers. 31 | - the universally same workflow on Windows, Linux and Mac 32 | - higher performance and productivity gain than default vagrant settings 33 | - support different configuration management tools (provisioners) 34 | - default set up with easy personalized configuration settings without any limitation 35 | - seamless upgrading to the next updated versions of teracy-dev 36 | - best practices to develop and deploy applications 37 | - a full-stack developer workstation 38 | - many more features that you will discover yourselves when using this 39 | 40 | Installation and Usage 41 | ---------------------- 42 | 43 | Follow the guide at http://dev.teracy.org/docs/getting_started.html 44 | 45 | 46 | License 47 | ------- 48 | 49 | BSD License 50 | -------------------------------------------------------------------------------- /certificates/README.md: -------------------------------------------------------------------------------- 1 | Creating SSL certificates is a common task done in web application infrastructures, so a rake task is provided to generate certificates. These certificates are stored here by the ssl_cert task. 2 | 3 | Configure the values used in the SSL certificate by modifying `config/rake.rb`. 4 | 5 | To generate a certificate set for a new monitoring server, for example: 6 | 7 | rake ssl_cert FQDN=monitoring.example.com 8 | 9 | Once the certificates are generated, copy them into the cookbook(s) where you want to use them. 10 | 11 | cp certificates/monitoring.example.com.* cookbooks/COOKBOOK/files/default 12 | 13 | In the recipe for that cookbook, create a `cookbook_file` resource to configure a resource that puts them in place on the destination server. 14 | 15 | cookbook_file '/etc/apache2/ssl/monitoring.example.com.pem' 16 | owner 'root' 17 | group 'root' 18 | mode 0600 19 | end 20 | -------------------------------------------------------------------------------- /chefignore: -------------------------------------------------------------------------------- 1 | # Put files/directories that should be ignored in this file. 2 | # Lines that start with '# ' are comments. 3 | 4 | # emacs 5 | *~ 6 | 7 | # vim 8 | *.sw[a-z] 9 | 10 | # subversion 11 | */.svn/* 12 | -------------------------------------------------------------------------------- /config/berks-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "ssl": { 3 | "verify": false 4 | } 5 | } -------------------------------------------------------------------------------- /config/rake.rb: -------------------------------------------------------------------------------- 1 | # Configure the Rakefile's tasks. 2 | 3 | ### 4 | # Company and SSL Details 5 | # Used with the ssl_cert task. 6 | ### 7 | 8 | # The company name - used for SSL certificates, and in srvious other places 9 | COMPANY_NAME = "Teracy, Inc." 10 | 11 | # The Country Name to use for SSL Certificates 12 | SSL_COUNTRY_NAME = "VN" 13 | 14 | # The State Name to use for SSL Certificates 15 | SSL_STATE_NAME = "Several" 16 | 17 | # The Locality Name for SSL - typically, the city 18 | SSL_LOCALITY_NAME = "Locality" 19 | 20 | # What department? 21 | SSL_ORGANIZATIONAL_UNIT_NAME = "Operations" 22 | 23 | # The SSL contact email address 24 | SSL_EMAIL_ADDRESS = "devops@teracy.com" 25 | 26 | # License for new Cookbooks 27 | # Can be :apachev2 or :none 28 | NEW_COOKBOOK_LICENSE = :none 29 | 30 | ### 31 | # Useful Extras (which you probably don't need to change) 32 | ### 33 | 34 | # The top of the repository checkout 35 | TOPDIR = File.expand_path(File.join(File.dirname(__FILE__), "..")) 36 | 37 | # Where to store certificates generated with ssl_cert 38 | CADIR = File.expand_path(File.join(TOPDIR, "certificates")) 39 | -------------------------------------------------------------------------------- /config/spork-config.yml: -------------------------------------------------------------------------------- 1 | default_environments: 2 | - dev 3 | - stag 4 | - prod 5 | version_changed_threshold: 2 6 | environment_path: "environments" -------------------------------------------------------------------------------- /data_bags/README.md: -------------------------------------------------------------------------------- 1 | Data Bags 2 | --------- 3 | 4 | This directory contains directories of the various data bags you create for your infrastructure. Each subdirectory corresponds to a data bag on the Chef Server, and contains JSON files of the items that go in the bag. 5 | 6 | First, create a directory for the data bag. 7 | 8 | mkdir data_bags/BAG 9 | 10 | Then create the JSON files for items that will go into that bag. 11 | 12 | $EDITOR data_bags/BAG/ITEM.json 13 | 14 | The JSON for the ITEM must contain a key named "id" with a value equal to "ITEM". For example, 15 | 16 | { 17 | "id": "foo" 18 | } 19 | 20 | Next, create the data bag on the Chef Server. 21 | 22 | knife data bag create BAG 23 | 24 | Then upload the items in the data bag's directory to the Chef Server. 25 | 26 | knife data bag from file BAG ITEM.json 27 | 28 | 29 | Encrypted Data Bags 30 | ------------------- 31 | 32 | Added in Chef 0.10, encrypted data bags allow you to encrypt the contents of your data bags. The content of attributes will no longer be searchable. To use encrypted data bags, first you must have or create a secret key. 33 | 34 | openssl rand -base64 512 > secret_key 35 | 36 | You may use this secret_key to add items to a data bag during a create. 37 | 38 | knife data bag create --secret-file secret_key passwords mysql 39 | 40 | You may also use it when adding ITEMs from files, 41 | 42 | knife data bag create passwords 43 | knife data bag from file passwords data_bags/passwords/mysql.json --secret-file secret_key 44 | 45 | The JSON for the ITEM must contain a key named "id" with a value equal to "ITEM" and the contents will be encrypted when uploaded. For example, 46 | 47 | { 48 | "id": "mysql", 49 | "password": "abc123" 50 | } 51 | 52 | Without the secret_key, the contents are encrypted. 53 | 54 | knife data bag show passwords mysql 55 | id: mysql 56 | password: 2I0XUUve1TXEojEyeGsjhw== 57 | 58 | Use the secret_key to view the contents. 59 | 60 | knife data bag show passwords mysql --secret-file secret_key 61 | id: mysql 62 | password: abc123 63 | 64 | -------------------------------------------------------------------------------- /docker-compose-mac.yml: -------------------------------------------------------------------------------- 1 | version: "2" 2 | 3 | services: 4 | dev: 5 | volumes: 6 | - teracy-dev-sync:/opt/app:rw 7 | volumes: 8 | teracy-dev-sync: 9 | external: true 10 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "2" 2 | 3 | services: 4 | dev: 5 | build: 6 | context: . 7 | dockerfile: Dockerfile-dev 8 | image: teracy/dev:dev_develop 9 | command: bash -c "rake build && rake berks_install" 10 | volumes: 11 | - .:/opt/app 12 | - /opt/app/.chef 13 | - /opt/app/.vagrant 14 | - /opt/app/.idea 15 | - /opt/app/workspace 16 | -------------------------------------------------------------------------------- /docker-sync.yml: -------------------------------------------------------------------------------- 1 | options: 2 | compose-dev-file-path: 'docker-compose-mac.yml' 3 | 4 | syncs: 5 | teracy-dev-sync: 6 | src: '.' 7 | dest: '/opt/app' 8 | sync_strategy: 'unison' 9 | sync_excludes: ['.chef', '.idea', '.vagrant', 'workspace'] 10 | sync_host_port: 10873 11 | -------------------------------------------------------------------------------- /docs/CHANGELOG_sphinx_deployment.md: -------------------------------------------------------------------------------- 1 | Change Log 2 | ========== 3 | 4 | [0.2.0][] 5 | --------- 6 | 7 | - Improvement 8 | + [SPXD-6] - remove duplication of git init when setup_gh_pages 9 | 10 | - New Feature 11 | + [SPXD-5] - Rsync support 12 | 13 | 14 | [0.1.0][] 15 | --------- 16 | 17 | - Improvement 18 | + [SPXD-2] - remove "make init_gh_pages" step 19 | 20 | - New Feature 21 | + [SPXD-1] - make gen_deploy 22 | + [SPXD-3] - installation bash script 23 | 24 | 25 | [0.1.0]: https://issues.teracy.org/secure/ReleaseNote.jspa?version=10003&styleName=Text&projectId=10405&Create=Create&atl_token=BD5N-YNBS-EHHQ-478Z%7C87dd31199258f9de5ade180582481463461ded32%7Clin 26 | 27 | [0.2.0]: https://issues.teracy.org/secure/ReleaseNote.jspa?projectId=10405&version=10004 28 | -------------------------------------------------------------------------------- /docs/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx:1.11 2 | 3 | LABEL authors="hoatle " 4 | 5 | # add more arguments from CI to the image so that `$ env` should reveal more info 6 | ARG CI_BUILD_ID 7 | ARG CI_BUILD_REF 8 | ARG CI_REGISTRY_IMAGE 9 | ARG CI_PROJECT_NAME 10 | ARG CI_BUILD_REF_NAME 11 | ARG CI_BUILD_TIME 12 | 13 | ENV CI_BUILD_ID=$CI_BUILD_ID CI_BUILD_REF=$CI_BUILD_REF CI_REGISTRY_IMAGE=$CI_REGISTRY_IMAGE \ 14 | CI_PROJECT_NAME=$CI_PROJECT_NAME CI_BUILD_REF_NAME=$CI_BUILD_REF_NAME CI_BUILD_TIME=$CI_BUILD_TIME 15 | 16 | COPY _build/html /usr/share/nginx/html -------------------------------------------------------------------------------- /docs/Dockerfile-dev: -------------------------------------------------------------------------------- 1 | FROM python:2.7 2 | 3 | LABEL authors="hoatle " 4 | 5 | RUN useradd --user-group --create-home --shell /bin/false app && mkdir -p /opt/app 6 | 7 | ENV HOME=/home/app TERM=xterm-256color APP=/opt/app 8 | 9 | # add more arguments from CI to the image so that `$ env` should reveal more info 10 | ARG CI_BUILD_ID 11 | ARG CI_BUILD_REF 12 | ARG CI_REGISTRY_IMAGE 13 | ARG CI_PROJECT_NAME 14 | ARG CI_BUILD_REF_NAME 15 | ARG CI_BUILD_TIME 16 | 17 | ENV CI_BUILD_ID=$CI_BUILD_ID CI_BUILD_REF=$CI_BUILD_REF CI_REGISTRY_IMAGE=$CI_REGISTRY_IMAGE \ 18 | CI_PROJECT_NAME=$CI_PROJECT_NAME CI_BUILD_REF_NAME=$CI_BUILD_REF_NAME CI_BUILD_TIME=$CI_BUILD_TIME 19 | 20 | ADD requirements.txt $APP/ 21 | 22 | RUN chown -R app $APP && chgrp -R app $APP \ 23 | && chown -R app /usr/local 24 | 25 | WORKDIR $APP 26 | 27 | USER app 28 | 29 | RUN pip install --global pip 30 | 31 | RUN pip install -r requirements.txt 32 | 33 | CMD ["make", "generate"] 34 | -------------------------------------------------------------------------------- /docs/LICENSE_sphinx_deployment: -------------------------------------------------------------------------------- 1 | Copyright (c) Teracy, Inc. and individual contributors. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 14 | 3. Neither the name of Teracy, Inc. nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without 16 | specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /docs/_static/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/.gitkeep -------------------------------------------------------------------------------- /docs/_static/Toolchain/edit-remove-query.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/Toolchain/edit-remove-query.png -------------------------------------------------------------------------------- /docs/_static/Toolchain/edit-time-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/Toolchain/edit-time-2.png -------------------------------------------------------------------------------- /docs/_static/Toolchain/edit-time.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/Toolchain/edit-time.png -------------------------------------------------------------------------------- /docs/_static/Toolchain/new-jira-connection-form.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/Toolchain/new-jira-connection-form.png -------------------------------------------------------------------------------- /docs/_static/Toolchain/new-jira-connection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/Toolchain/new-jira-connection.png -------------------------------------------------------------------------------- /docs/_static/Toolchain/query-by-assignee.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/Toolchain/query-by-assignee.png -------------------------------------------------------------------------------- /docs/_static/Toolchain/query-by-sprint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/Toolchain/query-by-sprint.png -------------------------------------------------------------------------------- /docs/_static/Toolchain/select-projects.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/Toolchain/select-projects.png -------------------------------------------------------------------------------- /docs/_static/Toolchain/start-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/Toolchain/start-button.png -------------------------------------------------------------------------------- /docs/_static/Toolchain/starting-tracking-time.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/Toolchain/starting-tracking-time.png -------------------------------------------------------------------------------- /docs/_static/Toolchain/stop-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/Toolchain/stop-button.png -------------------------------------------------------------------------------- /docs/_static/Toolchain/structure-of-queries.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/Toolchain/structure-of-queries.png -------------------------------------------------------------------------------- /docs/_static/built-in-ide/teracy_codebox_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/built-in-ide/teracy_codebox_screenshot.png -------------------------------------------------------------------------------- /docs/_static/databases-guide/mysql_workbench.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/databases-guide/mysql_workbench.png -------------------------------------------------------------------------------- /docs/_static/databases-guide/pgadmin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/databases-guide/pgadmin.png -------------------------------------------------------------------------------- /docs/_static/databases-guide/phpMyAdmin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/databases-guide/phpMyAdmin.png -------------------------------------------------------------------------------- /docs/_static/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/favicon.png -------------------------------------------------------------------------------- /docs/_static/php-dev-guide/LAMP_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/php-dev-guide/LAMP_info.png -------------------------------------------------------------------------------- /docs/_static/php-dev-guide/LEMP_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/php-dev-guide/LEMP_info.png -------------------------------------------------------------------------------- /docs/_static/workflow/clone-fork-url.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/workflow/clone-fork-url.png -------------------------------------------------------------------------------- /docs/_static/workflow/clone-official-url.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/workflow/clone-official-url.png -------------------------------------------------------------------------------- /docs/_static/workflow/conflict-mark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/workflow/conflict-mark.png -------------------------------------------------------------------------------- /docs/_static/workflow/conflict-resolved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/workflow/conflict-resolved.png -------------------------------------------------------------------------------- /docs/_static/workflow/create-pull-request-form.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/workflow/create-pull-request-form.png -------------------------------------------------------------------------------- /docs/_static/workflow/fork-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/workflow/fork-1.png -------------------------------------------------------------------------------- /docs/_static/workflow/fork-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/workflow/fork-2.png -------------------------------------------------------------------------------- /docs/_static/workflow/fork-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/workflow/fork-3.png -------------------------------------------------------------------------------- /docs/_static/workflow/git-conflict.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/workflow/git-conflict.png -------------------------------------------------------------------------------- /docs/_static/workflow/git-remote-info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/workflow/git-remote-info.png -------------------------------------------------------------------------------- /docs/_static/workflow/project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/workflow/project.png -------------------------------------------------------------------------------- /docs/_static/workflow/select-repo-to-merge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/workflow/select-repo-to-merge.png -------------------------------------------------------------------------------- /docs/_static/workflow/send-pull-request-form.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/workflow/send-pull-request-form.png -------------------------------------------------------------------------------- /docs/_static/workflow/sign-in.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/workflow/sign-in.png -------------------------------------------------------------------------------- /docs/_static/workflow/submit-pull-request-code-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/workflow/submit-pull-request-code-1.png -------------------------------------------------------------------------------- /docs/_static/workflow/submit-pull-request-code-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/workflow/submit-pull-request-code-2.png -------------------------------------------------------------------------------- /docs/_static/workflow/submit-pull-request-code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/workflow/submit-pull-request-code.png -------------------------------------------------------------------------------- /docs/_static/workflow/submit-pull-request-issue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/workflow/submit-pull-request-issue.png -------------------------------------------------------------------------------- /docs/_static/workflow/workflow-with-git.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_static/workflow/workflow-with-git.png -------------------------------------------------------------------------------- /docs/_templates/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/docs/_templates/.gitkeep -------------------------------------------------------------------------------- /docs/_templates/layout.html: -------------------------------------------------------------------------------- 1 | {% extends "!layout.html" %} 2 | 3 | {% block extrahead %} 4 | 14 | {% endblock %} -------------------------------------------------------------------------------- /docs/advanced_usage.rst: -------------------------------------------------------------------------------- 1 | Advanced Usage 2 | ============== 3 | 4 | This is for advanced usage, make sure to master the :doc:`basic_usage` guide first. 5 | 6 | Configuration 7 | ------------- 8 | 9 | Sometimes, we need some customized configuration other than default configuration. 10 | 11 | So for easier upgrade and customized configuration, we use a json file named `vagrant_config_override.json` 12 | to override the default configuration on `vagrant_config.json` file. 13 | 14 | By using this, we can easily upgrade teracy-dev with ease, no conflicts introduced. 15 | 16 | 17 | For example, to use more memory for the VM, looking into the `vagrant_config.json` file we could find: 18 | 19 | .. code-block:: javascript 20 | 21 | "vb":{ //virtualbox settings from https://www.virtualbox.org/manual/ch08.html#vboxmanage-modifyvm 22 | //"gui":true, 23 | //"name":"teracy-dev", 24 | "memory":2048, 25 | //"cpus":1, 26 | "description":"teracy-dev #{Time.now.getutc.to_i}" 27 | } 28 | 29 | Now create the `vagrant_config_override.json` file with the following content: 30 | 31 | .. code-block:: json 32 | 33 | { 34 | "vb":{ 35 | "memory":3072 36 | } 37 | } 38 | 39 | After that, ``$ vagrant reload``, then this overridden configuration will update the VM with *3072* MB memory instead of default *2048* MB memory. 40 | 41 | This applied the same for other configuration that you want to override. Under the hood, we merge 42 | the `vagrant_config_override.json` with `vagrant_config.json` to create the configuration settings. 43 | The configuration settings are then applied to the `Vagrantfile` file. 44 | 45 | 46 | Upgrading 47 | --------- 48 | 49 | To upgrade teracy-dev, just pull the latest changes from the git repo and you're set: 50 | 51 | .. code-block:: bash 52 | 53 | $ cd ~/teracy-dev 54 | $ git fetch origin && git reset --hard origin/master 55 | 56 | ``$ vagrant reload --provision`` is used for improvements and bug fixes change upgrading. 57 | 58 | ``$ vagrant destroy && vagrant up`` is used for next major version change upgrading. 59 | -------------------------------------------------------------------------------- /docs/android_training.rst: -------------------------------------------------------------------------------- 1 | Android Training 2 | ================ -------------------------------------------------------------------------------- /docs/built_in_ide.rst: -------------------------------------------------------------------------------- 1 | Built-in IDE (codebox) 2 | ====================== 3 | 4 | .. warning:: 5 | 6 | This page will be cleaned up by the next version of teracy-dev: v0.6.0 7 | 8 | We're leveraging Docker workflow since v0.5.0 and this feature is not available. 9 | 10 | This feature is available at http://dev.teracy.org/docs/0.4.2/built_in_ide.html 11 | -------------------------------------------------------------------------------- /docs/c_c++_training.rst: -------------------------------------------------------------------------------- 1 | C/C++ Training 2 | ============== -------------------------------------------------------------------------------- /docs/databases_guide.rst: -------------------------------------------------------------------------------- 1 | Databases Guide 2 | =============== 3 | 4 | .. warning:: 5 | 6 | This page will be cleaned up by the next version of teracy-dev: v0.6.0 7 | 8 | We're leveraging Docker workflow since v0.5.0 and this feature is not available. 9 | 10 | This feature is available at http://dev.teracy.org/docs/0.4.2/databases_guide.html 11 | -------------------------------------------------------------------------------- /docs/django_training.rst: -------------------------------------------------------------------------------- 1 | Django Training 2 | =============== 3 | 4 | .. warning:: 5 | 6 | This page will be cleaned up by the next version of teracy-dev: v0.6.0 7 | 8 | We're leveraging Docker workflow since v0.5.0 and this feature is not available. 9 | 10 | This feature is available at http://dev.teracy.org/docs/0.4.2/django_training.html 11 | -------------------------------------------------------------------------------- /docs/docker-compose-mac.yml: -------------------------------------------------------------------------------- 1 | version: "2" 2 | 3 | services: 4 | dev: 5 | volumes: 6 | - teracy-dev-docs-sync:/opt/app:rw 7 | volumes: 8 | teracy-dev-docs-sync: 9 | external: true 10 | -------------------------------------------------------------------------------- /docs/docker-compose.prod.yml: -------------------------------------------------------------------------------- 1 | version: "2" 2 | 3 | services: 4 | prod: 5 | build: . 6 | image: teracy/dev-docs:develop 7 | ports: 8 | - "8080:80" 9 | -------------------------------------------------------------------------------- /docs/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "2" 2 | 3 | services: 4 | dev: 5 | build: 6 | context: . 7 | dockerfile: Dockerfile-dev 8 | image: teracy/dev-docs:dev_develop 9 | command: bash -c "make livehtml" 10 | ports: 11 | - "8000:8000" 12 | volumes: 13 | - .:/opt/app 14 | -------------------------------------------------------------------------------- /docs/docker-sync.yml: -------------------------------------------------------------------------------- 1 | options: 2 | compose-dev-file-path: 'docker-compose-mac.yml' 3 | 4 | syncs: 5 | teracy-dev-docs-sync: 6 | src: '.' 7 | dest: '/opt/app' 8 | sync_strategy: 'unison' 9 | sync_host_port: 10875 10 | -------------------------------------------------------------------------------- /docs/docker.rst: -------------------------------------------------------------------------------- 1 | Docker 2 | ====== 3 | 4 | We leverage Docker for our software development. 5 | 6 | When ``$ vagrant up``, it's expected that ``docker`` and ``docker-compose`` should be installed within 7 | the VM and ready to be used: 8 | 9 | .. code-block:: bash 10 | 11 | $ vagrant ssh 12 | vagrant@vagrant:~$ docker version 13 | Client: 14 | Version: 1.12.3 15 | API version: 1.24 16 | Go version: go1.6.3 17 | Git commit: 6b644ec 18 | Built: Wed Oct 26 22:01:48 2016 19 | OS/Arch: linux/amd64 20 | 21 | Server: 22 | Version: 1.12.3 23 | API version: 1.24 24 | Go version: go1.6.3 25 | Git commit: 6b644ec 26 | Built: Wed Oct 26 22:01:48 2016 27 | OS/Arch: linux/amd64 28 | 29 | 30 | docker-machine 31 | -------------- 32 | 33 | Sometimes, we want to control the Docker VM with `docker-machine` from our host machine. Then do this: 34 | 35 | .. code-block:: bash 36 | 37 | $ cd ~/teracy-dev 38 | $ docker-machine create -d generic \ 39 | --generic-ssh-user vagrant \ 40 | --generic-ssh-key .vagrant/machines/default/virtualbox/private_key \ 41 | --generic-ip-address teracy-dev 42 | 43 | And then you should see something like: 44 | 45 | .. code-block:: bash 46 | 47 | Running pre-create checks... 48 | Creating machine... 49 | (teracy-dev) Importing SSH key... 50 | Waiting for machine to be running, this may take a few minutes... 51 | Detecting operating system of created instance... 52 | Waiting for SSH to be available... 53 | Detecting the provisioner... 54 | Provisioning with ubuntu(upstart)... 55 | Installing Docker... 56 | Copying certs to the local machine directory... 57 | Copying certs to the remote machine... 58 | Setting Docker configuration on the remote daemon... 59 | Checking connection to Docker... 60 | Docker is up and running! 61 | To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env teracy-dev 62 | hoatle-mbp:teracy-dev hoatle$ docker-machine env teracy-dev 63 | export DOCKER_TLS_VERIFY="1" 64 | export DOCKER_HOST="tcp://192.168.99.101:2376" 65 | export DOCKER_CERT_PATH="/Users/hoatle/.docker/machine/machines/teracy-dev" 66 | export DOCKER_MACHINE_NAME="teracy-dev" 67 | # Run this command to configure your shell: 68 | # eval $(docker-machine env teracy-dev) 69 | 70 | 71 | Debugging 72 | --------- 73 | 74 | #. Node.js 75 | 76 | - node-inspector at: http://:8080/?port=5858 77 | - remote js debug with IntelliJ: http://stackoverflow.com/a/23947664/1122198 78 | 79 | .. code-block:: bash 80 | 81 | vagrant ssh -- -L 5858:127.0.0.1:5858 82 | 83 | 84 | Related Resources 85 | ----------------- 86 | - https://github.com/smerrill/vagrant-gatling-rsync 87 | - https://github.com/veggiemonk/awesome-docker 88 | - https://github.com/wsargent/docker-cheat-sheet 89 | - https://github.com/chef-cookbooks/docker 90 | - https://docs.docker.com/ 91 | -------------------------------------------------------------------------------- /docs/docs_guide.rst: -------------------------------------------------------------------------------- 1 | Document Guide 2 | ============== 3 | 4 | At present we use ``reStructureText`` for project docs and ``Markdown`` for blog, spec docs. 5 | To write docs more easily and style consistently, document writers must follow some guidelines 6 | below. 7 | 8 | It's expected that everyone should understand this guide to produce good documents. 9 | 10 | Style Guide 11 | ----------- 12 | 13 | .. todo:: 14 | Need to have docs style guide here 15 | 16 | 17 | reStructuredText Writing 18 | ------------------------ 19 | 20 | .. todo:: 21 | Need to have docs guide here 22 | 23 | 24 | Markdown Writing 25 | ---------------- 26 | 27 | .. todo:: 28 | find good live markdown libs, for example: 29 | 30 | - https://github.com/shime/livedown 31 | - https://github.com/mobily/markdown-live 32 | 33 | 34 | References 35 | ---------- 36 | - http://docutils.sourceforge.net/rst.html 37 | - http://sphinx-doc.org/ 38 | - http://daringfireball.net/projects/markdown/syntax 39 | - https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet 40 | 41 | 42 | .. _restview: https://mg.pov.lt/restview/ 43 | -------------------------------------------------------------------------------- /docs/firefox_addon_dev_guide.rst: -------------------------------------------------------------------------------- 1 | Firefox Add-ons Development Guide 2 | ================================= 3 | 4 | .. warning:: 5 | 6 | This page will be cleaned up by the next version of teracy-dev: v0.6.0 7 | 8 | We're leveraging Docker workflow since v0.5.0 and this feature is not available. 9 | 10 | This feature is available at http://dev.teracy.org/docs/0.4.2/firefox_addon_dev_guide.html 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/html_css_training.rst: -------------------------------------------------------------------------------- 1 | HTML/CSS Training 2 | ================= -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. teracy-dev documentation master file, created by 2 | sphinx-quickstart on Sun Jul 14 04:20:29 2013. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | teracy-dev's documentation 7 | ========================== 8 | 9 | Contents: 10 | 11 | .. toctree:: 12 | :maxdepth: 2 13 | 14 | intro 15 | getting_started 16 | basic_usage 17 | advanced_usage 18 | extending_teracy_dev 19 | docker 20 | tool_chain 21 | built_in_ide 22 | style_standards 23 | workflow 24 | teracy_dev_development 25 | git_training 26 | most_used_git_commands 27 | firefox_addon_dev_guide 28 | docs_guide 29 | databases_guide 30 | nodejs_dev_guide 31 | c_c++_training 32 | python_dev_guide 33 | django_training 34 | ruby_dev_guide 35 | php_dev_guide 36 | html_css_training 37 | js_training 38 | java_training 39 | objective_c_training 40 | ios_training 41 | android_training 42 | semantic_versioning 43 | release_process 44 | faqs 45 | 46 | Indices and tables 47 | ================== 48 | 49 | * :ref:`genindex` 50 | * :ref:`search` 51 | -------------------------------------------------------------------------------- /docs/ios_training.rst: -------------------------------------------------------------------------------- 1 | iOS Training 2 | ============ -------------------------------------------------------------------------------- /docs/java_training.rst: -------------------------------------------------------------------------------- 1 | Java Training 2 | ============= -------------------------------------------------------------------------------- /docs/js_training.rst: -------------------------------------------------------------------------------- 1 | JavaScript Training 2 | =================== -------------------------------------------------------------------------------- /docs/objective_c_training.rst: -------------------------------------------------------------------------------- 1 | Objective C Training 2 | ==================== -------------------------------------------------------------------------------- /docs/php_dev_guide.rst: -------------------------------------------------------------------------------- 1 | PHP Development Guide 2 | ===================== 3 | 4 | .. warning:: 5 | 6 | This page will be cleaned up by the next version of teracy-dev: v0.6.0 7 | 8 | We're leveraging Docker workflow since v0.5.0 and this feature is not available. 9 | 10 | This feature is available at http://dev.teracy.org/docs/0.4.2/php_dev_guide.html 11 | -------------------------------------------------------------------------------- /docs/python_dev_guide.rst: -------------------------------------------------------------------------------- 1 | Python Development Guide 2 | ======================== 3 | 4 | .. warning:: 5 | 6 | This page will be cleaned up by the next version of teracy-dev: v0.6.0 7 | 8 | We're leveraging Docker workflow since v0.5.0 and this feature is not available. 9 | 10 | This feature is available at http://dev.teracy.org/docs/0.4.2/python_dev_guide.html 11 | -------------------------------------------------------------------------------- /docs/release.rst: -------------------------------------------------------------------------------- 1 | Release Steps 2 | ============= 3 | 4 | vagrant_config.json 5 | ------------------- 6 | 7 | - set "vm_box_version" limit on the new release when neccessary 8 | 9 | 10 | README.rst 11 | ---------- 12 | 13 | - change `develop` to the tag version. For example, `develop/` to `v0.5.0` 14 | 15 | docs/conf.py 16 | ------------ 17 | 18 | - Update docs version on `docs/conf.py` 19 | 20 | docs/getting_started.rst 21 | ------------------------ 22 | 23 | - Change `develop` to the tag version. For example, `develop` to `v0.5.0` 24 | - Keep the tag version for both the git tag and the master branch 25 | 26 | 27 | CHANGELOG.md 28 | ------------ 29 | 30 | - create release notes from https://github.com/teracyhq/dev/milestones 31 | -------------------------------------------------------------------------------- /docs/release_process.rst: -------------------------------------------------------------------------------- 1 | Release Process 2 | =============== 3 | 4 | This is the general guide for releasing software packages at Teracy. 5 | 6 | Starting 7 | -------- 8 | 9 | - Follow workflow, a releasing branch should be branched off from an origin branch that is ready to be 10 | released. 11 | 12 | - The releasing branch should be named ``releases/vX.X.X``. 13 | 14 | - For example: the ``releases/v0.1.0`` branch is branched off from the ``develop`` branch. 15 | 16 | - Set the next iteration version for the ``develop`` branch. This will make sure there is no snapshot 17 | version conflict between the ``releases`` branch and the ``develop`` branch. Moreover, the 18 | ``develop`` branch will not be blocked. 19 | 20 | - Create an issue for DevOps team to create ci job if required. 21 | 22 | - Create an issue for Blog team to preparing release announcement post. 23 | 24 | Releasing 25 | --------- 26 | 27 | - Follow specific release process doccuments on each project, this should be done on your forked 28 | repository, then make pull requests when the release is ready. 29 | 30 | - Remember that release branch should not introduce big changes. 31 | 32 | - After each staging release, create an issue for release test campaign to make sure the release 33 | is stable enough and have good quality. 34 | 35 | Ending 36 | ------ 37 | 38 | - Make sure that the tag step must be ready at least **3 days** before the expected release date. 39 | Use **UTC** as standard reference time. 40 | 41 | - Tag the release: ``$ git tag -a v`` with the ``v Release`` message. For example, 42 | ``$ git tag -a v0.1.0`` with the ``v0.1.0 Release`` message. This message pattern could be later 43 | used for auto deployment, so make sure the message has the correct pattern. 44 | 45 | - Merge the tag release into the ``master`` branch, then the origin branch. This is specified on the 46 | project workflow. 47 | 48 | - Delete the released branch and we are done. 49 | 50 | .. note:: 51 | 52 | Automation is one of our development philosophy, and we are working on it so that releasing 53 | should be automated and really easy to do. 54 | 55 | See the releated issue: https://issues.teracy.org/browse/DEVOPS-21 56 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | # pip requirements for docs generation 2 | # pip install -r docs/requirements.txt 3 | 4 | Sphinx 5 | sphinx-autobuild 6 | -------------------------------------------------------------------------------- /docs/rsync_exclude: -------------------------------------------------------------------------------- 1 | .git 2 | -------------------------------------------------------------------------------- /docs/ruby_dev_guide.rst: -------------------------------------------------------------------------------- 1 | Ruby Development Guide 2 | ====================== 3 | 4 | .. warning:: 5 | 6 | This page will be cleaned up by the next version of teracy-dev: v0.6.0 7 | 8 | We're leveraging Docker workflow since v0.5.0 and this feature is not available. 9 | 10 | This feature is available at http://dev.teracy.org/docs/0.4.2/ruby_dev_guide.html 11 | -------------------------------------------------------------------------------- /environment.sh: -------------------------------------------------------------------------------- 1 | # change to a node accordingly 2 | export OPSCODE_USER="hoatle" 3 | export OPSCODE_ORGNAME="teracy" 4 | export KNIFE_CLIENT_KEY_FOLDER="$HOME/.chef" 5 | export KNIFE_VALIDATION_KEY_FOLDER="$HOME/.chef" 6 | export KNIFE_CHEF_SERVER="https://api.opscode.com/organizations/$OPSCODE_ORGNAME" 7 | export KNIFE_CACHE_PATH="$HOME/.chef/checksums" 8 | export KNIFE_COOKBOOK_COPYRIGHT="Teracy, Inc." 9 | export KNIFE_COOKBOOK_LICENSE="BSD" 10 | export KNIFE_COOKBOOK_EMAIL="devops@teracy.com" 11 | -------------------------------------------------------------------------------- /environments/README.md: -------------------------------------------------------------------------------- 1 | Requires Chef 0.10.0+. 2 | 3 | This directory is for Ruby DSL and JSON files for environments. For more information see the Chef wiki page: 4 | 5 | http://wiki.opscode.com/display/chef/Environments 6 | -------------------------------------------------------------------------------- /home/.docker/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/home/.docker/.gitkeep -------------------------------------------------------------------------------- /home/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/home/.gitkeep -------------------------------------------------------------------------------- /main-cookbooks/README.md: -------------------------------------------------------------------------------- 1 | store all chef cookbooks and extended-chef cookbooks. -------------------------------------------------------------------------------- /main-cookbooks/teracy-dev/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/main-cookbooks/teracy-dev/.gitkeep -------------------------------------------------------------------------------- /main-cookbooks/teracy-dev/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # CHANGELOG for teracy-dev 2 | 3 | This file is used to list changes made in each version of teracy-dev. 4 | 5 | ## 0.1.0: 6 | 7 | * Initial release of teracy-dev 8 | 9 | - - - 10 | Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown. 11 | 12 | The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown. 13 | -------------------------------------------------------------------------------- /main-cookbooks/teracy-dev/README.md: -------------------------------------------------------------------------------- 1 | teracy-dev Cookbook 2 | =================== 3 | TODO: Enter the cookbook description here. 4 | 5 | e.g. 6 | This cookbook makes your favorite breakfast sandwhich. 7 | 8 | Requirements 9 | ------------ 10 | TODO: List your cookbook requirements. Be sure to include any requirements this cookbook has on platforms, libraries, other cookbooks, packages, operating systems, etc. 11 | 12 | e.g. 13 | #### packages 14 | - `toaster` - teracy-dev needs toaster to brown your bagel. 15 | 16 | Attributes 17 | ---------- 18 | TODO: List you cookbook attributes here. 19 | 20 | e.g. 21 | #### teracy-dev::default 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |
KeyTypeDescriptionDefault
['teracy-dev']['bacon']Booleanwhether to include bacontrue
36 | 37 | Usage 38 | ----- 39 | #### teracy-dev::default 40 | TODO: Write usage instructions for each cookbook. 41 | 42 | e.g. 43 | Just include `teracy-dev` in your node's `run_list`: 44 | 45 | ```json 46 | { 47 | "name":"my_node", 48 | "run_list": [ 49 | "recipe[teracy-dev]" 50 | ] 51 | } 52 | ``` 53 | 54 | Contributing 55 | ------------ 56 | TODO: (optional) If this is a public cookbook, detail the process for contributing. If this is a private cookbook, remove this section. 57 | 58 | e.g. 59 | 1. Fork the repository on Github 60 | 2. Create a named feature branch (like `add_component_x`) 61 | 3. Write you change 62 | 4. Write tests for your change (if applicable) 63 | 5. Run the tests, ensuring they all pass 64 | 6. Submit a Pull Request using Github 65 | 66 | License and Authors 67 | ------------------- 68 | Authors: TODO: List authors 69 | -------------------------------------------------------------------------------- /main-cookbooks/teracy-dev/attributes/default.rb: -------------------------------------------------------------------------------- 1 | default['docker_machine']['version'] = 'v0.8.2' 2 | default['docker_machine']['command_path'] = '/usr/local/bin/docker-machine' -------------------------------------------------------------------------------- /main-cookbooks/teracy-dev/definitions/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/main-cookbooks/teracy-dev/definitions/.gitkeep -------------------------------------------------------------------------------- /main-cookbooks/teracy-dev/files/default/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/main-cookbooks/teracy-dev/files/default/.gitkeep -------------------------------------------------------------------------------- /main-cookbooks/teracy-dev/files/default/nginx/certs/README.md: -------------------------------------------------------------------------------- 1 | #Nginx Certs 2 | 3 | This is self signed certificate for development purpose. 4 | 5 | ## How to create 6 | 7 | ```bash 8 | $ openssl genrsa -des3 -passout pass:x -out default.pass.key 2048 9 | $ openssl rsa -passin pass:x -in default.pass.key -out default.key 10 | $ openssl req -new -key default.key -out default.csr 11 | $ openssl x509 -req -sha256 -days 365 -in default.csr -signkey default.key -out default.crt 12 | ``` 13 | 14 | The default certificate is used along with https://github.com/jwilder/nginx-proxy to provide 15 | reverse proxy system for Docker applications. 16 | 17 | ## References 18 | 19 | - https://devcenter.heroku.com/articles/ssl-certificate-self 20 | - https://github.com/jwilder/nginx-proxy 21 | -------------------------------------------------------------------------------- /main-cookbooks/teracy-dev/files/default/nginx/certs/default.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDnDCCAoQCCQCrpk8p/6UAgDANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMC 3 | Vk4xDjAMBgNVBAgMBUhhbm9pMQ4wDAYDVQQHDAVIYW5vaTEbMBkGA1UECgwSVGVy 4 | YWN5IENvcnBvcmF0aW9uMRQwEgYDVQQLDAtDb3Jwb3JhdGlvbjEPMA0GA1UEAwwG 5 | VGVyYWN5MRwwGgYJKoZIhvcNAQkBFg1ocUB0ZXJhY3kuY29tMB4XDTE3MDIxMTEy 6 | Mjk0MFoXDTE4MDIxMTEyMjk0MFowgY8xCzAJBgNVBAYTAlZOMQ4wDAYDVQQIDAVI 7 | YW5vaTEOMAwGA1UEBwwFSGFub2kxGzAZBgNVBAoMElRlcmFjeSBDb3Jwb3JhdGlv 8 | bjEUMBIGA1UECwwLQ29ycG9yYXRpb24xDzANBgNVBAMMBlRlcmFjeTEcMBoGCSqG 9 | SIb3DQEJARYNaHFAdGVyYWN5LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC 10 | AQoCggEBALebUzxN0qthDnEG2dKZVKJnrg3j050JCvb2hzgWjoYFrFbnbXuIwr4q 11 | Hqf+S5QI8VCStlTgV1NwaE5gU+qozYwkUtcggd9nUkze2sX5xgpbz3+3WaMtnhNc 12 | QhCv+Esdp62hH9VeQw1rxBExOk66NXZpY+zSHCJDkOpkvHdzrmuMZAucMqgiJDfZ 13 | 3OEl5dN7kScdgTSYbtEUX6+cSPckEICWYJ+QB6d3FsIygWtKLYQvFMWXEtK7egCU 14 | ar416Q/cUcuJHlx8WyHfALOEFCFhoeJt63FEY3QJLXJkZjyhp5HE+zWjCmevVfBX 15 | sX4FccmSl5VXrFynPxsVcA1Cz7q0KRECAwEAATANBgkqhkiG9w0BAQsFAAOCAQEA 16 | It9+GbE41hdmnBG7OO+n4BjVPcb1dVD8tfzeMuyNnu4lwScr7A2bh6UVMPne9XG8 17 | NeXmFiudfvgpcQbWAvIn5iA/nz73d9eHrCY4OjJwm3F9mPLjheSvhhmblFMMVTaG 18 | gMfChpoFappMqJQiEEDqpBb/OM0o8Py1fccgGJczyR03ntAEjEyQbA3KVQdu1kFr 19 | YaMN1w8qTnDR6EiqVxn7YS8riygp747NRD+UtC2OtDhbuzFdPSXZXe5VFWTyngJL 20 | iEaDZEAsBiHi6yW0rrytgHKlhtwXC1uPgpuN6tffTjofQYBpKl8tWQkxi5GGlM7e 21 | I7PE5pYnfXv6GcytH9uGAQ== 22 | -----END CERTIFICATE----- 23 | -------------------------------------------------------------------------------- /main-cookbooks/teracy-dev/files/default/nginx/certs/default.csr: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE REQUEST----- 2 | MIIC1TCCAb0CAQAwgY8xCzAJBgNVBAYTAlZOMQ4wDAYDVQQIDAVIYW5vaTEOMAwG 3 | A1UEBwwFSGFub2kxGzAZBgNVBAoMElRlcmFjeSBDb3Jwb3JhdGlvbjEUMBIGA1UE 4 | CwwLQ29ycG9yYXRpb24xDzANBgNVBAMMBlRlcmFjeTEcMBoGCSqGSIb3DQEJARYN 5 | aHFAdGVyYWN5LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALeb 6 | UzxN0qthDnEG2dKZVKJnrg3j050JCvb2hzgWjoYFrFbnbXuIwr4qHqf+S5QI8VCS 7 | tlTgV1NwaE5gU+qozYwkUtcggd9nUkze2sX5xgpbz3+3WaMtnhNcQhCv+Esdp62h 8 | H9VeQw1rxBExOk66NXZpY+zSHCJDkOpkvHdzrmuMZAucMqgiJDfZ3OEl5dN7kScd 9 | gTSYbtEUX6+cSPckEICWYJ+QB6d3FsIygWtKLYQvFMWXEtK7egCUar416Q/cUcuJ 10 | Hlx8WyHfALOEFCFhoeJt63FEY3QJLXJkZjyhp5HE+zWjCmevVfBXsX4FccmSl5VX 11 | rFynPxsVcA1Cz7q0KRECAwEAAaAAMA0GCSqGSIb3DQEBCwUAA4IBAQApWQk8ie8D 12 | z+4OV3IPHi1ypAas5IJ7UdVqDECxVJGycjfX6ncy7Ancx7ay4L/VgCQ//jC3famy 13 | 3MSrJxn5TS3UnpDGmfPA2by+HMgPqXmHkTeQBW5J300YIFwO2tB3l4asLpSpluZE 14 | BesBK0N6InNJQWZQf8tryUn4OEonzDtyWf86/I8gkM4IbwSlrBIJWJOHCadWvT8Q 15 | PWIsE7bynGV9H9rXUeJDwaqMczvzJOVldi/eyi9ZpswpXjA2vXu3DsZHsfYgf587 16 | TydcK78tDKv+nev0824bhhEPoDeX7UyhRHArrEr8t14USmCMpyBrpayeflpqIJ3S 17 | 3B1BVWjSjWPf 18 | -----END CERTIFICATE REQUEST----- 19 | -------------------------------------------------------------------------------- /main-cookbooks/teracy-dev/files/default/nginx/certs/default.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEpAIBAAKCAQEAt5tTPE3Sq2EOcQbZ0plUomeuDePTnQkK9vaHOBaOhgWsVudt 3 | e4jCvioep/5LlAjxUJK2VOBXU3BoTmBT6qjNjCRS1yCB32dSTN7axfnGClvPf7dZ 4 | oy2eE1xCEK/4Sx2nraEf1V5DDWvEETE6Tro1dmlj7NIcIkOQ6mS8d3Oua4xkC5wy 5 | qCIkN9nc4SXl03uRJx2BNJhu0RRfr5xI9yQQgJZgn5AHp3cWwjKBa0othC8UxZcS 6 | 0rt6AJRqvjXpD9xRy4keXHxbId8As4QUIWGh4m3rcURjdAktcmRmPKGnkcT7NaMK 7 | Z69V8FexfgVxyZKXlVesXKc/GxVwDULPurQpEQIDAQABAoIBAQCUULhwIj1ni0Nr 8 | MimK4alod3A2cC9kzwU4cfTQ7ge7Y6HPoari+5q0mrmg4t6SepbUi28WKRLhqA/a 9 | IB4plKpV5pG0jeHbYU8uIWeAPUAo5fk8JhQWqKbk5MXJTRy5MP9eVqWsajSoBsGf 10 | UbDUH79II+JAT4nCc+oALdfAdoYTATsKv4pqnb24XI4/ix2vrb7mcBLMw19ifaE5 11 | /JX3vUoH2LL/AhZ9clc1ZmLuhdf49guo0uRshLR2yzV9EO4QCviG/HBlZES+sX6M 12 | c9Y3i7vfo7emLhDxhqyGyXYn0o3UPoPEwNLLaiBNbJwanSxWG2LkLoZQNGzeCy2K 13 | ralFXEtxAoGBAN0OZzoehG9t89aHKZNBDQdSlAJW6ocL5+L74vvk46hPy6ughgGA 14 | 74UU1StnQ7EnqtUIP7c4KcAQIJiNdazf+oVhqM41q8APSlnrOaa9m4GXBw1qSR8o 15 | Rupx4w0T9ABPxHwFIqvhha6P7Vnuc8SNlF1boreHUk0kvML7xrML8/LjAoGBANSh 16 | btGv5PaBPI0cfR6LzM1Q23a3+FDZjlfMUaTds4GtwGI2C17qi0Kk9lDACDvg9x86 17 | 5sIadRgt2PtUt3A7wN/h1a14l6aRL9Tix1RJNQBEIYb+2WvfewNHvBFpKc5MDvcP 18 | NbpmiHQZ9w1sl2NKdnTf2ngUUU22Pp+dvgNAc5J7AoGBAIQrxXrRnlvFwUKmxCwA 19 | fBrBvC996nJeowJrmvcDjz8mnt96dkVV42CN6TsvXiEBV7pSWU5ibUwiGGs+QXrg 20 | 3Lh9gOHy40NNoSYMaAcTXXRpadUSlK/ldClfeONr57t79j41D9r3V+fctIzN7zg5 21 | ctkzHiJf7cykR5zJz69kWTMDAoGAAn3hzpNBG6JoEz9COBlrTPyllb6SKmBiSqUa 22 | T9RJRjvDBWOcvoABIcbNHCUj84+vVa5bBetJc/8Vi9xySd5pZDZBSsce/9Szusrt 23 | iw9Qj7A8tFhIM/tqdZ9hlNKmqsQ5aKvE9Wo+Lx4exwl+vKsiuDvnU4Dpcv+vvC8d 24 | Cuy2bgECgYAisSjQTSppkp6OUfGmFMkzWJ7nibYDXLhMEY5Kua5OcAmFANdovQig 25 | rb54ECXYWv6XpzMCNEIAAJ9z7JflxobGKE1K6NfnHuwhKCeWI4Q3d5b4eC8krXi0 26 | 9iRgKhaBo0a4XM3h94EwQI/cczHqZF1jgIH3Vjl3s7a8Xr7Q6maZeQ== 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /main-cookbooks/teracy-dev/files/default/nginx/certs/default.pass.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | Proc-Type: 4,ENCRYPTED 3 | DEK-Info: DES-EDE3-CBC,6298455821AB1F4D 4 | 5 | H/8JyMjZOrxVrcC6mDB4d4qjEgS5dljed0HZroQPtR4I6vKDDKUG4O0dkHHRuG7H 6 | fvFZgy5TD/GtFpT4rfQo8EVX1h3cYpFUE37iWaprbd6B9oT2jiZCRg7wswvt8OQu 7 | fnGrMz2qkuPmdUnXD3dVJ406t8fQieB0ImceV3WiDpqUvGxiFPNWns4EXtHCRs7n 8 | SPBiRFtXZ4i+KHrtNi1dQSLuyHd44lFoysebf3x+uZ7BG9gPj7zWylbqICVOLd// 9 | z4wr69rn/vaEx9gSQEpMLHIPEMjIu14bHeuVRViv/lmYkAn+z8nSUvNU79i8pPKZ 10 | jxnSJRmDm8whMM5o6DJScLl7aB0lJSyyp8NT0LN9gHFxNEA8gYWSB19i9sH9yODb 11 | eslGISYJXfl3q1cCsVXMTHUvfxSOW0O9/6KlQnJmE3QntxnfB7yN+Muqisp4IjCs 12 | e3ym4rX63Q9bnTtu9EohATkGkcO0iYCMt0Y/7IpsZtVmZoi6jieetMwuqp+d5ick 13 | 3DjaeD8i7AjVVn7aVjulHS/elU1FnhwNrsl36dO0r9CCtGN956HgKIGoi97dDZSL 14 | tnIPSLikJV1Dd4Cnr6ywqm1rP5DUDOD+6eeF9l43CBeNXE3Dnpm1+0giWWn7bf4T 15 | uApFcoRmQAIFcmZYC26owzUL0muHIomrhvz0g2R5tqSr2oUK2zz2z2w8uu/XjqUk 16 | NrlmRwDmRp/ZibwXgDeQsKJx0DsjDsuU/miuKyLzGppBZTbazf8ONB6zcrHkYRuK 17 | WV8aCsGMZIUFAySyBb56KtPD+50+nDgHvQx/ESqdfVw8LOMlvdMrG15DTYNRxCed 18 | nAHDj99JrQ0VutWVAgfFZVX9o9UWBj8eGzz9+QnMbMeQ7EftkgUh8NtuAmDFR7fL 19 | wGMyeY/W2+y7nkiotPI5ZGjO4iSvLmNJIHdpSx1ClL9etyemAOYA7vSFZ1uMg2Mn 20 | O3fc+Ovg8ViTI7/Sb/j/lJvP0nDwFWhj6+ACIBbpyPjkt8ub2+qD6DDCJignNmGx 21 | DALKD6JIbwKlOCIWAMUiVMFTM5pZsP3g1s2GKHVo9sg9gtqzgH/+S5J8ECGNQ5lO 22 | ujKGNScv5BUEhuYntrrMdI7TgrfYWkxtCA2CYu6bpXVABIakr0JonWTeMwl69xw8 23 | Et7GHH9KsmvNOMSKO9PUspQb77kLIh1JKJP1QC0UXy+s2awZrwSjr3alJ0UyQmCz 24 | HFt2c/onCq+6cpGFunxraJnvBM864oEoLgo9oJZ0EwEMYR9UfTl4Rc7MmSmoMZzF 25 | y63smQKSnme6Bnw7vINNYYmDFS7U87jkIN8M/wqMUS+19yuxeSHdN/M/HKsti+7B 26 | zxzQr6trsS/X2dO1ieJ/siI6nwDd4F6DKEAA72GdzQVxfyd2Kw+v/DgAnvjELdi5 27 | lyKpDlob4480yqhbIoKBgJpjQPabah/QCAwoholf5JKHknlEw/z4ghOvaFxVMwvY 28 | QpnrBC+216osCFPZNB2NG1HO3a+D3ze8b75WK1z0mHQPQOl084QjtRxojew4kj0I 29 | cWPj3O3qh4y11akXyoEBlDW2Zyyip6trqtoNVho1UtGdabAQ0g1y166AO2mAkM2s 30 | -----END RSA PRIVATE KEY----- 31 | -------------------------------------------------------------------------------- /main-cookbooks/teracy-dev/libraries/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/main-cookbooks/teracy-dev/libraries/.gitkeep -------------------------------------------------------------------------------- /main-cookbooks/teracy-dev/libraries/helpers.rb: -------------------------------------------------------------------------------- 1 | module TeracyDev 2 | module Helpers 3 | def db_empty?(host, username, pwd, db_name) 4 | ::Mysql.new(host, username, pwd).select_db(db_name).list_tables().empty? 5 | end 6 | 7 | def db_tbl_exists?(host, username, pwd, db_name, tbl) 8 | querySt = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '#{tbl}'" 9 | ::Mysql.new(host, username, pwd).select_db(db_name).query(querySt).num_rows > 0 10 | end 11 | 12 | 13 | def db_tbl_empty?(host, username, pwd, db_name, tbl) 14 | m = ::Mysql.new(host, username, pwd, db_name) 15 | m.select_db(db_name).query('SELECT COUNT(*) FROM ' + tbl).fetch_row()[0].to_i < 1 16 | end 17 | 18 | def db_column_exists?(host, username, pwd, db_name, tbl, colum) 19 | querySt = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '#{tbl}' and COLUMN_NAME = '#{colum}'" 20 | ::Mysql.new(host, username, pwd).select_db(db_name).query(querySt).num_rows > 0 21 | end 22 | 23 | # Determines if php is installed on a system. 24 | # 25 | # @return [Boolean] 26 | def php_installed? 27 | !which('php').nil? 28 | end 29 | 30 | # Determines if mysql is installed on a system. 31 | # 32 | # @return [Boolean] 33 | def mysql_installed? 34 | !which('mysql').nil? 35 | end 36 | 37 | # Determines if ruby is installed on a system. 38 | # 39 | # @return [Boolean] 40 | def ruby_installed? 41 | !which('ruby').nil? 42 | end 43 | 44 | # Determines if rbenv is installed on a system. 45 | # 46 | # @return [Boolean] 47 | def rbenv_installed? 48 | !which('rbenv').nil? 49 | end 50 | 51 | # Determines if ruby-build is installed on a system. 52 | # 53 | # @return [Boolean] 54 | def ruby_build_installed? 55 | !which('ruby-build').nil? 56 | end 57 | 58 | # Finds a command in $PATH 59 | # 60 | # @return [String, nil] 61 | def which(cmd) 62 | paths = (ENV['PATH'].split(::File::PATH_SEPARATOR) + %w(/bin /usr/bin /sbin /usr/sbin)) 63 | 64 | paths.each do |path| 65 | possible = File.join(path, cmd) 66 | return possible if File.executable?(possible) 67 | end 68 | 69 | nil 70 | end 71 | end 72 | end 73 | 74 | Chef::Recipe.send(:include, ::TeracyDev::Helpers) 75 | Chef::Resource.send(:include, ::TeracyDev::Helpers) 76 | Chef::Provider.send(:include, ::TeracyDev::Helpers) 77 | -------------------------------------------------------------------------------- /main-cookbooks/teracy-dev/metadata.rb: -------------------------------------------------------------------------------- 1 | name 'teracy-dev' 2 | maintainer 'Teracy, Inc.' 3 | maintainer_email 'hoatlevan@gmail.com' 4 | license 'All rights reserved' 5 | description 'Installs/Configures teracy-dev' 6 | long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) 7 | version '0.3.0' 8 | issues_url 'https://github.com/teracyhq/issues' 9 | source_url 'https://github.com/teracyhq/issues' 10 | 11 | %w{ magic_shell docker docker_compose }.each do |dep| 12 | depends dep 13 | end 14 | 15 | recipe 'teracy::aliases', "Installs useful aliases for teracy's project development." 16 | recipe 'teracy-dev::directories', 'Manage directories.' 17 | recipe 'teracy-dev::env_vars', 'Configures environment variables.' 18 | recipe 'teracy-dev::docker', 'Installs Docker, docker-compose' 19 | recipe 'teracy-dev::docker_registry', "Docker registry's tasks: login, ..." 20 | recipe 'teracy-dev::docker_machine', 'Installs docker-machine' 21 | recipe 'teracy-dev::inotify', 'Modify inotify, useful for development watching a lot of files' 22 | recipe 'teracy-dev::proxy', 'Create a reverse proxy with nginx' 23 | -------------------------------------------------------------------------------- /main-cookbooks/teracy-dev/providers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/main-cookbooks/teracy-dev/providers/.gitkeep -------------------------------------------------------------------------------- /main-cookbooks/teracy-dev/recipes/aliases.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Hoat Le 3 | # Cookbook Name:: teracy-dev 4 | # Recipe:: aliases 5 | # 6 | # Copyright 2013 - current, Teracy, Inc. 7 | # 8 | # Redistribution and use in source and binary forms, with or without modification, 9 | # are permitted provided that the following conditions are met: 10 | 11 | # 1. Redistributions of source code must retain the above copyright notice, 12 | # this list of conditions and the following disclaimer. 13 | 14 | # 2. Redistributions in binary form must reproduce the above copyright 15 | # notice, this list of conditions and the following disclaimer in the 16 | # documentation and/or other materials provided with the distribution. 17 | 18 | # 3. Neither the name of Teracy, Inc. nor the names of its contributors may be used 19 | # to endorse or promote products derived from this software without 20 | # specific prior written permission. 21 | 22 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 23 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 26 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 29 | # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | node['teracy-dev']['aliases'].each do |ali| 34 | act = :create 35 | act = ali['action'].to_sym unless ali['action'].nil? or ali['action'].strip().empty? 36 | magic_shell_alias ali['name'] do 37 | command ali['command'] 38 | action act 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /main-cookbooks/teracy-dev/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Hoat Le 3 | # Cookbook Name:: teracy-dev 4 | # Recipe:: github 5 | # 6 | # Copyright 2013 - current, Teracy, Inc. 7 | # 8 | # Redistribution and use in source and binary forms, with or without modification, 9 | # are permitted provided that the following conditions are met: 10 | 11 | # 1. Redistributions of source code must retain the above copyright notice, 12 | # this list of conditions and the following disclaimer. 13 | 14 | # 2. Redistributions in binary form must reproduce the above copyright 15 | # notice, this list of conditions and the following disclaimer in the 16 | # documentation and/or other materials provided with the distribution. 17 | 18 | # 3. Neither the name of Teracy, Inc. nor the names of its contributors may be used 19 | # to endorse or promote products derived from this software without 20 | # specific prior written permission. 21 | 22 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 23 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 26 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 29 | # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | include_recipe 'teracy-dev::directories' 35 | include_recipe 'teracy-dev::aliases' 36 | include_recipe 'teracy-dev::env_vars' 37 | include_recipe 'teracy-dev::docker' 38 | include_recipe 'teracy-dev::docker_registry' 39 | include_recipe 'teracy-dev::docker_machine' 40 | include_recipe 'teracy-dev::inotify' 41 | include_recipe 'teracy-dev::proxy' 42 | -------------------------------------------------------------------------------- /main-cookbooks/teracy-dev/recipes/directories.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Hoat Le 3 | # Cookbook Name:: teracy-dev 4 | # Recipe:: directories 5 | # 6 | # Copyright 2013 - current, Teracy, Inc. 7 | # 8 | # Redistribution and use in source and binary forms, with or without modification, 9 | # are permitted provided that the following conditions are met: 10 | 11 | # 1. Redistributions of source code must retain the above copyright notice, 12 | # this list of conditions and the following disclaimer. 13 | 14 | # 2. Redistributions in binary form must reproduce the above copyright 15 | # notice, this list of conditions and the following disclaimer in the 16 | # documentation and/or other materials provided with the distribution. 17 | 18 | # 3. Neither the name of Teracy, Inc. nor the names of its contributors may be used 19 | # to endorse or promote products derived from this software without 20 | # specific prior written permission. 21 | 22 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 23 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 26 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 29 | # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | node['teracy-dev']['directories'].each do |dir| 35 | mode = 0775 36 | act = :create 37 | mod = dir['mode'] unless dir['mode'].nil? or dir['mode'].strip().empty? 38 | act = dir['action'].to_sym unless dir['action'].nil? or dir['action'].strip().empty? 39 | directory dir['path'] do 40 | owner dir['owner'] 41 | group dir['group'] 42 | mode mod 43 | action act 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /main-cookbooks/teracy-dev/recipes/docker_registry.rb: -------------------------------------------------------------------------------- 1 | # Author:: Hoat Le 2 | # Cookbook:: teracy-dev 3 | # Recipe:: docker_registry 4 | # Login into the Docker registries 5 | 6 | docker_conf = node['docker'] 7 | 8 | docker_registry_conf = node['docker_registry'] 9 | 10 | if docker_conf['enabled'] == true 11 | execute 'rm ~/.docker/config.json' do 12 | command 'rm /home/vagrant/.docker/config.json || true' 13 | only_if { 14 | docker_registry_conf['force'] == true and 15 | File.exist?('/home/vagrant/.docker/config.json') 16 | } 17 | end 18 | 19 | docker_registry_conf['entries'].each.with_index do |entry, index| 20 | # private registry login 21 | 22 | username = entry['username'] ? entry['username'] : '' 23 | 24 | password = entry['password'] ? entry['password'] : '' 25 | 26 | if not username.empty? and not password.empty? 27 | opt = [ 28 | "-u #{username}", 29 | "-p #{password}" 30 | ].join(' '); 31 | 32 | execute 'docker login' do 33 | command "docker login #{entry['host']} #{opt}" 34 | # because we need root to execute docker-compose, not 'vagrant' 35 | only_if { 36 | docker_registry_conf['force'] == true or 37 | not File.exist?('/root/.docker/config.json') 38 | } 39 | end 40 | end 41 | end 42 | 43 | execute 'copy /root/.docker/config.json to ~/.docker/config.json' do 44 | command 'cp /root/.docker/config.json /home/vagrant/.docker/config.json' 45 | only_if { 46 | File.exist?('/root/.docker/config.json') and ( 47 | docker_registry_conf['force'] == true or 48 | not File.exist?('/home/vagrant/.docker/config.json') 49 | ) 50 | } 51 | end 52 | end 53 | -------------------------------------------------------------------------------- /main-cookbooks/teracy-dev/recipes/env_vars.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Hoat Le 3 | # Cookbook Name:: teracy-dev 4 | # Recipe:: env_vars 5 | # Description: Configures environment 6 | # 7 | # Copyright 2013 - current, Teracy, Inc. 8 | # 9 | # Redistribution and use in source and binary forms, with or without modification, 10 | # are permitted provided that the following conditions are met: 11 | 12 | # 1. Redistributions of source code must retain the above copyright notice, 13 | # this list of conditions and the following disclaimer. 14 | 15 | # 2. Redistributions in binary form must reproduce the above copyright 16 | # notice, this list of conditions and the following disclaimer in the 17 | # documentation and/or other materials provided with the distribution. 18 | 19 | # 3. Neither the name of Teracy, Inc. nor the names of its contributors may be used 20 | # to endorse or promote products derived from this software without 21 | # specific prior written permission. 22 | 23 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 24 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 27 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 30 | # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | # 34 | node['teracy-dev']['env_vars'].each do |env| 35 | act = :add 36 | act = env['action'].to_sym unless env['action'].nil? or env['action'].strip().empty? 37 | magic_shell_environment env['key'] do 38 | value env['value'] 39 | action act 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /main-cookbooks/teracy-dev/recipes/inotify.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Hoat Le 3 | # Cookbook Name:: teracy-dev 4 | # Recipe:: inotify 5 | # Description: Configures inotify watchers 6 | # 7 | # Copyright 2013 - current, Teracy, Inc. 8 | # 9 | # Redistribution and use in source and binary forms, with or without modification, 10 | # are permitted provided that the following conditions are met: 11 | 12 | # 1. Redistributions of source code must retain the above copyright notice, 13 | # this list of conditions and the following disclaimer. 14 | 15 | # 2. Redistributions in binary form must reproduce the above copyright 16 | # notice, this list of conditions and the following disclaimer in the 17 | # documentation and/or other materials provided with the distribution. 18 | 19 | # 3. Neither the name of Teracy, Inc. nor the names of its contributors may be used 20 | # to endorse or promote products derived from this software without 21 | # specific prior written permission. 22 | 23 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 24 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 27 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 30 | # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | # 34 | 35 | # see https://github.com/teracyhq/dev/issues/208 36 | if node['platform'] == 'ubuntu' 37 | max_user_watches = node['teracy-dev']['inotify']['max_user_watches'] 38 | 39 | # should remove the existing line 40 | execute 'remove existing fs.inotify.max_user_watches line' do 41 | command "sudo sed -i '/fs.inotify.max_user_watches/d' /etc/sysctl.conf" 42 | end 43 | 44 | execute 'add new fs.inotify.max_user_watches config' do 45 | command "echo fs.inotify.max_user_watches=#{max_user_watches} | sudo tee -a /etc/sysctl.conf" 46 | not_if { max_user_watches < 1 } 47 | end 48 | 49 | # this must run after settings 50 | execute 'sudo sysctl -p' do 51 | command 'sudo sysctl -p' 52 | end 53 | 54 | end 55 | -------------------------------------------------------------------------------- /main-cookbooks/teracy-dev/resources/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/main-cookbooks/teracy-dev/resources/.gitkeep -------------------------------------------------------------------------------- /main-cookbooks/teracy-dev/templates/default/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/main-cookbooks/teracy-dev/templates/default/.gitkeep -------------------------------------------------------------------------------- /nodes/README.md: -------------------------------------------------------------------------------- 1 | Chef Nodes 2 | ========== -------------------------------------------------------------------------------- /provisioners/shells/ip.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | ipaddress=`hostname -I | cut -d' ' -f2` 4 | echo "ip address: $ipaddress" 5 | -------------------------------------------------------------------------------- /resources/README.md: -------------------------------------------------------------------------------- 1 | teracy-dev's resources 2 | ====================== 3 | 4 | Contain all common and useful resources for Teraciers. 5 | 6 | project-template 7 | ---------------- 8 | 9 | `project-template` includes common resources needed for creating a new project. 10 | 11 | ``` bash 12 | $ mkdir 13 | $ cd 14 | $ git init 15 | $ cp -r /vagrant/resources/project-template/. . 16 | ``` 17 | -------------------------------------------------------------------------------- /resources/project-template/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled source # 2 | ################### 3 | *.com 4 | *.class 5 | *.dll 6 | *.exe 7 | *.o 8 | *.so 9 | 10 | # Logs and databases # 11 | ###################### 12 | *.log 13 | *.sql 14 | *.sqlite 15 | 16 | ## https://github.com/github/gitignore/blob/master/Global/Archives.gitignore 17 | 18 | # It's better to unpack these files and commit the raw source because 19 | # git has its own built in compression methods. 20 | *.7z 21 | *.jar 22 | *.rar 23 | *.zip 24 | *.gz 25 | *.bzip 26 | *.bz2 27 | *.xz 28 | *.lzma 29 | 30 | #packing-only formats 31 | *.iso 32 | *.tar 33 | 34 | #package management formats 35 | *.dmg 36 | *.xpi 37 | *.gem 38 | *.egg 39 | *.deb 40 | *.rpm 41 | 42 | ## https://github.com/github/gitignore/blob/master/Global/Eclipse.gitignore 43 | 44 | *.pydevproject 45 | .project 46 | .metadata 47 | bin/** 48 | tmp/** 49 | tmp/**/* 50 | *.tmp 51 | *.bak 52 | *.swp 53 | *~.nib 54 | local.properties 55 | .classpath 56 | .settings/ 57 | .loadpath 58 | 59 | # External tool builders 60 | .externalToolBuilders/ 61 | 62 | # Locally stored "Eclipse launch configurations" 63 | *.launch 64 | 65 | # CDT-specific 66 | .cproject 67 | 68 | # PDT-specific 69 | .buildpath 70 | 71 | ## https://github.com/github/gitignore/blob/master/Global/IntelliJ.gitignore 72 | 73 | *.iml 74 | *.ipr 75 | *.iws 76 | .idea/ 77 | 78 | ## https://github.com/github/gitignore/blob/master/Global/Linux.gitignore 79 | 80 | .* 81 | !.gitignore 82 | *~ 83 | 84 | ## https://github.com/github/gitignore/blob/master/Global/OSX.gitignore 85 | 86 | .DS_Store 87 | .AppleDouble 88 | .LSOverride 89 | Icon 90 | 91 | 92 | # Thumbnails 93 | ._* 94 | 95 | # Files that might appear on external disk 96 | .Spotlight-V100 97 | .Trashes 98 | 99 | ## https://github.com/github/gitignore/blob/master/Global/SASS.gitignore 100 | 101 | ### SASS Ignores - "Sassy CSS" http://sass-lang.com/ 102 | *.sass-cache 103 | 104 | ## https://github.com/github/gitignore/blob/master/Global/SublimeText.gitignore 105 | 106 | # SublimeText project files 107 | *.sublime-workspace 108 | 109 | ## https://github.com/github/gitignore/blob/master/Global/Windows.gitignore 110 | 111 | # Windows image file caches 112 | Thumbs.db 113 | ehthumbs.db 114 | 115 | # Folder config file 116 | Desktop.ini 117 | 118 | # Recycle Bin used on file shares 119 | $RECYCLE.BIN/ 120 | 121 | ## https://github.com/github/gitignore/blob/master/Global/vim.gitignore 122 | 123 | *.s[a-w][a-z] 124 | *.un~ 125 | Session.vim 126 | .netrwhist 127 | *~ 128 | 129 | # teracy 130 | !.rbenv-version 131 | !.travis.yml 132 | !.gitkeep 133 | !.gitmodules 134 | 135 | # docs 136 | _build 137 | _deploy 138 | -------------------------------------------------------------------------------- /resources/project-template/AUTHORS.md: -------------------------------------------------------------------------------- 1 | Authors 2 | ======= 3 | 4 | Author Name - Email -------------------------------------------------------------------------------- /resources/project-template/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | Change Log 2 | ========== 3 | -------------------------------------------------------------------------------- /resources/project-template/CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | Contributors 2 | ============ 3 | 4 | Contributor Name - Email 5 | -------------------------------------------------------------------------------- /resources/project-template/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) Teracy, Inc. and individual contributors. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 14 | 3. Neither the name of Teracy, Inc. nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without 16 | specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /resources/project-template/README.md: -------------------------------------------------------------------------------- 1 | project-name 2 | ============ 3 | 4 | Project name introduction 5 | 6 | Continuous Integration 7 | ---------------------- 8 | 9 | Usage 10 | ----- 11 | 12 | 13 | Installation 14 | ------------ 15 | 16 | 17 | Configuration 18 | ------------- 19 | 20 | 21 | Contributing 22 | ------------ 23 | 24 | - File issues at https://issues.teracy.org/browse/ 25 | 26 | - Follow Teracy's workflow at http://dev.teracy.org/docs/develop/workflow.html 27 | 28 | Discussions 29 | ----------- 30 | 31 | Join us: 32 | 33 | - https://groups.google.com/forum/#!forum/teracy 34 | 35 | - https://www.facebook.com/groups/teracy 36 | 37 | Get our news: 38 | 39 | - https://www.facebook.com/teracy.official 40 | 41 | - https://twitter.com/teracy_official 42 | 43 | 44 | Author and contributors 45 | ----------------------- 46 | 47 | See more details at `AUTHORS.md` and `CONTRIBUTORS.md` files. 48 | 49 | 50 | License 51 | ------- 52 | 53 | BSD License 54 | 55 | ``` 56 | Copyright (c) Teracy, Inc. and individual contributors. 57 | All rights reserved. 58 | 59 | Redistribution and use in source and binary forms, with or without modification, 60 | are permitted provided that the following conditions are met: 61 | 62 | 1. Redistributions of source code must retain the above copyright notice, 63 | this list of conditions and the following disclaimer. 64 | 65 | 2. Redistributions in binary form must reproduce the above copyright 66 | notice, this list of conditions and the following disclaimer in the 67 | documentation and/or other materials provided with the distribution. 68 | 69 | 3. Neither the name of Teracy, Inc. nor the names of its contributors may be used 70 | to endorse or promote products derived from this software without 71 | specific prior written permission. 72 | 73 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 74 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 75 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 76 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 77 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 78 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 79 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 80 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 81 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 82 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 83 | 84 | ``` 85 | -------------------------------------------------------------------------------- /roles/README.md: -------------------------------------------------------------------------------- 1 | Create roles here, in either the Role Ruby DSL (.rb) or JSON (.json) files. To install roles on the server, use knife. 2 | 3 | For example, create `roles/base_example.rb`: 4 | 5 | name "base_example" 6 | description "Example base role applied to all nodes." 7 | # List of recipes and roles to apply. Requires Chef 0.8, earlier versions use 'recipes()'. 8 | #run_list() 9 | # Attributes applied if the node doesn't have it set already. 10 | #default_attributes() 11 | # Attributes applied no matter what the node has set already. 12 | #override_attributes() 13 | 14 | Then upload it to the Chef Server: 15 | 16 | knife role from file roles/base_example.rb 17 | -------------------------------------------------------------------------------- /scripts/Download-File.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Downloads a file showing the progress of the download 4 | .DESCRIPTION 5 | This Script will download a file locally while showing the progress of the download 6 | .EXAMPLE 7 | .\Download-File.ps1 'http:\\someurl.com\somefile.zip' 8 | .EXAMPLE 9 | .\Download-File.ps1 'http:\\someurl.com\somefile.zip' 'C:\Temp\somefile.zip' 10 | .PARAMETER url 11 | url to be downloaded 12 | .PARAMETER localFile 13 | the local filename where the download should be placed 14 | .NOTES 15 | FileName : Download-File.ps1 16 | Author : CrazyDave 17 | LastModified : 18 Jan 2011 9:39 AM PST 18 | #Requires -Version 2.0 19 | #> 20 | <# 21 | param( 22 | [Parameter(Mandatory=$true)] 23 | [String] $url, 24 | [Parameter(Mandatory=$false)] 25 | [String] $localFile = (Join-Path $pwd.Path $url.SubString($url.LastIndexOf('/'))) 26 | ) 27 | #> 28 | param( 29 | [Parameter(Mandatory=$true)] 30 | [String] $url, 31 | [Parameter(Mandatory=$false)] 32 | [String] $localFile = (Join-Path $pwd.Path $url.SubString($url.LastIndexOf('/'))) 33 | ) 34 | 35 | begin { 36 | 37 | $client = New-Object System.Net.WebClient 38 | $Global:downloadComplete = $false 39 | 40 | $eventDataComplete = Register-ObjectEvent $client DownloadFileCompleted ` 41 | -SourceIdentifier WebClient.DownloadFileComplete ` 42 | -Action {$Global:downloadComplete = $true} 43 | $eventDataProgress = Register-ObjectEvent $client DownloadProgressChanged ` 44 | -SourceIdentifier WebClient.DownloadProgressChanged ` 45 | -Action { $Global:DPCEventArgs = $EventArgs } 46 | } 47 | 48 | process { 49 | Write-Progress -Activity 'Downloading file' -Status $url 50 | $client.DownloadFileAsync($url, $localFile) 51 | 52 | while (!($Global:downloadComplete)) { 53 | $pc = $Global:DPCEventArgs.ProgressPercentage 54 | if ($pc -ne $null) { 55 | Write-Progress -Activity 'Downloading file' -Status $url -PercentComplete $pc 56 | } 57 | } 58 | 59 | Write-Progress -Activity 'Downloading file' -Status $url -Complete 60 | } 61 | 62 | end { 63 | Unregister-Event -SourceIdentifier WebClient.DownloadProgressChanged 64 | Unregister-Event -SourceIdentifier WebClient.DownloadFileComplete 65 | $client.Dispose() 66 | $Global:downloadComplete = $null 67 | $Global:DPCEventArgs = $null 68 | Remove-Variable client 69 | Remove-Variable eventDataComplete 70 | Remove-Variable eventDataProgress 71 | [GC]::Collect() 72 | } -------------------------------------------------------------------------------- /scripts/rbenv.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # install rbenv and switch ruby to 1.9.3-p194 4 | # kudos to https://learnchef.opscode.com/quickstart/workstation-setup/#linux for manual installation 5 | 6 | # How to install: 7 | # $ cd /tmp && wget https://raw.github.com/teracy-official/dev/master/scripts/rbenv.sh && chmod +x rbenv.sh && . ./rbenv.sh && cd ~ 8 | # TODO(phuonglm): improve this: non-root user? this was validated on dev VM only, what's about clean Ubuntu instance? 9 | function install_support_packages() { 10 | sudo apt-get install build-essential git 11 | } 12 | 13 | function install_rbenv() { 14 | #clone rbenv from official git repository and add it to your path 15 | cd ~ 16 | git clone git://github.com/sstephenson/rbenv.git .rbenv 17 | echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> .profile 18 | echo 'eval "$(rbenv init -)"' >> .profile 19 | source ~/.profile 20 | } 21 | 22 | function install_ruby_build() { 23 | cd /tmp 24 | git clone git://github.com/sstephenson/ruby-build.git 25 | cd ruby-build 26 | sudo ./install.sh 27 | } 28 | 29 | function install_ruby() { 30 | rbenv rehash 31 | rbenv install 1.9.3-p194 32 | rbenv shell 1.9.3-p194 33 | rbenv global 1.9.3-p194 34 | } 35 | 36 | sudo apt-get update 37 | install_support_packages 38 | install_rbenv 39 | install_ruby_build 40 | install_ruby 41 | -------------------------------------------------------------------------------- /scripts/setup_working_env_mac.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Setup initial working environment for host machines. This initial script only serves Mac. 4 | 5 | # requires 6 | # brew 7 | # brew-cask 8 | 9 | # to install: 10 | # virtualbox 11 | # vagrant 12 | # docker 13 | # docker-sync 14 | -------------------------------------------------------------------------------- /shared/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/shared/.gitkeep -------------------------------------------------------------------------------- /spec/fixture/config_override.json: -------------------------------------------------------------------------------- 1 | { 2 | "vm":{ 3 | "synced_folders":[{ //see: http://docs.vagrantup.com/v2/synced-folders/index.html 4 | "_id": "0", 5 | "_op": "d" 6 | }, { 7 | "_id": "1", 8 | "_op": "d" 9 | } 10 | ] 11 | } 12 | } -------------------------------------------------------------------------------- /spec/fixture/org_project.json: -------------------------------------------------------------------------------- 1 | { 2 | "vm": { 3 | "networks": [{ 4 | "_id": "0", 5 | "bridge": [ 6 | // If it asks for your network interface, add it the right network interface here 7 | // to choose it by default, you don't have to choose again when $ vagrant reload 8 | // note that if you choose the inactive network interface, problems could happen 9 | // then uncomment the line below and $ vagrant reload to select the right one 10 | //"en0: Wi-Fi (AirPort)" 11 | ] 12 | }] 13 | }, 14 | "vagrant": { 15 | "config_paths": [ 16 | "workspace/angular-hello-world/vagrant_config.default.json", 17 | "workspace/nextjs-hello-world/vagrant_config.default.json" 18 | ] 19 | }, 20 | "vb": { 21 | "memory": 2048, // need to adjust for the right optimal MEM 22 | "cpus": 2 23 | }, 24 | "provisioners": [{ 25 | "_id": "0", 26 | "_a_cookbooks_path": [ 27 | "workspace/dev-setup/chef/main-cookbooks" 28 | ], 29 | "_ua_run_list": [ 30 | "vim", 31 | "teracy-dev", 32 | "acme" 33 | ], 34 | "json": { 35 | "teracy-dev": { 36 | "aliases": [ { 37 | "name": "http", // `$ http` to make http requests, how to use: https://github.com/teracyhq/httpie-jwt-auth 38 | "command": "docker container run -it --rm --net=host teracy/httpie-jwt-auth:latest-alpine", 39 | "action": "add" 40 | }], 41 | "proxy": { 42 | "container": { 43 | "enabled": true 44 | } 45 | } 46 | } 47 | } 48 | }] 49 | } 50 | -------------------------------------------------------------------------------- /spec/fixture/project1.json: -------------------------------------------------------------------------------- 1 | { 2 | "vm": { 3 | "synced_folders":[{ 4 | "_id": "100", 5 | "type": "rsync", 6 | "host": "./workspace/angular-hello-world", 7 | "guest": "/home/vagrant/workspace/angular-hello-world", 8 | "rsync__exclude": [".git", ".idea/", "node_modules/", "bower_components/", ".npm/"] 9 | }, { 10 | "_id": "100", 11 | "type": "virtual_box", 12 | "host": "workspace/angular-hello-world/node_modules", 13 | "guest": "/home/vagrant/workspace/angular-hello-world/node_modules", 14 | "mount_options": [ 15 | "dmode=775", 16 | "fmode=755" 17 | ] 18 | }, { 19 | // enable this to sync /dist back and forth to the host automatically 20 | "_id": "101", 21 | "type": "virtual_box", 22 | "host": "workspace/angular-hello-world/dist", 23 | "guest": "/home/vagrant/workspace/angular-hello-world/dist", 24 | "mount_options": [ 25 | "dmode=775", 26 | "fmode=755" 27 | ] 28 | }] 29 | }, 30 | 31 | "provisioners": [{ 32 | "_id": "0", 33 | "_a_cookbooks_path": [ 34 | "workspace/angular-hello-world/dev-setup/chef/main-cookbooks" 35 | ], 36 | "_ua_run_list": [ 37 | "angular-hello-world" 38 | ], 39 | "json": { 40 | "teracy-dev": { 41 | "aliases": [ { 42 | "_id": "100", 43 | "name": "ahw", // `$ ahw` to cd right into the angular-hello-world project 44 | "command": "cd ~/workspace/angular-hello-world", 45 | "action": "add" 46 | }] 47 | }, 48 | "acme": { 49 | "angular-hello-world": { 50 | "project_guest_path": "/home/vagrant/workspace/angular-hello-world" 51 | } 52 | } 53 | } 54 | }], 55 | "plugins": [{ 56 | "_id": "2", 57 | "options": { 58 | "_ua_aliases": [ 59 | "dev.ahw.acme.dev", "review.ahw.acme.dev", "ahw.acme.dev" 60 | ] 61 | } 62 | }] 63 | } 64 | -------------------------------------------------------------------------------- /spec/fixture/project2.json: -------------------------------------------------------------------------------- 1 | { 2 | "vm": { 3 | "synced_folders":[{ 4 | "_id": "200", 5 | "type": "rsync", 6 | "host": "./workspace/nextjs-hello-world", 7 | "guest": "/home/vagrant/workspace/nextjs-hello-world", 8 | "rsync__exclude": [".git", ".idea/", "node_modules/", "bower_components/", ".npm/"] 9 | }, { 10 | "id": "201", 11 | "type": "virtual_box", 12 | "host": "workspace/nextjs-hello-world/node_modules", 13 | "guest": "/home/vagrant/workspace/nextjs-hello-world/node_modules", 14 | "mount_options": [ 15 | "dmode=775", 16 | "fmode=755" 17 | ] 18 | }, { // enable this to sync /.next back and forth to the host automatically 19 | "id": "202", 20 | "type": "virtual_box", 21 | "host": "workspace/nextjs-hello-world/.next", 22 | "guest": "/home/vagrant/workspace/nextjs-hello-world/.next", 23 | "mount_options": [ 24 | "dmode=775", 25 | "fmode=755" 26 | ] 27 | }] 28 | }, 29 | "provisioners": [{ 30 | "_id": "0", 31 | "_a_cookbooks_path": [ 32 | "workspace/nextjs-hello-world/dev-setup/chef/main-cookbooks" 33 | ], 34 | "_ua_run_list": [ 35 | "nextjs-hello-world" 36 | ], 37 | "json": { 38 | "teracy-dev": { 39 | "aliases": [ { 40 | "_id": "200", 41 | "name": "nhw", // `$ nhw` to cd right into the nextjs-hello-world project 42 | "command": "cd ~/workspace/nextjs-hello-world", 43 | "action": "add" 44 | }] 45 | }, 46 | "acme": { 47 | "nextjs-hello-world": { 48 | "project_guest_path": "/home/vagrant/workspace/nextjs-hello-world" 49 | } 50 | } 51 | } 52 | }], 53 | "plugins": [{ 54 | "_id": "2", 55 | "options": { 56 | "_ua_aliases": [ 57 | "dev.nextjs.acme.dev", "review.nextjs.acme.dev", "nextjs.acme.dev" 58 | ] 59 | } 60 | }] 61 | } 62 | -------------------------------------------------------------------------------- /test/knife.rb: -------------------------------------------------------------------------------- 1 | current_dir = File.dirname(__FILE__) 2 | cookbook_path ["#{current_dir}/../main-cookbooks"] 3 | cache_type 'BasicFile' 4 | cache_options(:path => "#{ENV['HOME']}/.chef/checksums") 5 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # compat_resource Cookbook CHANGELOG 2 | 3 | This file is used to list changes made in each version of the compat_resource cookbook. 4 | 5 | ## 12.19.0 (2017-04-17) 6 | 7 | - Suppress warning already initialized constant 8 | - Backport yum/apt changes from 12.19 9 | 10 | ## 12.16.2 (2016-11-09) 11 | 12 | - Sync chef-client changes from Chef 12.16.42 13 | 14 | ## 12.16.1 (2016-10-20) 15 | 16 | - add delayed_action helper 17 | 18 | ## 12.16.0 (2016-10-19) 19 | 20 | - Sync chef-client changes from Chef 12.16.14 21 | 22 | ## 12.14.7 (2016-09-26) 23 | 24 | - Update to 12.14.89 Chef 25 | - Fix autoload by applying fix from #106 26 | 27 | ## 12.14.6 (2016-09-20) 28 | 29 | - Update backported codebase to Chef 12.14.77 which brings in yum_repository updates and why-run enabled by default in custom resources 30 | 31 | ## 12.14.5 (2016-09-19) 32 | 33 | - Prevent spamming messages in Chefspec runs for cookbooks that depend on compat_resource 34 | 35 | ## 12.14.4 (2016-09-19) 36 | 37 | - Fix delayed notifications cloning 38 | 39 | ## 12.14.3 (2016-09-12) 40 | 41 | - Fix subscribes notifications 42 | 43 | ## 12.14.2 (2016-09-09) 44 | 45 | - Improve documentation 46 | - keep ChefCompat::Resource defined even if we don't load 47 | 48 | ## 12.14.1 (2016-09-07) 49 | 50 | - add yum_repository resource from Chef 12.14 51 | - Update the minimum chef version in the metadata to 12.1 52 | - Added maintainers files 53 | - suppress constant redef warnings when running chefspec 54 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Please refer to 2 | https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD 3 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/MAINTAINERS.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Maintainers 4 | 5 | This file lists how this cookbook project is maintained. When making changes to the system, this file tells you who needs to review your patch - you need a review from an existing maintainer for the cookbook to provide a :+1: on your pull request. Additionally, you need to not receive a veto from a Lieutenant or the Project Lead. 6 | 7 | Check out [How Cookbooks are Maintained](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD) for details on the process and how to become a maintainer or the project lead. 8 | 9 | # Project Maintainer 10 | * [Lamont Granquist](https://github.com/lamont-granquist) 11 | 12 | # Maintainers 13 | * [Jennifer Davis](https://github.com/sigje) 14 | * [Tim Smith](https://github.com/tas50) 15 | * [Thom May](https://github.com/thommay) 16 | * [Lamont Granquist](https://github.com/lamont-granquist) 17 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/README.md: -------------------------------------------------------------------------------- 1 | # compat_resource cookbook 2 | 3 | [![Build Status](https://travis-ci.org/chef-cookbooks/compat_resource.svg?branch=master)](https://travis-ci.org/chef-cookbooks/compat_resource) [![Cookbook Version](https://img.shields.io/cookbook/v/compat_resource.svg)](https://supermarket.chef.io/cookbooks/compat_resource) 4 | 5 | This cookbook backports functionality introduced in the latest chef-client releases to any chef-client from 12.1 onwards. This includes [Custom Resource](https://docs.chef.io/custom_resources.html) functionality, notification improvements, as well as new resources added to core chef. It allows for the usage of these new resources in cookbooks without requiring the very latest Chef client release. 6 | 7 | ## Backported functionality 8 | 9 | - [Custom Resources](https://docs.chef.io/custom_resources.html) 10 | - [apt_repository](https://docs.chef.io/resource_apt_repository.html) 11 | - [apt_update](https://docs.chef.io/resource_apt_update.html) 12 | - [systemd_unit](https://docs.chef.io/resource_systemd_unit.html) 13 | - [yum_repository](https://docs.chef.io/resource_yum_repository.html) 14 | - [:before notifications](https://docs.chef.io/resources.html#timers) 15 | 16 | ## Requirements 17 | 18 | ### Platforms 19 | 20 | - All platforms supported by Chef 21 | 22 | ### Chef 23 | 24 | - Chef 12.1+ 25 | 26 | ### Cookbooks 27 | 28 | - none 29 | 30 | ## Usage 31 | 32 | To use this cookbook, put `depends 'compat_resource'` in the metadata.rb of your cookbook. Once this is done, you can use all the new custom resource features to define resources. It Just Works. 33 | 34 | ## Custom Resources? 35 | 36 | Curious about how to use custom resources? 37 | 38 | - Docs: 39 | - Slides: 40 | 41 | ## License & Authors 42 | 43 | - Author:: Lamont Granquist ([lamont@chef.io](mailto:lamont@chef.io)) 44 | - Author:: John Keiser ([jkeiser@chef.io](mailto:jkeiser@chef.io)) 45 | 46 | ```text 47 | Copyright:: 2015-2016 Chef Software, Inc. 48 | 49 | Licensed under the Apache License, Version 2.0 (the "License"); 50 | you may not use this file except in compliance with the License. 51 | You may obtain a copy of the License at 52 | 53 | http://www.apache.org/licenses/LICENSE-2.0 54 | 55 | Unless required by applicable law or agreed to in writing, software 56 | distributed under the License is distributed on an "AS IS" BASIS, 57 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 58 | See the License for the specific language governing permissions and 59 | limitations under the License. 60 | ``` 61 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef.rb: -------------------------------------------------------------------------------- 1 | module ChefCompat 2 | module CopiedFromChef 3 | def self.extend_chef_module(chef_module, target) 4 | target.instance_eval do 5 | include chef_module 6 | @chef_module = chef_module 7 | def self.method_missing(name, *args, &block) 8 | @chef_module.send(name, *args, &block) 9 | end 10 | def self.const_missing(name) 11 | @chef_module.const_get(name) 12 | end 13 | end 14 | end 15 | 16 | # This patch to CopiedFromChef's ActionClass is necessary for the include to work 17 | require 'chef/resource' 18 | class Chef < ::Chef 19 | class Resource < ::Chef::Resource 20 | module ActionClass 21 | def self.use_inline_resources 22 | end 23 | def self.include_resource_dsl(include_resource_dsl) 24 | end 25 | end 26 | end 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/constants.rb: -------------------------------------------------------------------------------- 1 | # 2 | # NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE 3 | # 4 | # THIS IS A FILE AUTOGENERATED BY 'rake update' DO NOT EDIT!!!! 5 | # 6 | # NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE 7 | # 8 | 9 | begin 10 | require 'chef/constants' 11 | rescue LoadError; end 12 | 13 | require 'chef_compat/copied_from_chef' 14 | class Chef 15 | module ::ChefCompat 16 | module CopiedFromChef 17 | # 18 | # Author:: John Keiser 19 | # Copyright:: Copyright 2015-2016, Chef Software Inc. 20 | # License:: Apache License, Version 2.0 21 | # 22 | # Licensed under the Apache License, Version 2.0 (the "License"); 23 | # you may not use this file except in compliance with the License. 24 | # You may obtain a copy of the License at 25 | # 26 | # http://www.apache.org/licenses/LICENSE-2.0 27 | # 28 | # Unless required by applicable law or agreed to in writing, software 29 | # distributed under the License is distributed on an "AS IS" BASIS, 30 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 31 | # See the License for the specific language governing permissions and 32 | # limitations under the License. 33 | 34 | class Chef < (defined?(::Chef) ? ::Chef : Object) 35 | NOT_PASSED = Object.new 36 | def NOT_PASSED.to_s 37 | "NOT_PASSED" 38 | end 39 | 40 | def NOT_PASSED.inspect 41 | to_s 42 | end 43 | NOT_PASSED.freeze 44 | end 45 | end 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/delayed_evaluator.rb: -------------------------------------------------------------------------------- 1 | # 2 | # NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE 3 | # 4 | # THIS IS A FILE AUTOGENERATED BY 'rake update' DO NOT EDIT!!!! 5 | # 6 | # NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE 7 | # 8 | 9 | begin 10 | require 'chef/delayed_evaluator' 11 | rescue LoadError; end 12 | 13 | require 'chef_compat/copied_from_chef' 14 | class Chef 15 | module ::ChefCompat 16 | module CopiedFromChef 17 | # 18 | # Author:: John Keiser 19 | # Copyright:: Copyright 2015-2016, Chef Software Inc. 20 | # License:: Apache License, Version 2.0 21 | # 22 | # Licensed under the Apache License, Version 2.0 (the "License"); 23 | # you may not use this file except in compliance with the License. 24 | # You may obtain a copy of the License at 25 | # 26 | # http://www.apache.org/licenses/LICENSE-2.0 27 | # 28 | # Unless required by applicable law or agreed to in writing, software 29 | # distributed under the License is distributed on an "AS IS" BASIS, 30 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 31 | # See the License for the specific language governing permissions and 32 | # limitations under the License. 33 | 34 | class Chef < (defined?(::Chef) ? ::Chef : Object) 35 | class DelayedEvaluator < (defined?(::Chef::DelayedEvaluator) ? ::Chef::DelayedEvaluator : Proc) 36 | end 37 | end 38 | end 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/recipe.rb: -------------------------------------------------------------------------------- 1 | # 2 | # NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE 3 | # 4 | # THIS IS A FILE AUTOGENERATED BY 'rake update' DO NOT EDIT!!!! 5 | # 6 | # NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE 7 | # 8 | 9 | begin 10 | require 'chef/dsl/recipe' 11 | rescue LoadError; end 12 | 13 | require 'chef_compat/copied_from_chef' 14 | class Chef 15 | module ::ChefCompat 16 | module CopiedFromChef 17 | require "chef_compat/copied_from_chef/chef/dsl/core" 18 | require "chef_compat/copied_from_chef/chef/mixin/lazy_module_include" 19 | class Chef < (defined?(::Chef) ? ::Chef : Object) 20 | module DSL 21 | CopiedFromChef.extend_chef_module(::Chef::DSL, self) if defined?(::Chef::DSL) 22 | module Recipe 23 | CopiedFromChef.extend_chef_module(::Chef::DSL::Recipe, self) if defined?(::Chef::DSL::Recipe) 24 | include Chef::DSL::Core 25 | extend Chef::Mixin::LazyModuleInclude 26 | module FullDSL 27 | CopiedFromChef.extend_chef_module(::Chef::DSL::Recipe::FullDSL, self) if defined?(::Chef::DSL::Recipe::FullDSL) 28 | include Chef::DSL::Recipe 29 | extend Chef::Mixin::LazyModuleInclude 30 | end 31 | end 32 | end 33 | end 34 | require "chef_compat/copied_from_chef/chef/resource" 35 | end 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/mixin/notifying_block.rb: -------------------------------------------------------------------------------- 1 | # 2 | # NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE 3 | # 4 | # THIS IS A FILE AUTOGENERATED BY 'rake update' DO NOT EDIT!!!! 5 | # 6 | # NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE 7 | # 8 | 9 | begin 10 | require 'chef/mixin/notifying_block' 11 | rescue LoadError; end 12 | 13 | require 'chef_compat/copied_from_chef' 14 | class Chef 15 | module ::ChefCompat 16 | module CopiedFromChef 17 | #-- 18 | # Author:: Lamont Granquist 19 | # Copyright:: Copyright 2010-2016, Chef Software Inc. 20 | # License:: Apache License, Version 2.0 21 | # 22 | # Licensed under the Apache License, Version 2.0 (the "License"); 23 | # you may not use this file except in compliance with the License. 24 | # You may obtain a copy of the License at 25 | # 26 | # http://www.apache.org/licenses/LICENSE-2.0 27 | # 28 | # Unless required by applicable law or agreed to in writing, software 29 | # distributed under the License is distributed on an "AS IS" BASIS, 30 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 31 | # See the License for the specific language governing permissions and 32 | # limitations under the License. 33 | 34 | class Chef < (defined?(::Chef) ? ::Chef : Object) 35 | module Mixin 36 | CopiedFromChef.extend_chef_module(::Chef::Mixin, self) if defined?(::Chef::Mixin) 37 | module NotifyingBlock 38 | CopiedFromChef.extend_chef_module(::Chef::Mixin::NotifyingBlock, self) if defined?(::Chef::Mixin::NotifyingBlock) 39 | 40 | def notifying_block(&block) 41 | begin 42 | subcontext = subcontext_block(&block) 43 | Chef::Runner.new(subcontext).converge 44 | ensure 45 | # recipes don't have a new_resource 46 | if respond_to?(:new_resource) 47 | if subcontext && subcontext.resource_collection.any?(&:updated?) 48 | new_resource.updated_by_last_action(true) 49 | end 50 | end 51 | end 52 | end 53 | 54 | def subcontext_block(parent_context = nil, &block) 55 | parent_context ||= @run_context 56 | sub_run_context = parent_context.create_child 57 | 58 | begin 59 | outer_run_context = @run_context 60 | @run_context = sub_run_context 61 | instance_eval(&block) 62 | ensure 63 | @run_context = outer_run_context 64 | end 65 | 66 | sub_run_context 67 | end 68 | 69 | end 70 | end 71 | end 72 | end 73 | end 74 | end 75 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider/noop.rb: -------------------------------------------------------------------------------- 1 | # 2 | # NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE 3 | # 4 | # THIS IS A FILE AUTOGENERATED BY 'rake update' DO NOT EDIT!!!! 5 | # 6 | # NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE 7 | # 8 | 9 | begin 10 | require 'chef/provider/noop' 11 | rescue LoadError; end 12 | 13 | require 'chef_compat/copied_from_chef' 14 | class Chef 15 | module ::ChefCompat 16 | module CopiedFromChef 17 | # 18 | # Author:: Thom May () 19 | # Copyright:: Copyright (c) 2016 Chef Software, Inc. 20 | # License:: Apache License, Version 2.0 21 | # 22 | # Licensed under the Apache License, Version 2.0 (the "License"); 23 | # you may not use this file except in compliance with the License. 24 | # You may obtain a copy of the License at 25 | # 26 | # http://www.apache.org/licenses/LICENSE-2.0 27 | # 28 | # Unless required by applicable law or agreed to in writing, software 29 | # distributed under the License is distributed on an "AS IS" BASIS, 30 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 31 | # See the License for the specific language governing permissions and 32 | # limitations under the License. 33 | # 34 | 35 | class Chef < (defined?(::Chef) ? ::Chef : Object) 36 | class Provider < (defined?(::Chef::Provider) ? ::Chef::Provider : Object) 37 | class Noop < (defined?(::Chef::Provider::Noop) ? ::Chef::Provider::Noop : Chef::Provider) 38 | def load_current_resource; end 39 | 40 | def respond_to_missing?(method_sym, include_private = false) 41 | method_sym.to_s.start_with?("action_") || super 42 | end 43 | 44 | def method_missing(method_sym, *arguments, &block) 45 | if method_sym.to_s =~ /^action_/ 46 | Chef::Log.debug("NoOp-ing for #{method_sym}") 47 | else 48 | super 49 | end 50 | end 51 | end 52 | end 53 | end 54 | end 55 | end 56 | end 57 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/apt_repository.rb: -------------------------------------------------------------------------------- 1 | # 2 | # NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE 3 | # 4 | # THIS IS A FILE AUTOGENERATED BY 'rake update' DO NOT EDIT!!!! 5 | # 6 | # NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE 7 | # 8 | 9 | begin 10 | require 'chef/resource/apt_repository' 11 | rescue LoadError; end 12 | 13 | require 'chef_compat/copied_from_chef' 14 | class Chef 15 | module ::ChefCompat 16 | module CopiedFromChef 17 | # 18 | # Author:: Thom May () 19 | # Copyright:: Copyright (c) 2016 Chef Software, Inc. 20 | # License:: Apache License, Version 2.0 21 | # 22 | # Licensed under the Apache License, Version 2.0 (the "License"); 23 | # you may not use this file except in compliance with the License. 24 | # You may obtain a copy of the License at 25 | # 26 | # http://www.apache.org/licenses/LICENSE-2.0 27 | # 28 | # Unless required by applicable law or agreed to in writing, software 29 | # distributed under the License is distributed on an "AS IS" BASIS, 30 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 31 | # See the License for the specific language governing permissions and 32 | # limitations under the License. 33 | # 34 | 35 | require "chef_compat/copied_from_chef/chef/resource" 36 | 37 | class Chef < (defined?(::Chef) ? ::Chef : Object) 38 | class Resource < (defined?(::Chef::Resource) ? ::Chef::Resource : Object) 39 | class AptRepository < (defined?(::Chef::Resource::AptRepository) ? ::Chef::Resource::AptRepository : Chef::Resource) 40 | resource_name :apt_repository 41 | provides :apt_repository 42 | 43 | property :repo_name, String, name_property: true 44 | property :uri, String 45 | property :distribution, [ String, nil, false ], default: lazy { node["lsb"]["codename"] }, nillable: true, coerce: proc { |x| x ? x : nil } 46 | property :components, Array, default: [] 47 | property :arch, [String, nil, false], default: nil, nillable: true, coerce: proc { |x| x ? x : nil } 48 | property :trusted, [TrueClass, FalseClass], default: false 49 | # whether or not to add the repository as a source repo, too 50 | property :deb_src, [TrueClass, FalseClass], default: false 51 | property :keyserver, [String, nil, false], default: "keyserver.ubuntu.com", nillable: true, coerce: proc { |x| x ? x : nil } 52 | property :key, [String, nil, false], default: nil, nillable: true, coerce: proc { |x| x ? x : nil } 53 | property :key_proxy, [String, nil, false], default: nil, nillable: true, coerce: proc { |x| x ? x : nil } 54 | 55 | property :cookbook, [String, nil, false], default: nil, desired_state: false, nillable: true, coerce: proc { |x| x ? x : nil } 56 | property :cache_rebuild, [TrueClass, FalseClass], default: true, desired_state: false 57 | 58 | default_action :add 59 | allowed_actions :add, :remove 60 | end 61 | end 62 | end 63 | end 64 | end 65 | end 66 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/apt_update.rb: -------------------------------------------------------------------------------- 1 | # 2 | # NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE 3 | # 4 | # THIS IS A FILE AUTOGENERATED BY 'rake update' DO NOT EDIT!!!! 5 | # 6 | # NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE 7 | # 8 | 9 | begin 10 | require 'chef/resource/apt_update' 11 | rescue LoadError; end 12 | 13 | require 'chef_compat/copied_from_chef' 14 | class Chef 15 | module ::ChefCompat 16 | module CopiedFromChef 17 | # 18 | # Author:: Thom May () 19 | # Copyright:: Copyright (c) 2016 Chef Software, Inc. 20 | # License:: Apache License, Version 2.0 21 | # 22 | # Licensed under the Apache License, Version 2.0 (the "License"); 23 | # you may not use this file except in compliance with the License. 24 | # You may obtain a copy of the License at 25 | # 26 | # http://www.apache.org/licenses/LICENSE-2.0 27 | # 28 | # Unless required by applicable law or agreed to in writing, software 29 | # distributed under the License is distributed on an "AS IS" BASIS, 30 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 31 | # See the License for the specific language governing permissions and 32 | # limitations under the License. 33 | # 34 | 35 | require "chef_compat/copied_from_chef/chef/resource" 36 | 37 | class Chef < (defined?(::Chef) ? ::Chef : Object) 38 | class Resource < (defined?(::Chef::Resource) ? ::Chef::Resource : Object) 39 | class AptUpdate < (defined?(::Chef::Resource::AptUpdate) ? ::Chef::Resource::AptUpdate : Chef::Resource) 40 | resource_name :apt_update 41 | provides :apt_update 42 | 43 | property :frequency, Integer, default: 86_400 44 | 45 | default_action :periodic 46 | allowed_actions :update, :periodic 47 | end 48 | end 49 | end 50 | end 51 | end 52 | end 53 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/systemd_unit.rb: -------------------------------------------------------------------------------- 1 | # 2 | # NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE 3 | # 4 | # THIS IS A FILE AUTOGENERATED BY 'rake update' DO NOT EDIT!!!! 5 | # 6 | # NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE 7 | # 8 | 9 | begin 10 | require 'chef/resource/systemd_unit' 11 | rescue LoadError; end 12 | 13 | require 'chef_compat/copied_from_chef' 14 | class Chef 15 | module ::ChefCompat 16 | module CopiedFromChef 17 | # 18 | # Author:: Nathan Williams () 19 | # Copyright:: Copyright 2016, Nathan Williams 20 | # License:: Apache License, Version 2.0 21 | # 22 | # Licensed under the Apache License, Version 2.0 (the "License"); 23 | # you may not use this file except in compliance with the License. 24 | # You may obtain a copy of the License at 25 | # 26 | # http://www.apache.org/licenses/LICENSE-2.0 27 | # 28 | # Unless required by applicable law or agreed to in writing, software 29 | # distributed under the License is distributed on an "AS IS" BASIS, 30 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 31 | # See the License for the specific language governing permissions and 32 | # limitations under the License. 33 | # 34 | 35 | require "chef_compat/copied_from_chef/chef/resource" 36 | 37 | class Chef < (defined?(::Chef) ? ::Chef : Object) 38 | class Resource < (defined?(::Chef::Resource) ? ::Chef::Resource : Object) 39 | class SystemdUnit < (defined?(::Chef::Resource::SystemdUnit) ? ::Chef::Resource::SystemdUnit : Chef::Resource) 40 | resource_name :systemd_unit 41 | 42 | default_action :nothing 43 | allowed_actions :create, :delete, 44 | :enable, :disable, 45 | :mask, :unmask, 46 | :start, :stop, 47 | :restart, :reload, 48 | :try_restart, :reload_or_restart, 49 | :reload_or_try_restart 50 | 51 | property :enabled, [TrueClass, FalseClass] 52 | property :active, [TrueClass, FalseClass] 53 | property :masked, [TrueClass, FalseClass] 54 | property :static, [TrueClass, FalseClass] 55 | property :user, String, desired_state: false 56 | property :content, [String, Hash] 57 | property :triggers_reload, [TrueClass, FalseClass], 58 | default: true, desired_state: false 59 | 60 | def to_ini 61 | case content 62 | when Hash 63 | IniParse.gen do |doc| 64 | content.each_pair do |sect, opts| 65 | doc.section(sect) do |section| 66 | opts.each_pair do |opt, val| 67 | section.option(opt, val) 68 | end 69 | end 70 | end 71 | end.to_s 72 | else 73 | content.to_s 74 | end 75 | end 76 | end 77 | end 78 | end 79 | end 80 | end 81 | end 82 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/files/lib/chef_compat/mixin/properties.rb: -------------------------------------------------------------------------------- 1 | require 'chef_compat/monkeypatches' 2 | require 'chef_compat/copied_from_chef/chef/mixin/properties' 3 | 4 | module ChefCompat 5 | module Mixin 6 | Properties = ChefCompat::CopiedFromChef::Chef::Mixin::Properties 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/files/lib/chef_compat/monkeypatches.rb: -------------------------------------------------------------------------------- 1 | class Chef 2 | class RunContext 3 | class ChildRunContext < RunContext 4 | # magic that lets us re-parse the ChildRunContext without erroring due to 5 | # cheffish and chef-provisioning hooks having been loaded (on old versions of 6 | # chef-client without the lazy hooks for those gems) 7 | @__skip_method_checking = true 8 | end 9 | end 10 | end 11 | 12 | # fix to quiet constant redefined warnings 13 | if defined?(Chef::RunContext::ChildRunContext::CHILD_STATE) 14 | Chef::RunContext::ChildRunContext.send(:remove_const, :CHILD_STATE) 15 | end 16 | 17 | require 'chef_compat/monkeypatches/chef' 18 | require 'chef_compat/monkeypatches/chef/exceptions' 19 | require 'chef_compat/monkeypatches/chef/log' 20 | require 'chef_compat/monkeypatches/chef/node' 21 | require 'chef_compat/monkeypatches/chef/mixin/params_validate' 22 | require 'chef_compat/monkeypatches/chef/property' 23 | require 'chef_compat/monkeypatches/chef/provider' 24 | require 'chef_compat/monkeypatches/chef/recipe' # copied from chef 25 | require 'chef_compat/monkeypatches/chef/recipe_hook' 26 | require 'chef_compat/monkeypatches/chef/resource' 27 | require 'chef_compat/monkeypatches/chef/resource_builder' 28 | require 'chef_compat/monkeypatches/chef/resource/lwrp_base' 29 | require 'chef_compat/monkeypatches/chef/resource_collection' 30 | require 'chef_compat/monkeypatches/chef/resource_collection/resource_list' 31 | require 'chef_compat/monkeypatches/chef/resource_collection/resource_set' 32 | require 'chef_compat/monkeypatches/chef/run_context' # copied from chef 33 | require 'chef_compat/monkeypatches/chef/runner' # copied from chef 34 | 35 | # fix for Chef::RunContext instance that has already been created 36 | ObjectSpace.each_object(Chef::RunContext) do |run_context| 37 | run_context.node.run_context = run_context 38 | run_context.instance_variable_set(:@loaded_recipes_hash, {}) 39 | run_context.instance_variable_set(:@loaded_attributes_hash, {}) 40 | run_context.initialize_child_state 41 | end 42 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef.rb: -------------------------------------------------------------------------------- 1 | class Chef 2 | NOT_PASSED = Object.new if !defined?(NOT_PASSED) 3 | # Earlier versions of Chef didn't have this message 4 | module ChefCompatDeprecation 5 | def log_deprecation(message, location=nil) 6 | if !location 7 | # Pick the first caller that is *not* part of the Chef or ChefCompat gem, 8 | # that's the thing the user wrote. 9 | chef_compat_gem_path = File.expand_path("../../..", __FILE__) 10 | chef_gem_path = File.expand_path("../..",::Chef::Resource.instance_method(:initialize).source_location[0]) 11 | caller(0..10).each do |c| 12 | if !c.start_with?(chef_gem_path) && !c.start_with?(chef_compat_gem_path) 13 | location = c 14 | break 15 | end 16 | end 17 | end 18 | 19 | begin 20 | super 21 | # Bleagh. `super_method` doesn't exist on older rubies and I haven't 22 | # figured out a way to check for its existence otherwise. 23 | rescue NoMethodError 24 | Chef::Log.warn(message) 25 | end 26 | end 27 | end 28 | 29 | class<= 12.5 && Chef::VERSION.to_f <= 12.8 2 | require 'chef/mixin/params_validate' 3 | class Chef 4 | module Mixin 5 | module ParamsValidate 6 | class SetOrReturnProperty < Chef::Property 7 | # 12.9 introduced a new optional parameter to `get()` to avoid a nil-set warning. 8 | # When their method gets called with 2 args, we need to ignore and call with 1. 9 | alias_method :_original_get2, :get 10 | def get(resource, *args) 11 | _original_get2(resource) 12 | end 13 | end 14 | end 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/node.rb: -------------------------------------------------------------------------------- 1 | class Chef 2 | class Node 3 | unless method_defined?(:set_cookbook_attribute) 4 | def set_cookbook_attribute 5 | # this implementation deliberately left blank - we don't need to do anything we just need to not fail 6 | end 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/property.rb: -------------------------------------------------------------------------------- 1 | # 12.9 introduced a new optional parameter to `get()` to avoid a nil-set warning. 2 | # We need to mimick it here. 3 | if Chef::VERSION.to_f >= 12.5 && Chef::VERSION.to_f <= 12.8 4 | require 'chef/property' 5 | class Chef 6 | class Property 7 | # 12.9 introduced a new optional parameter to `get()` to avoid a nil-set warning. 8 | # When their method gets called with 2 args, we need to ignore and call with 1. 9 | alias_method :_original_get, :get 10 | def get(resource, *args) 11 | _original_get(resource) 12 | end 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/provider.rb: -------------------------------------------------------------------------------- 1 | require 'chef/provider' 2 | require 'chef/provider/lwrp_base' 3 | 4 | class Chef::Provider 5 | if !defined?(InlineResources) 6 | InlineResources = Chef::Provider::LWRPBase::InlineResources 7 | end 8 | module InlineResources 9 | require 'chef/dsl/recipe' 10 | require 'chef/dsl/platform_introspection' 11 | require 'chef/dsl/data_query' 12 | require 'chef/dsl/include_recipe' 13 | include Chef::DSL::Recipe 14 | include Chef::DSL::PlatformIntrospection 15 | include Chef::DSL::DataQuery 16 | include Chef::DSL::IncludeRecipe 17 | 18 | unless Chef::Provider::InlineResources::ClassMethods.instance_method(:action).source_location[0] =~ /chefspec/ 19 | # Don't override action if chefspec is doing its thing 20 | module ::ChefCompat 21 | module Monkeypatches 22 | module InlineResources 23 | module ClassMethods 24 | def action(name, &block) 25 | super(name) { send("compile_action_#{name}") } 26 | # We put the action in its own method so that super() works. 27 | define_method("compile_action_#{name}", &block) 28 | end 29 | end 30 | end 31 | end 32 | end 33 | module ClassMethods 34 | prepend ChefCompat::Monkeypatches::InlineResources::ClassMethods 35 | end 36 | end 37 | end 38 | end 39 | 40 | 41 | class Chef 42 | class Provider 43 | class LWRPBase < Provider 44 | if defined?(InlineResources) 45 | module InlineResources 46 | # since we upgrade the Chef::Runner and Chef::RunContext globally to >= 12.14 style classes, we need to also 47 | # fix the use_inline_resources LWRPBase wrapper that creates a sub-resource collection with the ugpraded code 48 | # from the Chef::Provider subclasses that do similar things in post-12.5 chef. 49 | def recipe_eval_with_update_check(&block) 50 | old_run_context = run_context 51 | @run_context = run_context.create_child 52 | return_value = instance_eval(&block) 53 | Chef::Runner.new(run_context).converge 54 | return_value 55 | ensure 56 | if run_context.resource_collection.any? { |r| r.updated? } 57 | new_resource.updated_by_last_action(true) 58 | end 59 | @run_context = old_run_context 60 | end 61 | end 62 | end 63 | end 64 | end 65 | end 66 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/recipe_hook.rb: -------------------------------------------------------------------------------- 1 | require 'chef/recipe' 2 | require 'chef_compat/recipe' 3 | 4 | class Chef::Recipe 5 | # If the cookbook depends on compat_resource, create a ChefCompat::Recipe object 6 | # instead of Chef::Recipe, for the extra goodies. 7 | def self.new(cookbook_name, recipe_name, run_context) 8 | if run_context && 9 | cookbook_name && 10 | recipe_name && 11 | run_context.cookbook_collection && 12 | run_context.cookbook_collection[cookbook_name] && 13 | run_context.cookbook_collection[cookbook_name].metadata.dependencies.has_key?('compat_resource') && 14 | self != ::ChefCompat::Recipe 15 | ::ChefCompat::Recipe.new(cookbook_name, recipe_name, run_context) 16 | else 17 | super 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource/lwrp_base.rb: -------------------------------------------------------------------------------- 1 | require 'chef_compat/resource/lwrp_base' 2 | require 'chef/resource/lwrp_base' 3 | 4 | module ChefCompat 5 | module Monkeypatches 6 | # 7 | # NOTE: LOTS OF METAPROGRAMMING HERE. NOT FOR FAINT OF HEART. 8 | # 9 | 10 | # Add an empty module to Class so we can temporarily override it in build_from_file 11 | module Class 12 | end 13 | class<<::Class 14 | prepend(ChefCompat::Monkeypatches::Class) 15 | end 16 | 17 | module Chef 18 | module Resource 19 | module LWRPBase 20 | def build_from_file(cookbook_name, filename, run_context) 21 | # If the cookbook this LWRP is from depends on compat_resource, fix its LWRPs up real good 22 | if run_context.cookbook_collection[cookbook_name].metadata.dependencies.has_key?('compat_resource') 23 | # All cookbooks do Class.new(Chef::Resource::LWRPBase). Change Class.new 24 | # temporarily to translate Chef::Resource::LWRPBase to ChefCompat::Resource 25 | ChefCompat::Monkeypatches::Class.module_eval do 26 | def new(*args, &block) 27 | # Trick it! Use ChefCompat::Resource instead of Chef::Resource::LWRPBase 28 | if args == [ ::Chef::Resource::LWRPBase ] 29 | ChefCompat::Monkeypatches::Class.module_eval do 30 | remove_method(:new) if method_defined?(:new) 31 | end 32 | args = [ ChefCompat::Resource::LWRPBase ] 33 | end 34 | super(*args, &block) 35 | end 36 | end 37 | 38 | begin 39 | 40 | # Call the actual build_from_file 41 | super 42 | 43 | ensure 44 | class<) 3 | # Copyright:: Copyright 2014-2016, Chef Software, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | require "chef/resource_collection/resource_list" 20 | require "chef/exceptions" 21 | 22 | module ChefCompat 23 | module Monkeypatches 24 | module Chef 25 | module ResourceCollection 26 | module ResourceList 27 | module DeleteResource 28 | # Copied verbatim from Chef 12.10.4 29 | def delete(key) 30 | raise ArgumentError, "Must pass a Chef::Resource or String to delete" unless key.is_a?(String) || key.is_a?(Chef::Resource) 31 | key = key.to_s 32 | ret = @resources.reject! { |r| r.to_s == key } 33 | if ret.nil? 34 | raise ::Chef::Exceptions::ResourceNotFound, "Cannot find a resource matching #{key} (did you define it first?)" 35 | end 36 | ret 37 | end 38 | end 39 | end 40 | end 41 | end 42 | end 43 | end 44 | 45 | class Chef::ResourceCollection::ResourceList 46 | unless method_defined?(:delete) 47 | prepend ChefCompat::Monkeypatches::Chef::ResourceCollection::ResourceList::DeleteResource 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource_collection/resource_set.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Tyler Ball () 3 | # Copyright:: Copyright 2014-2016, Chef Software, Inc. 4 | # License:: Apache License, Version 2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | require "chef/resource_collection/resource_list" 20 | require "chef/exceptions" 21 | 22 | module ChefCompat 23 | module Monkeypatches 24 | module Chef 25 | module ResourceCollection 26 | module ResourceSet 27 | module DeleteResource 28 | def delete(key) 29 | raise ArgumentError, "Must pass a Chef::Resource or String to delete" unless key.is_a?(String) || key.is_a?(Chef::Resource) 30 | key = key.to_s 31 | res = @resources_by_key.delete(key) 32 | 33 | if res == @resources_by_key.default 34 | raise Chef::Exceptions::ResourceNotFound, "Cannot find a resource matching #{key} (did you define it first?)" 35 | end 36 | res 37 | end 38 | end 39 | end 40 | end 41 | end 42 | end 43 | end 44 | 45 | class Chef::ResourceCollection::ResourceSet 46 | unless method_defined?(:delete) 47 | prepend ChefCompat::Monkeypatches::Chef::ResourceCollection::ResourceSet::DeleteResource 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/files/lib/chef_compat/property.rb: -------------------------------------------------------------------------------- 1 | require 'chef_compat/copied_from_chef/chef/property' 2 | 3 | module ChefCompat 4 | class Property < ChefCompat::CopiedFromChef::Chef::Property 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/files/lib/chef_compat/recipe.rb: -------------------------------------------------------------------------------- 1 | require 'chef/recipe' 2 | require 'chef_compat/copied_from_chef/chef/dsl/recipe' 3 | 4 | module ChefCompat 5 | class Recipe < Chef::Recipe 6 | include ChefCompat::CopiedFromChef::Chef::DSL::Recipe::FullDSL 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/files/lib/chef_compat/resource.rb: -------------------------------------------------------------------------------- 1 | require 'chef_compat/monkeypatches' 2 | require 'chef_compat/copied_from_chef/chef/resource' 3 | 4 | # We do NOT want action defined if chefspec is engaged 5 | if Chef::Provider::InlineResources::ClassMethods.instance_method(:action).source_location[0] =~ /chefspec/ 6 | ChefCompat::CopiedFromChef::Chef::Provider::InlineResources::ClassMethods.instance_eval do 7 | remove_method(:action) 8 | end 9 | end 10 | 11 | module ChefCompat 12 | class Resource < ChefCompat::CopiedFromChef::Chef::Resource 13 | def initialize(*args, &block) 14 | super 15 | # @resource_name is used in earlier Chef versions 16 | @resource_name = self.class.resource_name 17 | end 18 | # Things we'll need to define ourselves: 19 | # 1. provider 20 | # 2. resource_name 21 | 22 | def provider(*args, &block) 23 | super || self.class.action_class 24 | end 25 | def provider=(arg) 26 | provider(arg) 27 | end 28 | 29 | if !respond_to?(:resource_name) 30 | def self.resource_name(name=Chef::NOT_PASSED) 31 | # Setter 32 | if name != Chef::NOT_PASSED 33 | # remove_canonical_dsl 34 | 35 | # Set the resource_name and call provides 36 | if name 37 | name = name.to_sym 38 | # If our class is not already providing this name, provide it. 39 | # Commented out: use of resource_name and provides will need to be 40 | # mutually exclusive in this world, generally. 41 | # if !Chef::ResourceResolver.includes_handler?(name, self) 42 | provides name#, canonical: true 43 | # end 44 | @resource_name = name 45 | else 46 | @resource_name = nil 47 | end 48 | end 49 | @resource_name 50 | end 51 | def self.resource_name=(name) 52 | resource_name(name) 53 | end 54 | end 55 | end 56 | end 57 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/files/lib/chef_compat/resource/lwrp_base.rb: -------------------------------------------------------------------------------- 1 | require 'chef_compat/resource' 2 | require 'chef_compat/copied_from_chef/chef/resource' 3 | require 'chef/mixin/convert_to_class_name' 4 | require 'chef/mixin/from_file' 5 | 6 | module ChefCompat 7 | class Resource < ChefCompat::CopiedFromChef::Chef::Resource 8 | class LWRPBase < ChefCompat::Resource 9 | class<= 12.0").satisfied_by?(Gem::Version.new(Chef::VERSION)) 4 | 5 | require 'chef_compat/resource' 6 | require 'chef_compat/property' 7 | require 'chef_compat/mixin/properties' 8 | 9 | resources_dir = File.expand_path("chef_compat/copied_from_chef/chef/resource", File.dirname(__FILE__)) 10 | providers_dir = File.expand_path("chef_compat/copied_from_chef/chef/provider", File.dirname(__FILE__)) 11 | Dir["#{resources_dir}/*.rb"].each {|file| require file } 12 | Dir["#{providers_dir}/*.rb"].each {|file| require file } 13 | else 14 | 15 | class Chef 16 | class Resource 17 | def self.property(args, &block) 18 | raise_chef_11_error 19 | end 20 | 21 | def self.resource_name(args, &block) 22 | raise_chef_11_error 23 | end 24 | 25 | def self.action(args, &block) 26 | raise_chef_11_error 27 | end 28 | 29 | def self.raise_chef_11_error 30 | raise "This resource is written with Chef 12.5 custom resources, and requires at least Chef 12.0 used with the compat_resource cookbook, it will not work with Chef 11.x clients, and those users must pin their cookbooks to older versions or upgrade." 31 | end 32 | end 33 | end 34 | 35 | end 36 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/libraries/autoload.rb: -------------------------------------------------------------------------------- 1 | unless Gem::Requirement.new(">= 12.0").satisfied_by?(Gem::Version.new(Chef::VERSION)) 2 | raise "This resource is written with Chef 12.5 custom resources, and requires at least Chef 12.0 used with the compat_resource cookbook, it will not work with Chef 11.x clients, and those users must pin their cookbooks to older versions or upgrade." 3 | end 4 | 5 | # If users are on old verisons of ChefDK which activates an (old) gem via cheffish before this cookbook loads, then 6 | # we just try to monkeypatch over the top of a monkeypatch. Its possible that we have checks in this cookbook which 7 | # will defeat that purpose and fail to monkeypatch on top of monkeypatches -- in which case those checks should be 8 | # removed -- this cookbook needs to win when it gets into a fight with the old gem versions. 9 | if Gem.loaded_specs["compat_resource"] 10 | Chef.log_deprecation "using compat_resource as a gem is deprecated; please update cheffish and chef-provisioning gems (or use the latest Chef/ChefDK packages) or else manually pin your compat_resource cookbook version to the same version as the gem you are using to remove this warning" 11 | end 12 | 13 | # we want to not pollute the libpath with our files until after we've done the version check 14 | require_relative '../files/lib/chef_upstream_version' 15 | 16 | # on any chef client later than the one we were based off of we just turn into a no-op 17 | if Gem::Requirement.new("< #{ChefCompat::CHEF_UPSTREAM_VERSION}").satisfied_by?(Gem::Version.new(Chef::VERSION)) 18 | Chef::Log.debug "loading compat_resource based on chef-version #{ChefCompat::CHEF_UPSTREAM_VERSION} over chef version #{Gem::Version.new(Chef::VERSION)}" 19 | $LOAD_PATH.unshift(File.expand_path("../files/lib", File.dirname(__FILE__))) 20 | require 'compat_resource' 21 | else 22 | Chef::Log.debug "NOT LOADING compat_resource based on chef-version #{ChefCompat::CHEF_UPSTREAM_VERSION} over chef version #{Gem::Version.new(Chef::VERSION)}" 23 | unless defined?(ChefCompat::Resource) && defined?(ChefCompat::Mixin::Properties) 24 | module ChefCompat 25 | Resource = Chef::Resource 26 | module Mixin 27 | Properties = Chef::Mixin::Properties 28 | end 29 | end 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /vendor-cookbooks/compat_resource/metadata.json: -------------------------------------------------------------------------------- 1 | {"name":"compat_resource","version":"12.19.0","description":"Backports functionality introduced in the latest chef-client releases to any chef-client from 12.1 onwards","long_description":"# compat_resource cookbook\n\n[![Build Status](https://travis-ci.org/chef-cookbooks/compat_resource.svg?branch=master)](https://travis-ci.org/chef-cookbooks/compat_resource) [![Cookbook Version](https://img.shields.io/cookbook/v/compat_resource.svg)](https://supermarket.chef.io/cookbooks/compat_resource)\n\nThis cookbook backports functionality introduced in the latest chef-client releases to any chef-client from 12.1 onwards. This includes [Custom Resource](https://docs.chef.io/custom_resources.html) functionality, notification improvements, as well as new resources added to core chef. It allows for the usage of these new resources in cookbooks without requiring the very latest Chef client release.\n\n## Backported functionality\n\n- [Custom Resources](https://docs.chef.io/custom_resources.html)\n- [apt_repository](https://docs.chef.io/resource_apt_repository.html)\n- [apt_update](https://docs.chef.io/resource_apt_update.html)\n- [systemd_unit](https://docs.chef.io/resource_systemd_unit.html)\n- [yum_repository](https://docs.chef.io/resource_yum_repository.html)\n- [:before notifications](https://docs.chef.io/resources.html#timers)\n\n## Requirements\n\n### Platforms\n\n- All platforms supported by Chef\n\n### Chef\n\n- Chef 12.1+\n\n### Cookbooks\n\n- none\n\n## Usage\n\nTo use this cookbook, put `depends 'compat_resource'` in the metadata.rb of your cookbook. Once this is done, you can use all the new custom resource features to define resources. It Just Works.\n\n## Custom Resources?\n\nCurious about how to use custom resources?\n\n- Docs: \n- Slides: \n\n## License & Authors\n\n- Author:: Lamont Granquist ([lamont@chef.io](mailto:lamont@chef.io))\n- Author:: John Keiser ([jkeiser@chef.io](mailto:jkeiser@chef.io))\n\n```text\nCopyright:: 2015-2016 Chef Software, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","maintainer":"Lamont Granquist","maintainer_email":"lamont@chef.io","license":"Apache 2.0","platforms":{},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/chef-cookbooks/compat_resource","issues_url":"https://github.com/chef-cookbooks/compat_resource/issues","chef_version":[[">= 12.1"]],"ohai_version":[]} -------------------------------------------------------------------------------- /vendor-cookbooks/docker/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Please refer to 2 | https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD 3 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker/MAINTAINERS.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Maintainers 4 | 5 | This file lists how this cookbook project is maintained. When making changes to the system, this file tells you who needs to review your patch - you need a review from an existing maintainer for the cookbook to provide a :+1: on your pull request. Additionally, you need to not receive a veto from a Lieutenant or the Project Lead. 6 | 7 | Check out [How Cookbooks are Maintained](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD) for details on the process and how to become a maintainer or the project lead. 8 | 9 | # Project Maintainer 10 | * [Sean OMeara](https://github.com/someara) 11 | 12 | # Maintainers 13 | * [Jennifer Davis](https://github.com/sigje) 14 | * [Sean OMeara](https://github.com/someara) 15 | * [Tim Smith](https://github.com/tas50) 16 | * [Thom May](https://github.com/thommay) 17 | * [Anthony Scalisi](https://github.com/scalp42) 18 | * [Chase Bolt](https://github.com/chasebolt) 19 | * [Brian Flad](https://github.com/bflad) 20 | * [Tom Duffield](https://github.com/tduffield) 21 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker/libraries/_autoload.rb: -------------------------------------------------------------------------------- 1 | begin 2 | gem 'docker-api', '= 1.33.0' 3 | rescue LoadError 4 | unless defined?(ChefSpec) 5 | run_context = Chef::RunContext.new(Chef::Node.new, {}, Chef::EventDispatch::Dispatcher.new) 6 | 7 | require 'chef/resource/chef_gem' 8 | 9 | docker = Chef::Resource::ChefGem.new('docker-api', run_context) 10 | docker.version '= 1.33.0' 11 | docker.run_action(:install) 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker/libraries/docker_exec.rb: -------------------------------------------------------------------------------- 1 | module DockerCookbook 2 | class DockerExec < DockerBase 3 | resource_name :docker_exec 4 | 5 | property :host, [String, nil], default: lazy { default_host } 6 | property :command, Array 7 | property :container, String 8 | property :timeout, Numeric, default: 60 9 | 10 | property :container_obj, Docker::Container, desired_state: false 11 | 12 | alias cmd command 13 | 14 | action :run do 15 | converge_by "executing #{command} on #{container}" do 16 | with_retries { container_obj Docker::Container.get(container, {}, connection) } 17 | container_obj.exec(command, wait: timeout) 18 | end 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker/libraries/docker_image.rb: -------------------------------------------------------------------------------- 1 | module DockerCookbook 2 | class DockerImage < DockerBase 3 | require 'docker' 4 | require_relative 'helpers_image' 5 | 6 | resource_name :docker_image 7 | 8 | # Modify the default of read_timeout from 60 to 120 9 | property :read_timeout, default: 120, desired_state: false 10 | 11 | # https://docs.docker.com/reference/api/docker_remote_api_v1.20/ 12 | property :destination, [String, nil] 13 | property :force, Boolean, default: false 14 | property :host, [String, nil], default: lazy { default_host }, desired_state: false 15 | property :nocache, Boolean, default: false 16 | property :noprune, Boolean, default: false 17 | property :repo, String, name_property: true 18 | property :rm, Boolean, default: true 19 | property :source, String 20 | property :tag, String, default: 'latest' 21 | 22 | alias image repo 23 | alias image_name repo 24 | alias no_cache nocache 25 | alias no_prune noprune 26 | 27 | ######### 28 | # Actions 29 | ######### 30 | 31 | default_action :pull 32 | 33 | declare_action_class.class_eval do 34 | include DockerHelpers::Image 35 | def whyrun_supported? 36 | true 37 | end 38 | end 39 | 40 | action :build do 41 | converge_by "Build image #{image_identifier}" do 42 | build_image 43 | end 44 | end 45 | 46 | action :build_if_missing do 47 | return if Docker::Image.exist?(image_identifier, {}, connection) 48 | action_build 49 | end 50 | 51 | action :import do 52 | return if Docker::Image.exist?(image_identifier, {}, connection) 53 | converge_by "Import image #{image_identifier}" do 54 | import_image 55 | end 56 | end 57 | 58 | action :pull do 59 | # We already did the work, but we need to report what we did! 60 | converge_by "Pull image #{image_identifier}" do 61 | end if pull_image 62 | end 63 | 64 | action :pull_if_missing do 65 | return if Docker::Image.exist?(image_identifier, {}, connection) 66 | action_pull 67 | end 68 | 69 | action :push do 70 | converge_by "Push image #{image_identifier}" do 71 | push_image 72 | end 73 | end 74 | 75 | action :remove do 76 | return unless Docker::Image.exist?(image_identifier, {}, connection) 77 | converge_by "Remove image #{image_identifier}" do 78 | remove_image 79 | end 80 | end 81 | 82 | action :save do 83 | converge_by "Save image #{image_identifier}" do 84 | save_image 85 | end 86 | end 87 | 88 | action :load do 89 | converge_by "load image #{image_identifier}" do 90 | load_image 91 | end 92 | end 93 | end 94 | end 95 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker/libraries/docker_installation_binary.rb: -------------------------------------------------------------------------------- 1 | module DockerCookbook 2 | class DockerInstallationBinary < DockerBase 3 | require_relative 'helpers_installation_binary' 4 | 5 | include DockerHelpers::InstallationBinary 6 | 7 | ##################### 8 | # Resource properties 9 | ##################### 10 | resource_name :docker_installation_binary 11 | 12 | property :checksum, String, default: lazy { default_checksum }, desired_state: false 13 | property :source, String, default: lazy { default_source }, desired_state: false 14 | property :version, String, default: lazy { default_version }, desired_state: false 15 | 16 | default_action :create 17 | 18 | ######### 19 | # Actions 20 | ######### 21 | 22 | action :create do 23 | # Pull a precompiled binary off the network 24 | remote_file docker_bin do 25 | source new_resource.source 26 | checksum new_resource.checksum 27 | owner 'root' 28 | group 'root' 29 | mode '0755' 30 | action :create 31 | end 32 | end 33 | 34 | action :delete do 35 | file docker_bin do 36 | action :delete 37 | end 38 | end 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker/libraries/docker_installation_package.rb: -------------------------------------------------------------------------------- 1 | module DockerCookbook 2 | class DockerInstallationPackage < DockerBase 3 | require_relative 'helpers_installation_package' 4 | 5 | include DockerHelpers::InstallationPackage 6 | 7 | # Resource properties 8 | resource_name :docker_installation_package 9 | 10 | property :package_name, String, default: 'docker-engine', desired_state: false 11 | property :package_version, String, default: lazy { version_string(version) }, desired_state: false 12 | property :version, String, default: lazy { default_docker_version }, desired_state: false 13 | property :package_options, String, desired_state: false 14 | 15 | # Actions 16 | action :create do 17 | package package_name do 18 | version package_version 19 | options package_options 20 | action :install 21 | end 22 | end 23 | 24 | action :delete do 25 | package package_name do 26 | action :remove 27 | end 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker/libraries/docker_installation_script.rb: -------------------------------------------------------------------------------- 1 | module DockerCookbook 2 | class DockerInstallationScript < DockerBase 3 | ##################### 4 | # Resource properties 5 | ##################### 6 | resource_name :docker_installation_script 7 | 8 | provides :docker_installation, os: 'linux' 9 | 10 | property :repo, %w(main test experimental), default: 'main', desired_state: false 11 | property :script_url, String, default: lazy { default_script_url }, desired_state: false 12 | 13 | default_action :create 14 | 15 | ################ 16 | # helper methods 17 | ################ 18 | 19 | def default_script_url 20 | case repo 21 | when 'main' 22 | 'https://get.docker.com/' 23 | when 'test' 24 | 'https://test.docker.com/' 25 | when 'experimental' 26 | 'https://experimental.docker.com/' 27 | end 28 | end 29 | 30 | ######### 31 | # Actions 32 | ######### 33 | 34 | action :create do 35 | package 'curl' do 36 | action :install 37 | end 38 | 39 | execute 'install docker' do 40 | command "curl -sSL #{script_url} | sh" 41 | creates '/usr/bin/docker' 42 | end 43 | end 44 | 45 | action :delete do 46 | package 'docker-engine' do 47 | action :remove 48 | end 49 | end 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker/libraries/docker_installation_tarball.rb: -------------------------------------------------------------------------------- 1 | module DockerCookbook 2 | class DockerInstallationTarball < DockerBase 3 | require_relative 'helpers_installation_tarball' 4 | 5 | include DockerHelpers::InstallationTarball 6 | 7 | ##################### 8 | # Resource properties 9 | ##################### 10 | resource_name :docker_installation_tarball 11 | 12 | property :checksum, String, default: lazy { default_checksum }, desired_state: false 13 | property :source, String, default: lazy { default_source }, desired_state: false 14 | property :version, String, default: lazy { default_version }, desired_state: false 15 | 16 | default_action :create 17 | 18 | ######### 19 | # Actions 20 | ######### 21 | 22 | action :create do 23 | # Pull a precompiled binary off the network 24 | remote_file docker_tarball do 25 | source new_resource.source 26 | checksum new_resource.checksum 27 | owner 'root' 28 | group 'root' 29 | mode '0755' 30 | action :create 31 | notifies :run, 'execute[extract tarball]', :immediately 32 | end 33 | 34 | execute 'extract tarball' do 35 | action :nothing 36 | command "tar -xzf #{docker_tarball} --strip-components=1 -C #{docker_bin_prefix}" 37 | creates docker_bin 38 | end 39 | end 40 | 41 | action :delete do 42 | file docker_bin do 43 | action :delete 44 | end 45 | end 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker/libraries/docker_registry.rb: -------------------------------------------------------------------------------- 1 | module DockerCookbook 2 | class DockerRegistry < DockerBase 3 | require 'docker' 4 | require_relative 'helpers_auth' 5 | 6 | resource_name :docker_registry 7 | 8 | property :email, [String, nil] 9 | property :password, [String, nil] 10 | property :serveraddress, [String, nil], name_property: true 11 | property :username, [String, nil] 12 | 13 | action :login do 14 | tries = api_retries 15 | 16 | registry_host = parse_registry_host(serveraddress) 17 | 18 | (node.run_state['docker_auth'] ||= {})[registry_host] = { 19 | 'serveraddress' => registry_host, 20 | 'username' => username, 21 | 'password' => password, 22 | 'email' => email, 23 | } 24 | 25 | begin 26 | Docker.connection.post( 27 | '/auth', {}, 28 | body: node.run_state['docker_auth'][registry_host].to_json 29 | ) 30 | rescue Docker::Error::ServerError, Docker::Error::UnauthorizedError 31 | raise Docker::Error::AuthenticationError, "#{username} failed to authenticate with #{serveraddress}" if (tries -= 1).zero? 32 | retry 33 | end 34 | 35 | true 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker/libraries/docker_service_manager_execute.rb: -------------------------------------------------------------------------------- 1 | module DockerCookbook 2 | class DockerServiceManagerExecute < DockerServiceBase 3 | resource_name :docker_service_manager_execute 4 | 5 | provides :docker_service_manager, os: 'linux' 6 | 7 | # Start the service 8 | action :start do 9 | # enable ipv4 forwarding 10 | execute 'enable net.ipv4.conf.all.forwarding' do 11 | command '/sbin/sysctl net.ipv4.conf.all.forwarding=1' 12 | not_if '/sbin/sysctl -q -n net.ipv4.conf.all.forwarding | grep ^1$' 13 | action :run 14 | end 15 | 16 | # enable ipv6 forwarding 17 | execute 'enable net.ipv6.conf.all.forwarding' do 18 | command '/sbin/sysctl net.ipv6.conf.all.forwarding=1' 19 | not_if '/sbin/sysctl -q -n net.ipv6.conf.all.forwarding | grep ^1$' 20 | action :run 21 | end 22 | 23 | # Go doesn't support detaching processes natively, so we have 24 | # to manually fork it from the shell with & 25 | # https://github.com/docker/docker/issues/2758 26 | bash "start docker #{name}" do 27 | code "#{docker_daemon_cmd} >> #{logfile} 2>&1 &" 28 | environment 'HTTP_PROXY' => http_proxy, 29 | 'HTTPS_PROXY' => https_proxy, 30 | 'NO_PROXY' => no_proxy, 31 | 'TMPDIR' => tmpdir 32 | not_if "ps -ef | grep -v grep | grep #{Shellwords.escape(docker_daemon_cmd)}" 33 | action :run 34 | end 35 | 36 | create_docker_wait_ready 37 | 38 | execute 'docker-wait-ready' do 39 | command "#{libexec_dir}/#{docker_name}-wait-ready" 40 | end 41 | end 42 | 43 | action :stop do 44 | execute "stop docker #{name}" do 45 | command "kill `cat #{pidfile}` && while [ -e #{pidfile} ]; do sleep 1; done" 46 | timeout 10 47 | only_if "#{docker_cmd} ps | head -n 1 | grep ^CONTAINER" 48 | end 49 | end 50 | 51 | action :restart do 52 | action_stop 53 | action_start 54 | end 55 | end 56 | end 57 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker/libraries/docker_service_manager_sysvinit_debian.rb: -------------------------------------------------------------------------------- 1 | module DockerCookbook 2 | class DockerServiceManagerSysvinitDebian < DockerServiceBase 3 | resource_name :docker_service_manager_sysvinit_debian 4 | 5 | provides :docker_service_manager, platform: 'debian' do |node| 6 | node['platform_version'].to_f < 8.0 7 | end 8 | 9 | provides :docker_service_manager, platform: 'ubuntu' do |node| 10 | node['platform_version'].to_f < 12.04 11 | end 12 | 13 | provides :docker_service_manager_sysvinit, platform: 'debian' do |node| 14 | node['platform_version'].to_f < 8.0 15 | end 16 | 17 | provides :docker_service_manager_sysvinit, platform: 'ubuntu' do |node| 18 | node['platform_version'].to_f < 12.04 19 | end 20 | 21 | action :start do 22 | create_docker_wait_ready 23 | create_init 24 | create_service 25 | end 26 | 27 | action :stop do 28 | create_init 29 | s = create_service 30 | s.action :stop 31 | end 32 | 33 | action :restart do 34 | action_stop 35 | action_start 36 | end 37 | 38 | action_class.class_eval do 39 | def create_init 40 | execute 'groupadd docker' do 41 | not_if 'getent group docker' 42 | action :run 43 | end 44 | 45 | link "/usr/bin/#{docker_name}" do 46 | to '/usr/bin/docker' 47 | link_type :hard 48 | action :create 49 | not_if { docker_name == 'docker' } 50 | end 51 | 52 | template "/etc/init.d/#{docker_name}" do 53 | source 'sysvinit/docker-debian.erb' 54 | owner 'root' 55 | group 'root' 56 | mode '0755' 57 | variables( 58 | docker_name: docker_name, 59 | docker_daemon_arg: docker_daemon_arg, 60 | docker_wait_ready: "#{libexec_dir}/#{docker_name}-wait-ready" 61 | ) 62 | cookbook 'docker' 63 | action :create 64 | end 65 | 66 | template "/etc/default/#{docker_name}" do 67 | source 'default/docker.erb' 68 | variables( 69 | config: new_resource, 70 | docker_daemon: docker_daemon, 71 | docker_daemon_opts: docker_daemon_opts.join(' ') 72 | ) 73 | cookbook 'docker' 74 | action :create 75 | end 76 | end 77 | 78 | def create_service 79 | service docker_name do 80 | provider Chef::Provider::Service::Init::Debian 81 | supports restart: true, status: true 82 | action [:enable, :start] 83 | end 84 | end 85 | end 86 | end 87 | end 88 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker/libraries/docker_service_manager_sysvinit_rhel.rb: -------------------------------------------------------------------------------- 1 | module DockerCookbook 2 | class DockerServiceManagerSysvinitRhel < DockerServiceBase 3 | resource_name :docker_service_manager_sysvinit_rhel 4 | 5 | provides :docker_service_manager, platform: 'amazon' 6 | provides :docker_service_manager, platform: 'suse' 7 | provides :docker_service_manager, platform: %w(redhat centos scientific oracle) do |node| # ~FC005 8 | node['platform_version'].to_f <= 7.0 9 | end 10 | 11 | provides :docker_service_manager_sysvinit, platform: 'amazon' 12 | provides :docker_service_manager_sysvinit, platform: 'suse' 13 | provides :docker_service_manager_sysvinit, platform: %w(redhat centos scientific oracle) do |node| # ~FC005 14 | node['platform_version'].to_f <= 7.0 15 | end 16 | 17 | action :start do 18 | create_docker_wait_ready 19 | create_init 20 | create_service 21 | end 22 | 23 | action :stop do 24 | create_init 25 | s = create_service 26 | s.action :stop 27 | end 28 | 29 | action :restart do 30 | action_stop 31 | action_start 32 | end 33 | 34 | action_class.class_eval do 35 | def create_init 36 | execute 'groupadd docker' do 37 | not_if 'getent group docker' 38 | action :run 39 | end 40 | 41 | link "/usr/bin/#{docker_name}" do 42 | to '/usr/bin/docker' 43 | link_type :hard 44 | action :create 45 | not_if { docker_name == 'docker' } 46 | end 47 | 48 | template "/etc/init.d/#{docker_name}" do 49 | source 'sysvinit/docker-rhel.erb' 50 | owner 'root' 51 | group 'root' 52 | mode '0755' 53 | variables( 54 | docker_name: docker_name, 55 | docker_daemon_arg: docker_daemon_arg, 56 | docker_wait_ready: "#{libexec_dir}/#{docker_name}-wait-ready" 57 | ) 58 | cookbook 'docker' 59 | action :create 60 | end 61 | 62 | template "/etc/sysconfig/#{docker_name}" do 63 | source 'sysconfig/docker.erb' 64 | variables( 65 | config: new_resource, 66 | docker_daemon_opts: docker_daemon_opts.join(' ') 67 | ) 68 | cookbook 'docker' 69 | action :create 70 | end 71 | end 72 | 73 | def create_service 74 | service docker_name do 75 | supports restart: true, status: true 76 | action [:enable, :start] 77 | end 78 | end 79 | end 80 | end 81 | end 82 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker/libraries/docker_service_manager_upstart.rb: -------------------------------------------------------------------------------- 1 | module DockerCookbook 2 | class DockerServiceManagerUpstart < DockerServiceBase 3 | resource_name :docker_service_manager_upstart 4 | 5 | provides :docker_service_manager, platform: 'ubuntu' 6 | provides :docker_service_manager, platform: 'linuxmint' 7 | 8 | action :start do 9 | create_docker_wait_ready 10 | 11 | template "/etc/init/#{docker_name}.conf" do 12 | source 'upstart/docker.conf.erb' 13 | owner 'root' 14 | group 'root' 15 | mode '0644' 16 | variables( 17 | docker_name: docker_name, 18 | docker_daemon_arg: docker_daemon_arg, 19 | docker_wait_ready: "#{libexec_dir}/#{docker_name}-wait-ready" 20 | ) 21 | cookbook 'docker' 22 | action :create 23 | end 24 | 25 | template "/etc/default/#{docker_name}" do 26 | source 'default/docker.erb' 27 | variables( 28 | config: new_resource, 29 | docker_daemon: docker_daemon, 30 | docker_daemon_opts: docker_daemon_opts.join(' ') 31 | ) 32 | cookbook 'docker' 33 | action :create 34 | end 35 | 36 | # Upstart broken in 12.17.44 37 | # https://github.com/chef/chef/issues/2819 ish.. 38 | # 39 | # hack around this until it gets fixed in Chef proper 40 | # 41 | # service docker_name do 42 | # provider Chef::Provider::Service::Upstart 43 | # supports status: true 44 | # action :start 45 | # end 46 | 47 | execute '/sbin/initctl start docker' do 48 | only_if '/sbin/status docker | grep "stop/waiting"' 49 | end 50 | end 51 | 52 | action :stop do 53 | # Upstart broken in 12.17.44 54 | # https://github.com/chef/chef/issues/2819 ish.. 55 | # 56 | # hack around this until it gets fixed in Chef proper 57 | # 58 | # service docker_name do 59 | # provider Chef::Provider::Service::Upstart 60 | # supports status: true 61 | # action :stop 62 | # end 63 | 64 | execute '/sbin/initctl stop docker' do 65 | not_if '/sbin/status docker | grep "stop/waiting"' 66 | end 67 | end 68 | 69 | action :restart do 70 | action_stop 71 | action_start 72 | end 73 | end 74 | end 75 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker/libraries/docker_tag.rb: -------------------------------------------------------------------------------- 1 | module DockerCookbook 2 | class DockerTag < DockerBase 3 | resource_name :docker_tag 4 | 5 | property :target_repo, String, name_property: true 6 | property :target_tag, String 7 | property :to_repo, String 8 | property :to_tag, String 9 | property :force, Boolean, default: false 10 | 11 | ######### 12 | # Actions 13 | ######### 14 | 15 | action :tag do 16 | return if force == false && Docker::Image.exist?("#{to_repo}:#{to_tag}") 17 | begin 18 | converge_by "update #{target_repo}:#{target_tag} to #{to_repo}:#{to_tag}" do 19 | i = Docker::Image.get("#{target_repo}:#{target_tag}") 20 | i.tag('repo' => to_repo, 'tag' => to_tag, 'force' => force) 21 | end 22 | rescue Docker::Error => e 23 | raise e.message 24 | end 25 | end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker/libraries/docker_volume.rb: -------------------------------------------------------------------------------- 1 | module DockerCookbook 2 | class DockerVolume < DockerBase 3 | require 'docker' 4 | 5 | resource_name :docker_volume 6 | 7 | property :driver, String, desired_state: false 8 | property :host, [String, nil], default: lazy { default_host }, desired_state: false 9 | property :opts, [String, Array, nil], desired_state: false 10 | property :volume, Docker::Volume, desired_state: false 11 | property :volume_name, String, name_property: true 12 | 13 | load_current_value do 14 | begin 15 | with_retries { volume Docker::Volume.get(volume_name, connection) } 16 | rescue Docker::Error::NotFoundError 17 | current_value_does_not_exist! 18 | end 19 | end 20 | 21 | action :create do 22 | converge_by "creating volume #{volume_name}" do 23 | Docker::Volume.create(volume_name, {}, connection) 24 | end if volume.nil? 25 | end 26 | 27 | action :remove do 28 | converge_by "removing volume #{volume_name}" do 29 | volume.remove 30 | end unless volume.nil? 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker/libraries/helpers_auth.rb: -------------------------------------------------------------------------------- 1 | module DockerCookbook 2 | module DockerHelpers 3 | module Authentication 4 | # https://github.com/docker/docker/blob/4fcb9ac40ce33c4d6e08d5669af6be5e076e2574/registry/auth.go#L231 5 | def parse_registry_host(val) 6 | val.sub(%r{https?://}, '').split('/').first 7 | end 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker/libraries/helpers_installation_tarball.rb: -------------------------------------------------------------------------------- 1 | module DockerCookbook 2 | module DockerHelpers 3 | module InstallationTarball 4 | def docker_bin_prefix 5 | '/usr/bin' 6 | end 7 | 8 | def docker_bin 9 | "#{docker_bin_prefix}/docker" 10 | end 11 | 12 | def docker_tarball 13 | "#{Chef::Config[:file_cache_path]}/docker-#{version}.tgz" 14 | end 15 | 16 | def docker_kernel 17 | node['kernel']['name'] 18 | end 19 | 20 | def docker_arch 21 | node['kernel']['machine'] 22 | end 23 | 24 | def default_source 25 | "https://get.docker.com/builds/#{docker_kernel}/#{docker_arch}/docker-#{version}.tgz" 26 | end 27 | 28 | def default_checksum 29 | case docker_kernel 30 | when 'Darwin' 31 | case version 32 | when '1.11.0' then '25e4f5f37e2e17beb20e5a468674750350824059bdeeca09d6a941bca8fc4f73' 33 | when '1.11.1' then '6d35487fbcc7e3f722f3d5f3e5c070a41d87c88e3770f52ae28460a689c40efd' 34 | when '1.11.2' then 'f44da1025c355c51ae6e150fcc0672b87a738b9c8ad98e5fa6091502211da19a' 35 | end 36 | when 'Linux' 37 | case version 38 | when '1.11.0' then '87331b3b75d32d3de5d507db9a19a24dd30ff9b2eb6a5a9bdfaba954da15e16b' 39 | when '1.11.1' then '893e3c6e89c0cd2c5f1e51ea41bc2dd97f5e791fcfa3cee28445df277836339d' 40 | when '1.11.2' then '8c2e0c35e3cda11706f54b2d46c2521a6e9026a7b13c7d4b8ae1f3a706fc55e1' 41 | end 42 | end 43 | end 44 | 45 | def default_version 46 | '1.11.2' 47 | end 48 | end 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker/metadata.json: -------------------------------------------------------------------------------- 1 | {"name":"docker","version":"2.13.10","description":"Provides docker_service, docker_image, and docker_container resources","long_description":"","maintainer":"Cookbook Engineering Team","maintainer_email":"cookbooks@chef.io","license":"Apache 2.0","platforms":{"amazon":">= 0.0.0","centos":">= 0.0.0","scientific":">= 0.0.0","oracle":">= 0.0.0","debian":">= 0.0.0","fedora":">= 0.0.0","redhat":">= 0.0.0","ubuntu":">= 0.0.0"},"dependencies":{"compat_resource":">= 12.16.2"},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{}} -------------------------------------------------------------------------------- /vendor-cookbooks/docker/templates/default/default/docker-wait-ready.erb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | i=0 3 | while [ $i -lt <%= @service_timeout * 2 %> ]; do 4 | <%= @docker_cmd %> ps | head -n 1 | grep ^CONTAINER > /dev/null 2>&1 5 | [ $? -eq 0 ] && break 6 | ((i++)) 7 | sleep 0.5 8 | done 9 | [ $i -eq <%= @service_timeout * 2 %> ] && exit 1 10 | exit 0 11 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker/templates/default/default/docker.erb: -------------------------------------------------------------------------------- 1 | # Docker Upstart and SysVinit configuration file 2 | 3 | # Customize location of Docker binary (especially for development testing). 4 | DOCKER="<%= @docker_daemon %>" 5 | 6 | # Use DOCKER_OPTS to modify the daemon startup options. 7 | DOCKER_OPTS="<%= @docker_daemon_opts %>" 8 | 9 | # If you need Docker to use an HTTP proxy, it can also be specified here. 10 | <% if @config.http_proxy %> 11 | export http_proxy="<%= @config.http_proxy %>" 12 | <% end %> 13 | <% if @config.https_proxy %> 14 | export https_proxy="<%= @config.https_proxy %>" 15 | <% end %> 16 | 17 | <% if @config.no_proxy %> 18 | export no_proxy="<%= @config.no_proxy %>" 19 | <% end %> 20 | 21 | # This is also a handy place to tweak where Docker's temporary files go. 22 | <% if @config.tmpdir %> 23 | export TMPDIR="<%= @config.tmpdir %>" 24 | <% end %> 25 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker/templates/default/sysconfig/docker.erb: -------------------------------------------------------------------------------- 1 | # /etc/sysconfig/docker 2 | # 3 | # Other arguments to pass to the docker daemon process 4 | # These will be parsed by the sysv initscript and appended 5 | # to the arguments list passed to docker 6 | 7 | other_args="<%= @docker_daemon_opts %>" 8 | 9 | # If you need Docker to use an HTTP proxy, it can also be specified here. 10 | <% if @config.http_proxy %> 11 | export http_proxy="<%= @config.http_proxy %>" 12 | <% end %> 13 | <% if @config.https_proxy %> 14 | export https_proxy="<%= @config.https_proxy %>" 15 | <% end %> 16 | 17 | <% if @config.no_proxy %> 18 | export no_proxy="<%= @config.no_proxy %>" 19 | <% end %> 20 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker/templates/default/systemd/docker.service-override.erb: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Docker Application Container Engine 3 | Documentation=http://docs.docker.com 4 | After=network.target 5 | 6 | [Service] 7 | Type=notify 8 | <% if @config.http_proxy %> 9 | Environment="HTTP_PROXY=<%= @config.http_proxy %>" 10 | <% end %> 11 | <% if @config.https_proxy %> 12 | Environment="HTTPS_PROXY=<%= @config.https_proxy %>" 13 | <% end %> 14 | <% if @config.no_proxy %> 15 | Environment="NO_PROXY=<%= @config.no_proxy %>" 16 | <% end %> 17 | <% if @config.tmpdir %> 18 | Environment="TMPDIR=<%= @config.tmpdir %>" 19 | <% end %> 20 | <% if @config.ipv4_forward %> 21 | ExecStartPre=/sbin/sysctl -w net.ipv4.ip_forward=1 22 | <% end %> 23 | <% if @config.ipv6_forward %> 24 | ExecStartPre=/sbin/sysctl -w net.ipv6.conf.all.forwarding=1 25 | <% end %> 26 | ExecStart=<%= @docker_daemon_cmd %> 27 | ExecStartPost=<%= @docker_wait_ready %> 28 | Restart=always 29 | MountFlags=<%= @docker_mount_flags %> 30 | LimitNOFILE=1048576 31 | LimitNPROC=1048576 32 | LimitCORE=infinity 33 | <%= @systemd_args %> 34 | 35 | [Install] 36 | WantedBy=multi-user.target 37 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker/templates/default/systemd/docker.service.erb: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Docker Application Container Engine 3 | Documentation=https://docs.docker.com 4 | After=network.target <%= @docker_name %>.socket 5 | Requires=<%= @docker_name %>.socket 6 | 7 | [Service] 8 | Type=notify 9 | ExecStart=/usr/bin/docker daemon -H fd:// 10 | MountFlags=<%= @docker_mount_flags %> 11 | LimitNOFILE=1048576 12 | LimitNPROC=1048576 13 | LimitCORE=infinity 14 | TasksMax=1048576 15 | TimeoutStartSec=0 16 | 17 | [Install] 18 | WantedBy=multi-user.target 19 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker/templates/default/systemd/docker.socket-override.erb: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Docker Socket for the API 3 | PartOf=<%= @docker_name %>.service 4 | 5 | [Socket] 6 | ListenStream=<%= @docker_socket %> 7 | SocketMode=0660 8 | SocketUser=root 9 | SocketGroup=<%= @config.group %> 10 | 11 | [Install] 12 | WantedBy=sockets.target 13 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker/templates/default/systemd/docker.socket.erb: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Docker Socket for the API 3 | PartOf=<%= @docker_name %>.service 4 | 5 | [Socket] 6 | ListenStream=<%= @docker_socket %> 7 | SocketMode=0660 8 | SocketUser=root 9 | SocketGroup=docker 10 | 11 | [Install] 12 | WantedBy=sockets.target 13 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker/templates/default/systemd/tmpfiles.d.conf.erb: -------------------------------------------------------------------------------- 1 | d /var/run/docker 0755 root <%= @config.group || 'root' %> - 2 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker/templates/default/upstart/docker.conf.erb: -------------------------------------------------------------------------------- 1 | description "Docker daemon" 2 | 3 | start on (filesystem and net-device-up IFACE!=lo) 4 | stop on runlevel [!2345] 5 | limit nofile 524288 1048576 6 | limit nproc 524288 1048576 7 | 8 | respawn 9 | 10 | kill timeout 20 11 | 12 | pre-start script 13 | # see also https://github.com/tianon/cgroupfs-mount/blob/master/cgroupfs-mount 14 | if grep -v '^#' /etc/fstab | grep -q cgroup \ 15 | || [ ! -e /proc/cgroups ] \ 16 | || [ ! -d /sys/fs/cgroup ]; then 17 | exit 0 18 | fi 19 | if ! mountpoint -q /sys/fs/cgroup; then 20 | mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup 21 | fi 22 | ( 23 | cd /sys/fs/cgroup 24 | for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do 25 | mkdir -p $sys 26 | if ! mountpoint -q $sys; then 27 | if ! mount -n -t cgroup -o $sys cgroup $sys; then 28 | rmdir $sys || true 29 | fi 30 | fi 31 | done 32 | ) 33 | end script 34 | 35 | script 36 | # modify these in /etc/default/$UPSTART_JOB (/etc/default/docker) 37 | DOCKER=/usr/bin/dockerd 38 | DOCKER_OPTS= 39 | if [ -f /etc/default/$UPSTART_JOB ]; then 40 | . /etc/default/$UPSTART_JOB 41 | fi 42 | exec "$DOCKER" <%= @docker_daemon_arg %> $DOCKER_OPTS --raw-logs 43 | end script 44 | 45 | post-start script 46 | DOCKER_OPTS= 47 | if [ -f /etc/default/$UPSTART_JOB ]; then 48 | . /etc/default/$UPSTART_JOB 49 | fi 50 | <%= @docker_wait_ready %> 51 | if [ $? -eq 0 ]; then 52 | echo "<%= @docker_socket %> is up" 53 | else 54 | echo "<%= @docker_socket %> failed to come start" 55 | exit 1 56 | fi 57 | end script 58 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker_compose/HISTORY.md: -------------------------------------------------------------------------------- 1 | # Release History 2 | 3 | ## vNEXT 4 | 5 | ## v0.1.1 6 | 7 | * Added support for docker-compose's --remove-orphans parameter. 8 | * The cookbook is now compatible with CentOS. 9 | * Improved cookbook documentation. 10 | 11 | ## v0.1.0 12 | 13 | * Initial release. 14 | 15 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker_compose/attributes/default.rb: -------------------------------------------------------------------------------- 1 | default['docker_compose']['release'] = '1.8.0' 2 | default['docker_compose']['command_path'] = '/usr/local/bin/docker-compose' -------------------------------------------------------------------------------- /vendor-cookbooks/docker_compose/chefignore: -------------------------------------------------------------------------------- 1 | # Put files/directories that should be ignored in this file when uploading 2 | # to a chef-server or supermarket. 3 | # Lines that start with '# ' are comments. 4 | 5 | # OS generated files # 6 | ###################### 7 | .DS_Store 8 | Icon? 9 | nohup.out 10 | ehthumbs.db 11 | Thumbs.db 12 | 13 | # SASS # 14 | ######## 15 | .sass-cache 16 | 17 | # EDITORS # 18 | ########### 19 | \#* 20 | .#* 21 | *~ 22 | *.sw[a-z] 23 | *.bak 24 | REVISION 25 | TAGS* 26 | tmtags 27 | *_flymake.* 28 | *_flymake 29 | *.tmproj 30 | .project 31 | .settings 32 | mkmf.log 33 | 34 | ## COMPILED ## 35 | ############## 36 | a.out 37 | *.o 38 | *.pyc 39 | *.so 40 | *.com 41 | *.class 42 | *.dll 43 | *.exe 44 | */rdoc/ 45 | 46 | # Testing # 47 | ########### 48 | .watchr 49 | .rspec 50 | spec/* 51 | spec/fixtures/* 52 | test/* 53 | features/* 54 | examples/* 55 | Guardfile 56 | Procfile 57 | .kitchen* 58 | .rubocop.yml 59 | spec/* 60 | Rakefile 61 | .travis.yml 62 | .foodcritic 63 | .codeclimate.yml 64 | 65 | # SCM # 66 | ####### 67 | .git 68 | */.git 69 | .gitignore 70 | .gitmodules 71 | .gitconfig 72 | .gitattributes 73 | .svn 74 | */.bzr/* 75 | */.hg/* 76 | */.svn/* 77 | 78 | # Berkshelf # 79 | ############# 80 | Berksfile 81 | Berksfile.lock 82 | cookbooks/* 83 | tmp 84 | 85 | # Cookbooks # 86 | ############# 87 | CONTRIBUTING* 88 | CHANGELOG* 89 | TESTING* 90 | MAINTAINERS.toml 91 | 92 | # Strainer # 93 | ############ 94 | Colanderfile 95 | Strainerfile 96 | .colander 97 | .strainer 98 | 99 | # Vagrant # 100 | ########### 101 | .vagrant 102 | Vagrantfile 103 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker_compose/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "docker_compose", 3 | "description": "Installs docker_compose and provides the docker_compose_application resource.", 4 | "long_description": "Installs docker_compose and provides the docker_compose_application resource.", 5 | "maintainer": "Sebastian Boschert", 6 | "maintainer_email": "sebastian@2007.org", 7 | "license": "Apache v2.0", 8 | "platforms": { 9 | "debian": ">= 0.0.0", 10 | "ubuntu": ">= 0.0.0", 11 | "redhat": ">= 0.0.0", 12 | "centos": ">= 0.0.0" 13 | }, 14 | "dependencies": { 15 | 16 | }, 17 | "recommendations": { 18 | 19 | }, 20 | "suggestions": { 21 | 22 | }, 23 | "conflicting": { 24 | 25 | }, 26 | "providing": { 27 | 28 | }, 29 | "replacing": { 30 | 31 | }, 32 | "attributes": { 33 | 34 | }, 35 | "groupings": { 36 | 37 | }, 38 | "recipes": { 39 | 40 | }, 41 | "version": "0.1.1", 42 | "source_url": "https://github.com/sboschert/chef-cookbook-docker_compose", 43 | "issues_url": "https://github.com/sboschert/chef-cookbook-docker_compose/issues", 44 | "privacy": false, 45 | "chef_versions": [ 46 | [ 47 | ">= 12" 48 | ] 49 | ], 50 | "ohai_versions": [ 51 | 52 | ], 53 | "gems": [ 54 | 55 | ] 56 | } 57 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker_compose/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: docker_compose 3 | # Recipe:: default 4 | # 5 | # Copyright (c) 2016 Sebastian Boschert, All Rights Reserved. 6 | 7 | include_recipe 'docker_compose::default' -------------------------------------------------------------------------------- /vendor-cookbooks/docker_compose/recipes/installation.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: docker_compose 3 | # Recipe:: installation 4 | # 5 | # Copyright (c) 2016 Sebastian Boschert, All Rights Reserved. 6 | 7 | def get_install_url 8 | release = node['docker_compose']['release'] 9 | kernel_name = node['kernel']['name'] 10 | machine_hw_name = node['kernel']['machine'] 11 | "https://github.com/docker/compose/releases/download/#{release}/docker-compose-#{kernel_name}-#{machine_hw_name}" 12 | end 13 | 14 | command_path = node['docker_compose']['command_path'] 15 | install_url = get_install_url 16 | 17 | package 'curl' do 18 | action :install 19 | end 20 | 21 | directory '/etc/docker-compose' do 22 | action :create 23 | owner 'root' 24 | group 'docker' 25 | mode '0750' 26 | end 27 | 28 | execute 'install docker-compose' do 29 | action :run 30 | command "curl -sSL #{install_url} > #{command_path} && chmod +x #{command_path}" 31 | creates command_path 32 | user 'root' 33 | group 'docker' 34 | umask '0027' 35 | end 36 | -------------------------------------------------------------------------------- /vendor-cookbooks/docker_compose/resources/application.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: docker_compose 3 | # Resource:: application 4 | # 5 | # Copyright (c) 2016 Sebastian Boschert, All Rights Reserved. 6 | 7 | property :project_name, kind_of: String, name_property: true 8 | property :compose_files, kind_of: Array, required: true 9 | property :remove_orphans, kind_of: [TrueClass, FalseClass], default: false 10 | 11 | default_action :up 12 | 13 | def get_compose_params 14 | "-p #{project_name}" + 15 | ' -f ' + compose_files.join(' -f ') 16 | end 17 | 18 | def get_up_params 19 | '-d' + 20 | (remove_orphans ? ' --remove-orphans' : '') 21 | end 22 | 23 | def get_down_params 24 | (remove_orphans ? ' --remove-orphans' : '') 25 | end 26 | 27 | action :up do 28 | execute "running docker-compose up for project #{project_name}" do 29 | command "docker-compose #{get_compose_params} up #{get_up_params}" 30 | user 'root' 31 | group 'root' 32 | end 33 | end 34 | 35 | 36 | action :down do 37 | execute "running docker-compose down for project #{project_name}" do 38 | command "docker-compose #{get_compose_params} down #{get_down_params}" 39 | user 'root' 40 | group 'root' 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /vendor-cookbooks/magic_shell/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | magic_shell CHANGELOG 2 | ===================== 3 | 4 | 1.0.0 5 | ----- 6 | * Refactor providers to support whyrun mode 7 | * Package custom ChefSpec matchers 8 | * Add Test Kitchen integration test 9 | * Update ChefSpec tests 10 | * Expand environment variables (like `$PATH`) 11 | * Add Rakefile for running tests 12 | * Use the latest and greatest testing strategies 13 | 14 | 0.3.1, 0.3.2 15 | ------------ 16 | 17 | * **No changes** - chefigonre with `knife cookbook site share` was being ignored, so unnecessary artifacts were uploaded 18 | 19 | 0.3.0 20 | ---- 21 | 22 | * Full test suite 23 | * Test with strainer 24 | * Support for cross-Chef version default_action 25 | 26 | 0.2.0 27 | ---- 28 | 29 | * Add `magic_shell_environment` 30 | 31 | 0.1.5 32 | ---- 33 | 34 | * The default action for the alias resource is now :add 35 | 36 | 0.1.4 37 | ----- 38 | 39 | * The default action for the alias resource is now :create 40 | * Formatting changes to the metadata, README, and CHANGELOG 41 | 42 | 0.1.3 43 | ----- 44 | 45 | * Address FC0016 - specify a default action 46 | * Add integration with Travis CI 47 | 48 | 0.1.2 49 | ----- 50 | 51 | * Update the README to indicate that you need to specify an action (:add or :remove) 52 | 53 | 0.1.1 54 | ----- 55 | 56 | * Rename the resource and provider files 57 | 58 | 0.1.0 59 | ----- 60 | 61 | * Initial release of magic_shell 62 | -------------------------------------------------------------------------------- /vendor-cookbooks/magic_shell/README.md: -------------------------------------------------------------------------------- 1 | magic_shell Cookbook 2 | ==================== 3 | [![Build Status](https://secure.travis-ci.org/customink-webops/magic_shell.png)](http://travis-ci.org/customink-webops/magic_shell) 4 | 5 | Provides utility for adding some syntactic sugar to your shell. 6 | 7 | Usage 8 | ----- 9 | Update the `metadata.rb` for your cookbook to depend on magic_shell 10 | 11 | ```ruby 12 | depends 'magic_shell' 13 | ``` 14 | 15 | Use the `magic_shell_alias` resource to create a command alias. 16 | 17 | ```ruby 18 | magic_shell_alias 'myrailsapp' do 19 | command 'cd /opt/myrailsapp/current' 20 | end 21 | ``` 22 | 23 | This will alias `myrailsapp` to `cd /opt/myrailsapp/current`. 24 | 25 | You can also remove aliases: 26 | 27 | ```ruby 28 | magic_shell_alias 'myrailsapp' do 29 | action :remove 30 | end 31 | ``` 32 | 33 | Use the `magic_shell_environment` resource to create a shell environment variable. 34 | 35 | ```ruby 36 | magic_shell_environment 'EDITOR' do 37 | value 'vim' 38 | end 39 | ``` 40 | 41 | This will export an `EDITOR` environment variable with a value of `vim`. 42 | 43 | You can also remove environment variables: 44 | 45 | ```ruby 46 | magic_shell_environment 'EDITOR' do 47 | action :remove 48 | end 49 | ``` 50 | 51 | Contributing 52 | ------------ 53 | 1. Fork the repo 54 | 2. Create a feature branch 55 | 3. Code, document, write specs, test 56 | 4. Submit a PR 57 | 58 | 59 | License & Authors 60 | ----------------- 61 | - Author: Nathen Harvey 62 | - Author: Seth Vargo 63 | 64 | ```text 65 | Copyright 2012-2014 CustomInk, LLC. 66 | 67 | Licensed under the Apache License, Version 2.0 (the "License"); 68 | you may not use this file except in compliance with the License. 69 | You may obtain a copy of the License at 70 | 71 | http://www.apache.org/licenses/LICENSE-2.0 72 | 73 | Unless required by applicable law or agreed to in writing, software 74 | distributed under the License is distributed on an "AS IS" BASIS, 75 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 76 | See the License for the specific language governing permissions and 77 | limitations under the License. 78 | ``` 79 | -------------------------------------------------------------------------------- /vendor-cookbooks/magic_shell/libraries/matchers.rb: -------------------------------------------------------------------------------- 1 | if defined?(ChefSpec) 2 | def add_magic_shell_alias(name) 3 | ChefSpec::Matchers::ResourceMatcher.new(:magic_shell_alias, :add, name) 4 | end 5 | 6 | def remove_magic_shell_alias(name) 7 | ChefSpec::Matchers::ResourceMatcher.new(:magic_shell_alias, :remove, name) 8 | end 9 | 10 | def add_magic_shell_environment(name) 11 | ChefSpec::Matchers::ResourceMatcher.new(:magic_shell_environment, :add, name) 12 | end 13 | 14 | def remove_magic_shell_environment(name) 15 | ChefSpec::Matchers::ResourceMatcher.new(:magic_shell_environment, :remove, name) 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /vendor-cookbooks/magic_shell/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "magic_shell", 3 | "version": "1.0.0", 4 | "description": "Installs/Configures command_alias", 5 | "long_description": "magic_shell Cookbook\n====================\n[![Build Status](https://secure.travis-ci.org/customink-webops/magic_shell.png)](http://travis-ci.org/customink-webops/magic_shell)\n\nProvides utility for adding some syntactic sugar to your shell.\n\nUsage\n-----\nUpdate the `metadata.rb` for your cookbook to depend on magic_shell\n\n```ruby\ndepends 'magic_shell'\n```\n\nUse the `magic_shell_alias` resource to create a command alias.\n\n```ruby\nmagic_shell_alias 'myrailsapp' do\n command 'cd /opt/myrailsapp/current'\nend\n```\n\nThis will alias `myrailsapp` to `cd /opt/myrailsapp/current`.\n\nYou can also remove aliases:\n\n```ruby\nmagic_shell_alias 'myrailsapp' do\n action :remove\nend\n```\n\nUse the `magic_shell_environment` resource to create a shell environment variable.\n\n```ruby\nmagic_shell_environment 'EDITOR' do\n value 'vim'\nend\n```\n\nThis will export an `EDITOR` environment variable with a value of `vim`.\n\nYou can also remove environment variables:\n\n```ruby\nmagic_shell_environment 'EDITOR' do\n action :remove\nend\n```\n\nContributing\n------------\n1. Fork the repo\n2. Create a feature branch\n3. Code, document, write specs, test\n4. Submit a PR\n\n\nLicense & Authors\n-----------------\n- Author: Nathen Harvey \n- Author: Seth Vargo \n\n```text\nCopyright 2012-2014 CustomInk, LLC.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n", 6 | "maintainer": "CustomInk, LLC", 7 | "maintainer_email": "webops@customink.com", 8 | "license": "Apache 2.0", 9 | "platforms": { 10 | }, 11 | "dependencies": { 12 | }, 13 | "recommendations": { 14 | }, 15 | "suggestions": { 16 | }, 17 | "conflicting": { 18 | }, 19 | "providing": { 20 | }, 21 | "replacing": { 22 | }, 23 | "attributes": { 24 | }, 25 | "groupings": { 26 | }, 27 | "recipes": { 28 | } 29 | } -------------------------------------------------------------------------------- /vendor-cookbooks/magic_shell/providers/alias.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: magic_shell 3 | # Provider:: alias 4 | # 5 | # Author:: Nathen Harvey 6 | # Author:: Seth Vargo 7 | # 8 | # Copyright 2012-2014, CustomInk, LLC. 9 | # 10 | # Licensed under the Apache License, Version 2.0 (the "License"); 11 | # you may not use this file except in compliance with the License. 12 | # You may obtain a copy of the License at 13 | # 14 | # http://www.apache.org/licenses/LICENSE-2.0 15 | # 16 | # Unless required by applicable law or agreed to in writing, software 17 | # distributed under the License is distributed on an "AS IS" BASIS, 18 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | # See the License for the specific language governing permissions and 20 | # limitations under the License. 21 | # 22 | 23 | # 24 | # Delegate update actions to inline resources 25 | # 26 | use_inline_resources 27 | 28 | # 29 | # This provider supports why-run mode. 30 | # 31 | def whyrun_supported? 32 | true 33 | end 34 | 35 | # 36 | # Create a file entry for the given alias. 37 | # 38 | action :add do 39 | file = Chef::Resource::File.new(destination, run_context) 40 | file.owner('root') 41 | file.group('root') 42 | file.mode('0755') 43 | file.content(<<-EOH.gsub(/^ {8}/, '')) 44 | # 45 | # This file was generated by Chef for #{node['fqdn']} 46 | # Do NOT modify this file by hand! 47 | # 48 | 49 | alias #{new_resource.alias_name}="#{new_resource.command}" 50 | EOH 51 | file.run_action(:create) 52 | end 53 | 54 | # 55 | # Delete the file entry for the given alias. 56 | # 57 | action :remove do 58 | file = Chef::Resource::File.new(destination, run_context) 59 | file.run_action(:delete) 60 | end 61 | 62 | def destination 63 | "/etc/profile.d/#{filename}.sh" 64 | end 65 | 66 | def filename 67 | new_resource.alias_name.to_s.gsub(/\s/, '_') 68 | end 69 | -------------------------------------------------------------------------------- /vendor-cookbooks/magic_shell/providers/environment.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: magic_shell 3 | # Provider:: environment 4 | # 5 | # Author:: Nathen Harvey 6 | # Author:: Seth Vargo 7 | # 8 | # Copyright 2012-2014, CustomInk, LLC. 9 | # 10 | # Licensed under the Apache License, Version 2.0 (the "License"); 11 | # you may not use this file except in compliance with the License. 12 | # You may obtain a copy of the License at 13 | # 14 | # http://www.apache.org/licenses/LICENSE-2.0 15 | # 16 | # Unless required by applicable law or agreed to in writing, software 17 | # distributed under the License is distributed on an "AS IS" BASIS, 18 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | # See the License for the specific language governing permissions and 20 | # limitations under the License. 21 | # 22 | 23 | # 24 | # Delegate update actions to inline resources 25 | # 26 | use_inline_resources 27 | 28 | # 29 | # This provider supports why-run mode. 30 | # 31 | def whyrun_supported? 32 | true 33 | end 34 | 35 | # 36 | # Create a file entry for the given environment. 37 | # 38 | action :add do 39 | file = Chef::Resource::File.new(destination, run_context) 40 | file.owner('root') 41 | file.group('root') 42 | file.mode('0755') 43 | file.content(<<-EOH.gsub(/^ {8}/, '')) 44 | # 45 | # This file was generated by Chef for #{node['fqdn']} 46 | # Do NOT modify this file by hand! 47 | # 48 | 49 | export #{new_resource.environment_variable}="#{new_resource.value}" 50 | EOH 51 | file.run_action(:create) 52 | end 53 | 54 | # 55 | # 56 | # 57 | action :remove do 58 | file = Chef::Resource::File.new(destination, run_context) 59 | file.run_action(:delete) 60 | end 61 | 62 | def destination 63 | "/etc/profile.d/#{filename}.sh" 64 | end 65 | 66 | def filename 67 | new_resource.environment_variable.to_s.gsub(/\s/, '_') 68 | end 69 | -------------------------------------------------------------------------------- /vendor-cookbooks/magic_shell/resources/alias.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: magic_shell 3 | # Resource:: alias 4 | # 5 | # Author:: Nathen Harvey 6 | # Author:: Seth Vargo 7 | # 8 | # Copyright 2012-2014, CustomInk, LLC. 9 | # 10 | # Licensed under the Apache License, Version 2.0 (the "License"); 11 | # you may not use this file except in compliance with the License. 12 | # You may obtain a copy of the License at 13 | # 14 | # http://www.apache.org/licenses/LICENSE-2.0 15 | # 16 | # Unless required by applicable law or agreed to in writing, software 17 | # distributed under the License is distributed on an "AS IS" BASIS, 18 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | # See the License for the specific language governing permissions and 20 | # limitations under the License. 21 | # 22 | 23 | actions :add, :remove 24 | default_action :add 25 | 26 | attribute :alias_name, kind_of: String, name_attribute: true 27 | attribute :command, kind_of: String 28 | -------------------------------------------------------------------------------- /vendor-cookbooks/magic_shell/resources/environment.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: magic_shell 3 | # Resource:: environment 4 | # 5 | # Author:: Nathen Harvey 6 | # Author:: Seth Vargo 7 | # 8 | # Copyright 2012-2014, CustomInk, LLC. 9 | # 10 | # Licensed under the Apache License, Version 2.0 (the "License"); 11 | # you may not use this file except in compliance with the License. 12 | # You may obtain a copy of the License at 13 | # 14 | # http://www.apache.org/licenses/LICENSE-2.0 15 | # 16 | # Unless required by applicable law or agreed to in writing, software 17 | # distributed under the License is distributed on an "AS IS" BASIS, 18 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | # See the License for the specific language governing permissions and 20 | # limitations under the License. 21 | # 22 | 23 | actions :add, :remove 24 | default_action :add 25 | 26 | attribute :environment_variable, kind_of: String, name_attribute: true 27 | attribute :value, kind_of: String 28 | -------------------------------------------------------------------------------- /vendor-cookbooks/vim/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # vim Cookbook CHANGELOG 2 | 3 | This file is used to list changes made in each version of the vim cookbook. 4 | 5 | ## 2.0.2 (2016-08-30) 6 | 7 | - Add IBM zLinux to metadata 8 | - Use kitchen-dokken in Travis CI and test on more Platforms 9 | - Update specs with new platforms 10 | - Remove Chef 11 compatibility 11 | - Add chef_version to metadata 12 | 13 | ## v2.0.1 (2016-02-22) 14 | 15 | - add missing bzip2 package to fix source recipe. 16 | 17 | ## v2.0.0 (2015-10-01) 18 | 19 | - Use multi-package installs introduced in Chef 12.1 to simplify code and speed up installs 20 | - Add Fedora source install support 21 | - Fix CentOS source install support and ensure vim compiles correctly on CentOS 5/6/7 22 | - Fix the tarball checksum to be the actual SHA256 checksum 23 | - Enable lua, perl, tcl support in the source install and add the necessary development packages for that support 24 | - Use the correct ctags package on Debian/Ubuntu systems to prevent errors or warnings 25 | - Improve how the code compilation runs in source installs so that a failed run doesn't prevent subsequent Chef runs or introduce a state where vim is never compiled 26 | - Add basic Serverspec test for source installs to ensure that vim runs 27 | - Fixed the error message is a bad install_method attribute is given to describe the actual problema and vim cookbook 28 | 29 | ## v1.1.4 (2015-09-21) 30 | 31 | - Converted value_for_platform to value_for_platform_family in order to support all RHEL and Debian derivitives 32 | - Added a Kitchen CI config for integration testing 33 | - Updated Travis to test on the latest ruby versions and to perform Chefspec tests 34 | - Updated Berkfile to 3.X format 35 | - Added updated CONTRIBUTING.MD, TESTING.MD and MAINTAINERS.MD files 36 | - Added Chefspec tests to get coverage to 100% 37 | - Added an expanded .gitignore and a chefignore file to limit the files uploaded to the chef-server 38 | - Added a Rakefile for simplified testing 39 | - Resolved rubocop warnings 40 | - Added Oracle Linux and Amazon Linux to the metadata file 41 | - Updated development dependencies 42 | - Updated Kitchen config to work with the latest in Chef DK 43 | 44 | ## v1.1.2 (2013-12-30) 45 | 46 | - Fixed Ubuntu package installer bug. Adding specs. 47 | 48 | ## v1.1.0 49 | 50 | ### Improvement 51 | 52 | - **[COOK-2465](https://tickets.opscode.com/browse/COOK-2465)** - Add a compile and settings optional recipe. 53 | -------------------------------------------------------------------------------- /vendor-cookbooks/vim/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Please refer to 2 | https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD 3 | -------------------------------------------------------------------------------- /vendor-cookbooks/vim/MAINTAINERS.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Maintainers 4 | This file lists how this cookbook project is maintained. When making changes to the system, this 5 | file tells you who needs to review your patch - you need a simple majority of maintainers 6 | for the relevant subsystems to provide a :+1: on your pull request. Additionally, you need 7 | to not receive a veto from a Lieutenant or the Project Lead. 8 | 9 | Check out [How Cookbooks are Maintained](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD) 10 | for details on the process and how to become a maintainer or the project lead. 11 | 12 | # Project Maintainer 13 | * [Tim Smith](https://github.com/tas50) 14 | 15 | # Maintainers 16 | * [Jennifer Davis](https://github.com/sigje) 17 | * [Tim Smith](https://github.com/tas50) 18 | * [Thom May](https://github.com/thommay) 19 | -------------------------------------------------------------------------------- /vendor-cookbooks/vim/README.md: -------------------------------------------------------------------------------- 1 | # vim Cookbook 2 | 3 | [![Build Status](https://travis-ci.org/chef-cookbooks/vim.svg?branch=master)](https://travis-ci.org/chef-cookbooks/vim) [![Cookbook Version](https://img.shields.io/cookbook/v/vim.svg)](https://supermarket.chef.io/cookbooks/vim) 4 | 5 | Installs or compiles/installs vim. 6 | 7 | ## Requirements 8 | 9 | ### Platforms 10 | 11 | - Ubuntu/Debian 12 | - RHEL/CentOS/Scientific/Amazon/Oracle 13 | - Fedora 14 | 15 | ### Chef 16 | 17 | - Chef 12.1+ 18 | 19 | ### Cookbooks 20 | 21 | - none 22 | 23 | ## Attributes 24 | 25 | ### Default recipe attributes: 26 | 27 | - `node['vim']['extra_packages']` - An array of extra packages related to vim to install (like plugins). Empty array by default. 28 | 29 | - `node['vim']['install_method']` - Sets the install method, choose from the various install recipes. This attribute is set to 'package' by default. 30 | 31 | ### Source recipe attributes: 32 | 33 | - `node['vim']['source']['version']` - The version of vim to compile, 7.4 by default. 34 | - `node['vim']['source']['checksum']` - The source file checksum. 35 | - `node['vim']['source']['dependencies']` - These are the non rhl specific devel dependencies for compiling vim. 36 | - `node['vim']['source']['centos_dependencies']` - These are the rhl and centos specific dependencies needed for compiling vim. 37 | - `node['vim']['source']['prefix']` - This is the path the vim bin will be placed, it's `/usr/local` 38 | - `node['vim']['source']['configuration']` - If you prefer to compile vim differently than the default you can override this configuration. 39 | 40 | ## Usage 41 | 42 | Add `recipe[vim]` to your run list or include the default recipe with `include_recipe 'vim'` in a recipe that is in your run list. 43 | 44 | This uses the value of the attribute `node['vim']['install_method']` which by default is _package_. 45 | 46 | If you would like to install additional vim plugin packages, include their package names in the `node['vim']['extra_packages']` attribute. Verify that your operating sytem has the package available. 47 | 48 | If you would rather compile vim from source, as the case may be for centos nodes, then override the `node['vim']['install_method']` with a value of `'source'`. 49 | 50 | ## License & Authors 51 | 52 | **Author:** Cookbook Engineering Team ([cookbooks@chef.io](mailto:cookbooks@chef.io)) 53 | 54 | **Copyright:** 2008-2016, Chef Software, Inc. 55 | 56 | ``` 57 | Licensed under the Apache License, Version 2.0 (the "License"); 58 | you may not use this file except in compliance with the License. 59 | You may obtain a copy of the License at 60 | 61 | http://www.apache.org/licenses/LICENSE-2.0 62 | 63 | Unless required by applicable law or agreed to in writing, software 64 | distributed under the License is distributed on an "AS IS" BASIS, 65 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 66 | See the License for the specific language governing permissions and 67 | limitations under the License. 68 | ``` 69 | -------------------------------------------------------------------------------- /vendor-cookbooks/vim/attributes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: vim 3 | # Attributes:: default 4 | # 5 | # Copyright 2010-2015, Chef Software, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | 20 | default['vim']['extra_packages'] = [] 21 | default['vim']['install_method'] = 'package' 22 | -------------------------------------------------------------------------------- /vendor-cookbooks/vim/recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: vim 3 | # Recipe:: default 4 | # 5 | # Copyright 2010-2015, Chef Software, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | 20 | begin 21 | include_recipe "vim::#{node['vim']['install_method']}" 22 | rescue Chef::Exceptions::RecipeNotFound 23 | Chef::Log.warn "A vim recipe does not exist for the install method specified: #{node['vim']['install_method']}" 24 | end 25 | -------------------------------------------------------------------------------- /vendor-cookbooks/vim/recipes/package.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: vim 3 | # Recipe:: package 4 | # 5 | # Copyright 2013-2015, Chef Software, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | # There is no vim package on RHEL/CentOS derivatives 20 | # * vim-minimal gives you /bin/vi 21 | # * vim-enhanced gives you /usr/bin/vim 22 | # 23 | vim_base_pkgs = value_for_platform_family( 24 | %w(debian arch) => ['vim'], 25 | %w(rhel fedora) => ['vim-minimal', 'vim-enhanced'], 26 | 'default' => ['vim'] 27 | ) 28 | 29 | package vim_base_pkgs 30 | 31 | package node['vim']['extra_packages'] 32 | -------------------------------------------------------------------------------- /vendor-cookbooks/vim/recipes/source.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: vim 3 | # Recipe:: source 4 | # 5 | # Copyright 2013-2015, Chef Software, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | 20 | cache_path = Chef::Config['file_cache_path'] 21 | source_version = node['vim']['source']['version'] 22 | 23 | package 'bzip2' 24 | package node['vim']['source']['dependencies'] 25 | 26 | include_recipe 'vim::source_rhel' if platform?('fedora') || platform_family?('rhel') 27 | 28 | remote_file "#{cache_path}/vim-#{source_version}.tar.bz2" do 29 | source "http://ftp.vim.org/pub/vim/unix/vim-#{source_version}.tar.bz2" 30 | checksum node['vim']['source']['checksum'] 31 | end 32 | 33 | bash 'install_vim' do 34 | cwd cache_path 35 | code <<-EOH 36 | mkdir vim-#{source_version} 37 | tar -jxf vim-#{source_version}.tar.bz2 -C vim-#{source_version} --strip-components 1 38 | (cd vim-#{source_version}/ && make clean && ./configure #{node['vim']['source']['configuration']} && make && make install) 39 | EOH 40 | creates "#{node['vim']['source']['prefix']}/bin/vim" 41 | end 42 | -------------------------------------------------------------------------------- /vendor-cookbooks/vim/recipes/source_rhel.rb: -------------------------------------------------------------------------------- 1 | # vim looks for xsubpp in wrong location RHEL 7+ and Fedora 2 | 3 | link '/usr/share/perl5/ExtUtils/xsubpp' do 4 | to '/usr/bin/xsubpp' 5 | only_if { ::File.exist?('/usr/bin/xsubpp') } # if package node attributes don't include perl this won't be here 6 | end if node['platform_version'].to_i >= 7 7 | 8 | package 'bzip2' if node['platform_version'].to_i >= 7 9 | -------------------------------------------------------------------------------- /workspace/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teracyhq/dev/2ed1b6aa36cdbcb75b7b90469e17001cf9ba2ea6/workspace/.gitkeep --------------------------------------------------------------------------------