You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Celestino Rey dcc20bffbc Quito nginx y pongo staticfiles_dirs 2 months ago
K8S Quito nginx y pongo staticfiles_dirs 2 months ago
Shells Nueva shell para asignar las pvc 8 months ago
Yamls Arreglo el servicio de reymota 8 months ago
nginx Cambios para que funcione en todos los clusters 2 months ago
src Quito nginx y pongo staticfiles_dirs 2 months ago
Dockerfile Quito expose del Dockerfile 8 months ago
Dockerfile.k8s Pone versión según si es openshift o no 7 months ago
Jenkinsfile Pongo nombre bien 2 months ago
Makefile Junto K8S y Openshift 8 months ago
README.md Añadido Acerca de... 7 months ago
builder.yaml Añado Jenkinsfile y builder 2 months ago
entrypoint.sh Junto K8S y Openshift 8 months ago

README.md

Versión para openshift

Instalación

Crear un proyecto.

Running Commands as Root in OpenShift

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

app reymota

A continuación añadir una app desde Agregar, importar desde git.

oc new-app http://gitea.reymota.es/creylopez/ReyMotaAppsOC.git -e APP_VERSION="15.0.0" -e DEBUG="False" -e OPENSHIFT="True" --name='reymota'

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

asignación de los volúmenes

Si la pvc no está creada

oc set volume deployment.apps/reymota --add -t pvc --claim-size=300M --name=reymota-lyrics-migrations --claim-name='reymota-lyrics-migrations' --mount-path='/app/lyrics/migrations'
oc set volume deployment.apps/reymota --add -t pvc --claim-size=300M --name=reymota-media --claim-name='reymota-media' --mount-path='/app/mediafiles'
oc set volume deployment.apps/reymota --add -t pvc --claim-size=300M --name=reymota-repostajes-migrations --claim-name='reymota-repostajes-migrations' --mount-path='/app/repostajes/migrations'
oc set volume deployment.apps/reymota --add -t pvc --claim-size=300M --name=reymota-reymotausers-migrations --claim-name='reymota-reymotausers-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'

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'

Exponer el servicio

oc expose deployment.apps/reymota --type=NodePort --port=8080

postgresql

Se hace desde el yaml

oc create -f postgresql-deployment.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

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

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.