oc new-project jugaralpadel
oc adm policy add-scc-to-user anyuid -z default
oc new-app http://gitea.reymota.es/creylopez/JugarAlPadelOC.git -e DEBUG="False" -e VERSION=11.0 --name='jugaralpadel'
Tal y como está la estructura de directorios, deberia detectar automáticamente una compilación Python
oc set volume deployment.apps/jugaralpadel --add -t pvc --claim-size=300M --name=jugaralpadel-eventos-migrations --claim-name='jugaralpadel-eventos-migrations' --mount-path='/app/eventos/migrations' --claim-class='lvms-vg1'
oc set volume deployment.apps/jugaralpadel --add -t pvc --claim-size=300M --name=jugaralpadel-media --claim-name='jugaralpadel-media' --mount-path='/app/mediafiles' --claim-class='lvms-vg1'
oc set volume deployment.apps/jugaralpadel --add -t pvc --claim-size=300M --name=reymota-reymotausers-migrations --claim-name='reymota-reymotausers-migrations' --mount-path='/app/reymotausers/migrations' --claim-class='lvms-vg1'
oc set volume deployment.apps/jugaralpadel --add -t pvc --claim-size=50G --name=static-volume --claim-name='static-volume' --mount-path='/app/staticfiles' --claim-class='lvms-vg1'
oc set volume deployment.apps/jugaralpadel --add -t pvc --name=jugaralpadel-eventos-migrations --claim-name='jugaralpadel-eventos-migrations' --mount-path='/app/eventos/migrations'
oc set volume deployment.apps/jugaralpadel --add -t pvc --name=jugaralpadel-media --claim-name='jugaralpadel-media' --mount-path='/app/mediafiles'
oc set volume deployment.apps/jugaralpadel --add -t pvc --name=reymota-reymotausers-migrations --claim-name='reymota-reymotausers-migrations' --mount-path='/app/reymotausers/migrations'
oc set volume deployment.apps/jugaralpadel --add -t pvc --name=static-volume --claim-name='static-volume' --mount-path='/app/staticfiles'
oc expose service/jugaralpadel
Los ficheros yaml están en el directorio Yamls.
Se crea el deployment y el servicio con la shell creaDB.sh Se borran con borraDB.sh
Hay que tener en cuenta que la PVC no se crea en estas shells. Hay que crearla a mano. Esto se hace para no perder los datos.
Desde dentro de la shell del pod
python manage.py createsuperuser
python manage.py makemigrations
python manage.py migrate
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.
avoid credentials:
git config credential.helper store
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
volumeMounts:
- mountPath: /app/mediafiles
name: jugaralpadel-media
- mountPath: /app/eventos/migrations
name: jugaralpadel-eventos-migrations
- mountPath: /app/reymotausers/migrations
name: jugaralpadel-reymotausers-migrations
- mountPath: /app/staticfiles
name: static-volume