Blog

Pivotal Web Services, SSL, and a Custom Domain

01.01.2020 | Devops | Austin Vance

hero

Pivotal Web Services (PWS) is a great place to set up push button deployments. It's cheaper than Heroku and has some great features. One place it falls short is offering free SSL for custom domains; you can't even upload your SSL cert without shelling out $20/month.

Luckily there is an effortless way to get SSL up and running for free using CloudFlare.

Deploy something to PWS

If you don't have a PWS account, create one at https://run.pivotal.io and download the cf command line tool.

On Mac

brew tap cloudfoundry/tap
brew install cf-cli

Now that you have an account let's create a super simple SpringBoot Kotlin app.

@SpringBootApplication
class SsldemoApplication

fun main(args: Array<String>) {
    runApplication<SsldemoApplication>(*args)
}

@Controller
class HelloController {
    @GetMapping("/")
    @ResponseBody
    fun hello(): String {
        return "Hello PWS"
    }
}

Now you have an app and a PWS account so let's push this thing up. Assuming you have an org and space set up already.

CF Push

cf login
./gradlew build
cf push ssldemo -p ./build/libs/ssldemo-0.0.1-SNAPSHOT.jar

Everything should deploy, and your app should be up and running at a *.cfapps.io domain.

Setup a custom route

In order of PWS to know to route your domain to your app, you need to set up a custom domain. You can either use the web UI or the CLI. To use the CLI use the cf create-domain and cf create-route commands.

cf create-domain focusedlabs focusedlabs.io
cf create-route development focusedlabs.io --hostname ssldemo
cf map-route ssldemo focusedlabs.io --hostname ssldemo

DNS stuff

Just because we have mapped the route doesn't mean everything is wired, we still have one more step, configure a DNS CNAME to route to our newly deployed service.

Cloud Flare DNS Setup

This guide assumes your DNS is already managed by CloudFlare. If it's can migrate over to them really easily.

In the CloudFlare DNS management panel add a new CNAME record and you're all set.

curl https://ssldemo.focusedlabs.io

Demo Curl

Share

Read More

Related Posts

related_image

06.30.2021 | Culture | Katy Scott

At Focused Labs, collaboration is key to how we work together; it helps our teams learn from each other, brings us closer and helps us become more efficient...

related_image

06.23.2021 | Culture | Austyn

Late-night feedings and diaper changes, the 3-4 month sleep regression, teething, and a growth spurt all mean I'm getting less sleep than...

related_image

05.12.2021 | Culture Backend Frontend | Ryan Taylor

Temporarily disrupts "normal" business operations and allow self-organized teams to rapid prototype around their interest areas

related_image

04.27.2021 | Culture | Erin Hochstatter

Several years ago, I'd been trying to find an approach to software consulting that made sense for me [...]

related_image

01.28.2021 | Backend | Parker Drake

Recently I found myself needing to validate fields in a Spring Boot controller written in Kotlin...

related_image

01.22.2021 | Tutorial | Luke Mueller

⌘+⇧+g is the way to go

related_image

01.21.2021 | Devops | Katy G

Kube jobs running wild? To delete successful jobs...

additional accent
accent
FocusedLabs

171 N Aberdeen St
Suite 400
Chicago, IL 60607
(708) 303-8088

[email protected]

© 2021 FocusedLabs, All Rights Reserved.

  • facebook icon
  • twitter icon
  • linkedin icon
  • github icon