Нет описания

creylopez d9ab49fa51 Añado información sobre PVC 1 год назад
nginx c04abab64c Cambio a puerto 8080 1 год назад
src d36e1b47aa Cambio nombre del host a postgresql 1 год назад
Dockerfile aff7031c4f Corrigo Dockerfile 1 год назад
README.md d9ab49fa51 Añado información sobre PVC 1 год назад
entra.sh cd2fef7240 Limpio migrations 1 год назад
nuevaapp.sh cd2fef7240 Limpio migrations 1 год назад
postgres-deployment.yaml 7c8d28934a Añado rsync para poder copiar ficheros al contenedor 1 год назад
pvc.yaml cd2fef7240 Limpio migrations 1 год назад

README.md

Versión para openshift

permitir a nginx correr con privilegios

esto se hace una vez dentro del proyecto.

oc adm policy add-scc-to-user -z default anyuid

Instalación

Crear un proyecto y luego añadir una app desde Agregar, importar desde git.

Tal y como está la estructura de directorios, deberia detectar automáticamente una compilación Python

Desde la línea de comandos, sería:

oc new-app http://gitea.reymota.es/creylopez/ReyMotaAppsOC.git -e DEBUG=True

python manage.py createsuperuser

python manage.py makemigrations

python manage.py migrate

Comprobar la base de datos

Con la shell entraPsql.sh:

\l para listar las BD

\c reymota para usar nuestra db \dt para ver las tablas

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 lo sid

ALTER SEQUENCE tablename_id_seq RESTART WITH nn;

esto se hace cuando restauro un volcado de la bd sobre una instalación nueva. Si hay índices ya creados, hay que reinciar a partir del último.

Copiar ficheros al contenedor

Copy local directory to a pod directory oc rsync /home/user/source devpod1234:/src

Copy pod directory to a local directory

oc rsync devpod1234:/src /home/user/source

Para que git no pida credenciales

git config --global credential.helper store

la siguiente vez que se haga el push nos la pedirá una última vez

Persistent Volume Claims y sus rutas de montaje

    volumeMounts:
    - mountPath: /app/gestion_reservas/mediafiles
      name: jugaralpadel-media
     - mountPath: /app/gestion_reservas/eventos/migrations
      name: jugaralpadel-eventos-migrations
    - mountPath: /app/gestion_reservas/reymotausers/migrations
      name: jugaralpadel-reymotausers-migrations
     - mountPath: /app/gestion_reservas/staticfiles
      name: static-volume
  imagePullSecrets:
  - name: myregistrykey
  restartPolicy: Always
  volumes:
  - name: jugaralpadel-media
    persistentVolumeClaim:
      claimName: jugaralpadel-media
  - name: jugaralpadel-eventos-migrations
    persistentVolumeClaim:
      claimName: jugaralpadel-eventos-migrations
  - name: jugaralpadel-reymotausers-migrations
    persistentVolumeClaim:
      claimName: jugaralpadel-reymotausers-migrations
  - name: static-volume
    persistentVolumeClaim:
      claimName: static-volume