Friday, December 29, 2017

Custom Domains

08 How do I use custom domains?
This content is copyright of CloudCredo. © CloudCredo 2015. All rights reserved.

Note: Saving the best for last...

Cloud Foundry Hero Badge
Outstanding Cloud Foundry Knowledge

Note: But first...

Feature
As a CF hero
I want my app to be accessible at my domain
So that everyone can see my Cloud Foundry Hero Badge
How do I use custom domains?
$ cf create-domain cf-hero-YOUR-NAME YOUR-NAME.cf-hero.cloudcredo.io
# From the training home directory:
$ cd 08-domains-routes/cf-hero
# Uncomment domain & replace YOUR-NAME
$ vim manifest.yml
$ cf push


Note: We can add our custom domain to our CF org.

I want multiple routes
pointing to the same app
$ cf map-route cf-hero gerhard.cf-hero.cloudcredo.io -n www
$ cf apps

name     ..  urls
cf-hero  ..  gerhard.cf-hero.cloudcredo.io, www.gerhard.cloudcredo..


I also want multiple domains
pointing to the same app
$ cf domains

name                            status
cfapps.io                       shared
gerhard.cf-hero.cloudcredo.io   owned
$ cf map-route cf-hero cfapps.io -n gerhard-cf-hero
$ cf routes

space         host              domain                          apps
development                     gerhard.cf-hero.cloudcredo.io   ...
development   www               gerhard.cf-hero.cloudcredo.io   ...
development   gerhard-cf-hero   cfapps.io                       ...


Note: Every Cloud Foundry installation will have at least one shared domain

This is shared across all apps deployed on that Cloud Foundry

Even though we are using no host with our custom domain, we cannot use no host with the shared domain

Shared domains have reserved hosts, such as api

What about multiple
domains & routes?
$ cat imaginary-manifest.yml

name: cf-hero
domains:
  - cloudcredo.io
  - cloudcredo.com
hosts:
  - gerhard
  - gerhard-lazu
$ cf routes

space          host            domain            apps
development    gerhard         cloudcredo.io     cf-hero
development    gerhard-lazu    cloudcredo.io     cf-hero
development    gerhard         cloudcredo.com    cf-hero
development    gerhard-lazu    cloudcredo.com    cf-hero
Experiment with app versions
$ cf push -f manifest-superhero.yml
And when it did its job...

$ cf delete -f -r cf-superhero


When you find
the best app version
# From the training home directory:
$ cd 08-domains-routes/cf-hero-static
# Replace YOUR-NAME
$ vim public/index.html
# Uncomment domain & replace YOUR-NAME
$ vim manifest.yml
$ cf push
$ cf app cf-hero-static

     state     since        cpu    memory        disk
#0   running   2015-11-02   0.0%   6.8M of 16M   33.6M of 64M
...
#3   running   2015-11-02   0.0%   6.7M of 16M   33.5M of 64M
$ cf delete -f cf-hero
Accidental blue/green deploy

You are now a
Cloud Foundry Hero



DELIVERED
As a CF hero
I want my app to be accessible at my domain
So that everyone can see my Cloud Foundry Hero Badge
Any questions?
Questions cannot be stupid. Answers can.

CF SUPERHERO
Set up a custom SSL certificate
Use feature flags instead of ENV vars
Delete all routes that are no longer used
$ cf delete-orphaned-routes

No comments:

Post a Comment

உப்பு மாங்காய்

சுருக்குப்பை கிழவி. சுருக்கங்கள் சூழ் கிழவி. பார்க்கும் போதெல்லாம் கூடையுடனே குடியிருப்பாள். கூடை நிறைய குட்டி குட்டி மாங்காய்கள். வெட்டிக்க...