route53_aliaser 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +32 -20
- data/lib/route53_aliaser/aliaser.rb +2 -2
- data/lib/route53_aliaser/route53_updater.rb +2 -0
- data/lib/route53_aliaser/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ab9ef8a372dec5ffad110b0cf3a2a629e52a282
|
4
|
+
data.tar.gz: 81bceee8f1616015be7bb1293c6878ef7d4b31e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffcbbd229e0f23783945ab7a0b731dedc3482f2493df79442392a8f7207c55633c685a4ef0203dc972b490cd3dbc41489be6cc07243ca3ab4d7383331a585fc4
|
7
|
+
data.tar.gz: fb6d97fae28e055d8514682ec9c466678f107672d5eaa1466b541394fcf26304a641c113cee872084635e9f45bb0c67d26b59baddbe0c3f696ef5580a0b90de7
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,15 +1,22 @@
|
|
1
1
|
# Route53Aliaser
|
2
2
|
|
3
|
-
Simulate DNS ALIAS-
|
4
|
-
zones](https://devcenter.heroku.com/articles/apex-domains) (a.k.a. bare /
|
5
|
-
domains) via Amazon [Route 53](https://aws.amazon.com/route53/)
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
3
|
+
Simulate DNS ALIAS-Record support for [apex
|
4
|
+
zones](https://devcenter.heroku.com/articles/apex-domains) (a.k.a. bare /
|
5
|
+
naked / root domains) via Amazon [Route 53](https://aws.amazon.com/route53/)
|
6
|
+
by looking for changes to the CNAME you'd like to point to and updating your
|
7
|
+
A-Record via the Route 53 APIs.
|
8
|
+
|
9
|
+
Just point your ping monitor at the engine URL and you're good to go! Your
|
10
|
+
A-Record will remain in sync with whatever CNAME you point it at.
|
11
|
+
|
12
|
+
This is useful because some providers (like Heroku) don't support these
|
13
|
+
so-called naked domains and there are a limited number of DNS providers who
|
14
|
+
support the [ALIAS record](http://support.dnsimple.com/articles/alias-record/)
|
15
|
+
type (which is essentially a fake CNAME record set on the root domain; fake
|
16
|
+
because you [cannot have a CNAME at the
|
17
|
+
apex](http://serverfault.com/questions/613829/why-cant-a-cname-record-be-used-at-the-apex-of-a-domain)).
|
18
|
+
Amazon Route 53 only supports ALIASes to a few specific types of records,
|
19
|
+
which doesn't solve the problem for Heroku users who require SSL.
|
13
20
|
|
14
21
|
This code will:
|
15
22
|
|
@@ -21,8 +28,6 @@ This code will:
|
|
21
28
|
domain)
|
22
29
|
- If the Target and Source addresses differ, update the `target_record`
|
23
30
|
|
24
|
-
The updates are easily triggered by polling a URL in your application that is
|
25
|
-
mounted via a Rails Engine.
|
26
31
|
|
27
32
|
## Installation
|
28
33
|
|
@@ -38,6 +43,7 @@ Or install it yourself as:
|
|
38
43
|
|
39
44
|
$ gem install route53_aliaser
|
40
45
|
|
46
|
+
|
41
47
|
## Usage
|
42
48
|
|
43
49
|
#### With Rails
|
@@ -67,15 +73,20 @@ Finally, set up something to ping this URL occasionally:
|
|
67
73
|
|
68
74
|
$ curl https://example.com/route53-update
|
69
75
|
|
70
|
-
|
71
|
-
an "every 10 minutes" option that'd be great for this. Just put the curl
|
72
|
-
command in there. Note that Heroku charges dyno hours for scheduled jobs; if
|
73
|
-
you're worried about this then you may prefer to use the "once an hour" option
|
74
|
-
instead.
|
75
|
-
|
76
|
-
You could also ping that URL via a free service like
|
76
|
+
The easiest way to do this is to ping that URL via a free service like
|
77
77
|
[Pingdom](http://www.pingdom.com/free). Since the DNS lookups are cached, most
|
78
|
-
of the time requests to this URL will return nearly instantly.
|
78
|
+
of the time requests to this URL will return nearly instantly. Pingdom
|
79
|
+
defaults to checking once per minute, which should be within even the shortest
|
80
|
+
TTLs.
|
81
|
+
|
82
|
+
Heroku's [free scheduler](https://devcenter.heroku.com/articles/scheduler) has
|
83
|
+
an "every 10 minutes" option that could also be used for this. Just put the
|
84
|
+
curl command in there. Note that Heroku
|
85
|
+
[charges](https://devcenter.heroku.com/articles/usage-and-billing) dyno hours
|
86
|
+
for scheduled jobs; if you're worried about this then you may prefer to use
|
87
|
+
the "once an hour" option instead. The downside to this approach is that the
|
88
|
+
further you stretch out the update interval the more likely you are to end up
|
89
|
+
with an out of date A-Record.
|
79
90
|
|
80
91
|
#### Without Rails
|
81
92
|
|
@@ -99,6 +110,7 @@ have a better idea. Here are a couple alternatives:
|
|
99
110
|
not in a separate thread) in a controller action is not recommended since
|
100
111
|
DNS lookups / AWS calls might be slow & will block the request to your page.
|
101
112
|
|
113
|
+
|
102
114
|
## Contributing
|
103
115
|
|
104
116
|
So far, this is being used against a limited number of configurations so
|
@@ -13,7 +13,7 @@ module Route53Aliaser
|
|
13
13
|
def call
|
14
14
|
unless stale?
|
15
15
|
# NOOP if we haven't expired
|
16
|
-
config.logger.
|
16
|
+
config.logger.info "Route53Aliaser: NOOP because cache is fresh"
|
17
17
|
return
|
18
18
|
end
|
19
19
|
|
@@ -21,7 +21,7 @@ module Route53Aliaser
|
|
21
21
|
source_ips = get_ips(config.source_record, config.source_key)
|
22
22
|
|
23
23
|
if target_ips == source_ips
|
24
|
-
config.logger.
|
24
|
+
config.logger.info "Route53Aliaser: No Route 53 Update required (Target IPs match the Source IPs)"
|
25
25
|
else
|
26
26
|
config.logger.info "Route53Aliaser: IPs for #{config.target_record} #{target_ips} differ from #{config.source_record} #{source_ips}; will attempt to update"
|
27
27
|
rt53 = Route53Updater.new(config)
|