From 7cbd1e7fb511bb80f9981c18b77ff00f437aa046 Mon Sep 17 00:00:00 2001 From: Celestino Rey Date: Thu, 16 Jan 2025 13:00:07 +0100 Subject: [PATCH] Actualizo readme --- README.md | 59 +++++++++++++++++-------------------------------------- 1 file changed, 18 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index 461aaaf..cf52a11 100644 --- a/README.md +++ b/README.md @@ -1,47 +1,32 @@ -# Instalación +# Running Commands as Root in OpenShift -Desde el directorio K8S ejecutar make (esto hace todo: la imagen, para los pods y los lanza otra vez) +## Opción 1 -La primera vez, hay que entrar en el pod con 'entra.sh' y + oc adm policy add-scc-to-user anyuid -z default -python manage.py createsuperuser +## Opción 2 +Esta es la que usé la primera vez, pero hay que hacerlo para cada deployment. La opción 1 es una vez por proyecto. -python manage.py makemigrations +Running commands as root in OpenShift is restricted by default due to security policies. To allow a container to run as root, you need to use the anyuid Security Context Constraints (SCC) or create a custom SCC. Here are the steps to enable running commands as root: -python manage.py migrate +1. Create a Service Account: First, create a new service account in the project where you want to run the container as root. -## Comprobar la base de datos + oc create serviceaccount runasanyuid + +2. Grant the anyuid SCC to the Service Account: As a cluster administrator, grant the anyuid SCC to the service account. -Con la shell entraPsql.sh: + oc adm policy add-scc-to-user anyuid -z runasanyuid --as system:admin + +3. Update the Deployment Configuration: Modify the deployment configuration to use the newly created service account. -\l para listar las BD + oc patch deployment.apps/django-nginx-git --patch '{"spec":{"template":{"spec":{"serviceAccountName": "runasanyuid"}}}}' + +4. Trigger a New Deployment: After updating the deployment configuration, trigger a new deployment if necessary. -\c reymota para usar nuestra db -\dt para ver las tablas + oc rollout latest minimal-notebook -# De dónde cogí ideas - -https://learndjango.com/tutorials/django-login-and-logout-tutorial - - -Username: {{ user.username }} - -User Full name: {{ user.get_full_name }} - -User Group: {{ user.groups.all.0 }} - -Email: {{ user.email }} - -Session Started at: {{ user.last_login }} - - -## Para funcionar con gunicorn y nginx -https://testdriven.io/blog/dockerizing-django-with-postgres-gunicorn-and-nginx/ - - - -## Cambiar la secuencia de los id +# Cambiar la secuencia de los id ALTER SEQUENCE tablename_id_seq RESTART WITH nn; @@ -55,11 +40,3 @@ avoid credentials: después se hace un pull o push o lo que sea que te pida el usuario y password, los metes y ya la próxima no hace falta - -# Versiones. -## 0.27 de 3 de noviembre de 2024 - -Contiene una mejora en la lista de eventos, que ya no es lista sino cajas con foto y detalles. - - -![0.27](https://gogs.reymota.es/attachments/2ea8f931-8623-441f-81d7-bca5657dd98b)