Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add autoDomain option to config #323

Conversation

bryan-hunter
Copy link
Contributor

@bryan-hunter bryan-hunter commented Apr 15, 2020

Changes proposed in this pull request:

  • Adds autoDomain option to customDomain config

This will enable the creation/deletion of a domain name to be run as part of sls deploy and sls remove.

This will be an option to eliminate the need to call sls create_domain prior to sls deploy if you'd like to only run sls deploy across all of your stacks and do not want to run an additional pre-command.

@bryan-hunter
Copy link
Contributor Author

@jconstance-amplify any chance you will be able to review this? Thanks!!

@bryan-hunter
Copy link
Contributor Author

@jconstance-amplify bump - looking for feedback or approval when you have some free time 😁

thanks again!

Copy link
Collaborator

@jconstance-amplify jconstance-amplify left a comment

Choose a reason for hiding this comment

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

Thanks for sending this PR. Apologies for the long wait on review. One minor comment on the name of the config option. Otherwise seems okay.

We'll probably wait to merge this until after #319 though. And you might need to fix some merge conflicts after that.

README.md Outdated
@@ -85,6 +86,7 @@ custom:
| hostedZonePrivate | | If hostedZonePrivate is set to `true` then only private hosted zones will be used for route 53 records. If it is set to `false` then only public hosted zones will be used for route53 records. Setting this parameter is specially useful if you have multiple hosted zones with the same domain name (e.g. a public and a private one) |
| enabled | true | Sometimes there are stages for which is not desired to have custom domain names. This flag allows the developer to disable the plugin for such cases. Accepts either `boolean` or `string` values and defaults to `true` for backwards compatibility. |
securityPolicy | tls_1_2 | The security policy to apply to the custom domain name. Accepts `tls_1_0` or `tls_1_2`|
| createDomainName | `false` | Toggles whether or not the plugin will run `create_domain/delete_domain` as part of `sls deploy/remove` so that multiple commands are not required. |
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure about the name createDomainName because it doesn't quite convey that this will also automatically run delete_domain for you. Maybe something like autoDomain, automaticallyManageDomain, or something along those lines?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated to autoDomain.

I'll keep an eye out for when 319 is merged - thanks!

@bryan-hunter bryan-hunter changed the title add createDomainName option to config add autoDomain option to config May 5, 2020
@bryan-hunter
Copy link
Contributor Author

@jconstance-amplify I have pulled in master and addressed merge conflicts when you have a chance to review

@bryan-hunter
Copy link
Contributor Author

@jconstance-amplify bumping, just in case you missed it :)

@jconstance-amplify
Copy link
Collaborator

@bryan-hunter Thanks for the bump, will try to get this in this week.

Copy link
Collaborator

@jconstance-amplify jconstance-amplify left a comment

Choose a reason for hiding this comment

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

LGTM, apologies for the delay and thanks for doing this @bryan-hunter.

@sonarcloud
Copy link

sonarcloud bot commented Jun 1, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@jconstance-amplify jconstance-amplify merged commit d890548 into amplify-education:master Jun 1, 2020
@bryan-hunter
Copy link
Contributor Author

@jconstance-amplify do you know when a new version will be deployed?

@jconstance-amplify
Copy link
Collaborator

@bryan-hunter Probably today or tomorrow.

@jconstance-amplify
Copy link
Collaborator

@bryan-hunter Hey, had to revert this off of master. I ran into a few intermittent race conditions with this locally. Looks like sometimes when the deploy tries to add the base path mapping, the domain isn't available yet and the deploy fails. Maybe you could look into that via adding an integration test for this new behavior?

@bryan-hunter
Copy link
Contributor Author

@jconstance-amplify from the docs:

The plugin then creates the proper A Alias and AAAA Alias records for the domain through Route 53. Once the domain name is set it takes up to 40 minutes before it is initialized. After the certificate is initialized, sls deploy will create the base path mapping and assign the lambda to the custom domain name through CloudFront. 

Do you think I should add an optional waitForDomain option to autoDomain that lets you specify a max wait time and maybe try to see if it's created every X sec?

@jconstance-amplify
Copy link
Collaborator

@bryan-hunter I believe the initialized time is how long it takes for it to be available to handle web traffic - the timing for it to be available inside of the API is usually much less. This is probably an issue stemming how from the AWS API is usually eventually consistent. If you create a resource, it's not unexpected for subsequent API calls to not see the resource for some amount of time (in my experience usually less than a few minutes). Adding in the config option and defaulting it to something like a few minutes seems like it would resolve the issue to me.

@50l3r
Copy link

50l3r commented Jun 24, 2020

It has been implemented in latest version?

@bryan-hunter
Copy link
Contributor Author

It has been implemented in latest version?

there's an open PR for it here: #356

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants