{"id":21297082,"url":"https://github.com/pyar/pyar_infra","last_synced_at":"2026-01-02T09:19:14.259Z","repository":{"id":32066939,"uuid":"131495533","full_name":"PyAr/pyar_infra","owner":"PyAr","description":"Python Argentina Infrastructure","archived":false,"fork":false,"pushed_at":"2025-01-13T18:47:00.000Z","size":350,"stargazers_count":7,"open_issues_count":26,"forks_count":2,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-01-22T07:27:42.033Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Mustache","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/PyAr.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":"2018-04-29T13:11:00.000Z","updated_at":"2025-01-13T13:20:33.000Z","dependencies_parsed_at":"2023-10-17T04:48:49.401Z","dependency_job_id":"f1129972-a071-4bb0-973b-3f6f24f1733d","html_url":"https://github.com/PyAr/pyar_infra","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyAr%2Fpyar_infra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyAr%2Fpyar_infra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyAr%2Fpyar_infra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyAr%2Fpyar_infra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PyAr","download_url":"https://codeload.github.com/PyAr/pyar_infra/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243765379,"owners_count":20344581,"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-11-21T14:32:54.935Z","updated_at":"2026-01-02T09:19:14.204Z","avatar_url":"https://github.com/PyAr.png","language":"Mustache","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python Argentina Infrastructure\n\nThis is the repository with all the code and documentation to handle PyAr infrastructure\n\nWe are working with [kubernetes](http://kubernetes.io/) in Azure [aks](https://docs.microsoft.com/en-us/azure/aks/)\n\nWe use [Helm](https://www.helm.sh/) as a package manager.\n\n[Step-by-step guide to deploy de cluster](docs/k8s.md)\n\n\n## HTTPS config\n\nWe are using HTTPS with [Let's Encrypt](https://letsencrypt.org/)\n\nSettings details at: https://docs.microsoft.com/en-us/azure/aks/ingress\n\n\n## Redirecter.\n\nWe have lot of domains. But python.org.ar is our principal.\n\nTo handle redirects from other domains we have two models:\n\n1. nginx ingress rules, different services configured with files in the `redirects` directory\n\n    - first time:\n    \n        kubectl create -f redirects/prueba.yaml\n\n    - after any change:\n\n        kubectl apply -f redirects/prueba.yaml\n\n    - to see what's there:\n\n        kubectl get pods --namespace=ingress-basic\n\n2. nginx server, handling `redirecter.python.org.ar`, the configuration is stored in a config-map: `stable/pyar-rewrites/templates/config_map.yaml`\n\n    - to deploy it run:\n\n```bash\nhelm upgrade --install --wait pyar-rewrites stable/pyar-rewrites\n```\n\n    - check its public IP (`LoadBalancer Ingress` after doing `kubectl describe services pyar-rewrites`) and load it in Cloudflare for the `redirecter` entry.\n\n\n\n## The Database, a PostgreSQL cluster\n\nUsing https://github.com/helm/charts/tree/master/stable/postgresql\n\n\n### Deploy:\n\nEl siguiente comando hace el deploy. NOTA: NO tiene que estar el secreto `pgcluster-postgresql` al momento de deployar PSQL (se crea en ese proceso).\n\n```bash\nhelm upgrade --install --wait -f values/production/postgres_cluster.yaml pgcluster oci://registry-1.docker.io/bitnamicharts/postgresql\n```\n\nThis cluster is using a PersistentVolumeClaim and a \"lock\" is created manually in azure to prevent unintencional deletes. Detail about locks: https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-lock-resources\n\nTo set the backup:\n\n```bash\nkubectl apply -f k8s/pgsql_bkps_jobs/pg-storage-class.yaml\nkubectl apply -f k8s/pgsql_bkps_jobs/pg-persistent-volume-claim.yaml\nkubectl apply -f k8s/pgsql_bkps_jobs/pg-backup-cronJob.yaml\n```\n\n\n\n### Connect to the cluster\n\n```bash\n# get the password\nexport POSTGRES_PASSWORD=$(kubectl get secret --namespace default pgcluster-postgresql -o jsonpath=\"{.data.postgres-password}\" | base64 --decode)\n# connect\nkubectl run pgcluster-postgresql-client --rm --tty -i --restart='Never' --namespace default --image docker.io/bitnami/postgresql:11.5.0-debian-9-r84 --env=\"PGPASSWORD=$POSTGRES_PASSWORD\" --command -- psql --host pgcluster-postgresql -U postgres -p 5432\n```\n\n\n###  Configuration\n\nWe have to create the databases and users manually\n\n\n### Restore backups\n\n1. Download the Backup file from Azure Blob Storage\n1. Create a console to the PostgreSQL cluster\n```bash\n# get the password\nexport POSTGRES_PASSWORD=$(kubectl get secret --namespace default pgcluster-postgresql -o jsonpath=\"{.data.postgres-password}\" | base64 --decode)\n# connect\nkubectl run pgcluster-postgresql-client --rm --tty -i --restart='Never' --namespace default --image docker.io/bitnami/postgresql:11.5.0-debian-9-r84 --env=\"PGPASSWORD=$POSTGRES_PASSWORD\" --command -- /bin/bash\n```\n\n1. On a new local console, copy the local downloaded file to the cluster\n```bash\nkubectl cp *.dump pgcluster-postgresql-client:/tmp/backup\n```\n\n1. On the existing console to the PostgreSQL cluster run the restore command. Change the `CHANGE_THE_DATABASE` for the correct value\n```bash\nI have no name!@pgcluster-postgresql-client:/$ pg_restore --host pgcluster-postgresql -U postgres --d CHANGE_THE_DATABASE /tmp/backup\n```\n\n## Python Argentina community website\n\nhttp://www.python.org.ar\n\n```bash\nhelm upgrade --install --wait --timeout 120s --values values/production/pyarweb.yaml pyarweb-production stable/pyarweb\n```\n\n\n## Wiki\n\nUsing https://github.com/helm/charts/tree/master/testing/wiki\n\nStaging:\n\n```bash\nhelm upgrade --install --wait --timeout 120s --values values/staging/pyar-wiki.yaml staging-wiki stable/pyar-wiki --debug\n```\n\nProduction:\n\n```bash\nhelm upgrade --install --wait --timeout 120s --values values/production/pyar-wiki.yaml prod-wiki stable/pyar-wiki --debug\n```\n\n\n## Asociación Civil administration. (asoc_members)\n\n[Production](https://admin.ac.python.org.ar)\n\n\n```bash\nhelm upgrade --install --wait --timeout 120s --values values/production/asoc_members.yaml production-admin stable/asoc-members\n```\n\n## Join Captcha bot\n\n```bash\nhelm upgrade --install  --wait --timeout 120s --values values/production/join_captcha_bot.yaml captcha-bot-production stable/join_captcha_bot\n```\n\nOnce up, talk through Telegram with the bot itself and issue: `/allowgroup add CHAT_ID` (the CHAT_ID can be seen in the logs doing something similar to `kubectl logs captcha-bot-production-5d99c5595d-8wcbb`).\n\n\n## Events site (EventoL)\n\nhttps://eventos.python.org.ar\n\nEvents site, using [EventoL](https://github.com/eventoL/eventoL). We use it to host PyDays, PyCon, Pycamp and other events.\n\n\n### Staging\n\nSee instructions on how to copy the static files to Azure, but bear in mind that they might collide with production ones.\n\nFinal command to deploy to staging:\n\n```bash\nhelm upgrade --install  --wait --timeout 60000 --values values/staging/eventol.yaml staging-eventos stable/eventol\n```\n\n### Production\n\n\n1. We need to get the static files from Eventol docker image and push them to azure. First get a docker container with all the statics inside (the version might change, check the values/production/eventol.yaml file):\n\n```\n$ docker run --name eventol -it registry.gitlab.com/eventol/eventol/releases:v2.3.4 /bin/ash\n```\n\n2. In other terminal, bring those static files to your dev machine:\n\n```\n$ docker ps\nCONTAINER ID   IMAGE             COMMAND      CREATED          STATUS              PORTS      NAMES\n2e88bd843642   eventol/eventol   \"/bin/ash\"   41 seconds ago   Up About a minute   8000/tcp   eventol\n$ mkdir /tmp/eventolstatic\n$ cd /tmp/eventolstatic\n$ docker cp CONTAINER_ID:/usr/src/app/eventol/static .\n```\n\n(at this point you can let go the container from (1) )\n\n3. Upload the static files to Azure Storage\n\n```\ncd /tmp/eventolstatic/\naz storage copy -s static -d 'https://pyareventol.file.core.windows.net/eventol-prod-static/' --recursive\n```\n\n3. Deploy to [Production:](https://eventos.python.org.ar)\n```bash\nhelm upgrade --install  --wait --timeout 120s --values values/production/eventol.yaml production-eventos stable/eventol\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyar%2Fpyar_infra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyar%2Fpyar_infra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyar%2Fpyar_infra/lists"}