intentando "dockerizar" preciosa

60 views
Skip to first unread message

Martín Gaitán

unread,
Sep 15, 2016, 9:30:39 PM9/15/16
to preciosa-devs
Estuve intentando armar los archivos de configuración para correr Preciosa sobre docker usando docker-compose. No me funciona. Alguien tiene experiencia con esto? 



PD: si alguien puede probar el branch y decir si el resultado coincide, agradecere


--

Martín Gaitán

unread,
Sep 17, 2016, 12:50:27 AM9/17/16
to preciosa-devs
Estuve lidiando con esto un buen rato y creo que lo dejé funcionando, pero necesito corrobación. 

Las instrucciones las escribi en los cambios de la doc del mismo PR. 


-  Instalar docker-compose

$ docker-compose build web 
$ docker-compose run web ./initialize.sh

y luego cada vez que quieran levantar el entorno

$ docker-compose up

Pueden probar si les levanta ok? 

Santi Vallazza

unread,
Oct 10, 2016, 11:39:24 PM10/10/16
to Martín Gaitán, preciosa-devs
Martin,

Lo corrí una vez y al hacer
$ docker-compose build web

----------------------------------------------------------------------------------------
Step 8 : RUN pip install -r requirements.txt
 ---> Running in 943115d43fd5
(...)
  Cloning https://github.com/yourlabs/django-autocomplete-light.git (to 3.1.8) to /tmp/pip-build-3hIily/django-autocomplete-light
fatal: unable to access 'https://github.com/yourlabs/django-autocomplete-light.git/': Empty reply from server
Command "git clone -q https://github.com/yourlabs/django-autocomplete-light.git /tmp/pip-build-3hIily/django-autocomplete-light" failed with error code 128 in None
ERROR: Service 'web' failed to build: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
----------------------------------------------------------------------------------------

Luego lo ejecuté de nuevo y no tiró este error.

El paso de
$ docker-compose run web ./initialize.sh

Finalizò con:
----------------------------------------------------------------------------------------
System check identified some issues:

WARNINGS:
acuerdos.Acuerdo.cadenas: (fields.W340) null has no effect on ManyToManyField.
acuerdos.Acuerdo.sucursales: (fields.W340) null has no effect on ManyToManyField.
CommandError: No fixture named 'initial_data' found.
----------------------------------------------------------------------------------------



Al levantar el server hay algo raro en Postgres:
----------------------------------------------------------------------------------------
web_1  | Starting development server at http://0.0.0.0:8000/
----------------------------------------------------------------------------------------

y cuando ingreso a http://localhost:8000/

pasa esto:

----------------------------------------------------------------------------------------

Page not found (404)

Request Method: GET
Request URL: http://localhost:8000/

Using the URLconf defined in preciosa.urls, Django tried these URL patterns, in this order:

  1. ^api/v1/
  2. ^api/auth/
  3. ^admin/
  4. ^account/signup/$
  5. ^account/
  6. ^feedback/
  7. ^summernote/
  8. ^buscador/ [name='buscador']
  9. ^(\d+)-([a-z0-9-_]+)/$ [name='lista_productos']
  10. ^(\d+)-([a-z0-9-_]+)/(?P<pk>\d+)-([a-z0-9-_]+)$ [name='detalle_producto']
  11. ^home/$ [name='home']
  12. ^blog/
  13. ^voluntarios/

The current URL, , didn't match any of these.

You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.

----------------------------------------------------------------------------------------

Si identificas el error avisame así sigo intentando.

Saludos!
Santiago


--
Has recibido este mensaje porque estás suscrito al grupo "Preciosa" de Grupos de Google.
Para anular la suscripción a este grupo y dejar de recibir sus mensajes, envía un correo electrónico a preciosa-devs+unsubscribe@googlegroups.com.
Para acceder a más opciones, visita https://groups.google.com/d/optout.

Martín Gaitán

unread,
Oct 11, 2016, 8:37:30 AM10/11/16
to Santi Vallazza, preciosa-devs
Hola santi, . el primer error debe haber algo temporal en la disponibildad de github y no pudo bajar una dependencia. si la segunda vez no te dió problemas, podes ignorar eso. 

luego 



El paso de
$ docker-compose run web ./initialize.sh

Finalizò con:
----------------------------------------------------------------------------------------
System check identified some issues:

WARNINGS:
acuerdos.Acuerdo.cadenas: (fields.W340) null has no effect on ManyToManyField.
acuerdos.Acuerdo.sucursales: (fields.W340) null has no effect on ManyToManyField.
CommandError: No fixture named 'initial_data' found.
----------------------------------------------------------------------------------------

efectivamente era un bug: renombré un fixture pero no lo actualicé en este script.  Por ahora editá el "initialize.sh" y donde dice initial_data.json cambiá por 'sites'

Lo demás se ve ok, sólo que no tenés datos cargados y por eso la home no encuentra el contenido para mostrar (que está en la db) y te da ese error. 

avisame si podés levantarlo. 

Santi Vallazza

unread,
Oct 14, 2016, 6:12:04 PM10/14/16
to Martín Gaitán, preciosa-devs
Buenas,

Cambié esa línea, y quedó así:
python manage.py loaddata fixtures/sites.json \

al ejecutar

$ docker-compose run web ./initialize.sh

pasa esto:

----------------------------------------------------------------------------------------------------------------------------
Postgres is up - executing command

System check identified some issues:

WARNINGS:
acuerdos.Acuerdo.cadenas: (fields.W340) null has no effect on ManyToManyField.
acuerdos.Acuerdo.sucursales: (fields.W340) null has no effect on ManyToManyField.
Operations to perform:
  Apply all migrations: account, acuerdos, admin, api, auth, authtoken, cities_light, contenttypes, datos, django_summernote, easy_thumbnails, eventlog, feedback, flatpages, flatpagex, precios, radpress, sessions, sites, voluntarios
Running migrations:
  No migrations to apply.
  Your models have changes that are not yet reflected in a migration, and so won't be applied.
  Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.

System check identified some issues:

WARNINGS:
acuerdos.Acuerdo.cadenas: (fields.W340) null has no effect on ManyToManyField.
acuerdos.Acuerdo.sucursales: (fields.W340) null has no effect on ManyToManyField.
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 294, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 345, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/loaddata.py", line 64, in handle
    self.loaddata(fixture_labels)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/loaddata.py", line 104, in loaddata
    self.load_label(fixture_label)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/loaddata.py", line 161, in load_label
    for obj in objects:
  File "/usr/local/lib/python2.7/dist-packages/django/core/serializers/json.py", line 86, in Deserializer
    six.reraise(DeserializationError, DeserializationError(e), sys.exc_info()[2])
  File "/usr/local/lib/python2.7/dist-packages/django/core/serializers/json.py", line 80, in Deserializer
    for obj in PythonDeserializer(objects, **options):
  File "/usr/local/lib/python2.7/dist-packages/django/core/serializers/python.py", line 99, in Deserializer
    Model = _get_model(d["model"])
  File "/usr/local/lib/python2.7/dist-packages/django/core/serializers/python.py", line 194, in _get_model
    raise base.DeserializationError("Invalid model identifier: '%s'" % model_identifier)
django.core.serializers.base.DeserializationError: Problem installing fixture '/code/fixtures/newsletter.json': Invalid model identifier: 'newsletter.newsletter'

----------------------------------------------------------------------------------------------------------------------------------

Para probar que pasaba, en ./initializa.sh comenté la línea
#      fixtures/blog.json fixtures/newsletter.json \

y al ejecutar

$ docker-compose run web ./initialize.sh


----------------------------------------------------------------------------------------------------------------------------------
Postgres is up - executing command

System check identified some issues:

WARNINGS:
acuerdos.Acuerdo.cadenas: (fields.W340) null has no effect on ManyToManyField.
acuerdos.Acuerdo.sucursales: (fields.W340) null has no effect on ManyToManyField.
Operations to perform:
  Apply all migrations: account, acuerdos, admin, api, auth, authtoken, cities_light, contenttypes, datos, django_summernote, easy_thumbnails, eventlog, feedback, flatpages, flatpagex, precios, radpress, sessions, sites, voluntarios
Running migrations:
  No migrations to apply.
  Your models have changes that are not yet reflected in a migration, and so won't be applied.
  Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.

System check identified some issues:

WARNINGS:
acuerdos.Acuerdo.cadenas: (fields.W340) null has no effect on ManyToManyField.
acuerdos.Acuerdo.sucursales: (fields.W340) null has no effect on ManyToManyField.
Installed 9 object(s) from 3 fixture(s)
/code/initialize.sh: line 6: fixtures/ciudades.json: Permission denied


----------------------------------------------------------------------------------------------------------------------------------


Se te ocurre qué puede ser?

Reply all
Reply to author
Forward
0 new messages