configure-s3-website-ng 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/.travis.yml +5 -0
- data/Gemfile +2 -0
- data/LICENSE +19 -0
- data/README.md +280 -0
- data/Rakefile +11 -0
- data/bin/configure-s3-website +12 -0
- data/changelog.md +157 -0
- data/configure-s3-website.gemspec +23 -0
- data/lib/configure-s3-website/cli.rb +43 -0
- data/lib/configure-s3-website/cloudfront_client.rb +172 -0
- data/lib/configure-s3-website/config_source/config_source.rb +30 -0
- data/lib/configure-s3-website/config_source/file_config_source.rb +87 -0
- data/lib/configure-s3-website/endpoint_helper.rb +26 -0
- data/lib/configure-s3-website/http_helper.rb +74 -0
- data/lib/configure-s3-website/runner.rb +31 -0
- data/lib/configure-s3-website/s3_client.rb +129 -0
- data/lib/configure-s3-website/version.rb +3 -0
- data/lib/configure-s3-website/xml_helper.rb +15 -0
- data/lib/configure-s3-website.rb +10 -0
- data/spec/cloudfront_client_spec.rb +138 -0
- data/spec/config_source/file_config_source_spec.rb +68 -0
- data/spec/s3_client_spec.rb +162 -0
- data/spec/sample_files/_config_file.yml +3 -0
- data/spec/sample_files/_config_file_EU.yml +4 -0
- data/spec/sample_files/_config_file_no_credentials.yml +1 -0
- data/spec/sample_files/_config_file_oregon.yml +4 -0
- data/spec/sample_files/_config_file_with_eruby.yml +3 -0
- data/spec/sample_files/_custom_index_and_error_docs.yml +5 -0
- data/spec/sample_files/_custom_index_and_error_docs_with_routing_rules.yml +12 -0
- data/spec/xml_helper_spec.rb +39 -0
- metadata +145 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 123b9ee34cdac1ba9fd0c83c923c0ffc100ef7a1791bc7af0f8245d808fc8f50
|
4
|
+
data.tar.gz: 19a34cd18c1c96ce5e48866092c5831647417fb251340da58112e937d69e3a10
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8fec4eeeafef40128d1f4659d86499ec5ab0040611f64754ffff56b36007c9eb794a5a501540e29d3fbd395da4c139918a9d76e7e7983b21fb2144fb48f000ea
|
7
|
+
data.tar.gz: a9fba0235261025ffac457682cb83d4ba71c82fa1839f00c8a46c5dda91cec36fd865e2e8bc6257d73c88735c1c3cc9c5d736c5e2fa20c50083f83eb4259ad8f
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (C) 2012 Lauri lehmijoki
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
5
|
+
the Software without restriction, including without limitation the rights to
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
8
|
+
so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,280 @@
|
|
1
|
+
# Notice
|
2
|
+
|
3
|
+
This project is a fork from Lauri Lehmijoki's [configure-s3-website](https://github.com/laurilehmijoki/configure-s3-website). The upstream project [is not actively maintained](https://github.com/laurilehmijoki/configure-s3-website/issues/26#issuecomment-1586534812).
|
4
|
+
|
5
|
+
The gem has been renamed to configure-s3-website-ng to allow uploading to RubyGems without collisions.
|
6
|
+
|
7
|
+
The original README follows.
|
8
|
+
|
9
|
+
# Configure-s3-website
|
10
|
+
|
11
|
+
[![Build Status](https://secure.travis-ci.org/laurilehmijoki/configure-s3-website.png)](http://travis-ci.org/laurilehmijoki/configure-s3-website)
|
12
|
+
[![Gem Version](https://fury-badge.herokuapp.com/rb/configure-s3-website.png)](http://badge.fury.io/rb/configure-s3-website)
|
13
|
+
|
14
|
+
Configure an AWS S3 bucket to function as a website easily from a command-line interface.
|
15
|
+
|
16
|
+
The bucket may or may not exist. If the bucket does not exist,
|
17
|
+
`configure-s3-website` will create it.
|
18
|
+
|
19
|
+
For deploying websites to S3, consider using [s3_website](https://github.com/laurilehmijoki/s3_website).
|
20
|
+
|
21
|
+
## Install
|
22
|
+
|
23
|
+
gem install configure-s3-website
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
Create a file that contains the name of your AWS profile with access to S3 and the name of the bucket:
|
28
|
+
|
29
|
+
```yaml
|
30
|
+
profile: name-of-your-aws-profile-with-access
|
31
|
+
s3_bucket: name-of-your-bucket
|
32
|
+
```
|
33
|
+
|
34
|
+
**or** create a file that contains the S3 credentials and the name of the bucket:
|
35
|
+
|
36
|
+
```yaml
|
37
|
+
s3_id: your-aws-access-key
|
38
|
+
s3_secret: your-aws-secret-key
|
39
|
+
s3_bucket: name-of-your-bucket
|
40
|
+
```
|
41
|
+
|
42
|
+
**or** you may omit the `profile` and `s3_id` keys to use the system's default credentials.
|
43
|
+
This requires [configuring AWS credentials](http://docs.aws.amazon.com/sdk-for-ruby/v2/developer-guide/setup-config.html#aws-ruby-sdk-setting-credentials).
|
44
|
+
Options include [setting environment variables](http://docs.aws.amazon.com/sdk-for-ruby/v2/developer-guide/setup-config.html#aws-ruby-sdk-credentials-environment),
|
45
|
+
using a [shared credentials file](http://docs.aws.amazon.com/sdk-for-ruby/v2/developer-guide/setup-config.html#aws-ruby-sdk-credentials-shared),
|
46
|
+
or running an [EC2 instance with IAM roles](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UsingIAM.html#UsingIAMrolesWithAmazonEC2Instances).
|
47
|
+
|
48
|
+
Save the file (as *config.yml*, for example). Now you are ready to go. Run the
|
49
|
+
following command:
|
50
|
+
|
51
|
+
configure-s3-website --config-file config.yml
|
52
|
+
|
53
|
+
Congratulations! You now have an S3 bucket that can act as a website server for
|
54
|
+
you.
|
55
|
+
|
56
|
+
### Deliver your website via CloudFront
|
57
|
+
|
58
|
+
This gem can create new CloudFront distributions and update existing ones.
|
59
|
+
|
60
|
+
#### Creating a new distribution
|
61
|
+
|
62
|
+
`configure-s3-website` can create a CloudFront distribution for you. It will ask
|
63
|
+
you whether you want to deliver your website via the CDN. If you answer yes,
|
64
|
+
`configure-s3-website` will create a CloudFront distribution that has the
|
65
|
+
configured S3 bucket as its origin. In addition, it will add the entry
|
66
|
+
`cloudfront_distribution_id: [id-of-the-new-distribution]` into your
|
67
|
+
configuration file.
|
68
|
+
|
69
|
+
CloudFront can be configured in various ways. However, the distribution created
|
70
|
+
by `configure-s3-website` uses sensible defaults for an S3-based website and
|
71
|
+
thus saves you the burden of figuring out how to configure CloudFront. For
|
72
|
+
example, it assumes that your default root object is *index.html*.
|
73
|
+
|
74
|
+
You can see all the settings this gem applies on the new distribution by running
|
75
|
+
the command in verbose mode:
|
76
|
+
|
77
|
+
configure-s3-website --config-file config.yml --verbose
|
78
|
+
|
79
|
+
Note that if you already have the key `cloudfront_distribution_id` in your
|
80
|
+
configuration file, `configure-s3-website` will not create a new distribution.
|
81
|
+
Conversely, if you remove the `cloudfront_distribution_id` key from the file and
|
82
|
+
run `configure-s3-website` again, it will create you a new distribution.
|
83
|
+
|
84
|
+
##### Creating a new distribution with custom settings
|
85
|
+
|
86
|
+
If the default settings do not suit you, you can create a new distribution with
|
87
|
+
your settings by adding `cloudfront_distribution_config` values into your config
|
88
|
+
file. For example:
|
89
|
+
|
90
|
+
```yaml
|
91
|
+
cloudfront_distribution_config:
|
92
|
+
default_cache_behavior:
|
93
|
+
min_ttl: 600
|
94
|
+
aliases:
|
95
|
+
quantity: 1
|
96
|
+
items:
|
97
|
+
- your.domain.net
|
98
|
+
```
|
99
|
+
|
100
|
+
See the section below for more information about the valid values of the
|
101
|
+
`cloudfront_distribution_config` setting.
|
102
|
+
|
103
|
+
If you want to, you can look at the distribution settings on the management console
|
104
|
+
at <https://console.aws.amazon.com/cloudfront>.
|
105
|
+
|
106
|
+
#### Updating an existing distribution
|
107
|
+
|
108
|
+
You can modify an existing CloudFront distribution by defining the id of the
|
109
|
+
distribution and the configs you wish to override the defaults with.
|
110
|
+
|
111
|
+
Let's say your config file contains the following fragment:
|
112
|
+
|
113
|
+
```yaml
|
114
|
+
cloudfront_distribution_id: AXSAXSSE134
|
115
|
+
cloudfront_distribution_config:
|
116
|
+
default_cache_behavior:
|
117
|
+
min_ttl: 600
|
118
|
+
default_root_object: index.json
|
119
|
+
```
|
120
|
+
|
121
|
+
When you invoke `configure-s3-website`, it will overwrite the default value of
|
122
|
+
*default_cache_behavior's* *min_ttl* as well as the default value of
|
123
|
+
*default_root_object* setting in the [default distribution configs](#default-distribution-configs).
|
124
|
+
|
125
|
+
This gem generates `<DistributionConfig>` of the CloudFront REST API. For
|
126
|
+
reference, see
|
127
|
+
<http://docs.aws.amazon.com/AmazonCloudFront/latest/APIReference/GetConfig.html#GetConfig_Responses>
|
128
|
+
(example) and
|
129
|
+
<https://cloudfront.amazonaws.com/doc/2012-07-01/AmazonCloudFrontCommon.xsd>
|
130
|
+
(XSD). In other words, When you call `configure-s3-website`, it will turn the values of your
|
131
|
+
`cloudfront_distribution_config` into XML, include them in the
|
132
|
+
`<DistributionConfig>` element and send them to the CloudFront REST API.
|
133
|
+
|
134
|
+
The YAML keys in the config file will be turned into CloudFront REST API XML
|
135
|
+
with the same logic as in [configuring redirects](#configuring-redirects).
|
136
|
+
|
137
|
+
Having the distribution settings in the config file is handy, because it allows
|
138
|
+
you to store most (in many cases all) website deployment settings in one file.
|
139
|
+
|
140
|
+
#### Default distribution configs
|
141
|
+
|
142
|
+
Below is the default CloudFront distribution config. It is built based on the
|
143
|
+
API version 2012-07-01 of [DistributionConfig Complex
|
144
|
+
Type](http://docs.aws.amazon.com/AmazonCloudFront/latest/APIReference/DistributionConfigDatatype.html).
|
145
|
+
|
146
|
+
```ruby
|
147
|
+
{
|
148
|
+
'caller_reference' => 'configure-s3-website gem [generated-timestamp]',
|
149
|
+
'default_root_object' => 'index.html',
|
150
|
+
'logging' => {
|
151
|
+
'enabled' => 'false',
|
152
|
+
'include_cookies' => 'false',
|
153
|
+
'bucket' => '',
|
154
|
+
'prefix' => ''
|
155
|
+
},
|
156
|
+
'enabled' => 'true',
|
157
|
+
'comment' => 'Created by the configure-s3-website gem',
|
158
|
+
'aliases' => {
|
159
|
+
'quantity' => '0'
|
160
|
+
},
|
161
|
+
'default_cache_behavior' => {
|
162
|
+
'target_origin_id' => '[generated-string]',
|
163
|
+
'trusted_signers' => {
|
164
|
+
'enabled' => 'false',
|
165
|
+
'quantity' => '0'
|
166
|
+
},
|
167
|
+
'forwarded_values' => {
|
168
|
+
'query_string' => 'true',
|
169
|
+
'cookies' => {
|
170
|
+
'forward' => 'all'
|
171
|
+
}
|
172
|
+
},
|
173
|
+
'viewer_protocol_policy' => 'allow-all',
|
174
|
+
'min_ttl' => '86400'
|
175
|
+
},
|
176
|
+
'cache_behaviors' => {
|
177
|
+
'quantity' => '0'
|
178
|
+
},
|
179
|
+
'price_class' => 'PriceClass_All'
|
180
|
+
}
|
181
|
+
```
|
182
|
+
|
183
|
+
### Specifying a non-standard S3 endpoint
|
184
|
+
|
185
|
+
By default, `configure-s3-website` creates the S3 website into the US Standard
|
186
|
+
region.
|
187
|
+
|
188
|
+
If you want to create the website into another region, add into the
|
189
|
+
configuration file a row like this:
|
190
|
+
|
191
|
+
s3_endpoint: EU
|
192
|
+
|
193
|
+
The valid *s3_endpoint* values consist of the [S3 location constraint
|
194
|
+
values](http://docs.amazonwebservices.com/general/latest/gr/rande.html#s3_region).
|
195
|
+
|
196
|
+
|
197
|
+
### Specifying non-standard index or error documents
|
198
|
+
|
199
|
+
By default, `configure-s3-website` uses `index.html` for the index document and `error.html` for the error document.
|
200
|
+
|
201
|
+
You can override either or both of these defaults like this:
|
202
|
+
|
203
|
+
index_document: default.html
|
204
|
+
error_document: 404.html
|
205
|
+
|
206
|
+
You can specify the name of any document in the bucket.
|
207
|
+
|
208
|
+
|
209
|
+
### Configuring redirects
|
210
|
+
|
211
|
+
You can configure redirects on your S3 website by adding `routing_rules` into
|
212
|
+
the config file.
|
213
|
+
|
214
|
+
Here is an example:
|
215
|
+
|
216
|
+
````yaml
|
217
|
+
routing_rules:
|
218
|
+
- condition:
|
219
|
+
key_prefix_equals: blog/some_path
|
220
|
+
redirect:
|
221
|
+
host_name: blog.example.com
|
222
|
+
replace_key_prefix_with: some_new_path/
|
223
|
+
http_redirect_code: 301
|
224
|
+
````
|
225
|
+
|
226
|
+
You can use any routing rule property that the [REST
|
227
|
+
API](http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTwebsite.html)
|
228
|
+
supports. All you have to do is to replace the uppercase letter in AWS XML with
|
229
|
+
an underscore and an undercase version of the same letter. For example,
|
230
|
+
`KeyPrefixEquals` becomes `key_prefix_equals` in the config file.
|
231
|
+
|
232
|
+
Apply the rules by invoking `configure-s3-website --config [your-config-file]`
|
233
|
+
on the command-line interface. You can verify the results by looking at your
|
234
|
+
bucket on the [S3 console](https://console.aws.amazon.com/s3/home).
|
235
|
+
|
236
|
+
## How does `configure-s3-website` work?
|
237
|
+
|
238
|
+
`configure-s3-website` uses the AWS REST API of S3 for creating and modifying
|
239
|
+
the bucket. In brief, it does the following things:
|
240
|
+
|
241
|
+
1. Create a bucket for you (if it does not yet exist)
|
242
|
+
2. Add the website configuration on the bucket via the [website REST
|
243
|
+
API](http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTwebsite.html)
|
244
|
+
3. Make the bucket **readable to the whole world**
|
245
|
+
4. Apply the redirect (a.k.a routing) rules on the bucket website
|
246
|
+
|
247
|
+
When interacting with CloudFront, `configure-s3-website` uses the [POST
|
248
|
+
Distribution](http://docs.aws.amazon.com/AmazonCloudFront/latest/APIReference/CreateDistribution.html),
|
249
|
+
[GET
|
250
|
+
Distribution](http://docs.aws.amazon.com/AmazonCloudFront/latest/APIReference/GetDistribution.html) and [PUT Distribution Config](http://docs.aws.amazon.com/AmazonCloudFront/latest/APIReference/PutConfig.html) APIs.
|
251
|
+
|
252
|
+
### Running headlessly
|
253
|
+
|
254
|
+
Use the `--headless` option to run without user interaction. If you add the
|
255
|
+
`--autocreate-cloudfront-dist` option, `configure-s3-website` will automatically
|
256
|
+
create a CloudFront distribution for your S3 website.
|
257
|
+
|
258
|
+
## Development
|
259
|
+
|
260
|
+
* This project uses [Semantic Versioning](http://semver.org)
|
261
|
+
|
262
|
+
## Credit
|
263
|
+
|
264
|
+
Created by Lauri Lehmijoki.
|
265
|
+
|
266
|
+
Big thanks to the following contributors (in alphabetical order):
|
267
|
+
|
268
|
+
* SlawD
|
269
|
+
* Steve Schwartz
|
270
|
+
* Toby Marsden
|
271
|
+
|
272
|
+
## Supported Ruby versions
|
273
|
+
|
274
|
+
The file `.travis.yml` defines the officially supported Ruby versions. This gem
|
275
|
+
might work on other versions as well, but they are not covered with continuous
|
276
|
+
integration.
|
277
|
+
|
278
|
+
## License
|
279
|
+
|
280
|
+
See the file LICENSE.
|
data/Rakefile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
|
4
|
+
|
5
|
+
require 'optparse'
|
6
|
+
require 'configure-s3-website'
|
7
|
+
|
8
|
+
options, optparse = ConfigureS3Website::CLI.optparse_and_options
|
9
|
+
|
10
|
+
optparse.parse!
|
11
|
+
|
12
|
+
ConfigureS3Website::Runner.run(options)
|
data/changelog.md
ADDED
@@ -0,0 +1,157 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
This project uses [Semantic Versioning](http://semver.org).
|
4
|
+
|
5
|
+
## 2.3.0
|
6
|
+
|
7
|
+
* Add support for default credentials providers
|
8
|
+
|
9
|
+
## 2.2.0
|
10
|
+
|
11
|
+
* Convert `http_error_code_returned_equals` value to string
|
12
|
+
|
13
|
+
## 2.1.0
|
14
|
+
|
15
|
+
* Add ability to use an AWS profile instead of explicit `s3_id` and `s3_secret`
|
16
|
+
|
17
|
+
## 2.0.0
|
18
|
+
|
19
|
+
### Breaking changes
|
20
|
+
|
21
|
+
The CloudFront integration now uses the official Ruby AWS
|
22
|
+
SDK. As a consequence, the accepted format of the
|
23
|
+
`cloudfront_distribution_config` is slightly different.
|
24
|
+
|
25
|
+
Below are some examples of changes that you have to perform, depending on the
|
26
|
+
contents of your `cloudfront_distribution_config` setting.
|
27
|
+
|
28
|
+
* Rename `min_TTL` -> `min_ttl`
|
29
|
+
* Change
|
30
|
+
|
31
|
+
```yaml
|
32
|
+
aliases:
|
33
|
+
quantity: 1
|
34
|
+
items:
|
35
|
+
CNAME: my.site.net
|
36
|
+
```
|
37
|
+
|
38
|
+
to
|
39
|
+
|
40
|
+
```yaml
|
41
|
+
aliases:
|
42
|
+
quantity: 1
|
43
|
+
items:
|
44
|
+
- my.site.net
|
45
|
+
```
|
46
|
+
|
47
|
+
* There might be other incompatible settings in your old configuration, but
|
48
|
+
should them exist, the AWS SDK client will print you a helpful error and then
|
49
|
+
safely exit. If this happens, just fix the problems that the CloudFront client
|
50
|
+
reports and try again.
|
51
|
+
|
52
|
+
Also, the arrays in hashes are now merged:
|
53
|
+
|
54
|
+
```
|
55
|
+
source = {:x => [{:y => 1}]}
|
56
|
+
dest = {:x => [{:z => 2}]}
|
57
|
+
# merge...
|
58
|
+
Results: {:x => [{:y => 1, :z => 2}]}
|
59
|
+
```
|
60
|
+
|
61
|
+
With the help of array merging, given your config file contains the following
|
62
|
+
setting:
|
63
|
+
|
64
|
+
```yaml
|
65
|
+
cloudfront_distribution_config:
|
66
|
+
origins:
|
67
|
+
items:
|
68
|
+
- origin_path: /subfolder
|
69
|
+
```
|
70
|
+
|
71
|
+
... `configure-s3-website` will include the `origin_path` setting within the
|
72
|
+
properties of the first element in the `items` array of your distribution
|
73
|
+
settings.
|
74
|
+
|
75
|
+
## 1.7.5
|
76
|
+
|
77
|
+
* Fix CreateBucket broken in 1.7.4
|
78
|
+
|
79
|
+
## 1.7.4
|
80
|
+
|
81
|
+
* Support all AWS regions
|
82
|
+
|
83
|
+
## 1.7.3
|
84
|
+
|
85
|
+
* see <https://github.com/laurilehmijoki/configure-s3-website/pull/13>
|
86
|
+
|
87
|
+
## 1.7.2
|
88
|
+
|
89
|
+
* See <https://github.com/laurilehmijoki/configure-s3-website/pull/11>
|
90
|
+
|
91
|
+
## 1.7.1
|
92
|
+
|
93
|
+
* Change CloudFront `OriginProtocolPolicy` to `http-only`
|
94
|
+
|
95
|
+
See <https://github.com/laurilehmijoki/s3_website/issues/152> for discussion.
|
96
|
+
|
97
|
+
## 1.7.0
|
98
|
+
|
99
|
+
* Add eu-central-1 Region
|
100
|
+
|
101
|
+
## 1.6.0
|
102
|
+
|
103
|
+
* Add switches `--headless` and `--autocreate-cloudfront-dist`
|
104
|
+
|
105
|
+
## 1.5.5
|
106
|
+
|
107
|
+
* Fix bug that prevented creating new CloudFront distributions in the EU region
|
108
|
+
|
109
|
+
## 1.5.4
|
110
|
+
|
111
|
+
* Remove usage of the deprecated OpenSSL::Digest::Digest
|
112
|
+
|
113
|
+
## 1.5.3
|
114
|
+
|
115
|
+
* Do not override ERB code when adding CloudFront dist
|
116
|
+
|
117
|
+
## 1.5.2
|
118
|
+
|
119
|
+
* Support location constraint eu-west-1
|
120
|
+
|
121
|
+
## 1.5.1
|
122
|
+
|
123
|
+
* Use the S3 website domain as the Cloudfront origin
|
124
|
+
|
125
|
+
Replace `S3OriginConfig` with `CustomOriginConfig`. This solves the issue
|
126
|
+
https://github.com/laurilehmijoki/configure-s3-website/issues/6.
|
127
|
+
|
128
|
+
## 1.5.0
|
129
|
+
|
130
|
+
* Add support for custom index and error documents
|
131
|
+
|
132
|
+
## 1.4.0
|
133
|
+
|
134
|
+
* Allow the user to store his CloudFront settings in the config file
|
135
|
+
* Support updating configs of an existing CloudFront distribution
|
136
|
+
* Support creating of new distros with custom CloudFront configs
|
137
|
+
|
138
|
+
## 1.3.0
|
139
|
+
|
140
|
+
* Create a CloudFront distro if the user wants to deliver his S3 website via the
|
141
|
+
CDN
|
142
|
+
|
143
|
+
## 1.2.0
|
144
|
+
|
145
|
+
* Support configuring redirects on the S3 website
|
146
|
+
|
147
|
+
## 1.1.2
|
148
|
+
|
149
|
+
* Use UTC time when signing requests
|
150
|
+
|
151
|
+
## 1.1.1
|
152
|
+
|
153
|
+
* Do not send the location constraint XML when using the standard region
|
154
|
+
|
155
|
+
## 1.1.0
|
156
|
+
|
157
|
+
* Add support for non-standard AWS regions
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.join([File.dirname(__FILE__),'lib','configure-s3-website','version.rb'])
|
2
|
+
spec = Gem::Specification.new do |s|
|
3
|
+
s.name = 'configure-s3-website-ng'
|
4
|
+
s.version = ConfigureS3Website::VERSION
|
5
|
+
s.author = ['Ingelabs', 'Lauri Lehmijoki']
|
6
|
+
s.email = 'info@ingelabs.com'
|
7
|
+
s.homepage = 'https://github.com/ingelabs/configure-s3-website'
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.summary = 'Fork of configure-s3-website - Configure your AWS S3 bucket to function as a web site'
|
10
|
+
s.bindir = 'bin'
|
11
|
+
|
12
|
+
s.add_dependency 'deep_merge', '~> 1.0.0'
|
13
|
+
s.add_dependency 'aws-sdk', '~> 2'
|
14
|
+
|
15
|
+
s.add_development_dependency 'rspec', '~> 3'
|
16
|
+
s.add_development_dependency 'rspec-expectations', '~> 3'
|
17
|
+
s.add_development_dependency 'rake', '~> 0.9.0'
|
18
|
+
|
19
|
+
s.files = `git ls-files`.split("\n")
|
20
|
+
s.test_files = `git ls-files -- {spec}/*`.split("\n")
|
21
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
22
|
+
s.require_paths = ["lib"]
|
23
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module ConfigureS3Website
|
2
|
+
class CLI
|
3
|
+
def self.optparse_and_options
|
4
|
+
options = {}
|
5
|
+
optparse = OptionParser.new do |opts|
|
6
|
+
opts.banner = banner
|
7
|
+
opts.on('--headless',
|
8
|
+
'Run without interaction from the user. See the --autocreate-cloudfront-dist for more info.') do
|
9
|
+
options[:headless] = true
|
10
|
+
end
|
11
|
+
opts.on('--autocreate-cloudfront-dist',
|
12
|
+
'When running with --headless, automatically create a CloudFront distribution for your S3 website.') do
|
13
|
+
options['autocreate-cloudfront-dist'] = true
|
14
|
+
end
|
15
|
+
opts.on('-f', '--config-file FILE',
|
16
|
+
'Pick credentials and the S3 bucket name from a config file') do
|
17
|
+
|yaml_file_path|
|
18
|
+
options[:config_source] =
|
19
|
+
ConfigureS3Website::FileConfigSource.new yaml_file_path
|
20
|
+
end
|
21
|
+
opts.on('-v', '--verbose', 'Print more stuff') do
|
22
|
+
options[:verbose] = true
|
23
|
+
end
|
24
|
+
opts.on('--help', 'Display this screen') do
|
25
|
+
puts opts
|
26
|
+
exit
|
27
|
+
end
|
28
|
+
end
|
29
|
+
[options, optparse]
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def self.banner
|
35
|
+
%|Usage: #{File.basename(__FILE__)} arguments
|
36
|
+
|
37
|
+
Configure your S3 bucket to function as a web site
|
38
|
+
|
39
|
+
Arguments:
|
40
|
+
|
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|