GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — chore: add alias to the URI and listener rule by iamhopaul123 · Pull Request #2320 · aws/copilot-cli

This repository was archived by the owner on Jun 22, 2026. It is now read-only.

Conversation

@iamhopaul123

@iamhopaul123 iamhopaul123 commented May 13, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Part of #1188. Preceding PR #2315. This PR:

  • add alias to the URI
  • add alias to the listener rule
  • enable path routing for HTTPS
  • move stack related behaviors in describe to describe/stack pkg

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@iamhopaul123
iamhopaul123 requested a review from a team as a code owner May 13, 2021 23:36
@iamhopaul123
iamhopaul123 requested a review from efekarakus May 13, 2021 23:36
@amazon-ecs-cli-v2-pr-manager
amazon-ecs-cli-v2-pr-manager requested a review from bvtujo May 13, 2021 23:36
@iamhopaul123
iamhopaul123 marked this pull request as draft May 13, 2021 23:36
@iamhopaul123
iamhopaul123 force-pushed the alias-enable branch from 4a0d9e3 to f2b4ed1 Compare May 14, 2021 19:06
@iamhopaul123
iamhopaul123 marked this pull request as ready for review May 14, 2021 19:07
efekarakus
efekarakus reviewed May 14, 2021
View reviewed changes

@efekarakus efekarakus left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! I think mostly a request to clean up our describe pkg if possible 🙏

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread internal/pkg/describe/lb_web_service.go Outdated
Comment on lines +71 to +72
EnvStackParamOutput() (params map[string]string, outputs map[string]string, err error)
StackParamOutput() (params map[string]string, outputs map[string]string, err error)

@efekarakus efekarakus May 14, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This interface feels like is due a refactor. There are too many awkward things 😅

For example, StackParamOutput returns stack parameters and outputs but then we have a separate method for just returning the resources. It's not clear why it's separate.
The interface named svcDescriber also fetches outputs from the env stack which is peculiar 😆

Can we find a better separation? What about this:

type cfnStackDescriber interface {
   Params() (map[string]string, error)
   Outputs() (map[string]string, error)
   StackResources() ([]*cloudformation.StackResource, error)
}

type ecsSvcDescriber interface {
   cfnStackDescriber
   EnvVars() ([]*ecs.ContainerEnvVar, error)
   Secrets() ([]*ecs.ContainerSecret, error)
}

// implements cfnStackDescriber
type envStackDescriber struct { ... }

// implements ecsSvcDescriber
type ecsSvcDescriber struct { ... }

Anyway it doesn't need to be like the above, but it would be great if we can refactor this interface a little.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

iamhopaul123 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@iamhopaul123 iamhopaul123 May 17, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@efekarakus efekarakus mentioned this pull request May 17, 2021
How to move to production / change region with copilot? #2331
Closed
@iamhopaul123
iamhopaul123 force-pushed the alias-enable branch 2 times, most recently from 2647e68 to 86b3e3e Compare May 17, 2021 22:48
@iamhopaul123
iamhopaul123 requested a review from a team May 17, 2021 22:53
@iamhopaul123
iamhopaul123 force-pushed the alias-enable branch from 86b3e3e to 881cc37 Compare May 17, 2021 23:09
@efekarakus efekarakus added do-not-merge Pull requests that mergify shouldn't merge until the requester allows it. and removed do-not-merge Pull requests that mergify shouldn't merge until the requester allows it. labels May 18, 2021
@iamhopaul123
iamhopaul123 force-pushed the alias-enable branch 2 times, most recently from f102c45 to 3749557 Compare May 19, 2021 18:34
efekarakus
efekarakus reviewed May 19, 2021
View reviewed changes

@efekarakus efekarakus left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow all these merge conficts 😮

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread internal/pkg/describe/app.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread internal/pkg/describe/env.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread internal/pkg/describe/lb_web_service.go
Comment on lines +36 to +33
HTTPS bool
DNSNames []string // The environment's subdomain if the service is served on HTTPS. Otherwise, the public load balancer's DNS.

@efekarakus efekarakus May 19, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wut 🤔 how can HTTPS be true and DNSNames be empty?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@efekarakus efekarakus May 19, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it would make sense to instead have two different structs?
type HTTPendpoint struct and type HTTPSendpoint struct

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread internal/pkg/describe/lb_web_service.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread templates/workloads/services/lb-web/cf.yml Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread internal/pkg/describe/status.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread internal/pkg/describe/status.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread internal/pkg/describe/backend_service.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

iamhopaul123 added 2 commits May 19, 2021 15:54
@iamhopaul123
chore: add alias to the URI and listener rule
d73edf1
@iamhopaul123
Address feedback
e0c802c
@iamhopaul123
iamhopaul123 force-pushed the alias-enable branch from 00f402a to e0c802c Compare May 19, 2021 22:57
@efekarakus efekarakus added the do-not-merge Pull requests that mergify shouldn't merge until the requester allows it. label May 20, 2021
efekarakus
efekarakus approved these changes May 20, 2021
View reviewed changes

@efekarakus efekarakus left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! some tiny refactor comments, once addressed feel free to remove the label!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread internal/pkg/describe/lb_web_service.go Outdated
}
uris = append(uris, uri)
}
return strings.Join(uris, " or ")

@efekarakus efekarakus May 20, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use: https://github.com/dustin/go-humanize#word-series ?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@iamhopaul123 iamhopaul123 May 20, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm why do we need this?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@iamhopaul123 iamhopaul123 May 20, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oooh i see nvm

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread internal/pkg/describe/lb_web_service.go Outdated
var uris []string
for _, dnsName := range u.DNSNames {
uri := ""
switch strconv.FormatBool(u.HTTPS) + "|" + strconv.FormatBool(u.Path == "/") {

@efekarakus efekarakus May 20, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid this string conversion matrix?

protocol := "http://"
if u.HTTPS {
     protocol = "https://"
}
path := ""
if u.Path != "/" {
     path = fmt.Sprintf("/%s", u.Path)
}
uris = append(uris, fmt.Sprintf("%s%s%s", protocol, dnsName, path)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

iamhopaul123 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread internal/pkg/describe/lb_web_service.go Outdated
}

// URI returns the LBWebServiceURI to identify this service uniquely given an environment name.
// URI returns the WebServiceURI to identify this service uniquely given an environment name.

@efekarakus efekarakus May 20, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this comment says "WebServiceURI" but it's from a "LBWebServiceURI" can we rename the type?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Lou1415926
Lou1415926 reviewed May 20, 2021
View reviewed changes

@Lou1415926 Lou1415926 left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly agreeing with Efe and two more questions ⬇️ choked

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread internal/pkg/describe/service.go Outdated
ServiceStackResources() ([]*stack.Resource, error)
}

type stackDescriber interface {

@Lou1415926 Lou1415926 May 20, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wonder if it's worthy to define stackDescriber in a separate file since it's being used not only for service but also for app?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread internal/pkg/describe/stack/stack.go Outdated

// HumanString returns the stringified Resource struct with human readable format.
func (c Resource) HumanString() string {
return fmt.Sprintf(" %s\t%s\n", c.Type, c.PhysicalID)

@Lou1415926 Lou1415926 May 20, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a big deal but I think ideally we should probably let the caller add the extra spaces in front of of %s\t%s\n

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

iamhopaul123 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@iamhopaul123
Address minor feedback
9d681f6
@iamhopaul123 iamhopaul123 removed the do-not-merge Pull requests that mergify shouldn't merge until the requester allows it. label May 20, 2021
@iamhopaul123
Fix static check
c533dd7
Lou1415926
Lou1415926 approved these changes May 20, 2021
View reviewed changes

@Lou1415926 Lou1415926 left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the refactor!!!!!!!!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mergify
Merge branch 'mainline' into alias-enable
01fd2f8
@mergify
mergify Bot merged commit c2d143d into aws:mainline May 20, 2021
thrau pushed a commit to localstack/copilot-cli-local that referenced this pull request Dec 9, 2022
@iamhopaul123 @thrau
chore: add alias to the URI and listener rule (aws#2320)
b7b3dde
<!-- Provide summary of changes -->
Part of aws#1188. Preceding PR aws#2315. This PR:
- add alias to the URI
- add alias to the listener rule
- enable path routing for HTTPS
- move stack related behaviors in `describe` to `describe/stack` pkg
<!-- Issue number, if available. E.g. "Fixes aws#31", "Addresses aws#42, 77" -->

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@bvtujo bvtujo Awaiting requested review from bvtujo
2 more reviewers
@efekarakus efekarakus efekarakus approved these changes
@Lou1415926 Lou1415926 Lou1415926 approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@iamhopaul123 @efekarakus @Lou1415926
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.