stack_car 0.2.5 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 358880428cb3b1bebab4e7f47072cd0a9096e5e0
4
- data.tar.gz: 2c3d48913df2334d766f520ebd705680b84becc0
3
+ metadata.gz: 95e9a766c53dc60137049a34e4383dd1be2b58e4
4
+ data.tar.gz: 3a595fbf2e5aa3fea2ed40d7b31c37d96529c924
5
5
  SHA512:
6
- metadata.gz: 6b3732eeb9d5b2918a431ba0d790f8c51c639f5b56b132939d596fafa9f5b9eafa017f7f8f0ee8298eb271144aa80d44ac254b2451e9f7ef8077fc384a1118c6
7
- data.tar.gz: bae1834cf48c9bfb441494ba2e72e5837fb6ea45222fb54d399cd47e973c53921b3ef6ec5562121134bf24bc387e13e81d6fe0c0ec086d9a1712446d71c10198
6
+ metadata.gz: 5f26afb657875cd2a01fea147c36ad340c76f8439b5436c29d43eeaa90a6b494f88feab7844e7022f631748c3387243a3ecb6aed53b7bbd8b650075279185419
7
+ data.tar.gz: 2c0be0669b973341047c06fd70965fc7cc0f56e4c4b5587ffe04ed25aae92e8c6266598bf8a2d7eedd526344871aa7c4b3bcd02851e90009216c1eec0a07b347
data/lib/stack_car/cli.rb CHANGED
@@ -19,8 +19,12 @@ module StackCar
19
19
  args = ['--remove-orphans']
20
20
  args << '--build' if options[:build]
21
21
  args << '-d' if !options[:foreground]
22
- run("rm -rf tmp/pids/server.pid")
22
+ if options[:build]
23
+ run("docker-compose pull #{options[:service]}")
24
+ end
25
+
23
26
  run("docker-compose up #{args.join(' ')} #{options[:service]}")
27
+
24
28
  if options[:build]
25
29
  @project_name = File.basename(File.expand_path('.'))
26
30
  say 'copying bundle to local, you can start using the app now.'
@@ -33,7 +37,34 @@ module StackCar
33
37
  desc "stop", "starts docker-compose with rebuild and orphan removal, defaults to all"
34
38
  def stop
35
39
  run("docker-compose stop #{options[:service]}")
36
- run("rm -rf tmp/pids/server.pid")
40
+ run("rm -rf tmp/pids/*")
41
+ end
42
+
43
+ method_option :service, default: 'web', type: :string, aliases: '-s'
44
+ desc "push ARGS", "wraps docker-compose push web unless --service is used to specify"
45
+ def push(*args)
46
+ run("docker-compose push #{options[:service]} #{args.join(' ')}")
47
+ end
48
+
49
+ method_option :service, default: 'web', type: :string, aliases: '-s'
50
+ desc "pull ARGS", "wraps docker-compose pull web unless --service is used to specify"
51
+ def pull(*args)
52
+ run("docker-compose pull #{options[:service]} #{args.join(' ')}")
53
+ end
54
+
55
+ method_option :service, default: 'web', type: :string, aliases: '-s'
56
+ desc "ps ARGS", "wraps docker-compose pull web unless --service is used to specify"
57
+ def ps(*args)
58
+ run("docker-compose ps #{options[:service]} #{args.join(' ')}")
59
+ end
60
+ map status: :ps
61
+
62
+ method_option :service, default: 'web', type: :string, aliases: '-s'
63
+ desc "bundle ARGS", "wraps docker-compose run web unless --service is used to specify"
64
+ def bundle(*args)
65
+ run("docker-compose exec #{options[:service]} bundle")
66
+ @project_name = File.basename(File.expand_path('.'))
67
+ run("docker cp #{@project_name}_#{options[:service]}_1:/bundle .")
37
68
  end
38
69
 
39
70
  method_option :service, default: 'web', type: :string, aliases: '-s'
@@ -111,7 +142,7 @@ module StackCar
111
142
  @db_libs = @db_libs.join(' ')
112
143
 
113
144
 
114
- ['.dockerignore', 'Dockerfile', 'docker-compose.yml', 'docker-compose-prod.yml', '.gitlab-ci.yml', '.env'].each do |template_file|
145
+ ['.dockerignore', 'Dockerfile', 'docker-compose.yml', 'docker-compose-ci.yml', 'docker-compose-prod.yml', '.gitlab-ci.yml', '.env'].each do |template_file|
115
146
  puts template_file
116
147
  template("#{template_file}.erb", template_file)
117
148
  end
@@ -1,3 +1,3 @@
1
1
  module StackCar
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.7"
3
3
  end
data/templates/.env.erb CHANGED
@@ -3,7 +3,7 @@ POSTGRES_DB=<%= @project_name %>
3
3
  POSTGRES_USER=postgres
4
4
  POSTGRES_PASSWORD=DatabaseFTW
5
5
  POSTGRES_HOST=postgres
6
- TEST_DB=<%= @project_name %>
6
+ TEST_DB=<%= @project_name %>_test
7
7
  <% end -%>
8
8
  <% if options[:mysql] -%>
9
9
  MYSQL_DATABASE=<%= @project_name %>
@@ -11,9 +11,11 @@ MYSQL_USER=root
11
11
  MYSQL_PASSWORD=DatabaseFTW
12
12
  MYSQL_ROOT_PASSWORD=DatabaseFTW
13
13
  MYSQL_HOST=mysql
14
- TEST_DB=<%= @project_name %>
14
+ TEST_DB=<%= @project_name %>_test
15
15
  <% end -%>
16
16
  <% if options[:deploy] || options[:rancher] -%>
17
17
  REGISTRY_HOST=registry.gitlab.com
18
18
  REGISTRY_URI=/TODO/<%= @project_name %>
19
+ SITE_URI=https://TODO.com
19
20
  <% end -%>
21
+ TAG=`git branch | grep \* | cut -d ' ' -f2-`
@@ -1,3 +1,4 @@
1
+ image: docker:latest
1
2
  services:
2
3
  - docker:dind
3
4
  <% if options[:postgres] -%>
@@ -16,6 +17,13 @@ services:
16
17
  - redis:latest
17
18
  <% end -%>
18
19
 
20
+ stages:
21
+ - build
22
+ - test
23
+ - review
24
+ - staging
25
+ - production
26
+
19
27
  variables:
20
28
  <% if options[:postgres] -%>
21
29
  POSTGRES_DB: <%= @project_name %>
@@ -26,43 +34,102 @@ variables:
26
34
  MYSQL_DATABASE: <%= @project_name %>
27
35
  MYSQL_ROOT_PASSWORD: DatabaseFTW
28
36
  <% end -%>
29
-
30
-
31
- stages:
32
- - build
33
- - test
34
- - deploy
37
+ TEST_DB: <%= @project_name %>
38
+ DOCKER_DRIVER: overlay
35
39
 
36
40
  build:
37
41
  stage: build
38
- image: docker:latest
39
42
  script:
40
- - docker info
41
43
  - docker login -u "gitlab-ci-token" -p "$CI_BUILD_TOKEN" $CI_REGISTRY
42
- - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME" .
43
- - docker push "$CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME"
44
+ - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_BUILD_REF_SLUG" .
45
+ - docker push "$CI_REGISTRY_IMAGE:$CI_BUILD_REF_SLUG"
46
+ variables:
47
+ GIT_STRATEGY: fetch
48
+ tags:
49
+ - docker
44
50
 
45
51
  test:
46
- image: $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME
52
+ stage: test
53
+ image: $CI_REGISTRY_IMAGE:$CI_BUILD_REF_SLUG
47
54
  script:
48
- - bundle install --path /cache
49
- - bundle exec rake db:create db:migrate db:test:prepare RAILS_ENV=test
50
- - bundle exec rake
51
- - bundle exec rake assets:precompile
55
+ - cd /app && bundle exec rake db:create db:schema:load spec
56
+ tags:
57
+ - docker
58
+ variables:
59
+ GIT_STRATEGY: none
60
+
61
+ review:
62
+ stage: review
63
+ image: docker:latest
64
+ type: deploy
65
+ environment:
66
+ name: $CI_BUILD_REF_SLUG
67
+ url: http://web.$CI_BUILD_REF_SLUG.staging.$SITE_URI
68
+ on_stop: stop_review
69
+ only:
70
+ - branches
71
+ except:
72
+ - master
73
+ script:
74
+ - wget https://github.com/rancher/cli/releases/download/v0.4.1/rancher-linux-amd64-v0.4.1.tar.gz
75
+ - tar zxfv rancher-linux-amd64-v0.4.1.tar.gz
76
+ - export RANCHER_ENVIRONMENT=staging
77
+ - export TAG=$CI_BUILD_REF_SLUG
78
+ - ./rancher-v0.4.1/rancher up -p -d -u -c -s $TAG -f docker-compose-ci.yml
79
+ variables:
80
+ GIT_STRATEGY: fetch
81
+ tags:
82
+ - docker
83
+ - mysql
84
+
85
+ stop_review:
86
+ stage: review
87
+ script:
88
+ <% if options[:rancher] -%>
89
+ - wget https://github.com/rancher/cli/releases/download/v0.4.1/rancher-linux-amd64-v0.4.1.tar.gz
90
+ - tar zxfv rancher-linux-amd64-v0.4.1.tar.gz
91
+ - export RANCHER_ENVIRONMENT=staging
92
+ - ./rancher-v0.4.1/rancher rm $CI_BUILD_REF_SLUG
93
+ <% end %>
94
+ variables:
95
+ GIT_STRATEGY: none
96
+ when: manual
97
+ environment:
98
+ name: $CI_BUILD_REF_SLUG
99
+ action: stop
52
100
 
53
101
  staging:
54
- image: $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME
102
+ stage: staging
55
103
  type: deploy
56
104
  script:
57
- - gem install dpl multi_json
58
- - # TODO DEPLOY COMMAND dpl --provider=heroku --app=east-west-payroll-staging --api-key=$HEROKU_STAGING_API_KEY
105
+ <% if options[:rancher] -%>
106
+ - wget https://github.com/rancher/cli/releases/download/v0.4.1/rancher-linux-amd64-v0.4.1.tar.gz
107
+ - tar zxfv rancher-linux-amd64-v0.4.1.tar.gz
108
+ - export RANCHER_ENVIRONMENT=staging
109
+ - export TAG=master
110
+ - ./rancher-v0.4.1/rancher up -p -d -u -c -f docker-compose-ci.yml --stack $CI_BUILD_REF_SLUG
111
+ <% end -%>
59
112
  only:
60
113
  - master
114
+ variables:
115
+ GIT_STRATEGY: fetch
116
+ tags:
117
+ - docker
61
118
 
62
119
  production:
63
- image: $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME
120
+ stage: production
64
121
  type: deploy
65
122
  script:
66
- - gem install dpl multi_json
67
- - # TODO DEPLOY COMMAND dpl --provider=heroku --app=east-west-payroll --api-key=$HEROKU_PRODUCTION_API_KEY
123
+ <% if options[:rancher] -%>
124
+ - wget https://github.com/rancher/cli/releases/download/v0.4.1/rancher-linux-amd64-v0.4.1.tar.gz
125
+ - tar zxfv rancher-linux-amd64-v0.4.1.tar.gz
126
+ - export RANCHER_ENVIRONMENT=production
127
+ - ./rancher-v0.4.1/rancher up -p -d -u -c -f docker-compose-prod.yml
128
+ <% end -%>
68
129
  when: manual
130
+ only:
131
+ - master
132
+ variables:
133
+ GIT_STRATEGY: fetch
134
+ tags:
135
+ - docker
@@ -1,6 +1,6 @@
1
- FROM ruby:2.3.0
1
+ FROM phusion/passenger-ruby23:0.9.20
2
2
 
3
- RUN apt-get update -qq && apt-get install -y build-essential nodejs pv libsasl2-dev <%= @db_libs %> && \
3
+ RUN apt-get update -qq && apt-get install -y build-essential nodejs npm pv libsasl2-dev <%= @db_libs %> && \
4
4
  apt-get clean && \
5
5
  rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
6
6
 
@@ -0,0 +1,112 @@
1
+ version: '2'
2
+ services:
3
+ <% if options[:postgres] -%>
4
+ postgres:
5
+ image: postgres
6
+ env_file:
7
+ - .env
8
+ ports:
9
+ - "5432"
10
+ volumes:
11
+ - 'postgres:/var/lib/postgresql/data'
12
+ <% end -%>
13
+ <% if options[:mysql] -%>
14
+ mysql:
15
+ image: mysql
16
+ env_file:
17
+ - .env
18
+ ports:
19
+ - '3306'
20
+ volumes:
21
+ - 'mysql:/var/lib/mysql'
22
+ <% end -%>
23
+ <% if options[:elasticsearch] -%>
24
+ elasticsearch:
25
+ image: elasticsearch:1.7.1
26
+ ports:
27
+ - "9200"
28
+ - "9300"
29
+ volumes:
30
+ - 'elasticsearch:/usr/share/elasticsearch/data'
31
+ <% end -%>
32
+ <% if options[:solr] %>
33
+ solr:
34
+ image: solr:latest
35
+ ports:
36
+ - "8983"
37
+ volumes:
38
+ - 'solr:/opt/solr/server/solr/mycores'
39
+ entrypoint:
40
+ - docker-entrypoint.sh
41
+ - solr-precreate
42
+ - mycore
43
+ # docker-compose exec --user=solr solr bin/solr create_core -c CORENAME
44
+ <% end -%>
45
+ <% if options[:redis] -%>
46
+ redis:
47
+ image: 'redis:3.2-alpine'
48
+ command: redis-server
49
+ ports:
50
+ - '6379'
51
+ volumes:
52
+ - 'redis:/var/lib/redis/data'
53
+ <% end -%>
54
+ <% if options[:fcrepo] -%>
55
+ fcrepo:
56
+ image: botimer/fcrepo:4.5.1
57
+ volumes:
58
+ - 'fcrepo:/opt/data'
59
+ ports:
60
+ - "8080"
61
+ <% end -%>
62
+ main:
63
+ image: "${REGISTRY_HOST}/${REGISTRY_URI}:${TAG}"
64
+ volumes:
65
+ - .:/app
66
+ env_file:
67
+ - .env
68
+ # Keep the stdin open, so we can attach to our app container's process
69
+ # and do things such as byebug, etc:
70
+ stdin_open: true
71
+ # Enable sending signals (CTRL+C, CTRL+P + CTRL+Q) into the container:
72
+ tty: true
73
+ <% if options[:delayed_job] -%>
74
+ delayed_job:
75
+ extends:
76
+ service: main
77
+ command: ./bin/delayed_job run
78
+ depends_on:
79
+ <%= compose_depends(:delayed_job) %>
80
+ <% end -%>
81
+ web:
82
+ extends:
83
+ service: main
84
+ command: bundle exec rails s -p 3000 -b '0.0.0.0'
85
+ labels:
86
+ rap.host: ${SITE_URI}
87
+ rap.le_host: ${SITE_URI}
88
+ rap.le_test: true
89
+ ports:
90
+ - "3000"
91
+ depends_on:
92
+ <%= compose_depends %>
93
+
94
+ volumes:
95
+ <% if options[:postgres] -%>
96
+ postgres:
97
+ <% end -%>
98
+ <% if options[:mysql] -%>
99
+ mysql:
100
+ <% end -%>
101
+ <% if options[:elasticsearch] -%>
102
+ elasticsearch:
103
+ <% end -%>
104
+ <% if options[:solr] -%>
105
+ solr:
106
+ <% end -%>
107
+ <% if options[:redis] -%>
108
+ redis:
109
+ <% end -%>
110
+
111
+
112
+
@@ -1,11 +1,24 @@
1
1
  version: '2'
2
2
  services:
3
3
  web:
4
- image: <%= @project_name %>:latest
5
- command: bash -c "bundle exec rake assets:precompile db:migrate && bundle exec rails s -p 3000 -b '0.0.0.0'"
4
+ image: "${REGISTRY_HOST}/${REGISTRY_URI}:${TAG}"
5
+ command: bash -c "bundle exec rake assets:precompile db:migrate && bundle exec passenger start -p 3000 -b '0.0.0.0'""
6
6
  environment:
7
7
  - RAILS_ENV=production
8
8
  - RACK_ENV=production
9
9
  restart: unless-stopped
10
10
  ports:
11
- - "3000:3000"
11
+ - "3000"
12
+ labels:
13
+ rap.host: ${SITE_URI}
14
+ rap.le_host: ${SITE_URI}
15
+ rap.le_test: true
16
+ env_file:
17
+ .env
18
+
19
+ <% if options[:rancher] -%>
20
+ volumes:
21
+ uploads:
22
+ driver: rancher-nfs
23
+ external: true
24
+ <% end -%>
@@ -20,7 +20,7 @@ services:
20
20
  volumes:
21
21
  - 'mysql:/var/lib/mysql'
22
22
  <% end -%>
23
- <% if options[:elasticsearchi] -%>
23
+ <% if options[:elasticsearch] -%>
24
24
  elasticsearch:
25
25
  image: elasticsearch:1.7.1
26
26
  ports:
@@ -57,15 +57,20 @@ services:
57
57
  volumes:
58
58
  - 'fcrepo:/opt/data'
59
59
  ports:
60
- - "8984:8080"
60
+ - "8080"
61
61
  <% end -%>
62
62
  main:
63
63
  build: .
64
- image: <%= @project_name %>:latest
64
+ image: "${REGISTRY_HOST}/${REGISTRY_URI}:${TAG}"
65
65
  volumes:
66
66
  - .:/app
67
67
  env_file:
68
68
  - .env
69
+ # Keep the stdin open, so we can attach to our app container's process
70
+ # and do things such as byebug, etc:
71
+ stdin_open: true
72
+ # Enable sending signals (CTRL+C, CTRL+P + CTRL+Q) into the container:
73
+ tty: true
69
74
  <% if options[:delayed_job] -%>
70
75
  delayed_job:
71
76
  extends:
@@ -75,11 +80,11 @@ services:
75
80
  <%= compose_depends(:delayed_job) %>
76
81
  <% end -%>
77
82
  web:
78
- extends:
79
- service: urp
83
+ extends:
84
+ service: main
80
85
  command: bundle exec rails s -p 3000 -b '0.0.0.0'
81
86
  ports:
82
- - "3000:3000"
87
+ - "3000"
83
88
  depends_on:
84
89
  <%= compose_depends %>
85
90
 
@@ -3,7 +3,7 @@
3
3
  hosts: all
4
4
  become: true
5
5
  roles:
6
- - docker
6
+ - docker.ubuntu
7
7
  tasks:
8
8
  - name: Install Compose Module
9
9
  pip: name=docker-compose
@@ -0,0 +1,19 @@
1
+ ---
2
+ language: python
3
+ python: "2.7"
4
+ env:
5
+ - ANSIBLE_VERSION='ansible<2'
6
+ - ANSIBLE_VERSION='ansible>2'
7
+
8
+ before_install:
9
+ - sudo apt-get update -qq
10
+ #- sudo apt-get install -qq python-apt python-pycurl
11
+ install:
12
+ # Install Ansible.
13
+ - sudo pip install $ANSIBLE_VERSION
14
+ script:
15
+ - ansible --version
16
+ - export ANSIBLE_ROLES_PATH="../"
17
+ # - echo localhost > inventory
18
+ - ansible-playbook -i hosts --syntax-check docker.yml
19
+ - ansible-playbook -i hosts --connection=local --sudo -vvvv docker.yml
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright {yyyy} {name of copyright owner}
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+