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

feat: implement aws terraform modules and infrastructure example #143

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gabor-boros
Copy link
Contributor

This PR implements terraform modules for AWS that allows anyone to create a production-grade infrastructure for hosting Open edX instances using Tutor and Harmony.

The PR includes a reference implementation as a usage example.

@gabor-boros gabor-boros self-assigned this Jan 6, 2025
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jan 6, 2025
@openedx-webhooks
Copy link

Thanks for the pull request, @gabor-boros!

What's next?

Please work through the following steps to get your changes ready for engineering review:

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.

🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads

🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

🔘 Let us know that your PR is ready for review:

Who will review my changes?

This repository is currently maintained by @openedx/openedx-k8s-harmony-maintainers. Tag them in a comment and let them know that your changes are ready for review.

Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

registry_credentials = var.docker_registry_credentials

worker_node_ssh_key_name = var.worker_node_ssh_key_name
worker_node_instance_types = ["m6i.large"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be configurable or is this a pretty good node size for most setups?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just an example, the module is configurable. But it is a good node size too

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I see. That kind of answers my question about the s3 bucket too. Maybe rename this to main.example.tf then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As the whole code is within "infra-examples" I feel that would be repetitive. However, we could drop a readme in the directory to explain the purpose and clarify the expectations about that piece of code.

| <a name="input_database_storage_ipos"></a> [database\_storage\_ipos](#input\_database\_storage\_ipos) | The disk IOPS to have for the database instance | `number` | `null` | no |
| <a name="input_database_storage_size"></a> [database\_storage\_size](#input\_database\_storage\_size) | The storage assigned to the database instance | `number` | `null` | no |
| <a name="input_database_storage_type"></a> [database\_storage\_type](#input\_database\_storage\_type) | The storage type to use for the database instance | `string` | `null` | no |
| <a name="input_database_users"></a> [database\_users](#input\_database\_users) | Map of overrides for the user and database names. | <pre>map(object({<br/> username = string<br/> database = string<br/> forum_database = string<br/> }))</pre> | `{}` | no |
Copy link
Contributor

Choose a reason for hiding this comment

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

Would these database_users typically be left empty {} as in the default shown? What's the use case for specifying some?

I'm hoping this is only for admin/analytics style access to the whole cluster, and generally per-instance databases are created by Tutor [plugins].

Does MongoDB not have an equivalent of rds_root_username ?

Also, we won't be using MongoDB for the forum in Sumac / Tutor 19 / master, so will anything break if forum_database is "" ?

@@ -0,0 +1,65 @@
## Requirements
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these files auto-generated somehow or are you manually creating them and keeping them in sync with variables.tf etc.?

Comment on lines +60 to +66

module "bucket" {
source = "../../terraform/modules/aws/s3"

environment = var.environment
bucket_prefix = "my-institute"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

So if I understand correctly, this creates an S3 bucket called my-institute? Is there a use case for that? Why do we even have the s3 module at all?


variable "kubernetes_cluster_name" {
type = string
description = "Name of the DigitalOcean Kubernetes cluster to create."
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
description = "Name of the DigitalOcean Kubernetes cluster to create."
description = "Name of the Kubernetes cluster to create."

public_subnet_tags = {
"Tier" = "Public"
"kubernetes.io/cluster/${local.cluster_name}" = "shared"
"kubernetes.io/role/elb" = "1"
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like this only works if you are also using aws-load-balancer-controller or am I missing an additional step?. I tried using only the ingress-nginx controller and the controller service stays "pending" with the message:

Warning  SyncLoadBalancerFailed  5m22s (x19 over 70m)  service-controller  Error syncing load balancer: failed to ensure load balancer: could not find any suitable subnets for creating the ELB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
Status: Needs Triage
Development

Successfully merging this pull request may close these issues.

4 participants