{"id":22934655,"url":"https://github.com/frani/boilerplate-ec2-ssl","last_synced_at":"2026-07-13T23:32:39.773Z","repository":{"id":174215728,"uuid":"651697874","full_name":"frani/boilerplate-ec2-ssl","owner":"frani","description":"🐿️ Boilerplate con Terraform, Docker y Nginx para facilitar la creación y configuración de recursos necesarios para desplegar una instancia de tu sitio web en AWS. A su vez, ofrece la posibilidad de implementar despliegues continuos de manera sencilla usando Github Actions.","archived":false,"fork":false,"pushed_at":"2023-06-10T15:00:59.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-17T15:56:46.560Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/frani.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2023-06-09T21:03:25.000Z","updated_at":"2023-06-10T15:01:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"45d3db29-4ab5-40c3-9dfa-b96e8bd78659","html_url":"https://github.com/frani/boilerplate-ec2-ssl","commit_stats":null,"previous_names":["frani/boilerplate-ec2-ssl"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/frani/boilerplate-ec2-ssl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frani%2Fboilerplate-ec2-ssl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frani%2Fboilerplate-ec2-ssl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frani%2Fboilerplate-ec2-ssl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frani%2Fboilerplate-ec2-ssl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frani","download_url":"https://codeload.github.com/frani/boilerplate-ec2-ssl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frani%2Fboilerplate-ec2-ssl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35440511,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-13T02:00:06.543Z","response_time":119,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-14T11:44:34.357Z","updated_at":"2026-07-13T23:32:39.768Z","avatar_url":"https://github.com/frani.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# El dream\n\nVamos armar un boilerplate para configurar de forma generica terraform, docker, nginx, ECR, EC2 y activar un Despliegue continuo, en detalle:\n\n- Vamos a tener una config de Terraform para levantar Infra de ECR y EC2 con EIP (Elastic IP)\n- Dentro de la instancia de EC2 se va a instalar y configurar:\n  - Nginx ( HTTP → HTTP\\***\\*S\\*\\*** )\n  - Docker y docker-compose ( para levantar la API o el servicio web registrado en ECR )\n  - certbot para generar certificados para el Nginx\n- Se crea una configuracion de Github Action para el CI de las imagenes docker, y registrarlas en AWS ECR\n- Correr script dentro de instancia EC2 para actualizar el docker-compose y poner a correr la nueva version del contenedor deployado en AWS ECR\n- se puede crear un endpoint o un servicio en nginx que escuche alguna llamada y que esta ejecute el script de bash para volver a ejecutar docker-compose\n- se puede levantar un crontab en el cual cada minuto compruebe si hay diferencias entre el ultimo hash corriendo y el ultimo hash en ECR. Si hay diferencias, entonces actualiza.\n- crear un servicio HTTP, donde tenga endpoints para gestionar la imagen actual, ejemplo:\n\n```jsx\n\n/*\n * POST /\n **/\n\n// actualiza la imagen de docker\n{\n\t\"totp\": 102030,\n\t\"action\": \"upgrade\",\n\t\"imageId\": \"2767693332e5\" // optional, default is the latest\n}\n\n// actualiza la imagen de docker pa'tra\n{\n\t\"totp\": 102030,\n\t\"action\": \"docker compose rollback\",\n\t\"imageId\": \"04ff3864d734\" // optional, default is the previus of latest\n}\n\n// reinicia docker compose\n{\n\t\"totp\": 102030,\n\t\"action\": \"docker compose restart\"\n}\n\n// detiene docker compose\n{\n\t\"totp\": 102030,\n\t\"action\": \"docker compose stop\"\n}\n\n// devuelve listado de imagenes\n{\n\t\"totp\": 102030,\n\t\"action\": \"docker images\"\n}\n\n```\n\nEn caso de crear esta ultima opcion, deberia de configurarse algun hash aleatorio para el TOTP 👍\n\n# El Paso a paso\n\n- [ ] crear un servicio “gestor remoto de contenedor con TOTP”\n  1. el servicio puede correr en cualquier puerto que no sea 443 o 80 ( configurable )\n  2. se debe confiugrar un TOTP_SECRET en Github Secrets. Este mismo se va a usar para implementarse en este servicio de gestion remota de contenedores y en el CD\n  3. el servicio solo ejecuta ciertas funciones basicas como: upgrade, rollback, restart y stop\n- [ ] crear un script de bash para correr dentro de un AMI o Ubuntu e instalar y configurar:\n  1. instalar nginx, certbot y docker\n  2. ejecutar certbot\n  3. configurar nginx\n  4. descargar el gestor remoto de contenedor con TOTP\n  5. asignar subdominio `manage.\u003cdominio.com\u003e` , ejemplo: `manage.api.palta.app`\n- [ ] crear files para levantar infra con terraform:\n  1. crear EC2\n  2. levantar registro en ECR\n  3. crear sg con permisos inbound en puertos 80, 443 y 22\n  4. asignar EIP a EC2\n  5. darle permisos a instancia EC2 para acceder a ECR\n  6. dentro de EC2 correr script creado en el punto 1\n\nEn el boilerplate debe haber un lugar donde poder configurar ciertas variables a tener en cuenta como por ejemplo:\n\n- nombre del servicio\n- dominio del servicio\n\n_Notas o links de ref:_\n\nhttps://www.nginx.com/blog/using-free-ssltls-certificates-from-lets-encrypt-with-nginx/\n\nhttps://www.nginx.com/resources/wiki/start/topics/examples/full/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrani%2Fboilerplate-ec2-ssl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrani%2Fboilerplate-ec2-ssl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrani%2Fboilerplate-ec2-ssl/lists"}