arangodb / arangodb-docker

Docker container for ArangoDB
Apache License 2.0
106 stars 32 forks source link

Docker-compose not executing scripts in /docker-entrypoint-initdb.d #48

Closed wenshutang closed 6 years ago

wenshutang commented 6 years ago

We run a few scripts inside /docker-entrypoint-initdb.d When using docker to run the container, the scripts run fine:

$ docker run -it -p 8529:8529 -e ARANGO_NO_AUTH=1 my.registry.net/my-arangodb
automaticaly choosing storage engine
Initializing database...Hang on...
/entrypoint.sh: running /docker-entrypoint-initdb.d/1_init-objectstore-db.js
/entrypoint.sh: running /docker-entrypoint-initdb.d/2_deploy-foxx.js
Database initialized...Starting System...
2018-05-23T21:56:42Z [1] INFO ArangoDB 3.3.8 [linux] 64bit, using jemalloc, build tags/v3.3.8-0-g50ef880b25, VPack 0.1.30, RocksDB 5.6.0, ICU 58.1, V8 5.7.492.77, OpenSSL 1.1.0f  25 May 2017
2018-05-23T21:56:42Z [1] INFO {authentication} Jwt secret not specified, generating...
2018-05-23T21:56:42Z [1] INFO detected operating system: Linux version 4.9.87-linuxkit-aufs (root@70f48253c8b4) (gcc version 6.4.0 (Alpine 6.4.0) ) #1 SMP Fri Mar 16 18:16:33 UTC 2018
2018-05-23T21:56:42Z [1] INFO using storage engine mmfiles
2018-05-23T21:56:42Z [1] INFO {cluster} Starting up with role SINGLE

But when using docker-compose, the scripts are skipped

$ docker-compose up arangodb
Starting my-service_arangodb_1 ... done
Attaching to my-service_arangodb_1
arangodb_1              | automaticaly choosing storage engine
arangodb_1              | 2018-05-23T22:45:01Z [1] INFO ArangoDB 3.3.8 [linux] 64bit, using jemalloc, build tags/v3.3.8-0-g50ef880b25, VPack 0.1.30, RocksDB 5.6.0, ICU 58.1, V8 5.7.492.77, OpenSSL 1.1.0f  25 May 2017
arangodb_1              | 2018-05-23T22:45:01Z [1] INFO {authentication} Jwt secret not specified, generating...
arangodb_1              | 2018-05-23T22:45:01Z [1] INFO detected operating system: Linux version 4.9.87-linuxkit-aufs (root@70f48253c8b4) (gcc version 6.4.0 (Alpine 6.4.0) ) #1 SMP Fri Mar 16 18:16:33 UTC 2018
arangodb_1              | 2018-05-23T22:45:01Z [1] INFO using storage engine mmfiles
arangodb_1              | 2018-05-23T22:45:01Z [1] INFO {cluster} Starting up with role SINGLE
arangodb_1              | 2018-05-23T22:45:01Z [1] INFO {syscall} file-descriptors (nofiles) hard limit is 1048576, soft limit is 1048576
arangodb_1              | 2018-05-23T22:45:01Z [1] INFO {authentication} Authentication is turned off, authentication for unix sockets is turned on
arangodb_1              | 2018-05-23T22:45:01Z [1] WARNING {memory} /proc/sys/vm/overcommit_memory is set to '1'. It is recommended to set it to a value of 0 or 2
arangodb_1              | 2018-05-23T22:45:01Z [1] WARNING {memory} execute 'sudo bash -c "echo 2 > /proc/sys/vm/overcommit_memory"'
arangodb_1              | 2018-05-23T22:45:02Z [1] INFO using endpoint 'http+tcp://0.0.0.0:8529' for non-encrypted requests

Part of my compose file:

version: '3'
services:
  arangodb:
    build:
    image: my.registry.net/my-arangodb
    ports:
      - "8529:8529"
    environment:
      - ARANGO_NO_AUTH=1

Is there anything I am missing here? Why the inconsistency?

dothebart commented 6 years ago

Hi, we run https://github.com/arangodb/arangodb-docker/tree/official/test-user-scripts on each push of the docker container. Please have a look at them, whether they can serve as a working example for you.

wenshutang commented 6 years ago

@dothebart Thank you for the information. The scripts I have run fine on an arangodb container, it's when I try to bring it up using docker-compose that I am having issues. The entrypoint.sh script doesn't seem to run at all, I don't even see these 2 lines:

Initializing database...Hang on...
Database initialized...Starting System...
brendanwheble commented 6 years ago

I had exactly the same problem using docker-compose. I removed all of my containers and images and then tried again, this time it imported my /dumps

dothebart commented 6 years ago

could it be related to this comment? https://github.com/docker-library/postgres/issues/203#issuecomment-255200501 (learned that from @rtmruczek )

brendanwheble commented 6 years ago

Yes, see my previous comment

wenshutang commented 6 years ago

Yes @dothebart @brendanwheble, I believe this caused by persistence, much like the postgres issue

I believe this line in the docker entry file is the root cause. Try removing the file /var/lib/arangodb3/SERVER

dothebart commented 6 years ago

ok, maybe https://github.com/arangodb/arangodb-docker/pull/51 would then better help to see why no initialisation is done.

dothebart commented 6 years ago

Ok, the current arangodb docker containers now contain these hints, will close this issue.