{"id":22740614,"url":"https://github.com/datarockets/infrastructure","last_synced_at":"2025-04-23T21:40:47.860Z","repository":{"id":48456764,"uuid":"361402917","full_name":"datarockets/infrastructure","owner":"datarockets","description":"Infrastructure as Code","archived":false,"fork":false,"pushed_at":"2024-11-27T14:21:09.000Z","size":77,"stargazers_count":2,"open_issues_count":18,"forks_count":0,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-03-25T08:18:35.236Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/datarockets.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-25T10:55:47.000Z","updated_at":"2022-05-17T12:01:39.000Z","dependencies_parsed_at":"2023-12-15T22:02:18.743Z","dependency_job_id":null,"html_url":"https://github.com/datarockets/infrastructure","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datarockets%2Finfrastructure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datarockets%2Finfrastructure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datarockets%2Finfrastructure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datarockets%2Finfrastructure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/datarockets","download_url":"https://codeload.github.com/datarockets/infrastructure/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246273519,"owners_count":20750904,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-10T23:09:33.077Z","updated_at":"2025-03-30T03:42:06.780Z","avatar_url":"https://github.com/datarockets.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# datarockets infrastructure\n\n## Examples\n\n* [AWS EKS kubernetes cluster with deployment and ingress](examples/aws-eks-cluster)\n\n### Digitalocean kubernetes for web services\n\nCreate managed kubernetes cluster and managed PostgreSQL database in Digitalocean and deploy simple web app consisting of one or mulple services.\n\nThe app will be deployed automatically, TLS certificates will be obtained automatically using Let's Encrypt.\n\nKeep in mind that during the first run you won't have images in the registry yet, so you might put some placeholder images (e.g. `nginx:latest`) in `services` variable in `kubernetes` module.\n\nCreate `main.tf` in your repository:\n```tf\nmodule \"digitalocean\" {\n  source = \"git@github.com:datarockets/infrastructure.git//do/k8s?ref=v0.1.0\"\n\n  project = \"sphere\"\n  region = \"tor1\"\n\n  database = {\n    name = \"sphere\"\n    username = \"sphere\"\n  }\n}\n\nprovider \"kubernetes\" {\n  host = module.digitalocean.k8s_host\n  token = module.digitalocean.k8s_token\n  cluster_ca_certificate = module.digitalocean.k8s_ca_certificate\n}\n\nprovider \"kubernetes-alpha\" {\n  host = module.digitalocean.k8s_host\n  token = module.digitalocean.k8s_token\n  cluster_ca_certificate = module.digitalocean.k8s_ca_certificate\n}\n\nprovider \"helm\" {\n  kubernetes {\n    host = module.digitalocean.k8s_host\n    token = module.digitalocean.k8s_token\n    cluster_ca_certificate = module.digitalocean.k8s_ca_certificate\n  }\n}\n\nmodule \"kubernetes\" {\n  source = \"git@github.com:datarockets/infrastructure.git//k8s/basic?ref=v0.1.0\"\n  depends_on = [\n    module.digitalocean\n  ]\n\n  app = \"sphere\"\n  email = \"sphere@datarockets.com\"\n  dcr_credentials = module.digitalocean.dcr_credentials_k8s\n  services = {\n    app = {\n      replicas = 1\n      image = \"${module.digitalocean.dcr_endpoint}/app:latest\"\n      ports = [80]\n      env_from_secrets = []\n    }\n    api = {\n      replicas = 1\n      image = \"${module.digitalocean.dcr_endpoint}/api:latest\"\n      ports = [3000]\n      env_from_secrets = [\"sphere\"]\n      env = {\n        DB_POOL_SIZE = 16\n      }\n      init_container = {\n        command = [\"bin/rails\", \"db:migrate\"]\n        env_from_secrets = [\"sphere\"]\n        env = {\n          DB_POOL_SIZE = 1\n        }\n      }\n    }\n    worker = {\n      replicas = 1\n      image = \"${module.digitalocean.dcr_endpoint}/worker:latest\"\n      ports = []\n      env = {\n        QUEUES = \"default:10\"\n      }\n    }\n  }\n  web_services = [\"app\", \"api\"]\n  ingresses = {\n    \"sphere.datarockets.com\" = {\n      annotations = {\n      }\n      rules = [\n        {\n          host = \"sphere.datarockets.com\"\n          paths = [\n            {\n              path = \"/api\"\n              service = \"api\"\n              port = 3000\n            },\n            {\n              path = \"/\"\n              service = \"app\"\n              port = 80\n            }\n          ]\n        }\n      ]\n    }\n  }\n  secrets = {\n    sphere = {\n      DB_HOST = module.digitalocean.db_host\n      DB_PORT = module.digitalocean.db_port\n      DB_USER = module.digitalocean.db_user\n      DB_PASSWORD = module.digitalocean.db_password\n      DB_DATABASE = module.digitalocean.db_database\n    }\n  }\n}\n```\n\n## Caveats\n\nThe configuration above will probably fail due to limitations of kubernetes-alpha provider: we try to create an Issuer using kubernetes-alpha and it raises an error because there are no CRD Issuer before we install cert-manager helm chart. Therefore, in order to apply the terraform config above you would need to apply it via multiple steps:\n```\nterraform apply -target=module.digitalocean\nterraform apply -target=module.kubernetes.module.dependencies\nterraform apply\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatarockets%2Finfrastructure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatarockets%2Finfrastructure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatarockets%2Finfrastructure/lists"}