|
|
|
@ -19,42 +19,52 @@ Tal y como está la estructura de directorios, deberia detectar automáticamente |
|
|
|
## asignación de los volúmenes |
|
|
|
### Si la pvc no está creada |
|
|
|
|
|
|
|
oc set volume deployment.apps/entrenadores --add -t pvc --claim-size=300M --name=entrenadores-lyrics-migrations --claim-name='entrenadores-lyrics-migrations' --mount-path='/app/lyrics/migrations' |
|
|
|
oc set volume deployment.apps/entrenadores --add -t pvc --claim-size=300M --name=entrenadores-macrociclos-migrations --claim-name='entrenadores-lyrics-migrations' --mount-path='/app/lyrics/migrations' |
|
|
|
|
|
|
|
oc set volume deployment.apps/entrenadores --add -t pvc --claim-size=300M --name=entrenadores-media --claim-name='entrenadores-media' --mount-path='/app/mediafiles' |
|
|
|
oc set volume deployment.apps/entrenadores --add -t pvc --claim-size=300M --name=entrenadores-repostajes-migrations --claim-name='entrenadores-repostajes-migrations' --mount-path='/app/repostajes/migrations' |
|
|
|
oc set volume deployment.apps/entrenadores --add -t pvc --claim-size=300M --name=entrenadores-usuariosusers-migrations --claim-name='entrenadores-usuariosusers-migrations' --mount-path='/app/reymotausers/migrations' |
|
|
|
oc set volume deployment.apps/reymota --add -t pvc --claim-size=50G --name=static-volume --claim-name='static-volume' --mount-path='/app/staticfiles' |
|
|
|
|
|
|
|
oc set volume deployment.apps/entrenadores --add -t pvc --claim-size=300M --name=entrenadores-usuariosusers-migrations --claim-name='entrenadores-usuariosusers-migrations' --mount-path='/app/usuariosusers/migrations' |
|
|
|
|
|
|
|
oc set volume deployment.apps/entrenadores --add -t pvc --claim-size=50G --name=static-volume --claim-name='static-volume' --mount-path='/app/staticfiles' |
|
|
|
|
|
|
|
|
|
|
|
### Si la pvc ya está creada |
|
|
|
|
|
|
|
oc set volume deployment.apps/reymota --add -t pvc --name=reymota-lyrics-migrations --claim-name='reymota-lyrics-migrations' --mount-path='/app/lyrics/migrations' |
|
|
|
oc set volume deployment.apps/reymota --add -t pvc --name=reymota-media --claim-name='reymota-media' --mount-path='/app/mediafiles' |
|
|
|
oc set volume deployment.apps/reymota --add -t pvc --name=reymota-repostajes-migrations --claim-name='reymota-repostajes-migrations' --mount-path='/app/repostajes/migrations' |
|
|
|
oc set volume deployment.apps/reymota --add -t pvc --name=reymota-reymotausers-migrations --claim-name='reymota-reymotausers-migrations' --mount-path='/app/reymotausers/migrations' |
|
|
|
oc set volume deployment.apps/reymota --add -t pvc --name=static-volume --claim-name='static-volume' --mount-path='/app/staticfiles' |
|
|
|
oc set volume deployment.apps/entrenadores --add -t pvc --name=entrenadores-macrociclos-migrations --claim-name='entrenadores-lyrics-migrations' --mount-path='/app/lyrics/migrations' |
|
|
|
|
|
|
|
oc set volume deployment.apps/entrenadores --add -t pvc --name=entrenadores-media --claim-name='entrenadores-media' --mount-path='/app/mediafiles' |
|
|
|
|
|
|
|
oc set volume deployment.apps/entrenadores --add -t pvc --name=entrenadores-usuariosusers-migrations --claim-name='entrenadores-usuariosusers-migrations' --mount-path='/app/usuariosusers/migrations' |
|
|
|
|
|
|
|
oc set volume deployment.apps/entrenadores --add -t pvc --name=static-volume --claim-name='static-volume' --mount-path='/app/staticfiles' |
|
|
|
|
|
|
|
|
|
|
|
## Exponer el servicio |
|
|
|
oc expose deployment.apps/reymota --type=NodePort --port=8080 |
|
|
|
oc expose deployment.apps/entrenadores --type=NodePort --port=8080 |
|
|
|
|
|
|
|
### postgresql |
|
|
|
Se hace desde el yaml |
|
|
|
|
|
|
|
oc create -f postgresql-deployment.yaml |
|
|
|
#### La pvc solo la primera vez |
|
|
|
|
|
|
|
oc create -f Yamls/pvc-postgresql.yaml |
|
|
|
|
|
|
|
#### el deployment y el servicio |
|
|
|
|
|
|
|
oc create -f Yamls/env-prod-db-configmap.yaml |
|
|
|
oc create -f Yamls/postgresql-deployment.yaml |
|
|
|
oc create -f Yamls/postgresql-service.yaml |
|
|
|
|
|
|
|
## Modificaciones al código |
|
|
|
|
|
|
|
Una vez realizadas las modificaciones al código y se hayan subido a gitea, hay que reconstruir el proyecto. |
|
|
|
|
|
|
|
oc start-build reymota |
|
|
|
oc start-build entrenadores |
|
|
|
|
|
|
|
## Comandos a ejecutar la primera vez o cuando haya cambios en las bases de datos |
|
|
|
|
|
|
|
python manage.py createsuperuser |
|
|
|
|
|
|
|
|
|
|
|
python manage.py makemigrations |
|
|
|
|
|
|
|
python manage.py migrate |
|
|
|
@ -68,28 +78,6 @@ Con la shell entraPsql.sh: |
|
|
|
\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; |
|
|
|
|