jpbruinsslot / docker-django

A project to get you started with Docker and Django.
MIT License
179 stars 62 forks source link

Problems firing the container up #7

Closed ghost closed 8 years ago

ghost commented 8 years ago

Hey,

I'm trying to run the container, but this is what my terminal outputs after entering $ docker-compose up:

Successfully built 35a9736e0654
Creating dockerdjango_app_1
Attaching to dockerdjango_datastore_1, dockerdjango_db_1, dockerdjango_app_1
db_1        | The files belonging to this database system will be owned by user "postgres".
db_1        | This user must also own the server process.
db_1        | 
db_1        | The database cluster will be initialized with locale "en_US.utf8".
db_1        | The default database encoding has accordingly been set to "UTF8".
db_1        | The default text search configuration will be set to "english".
db_1        | 
db_1        | Data page checksums are disabled.
db_1        | 
db_1        | fixing permissions on existing directory /var/lib/postgresql/data ... ok
db_1        | creating subdirectories ... ok
db_1        | selecting default max_connections ... 100
db_1        | selecting default shared_buffers ... 128MB
db_1        | selecting dynamic shared memory implementation ... posix
db_1        | creating configuration files ... ok
db_1        | creating template1 database in /var/lib/postgresql/data/base/1 ... ok
db_1        | initializing pg_authid ... ok
db_1        | initializing dependencies ... ok
db_1        | creating system views ... ok
db_1        | loading system objects' descriptions ... ok
db_1        | creating collations ... ok
db_1        | creating conversions ... ok
db_1        | creating dictionaries ... ok
db_1        | setting privileges on built-in objects ... ok
db_1        | creating information schema ... ok
db_1        | loading PL/pgSQL server-side language ... ok
db_1        | vacuuming database template1 ... ok
dockerdjango_datastore_1 exited with code 0
db_1        | copying template1 to template0 ... ok
db_1        | copying template1 to postgres ... ok
db_1        | syncing data to disk ... ok
db_1        | 
db_1        | WARNING: enabling "trust" authentication for local connections
db_1        | You can change this by editing pg_hba.conf or using the option -A, or
db_1        | --auth-local and --auth-host, the next time you run initdb.
db_1        | 
db_1        | Success. You can now start the database server using:
db_1        | 
db_1        |     postgres -D /var/lib/postgresql/data
db_1        | or
db_1        |     pg_ctl -D /var/lib/postgresql/data -l logfile start
db_1        | 
db_1        | waiting for server to start....LOG:  database system was shut down at 2016-01-07 08:56:29 UTC
db_1        | LOG:  MultiXact member wraparound protections are now enabled
db_1        | LOG:  database system is ready to accept connections
db_1        | LOG:  autovacuum launcher started
db_1        |  done
db_1        | server started
db_1        | ALTER ROLE
db_1        | 
db_1        | 
db_1        | /docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
db_1        | 
db_1        | LOG:  received fast shutdown request
db_1        | LOG:  aborting any active transactions
db_1        | LOG:  autovacuum launcher shutting down
db_1        | LOG:  shutting down
db_1        | waiting for server to shut down....LOG:  database system is shut down
db_1        |  done
db_1        | server stopped
db_1        | 
db_1        | PostgreSQL init process complete; ready for start up.
db_1        | 
db_1        | LOG:  database system was shut down at 2016-01-07 08:56:30 UTC
db_1        | LOG:  MultiXact member wraparound protections are now enabled
db_1        | LOG:  database system is ready to accept connections
db_1        | LOG:  autovacuum launcher started
app_1       | *** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
app_1       | No SSH host key available. Generating one...
app_1       | Creating SSH2 RSA key; this may take some time ...
app_1       | Creating SSH2 DSA key; this may take some time ...
app_1       | Creating SSH2 ECDSA key; this may take some time ...
app_1       | Creating SSH2 ED25519 key; this may take some time ...
app_1       | invoke-rc.d: policy-rc.d denied execution of restart.
app_1       | *** Running /etc/my_init.d/setup.sh...
app_1       | *** /etc/my_init.d/setup.sh failed with status 127
app_1       | 
app_1       | *** Killing all processes...
dockerdjango_app_1 exited with code 1

I have no idea why the datastore exited. I did check of /etc/my_init,d/setup.sh actually exists however, and the answer is no. The entire my_init.d folder is missing, actually. Any ideas on how to solve this?

jpbruinsslot commented 8 years ago

@Pharetra I've updated the project. If you like, you can checkout the latest master branch, it might solve the problems you were having.

ghost commented 8 years ago

Thanks for the update. The sample project worked out of the box, but I still have some issues with adding my own project. This is repeated constantly after entering docker-compose up:

webapp_1    | *** has_emperor mode detected (fd: 5) ***
webapp_1    | [uWSGI] getting INI configuration from /etc/uwsgi/django-uwsgi.ini
webapp_1    | *** Starting uWSGI 2.0.11.1 (64bit) on [Sun Jan 10 20:42:52 2016] ***
webapp_1    | compiled with version: 4.9.2 on 10 January 2016 20:41:18
webapp_1    | os: Linux-3.19.0-25-generic #26~14.04.1-Ubuntu SMP Fri Jul 24 21:16:20 UTC 2015
webapp_1    | nodename: 7fd6c45ff449
webapp_1    | machine: x86_64
webapp_1    | clock source: unix
webapp_1    | pcre jit disabled
webapp_1    | detected number of CPU cores: 2
webapp_1    | current working directory: /
webapp_1    | detected binary path: /usr/local/bin/uwsgi
webapp_1    | setgid() to 108
webapp_1    | setuid() to 104
webapp_1    | chdir() to /srv/vms/
webapp_1    | chdir(): Permission denied [core/uwsgi.c line 2581]
webapp_1    | chdir(): Permission denied [core/uwsgi.c line 1603]
webapp_1    | Sun Jan 10 20:42:52 2016 - [emperor] curse the uwsgi instance /etc/uwsgi/django-uwsgi.ini (pid: 21)
webapp_1    | Sun Jan 10 20:42:55 2016 - [emperor] removed uwsgi instance /etc/uwsgi/django-uwsgi.ini
jpbruinsslot commented 8 years ago

@Pharetra Glad to hear that the sample project worked! It seems that uWSGI doesn't have permission to access the folder /srv/vms/. uWSGI is run by the django user and this user is added in the Dockerfile of the webapp. Perhaps the following line has to be updated: https://github.com/erroneousboat/docker-django/blob/master/webapp/Dockerfile#L21

RUN chown -R django:django /srv/vms

It could also be because of folder permissions of the local file system for that folder and problems with mounting that folder inside the container. You could try to comment out the following line in the docker-compose.yml file: https://github.com/erroneousboat/docker-django/blob/master/docker-compose.yml#L31

ghost commented 8 years ago

@erroneousboat The chown line was already updated. Commenting out the line in docker-compose.yml didn't work, sadly.