New user: How to create a s3 static website?

dreamobjects

#1

Hi Guys,
I’m a new user to DreamHost, though I’ve brought up test s3 websites in aws and before. Unfortunately my experience has been poor so far.

  • received a nice email to say I didn’t complete registration. Gave me a link to register. Link didn’t work. Gave me sales@dh email… email bounced as I wasn’t on their records.
  • dreamhost.com says “graham.xyz” is available, but when paying for it, it was unavailable.
  • registering via the panel “grahamx.xyz” failed first attempt, error “Can’t use an undefined value as a HASH reference at /usr/local/lib/site_perl/Ndn/Common/ApiCall/Enom.pm line 185.”
  • 15 minutes later, tried again to register same domain, and it worked okay. hu?

Tutorial

  • I was able to create the bucket using the web panel portal okay.

Help
What is this s3cmd certificate error about? How do I get this to work?

Tutorial "Creating the DNS entry"
The 2nd issue that I have with the tutorial above, is it says to go to “Panel ->: Domains”.
(I believe this to mean the “Manage Domains” on the left menu)

  • As per instructions, how do I add a custom DNS record, and pick CNAME ?
  • Do I need to select “+ Add Hosting” icon first? When I do, I see no options to create custom DNS records. Does this mean I need to purchase more services from DreamHost?
  • When I go to the “Registrations” page (left menu in panel) and click on the created domain, the whois information specifically doesn’t list .xyz domains. Does this mean that DreamHost doesn’t look after .xyz addresses?

I’m finding problems every step of the way… should I just give up now?
Graham


#2

I have a hosting plan, but when I go to the panel and click Manage Domains, then click the “Add Hosting To A Domain/Subdomain,” it sends me to the proper page that has a DNS Only option at the very bottom.

That being said, this overall approach isn’t the most desirable:

  1. You’ll be stuck with the www for your domain. I’m not sure if a non-www will send you to your proper site.
  2. You don’t get HTTPS (yet…supposedly it’s in the pipeline).
  3. S3 permissions (Read/Write, Owner/World) can get easily get mucked up.

TYPO! Your error you posted referred to “grahamx.xyz” with an extra x. That may be the problem.


#3

Thanks sdayman for your thoughts re DNS.

  1. I guess I don’t understand this DNS stuff well enough, and need further help in the tutorial.
  • aws seems to allow you to point multiple sub domains back to the primary.
  1. Not worried by HTTPS
  2. I need to understand permissions anyway, one of the reason’s I’m doing this.

I also wonder why I’m getting the certificate error in s3cmd?


#4

Is that the very first command you’ve tried with s3cmd? I had success.

ps526211:~> s3cmd mb s3://www.sdayman.com (I don’t even have an sdayman.com registered)
Bucket ‘s3://www.sdayman.com/’ created
ps526211:~>

However, I first had to create a .s3cfg file in my home directory:
https://help.dreamhost.com/hc/en-us/articles/215916627-How-to-use-S3cmd-with-DreamObjects (scroll down a bit until you get to the Configuring part).

And to backtrack a bit more, do you have a DreamObjects user set up from the DreamHost panel?
https://panel.dreamhost.com/index.cgi?tree=cloud.objects&

p.s. This happens to be a very timely topic, as I just this weekend discovered the very tutorial you’re working from. In fact, the bookmark is sitting on my desktop for frequent reference. Yes, I’m excited about this new facet of DreamObjects. I don’t recall s3cmd being available before.
[hr]
To answer your DNS Question, were you able to add a DNS entry for your www domain?

Come to think of it, you could probably even add a CNAME without the www part.

To be honest, I’m not even sure why the bucket name matters. Possibly because all bucket names go in the same pool, and their recommended naming method probably ensures uniqueness.


#5

sdayman, thanks for your ideas.

Yes, I’ve managed to get the DNS to work. I’ve needed to get my tongue touching my nose, head to the side, and then pressed a few buttons options on the dh panel which didn’t make much sense, and then finally got to the point where I added the CNAME entry.
(maybe the tutorial could help people that are not experienced with panel stuff?)

I haven’t thought about how to redirect the root url yet…

The s3cmd problem was that there are multiple . (periods) in the domain name, and the certificate authentication isn’t working properly with it.

(even the source code talks about the problem. https://github.com/s3tools/s3cmd/blob/master/S3/ConnMan.py
For reference My machine is a default linux mint C18)

I got around it by adding the parameter “–no-check-hostname” to the s3cmd command.
No idea how to stop the checking via the cfg file yet.

Enjoy your testing!
Graham


#6

Hi,

DreamObjects guy here (and upstream author of the majority of the static website functionality).

I’ve passed that remark on. I don’t use the DNS in the panel at all, because it doesn’t fit my own needs.

The DNS entry for the root of the domain should be manually inserted A/AAAA records that go to the same IP as objects-website-us-west-1.dream.io. Amazon has a bit of magic here, with their “Alias” type in Route53, that gives CNAME-like magic within the constraints of DNS.

For the content of http://graham.xyz/ itself, you have two options:

  1. Upload the same static website you have uploaded at http://www.graham.xyz/
  2. Set the RedirectAllRequestsTo property in the website configuration (s3cmd can’t do it, but boto & aws-cli can), and generate redirect from http://graham.xyz/ to http://www.graham.xyz/

That’s a matter of the definition of ‘properly’. The SSL specification says that wildcards only ever match a single element, and never go past the period. So properly according to the SSL spec is to fail it.

You have two options:

  1. Disable the hostname part of the check, in the s3cmd config file:
check_ssl_hostname = no
  1. Tell s3cmd to use the path-based calling format, and keep strict SSL validation on, again in the s3cmd config file:
host_bucket = objects-us-west-1.dream.io

Lastly, yes, HTTPS for website-hosting is on the radar (including LetsEncrypt support), but I don’t have any timeline on it yet.


#7

Hi robbat2,
Thanks for your knowledge on this. It will take some time to do the root of the domain, as it’s isn’t a high priority. Some thoughts:

Initial dreamhost problems: I have screenshots of the issues if this is of assistance.

DNS -> I think the panel is more useful for people using your existing products, and possibly not streamlined for running a static website with objects.

My understanding of ‘properly’ is following the tutorial. The tutorial says:

host_bucket = %(bucket)s.objects-us-west-1.dream.io

I’ve now tried: host_bucket = objects-us-west-1.dream.io
This works. Maybe the tutorial needs revamping for this condition?

Thanks,
Graham


#8

Maybe I’m slightly ignorant here, but why can’t you CNAME both the www and the root to the bucket? Is this tied to the way DreamSpeed won’t let me assign the root as a CNAME?

Regarding Graham’s host_bucket issue, I’m using the tutorial’s recommended setting and it’s working fine with s3cmd. Is this just a speedier way to use the short name of my bucket without having to type in the fully qualified domain name? If Option #2 (which worked for Graham) is correct, I think it is a special configuration for the static website setup.


#9

As you noted, it comes down to s3cmd. Here’s the last release (1.6.1):

Notice how it hardcodes Amazon :frowning: in that release.

This fix was committed, but has been released yet (the code you linked before):

I would strongly suggest only using host_bucket = objects-us-west-1.dream.io only if you have buckets with periods and need strict hostname verification (eg some PCI compliance requirement).

The setting of host_bucket = %(bucket)s.objects-us-west-1.dream.io is much preferred, because it allows buckets to be load-balanced via DNS (Amazon S3 makes heavy use of that).


#10

New user here too. I successfully created a static website using DreamObjects. My domain is registered at a third party (i.e. not Dreamhost) and I realized that I don’t need to create any alias or DNS entries at dreamhost at all. Instead I just went in to my registrar’s settings and changed the CNAME record to the www.example.com.objects-website-us-west-1.dream.io and things are working fine. On the dreamhost side, you only need to create your buckets and do the correct configuration using “s3cmd” including the “ws-create” listed in the tutorial.


#11

Hi robbat2,
Thanks for looking this through. I’ll probably turn off ssl authentication for the time being, and watch out for an s3cmd update. There is much yet to learn about these things. Graham