stuartpb / dokku-rethinkdb-plugin

RethinkDB plugin for Dokku
MIT License
33 stars 11 forks source link

Error creating RethinkDB instance for app on Ubuntu 14.04 / Latest Dokku #4

Closed heiko-s closed 10 years ago

heiko-s commented 10 years ago
# dokku rethinkdb:create testapp
-----> Creating new RethinkDB volume for testapp
-----> Releasing testapp ...
-----> Injecting Supervisor ...
-----> Release complete!
-----> Deploying testapp ...
-----> Starting linked container rethinkdb_ testapp ...
44907e4f3a8376f1d7b3a6994e23238b0dc3776828d320d243bff0b09748fa2c
Error: No such image or container: <no
Error: No such image or container: value>

Docker 1.0 Dokku 0.2.3 Installed Plugins: Rebuild, Supervisord, RethinkDB

stuartpb commented 10 years ago

FYI, you only need triple-backticks (```) before and after a block of code, not each line.

Is that space in rethinkdb_ testapp present in the source?

stuartpb commented 10 years ago

Could you rerun this with DOKKU_TRACE=1 in /home/dokku/dokkurc?

jhvst commented 10 years ago

Running to the exact same problem with the disk image DigitalOcean provides.

Edit: The image name: Dokku v0.2.3 on Ubuntu 14.04 (w/ Docker 1.0)

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree push -v --tags --set-upstream progrium master:master 
Pushing to dokku@178.62.......:myproject
++ id -un
+ [[ dokku != \d\o\k\k\u ]]
+ case "$1" in
++ ls -d /var/lib/dokku/plugins/00_dokku-standard/commands /var/lib/dokku/plugins/backup/commands /var/lib/dokku/plugins/config/commands /var/lib/dokku/plugins/git/commands /var/lib/dokku/plugins/nginx-vhosts/commands /var/lib/dokku/plugins/rethinkdb/commands
+ for script in '$(ls -d /var/lib/dokku/plugins/*/commands)'
+ /var/lib/dokku/plugins/00_dokku-standard/commands git-receive-pack ''\''myproject'\'''
+ case "$1" in
+ for script in '$(ls -d /var/lib/dokku/plugins/*/commands)'
+ /var/lib/dokku/plugins/backup/commands git-receive-pack ''\''myproject'\'''
+ CURRENT_BACKUP_VERSION=1
+ set -e
+ case "$1" in
+ for script in '$(ls -d /var/lib/dokku/plugins/*/commands)'
+ /var/lib/dokku/plugins/config/commands git-receive-pack ''\''myproject'\'''
+ [[ git-receive-pack == config ]]
+ [[ git-receive-pack == config:* ]]
+ case "$1" in
+ for script in '$(ls -d /var/lib/dokku/plugins/*/commands)'
+ /var/lib/dokku/plugins/git/commands git-receive-pack ''\''myproject'\'''
+ case "$1" in
++ sed 's/\\'\''/'\''/g'
++ perl -pe 's/(?<!\\)'\''//g'
++ echo ''\''myproject'\'''
+ APP=myproject
+ APP_PATH=/home/dokku/myproject
+ [[ git-receive-pack == \g\i\t\-\r\e\c\e\i\v\e\-\p\a\c\k ]]
+ [[ ! -d /home/dokku/myproject/refs ]]
+ args='git-receive-pack '\''myproject'\'''
+ git-shell -c 'git-receive-pack '\''myproject'\'''
remote: ++ id -un        
remote: + [[ dokku != \d\o\k\k\u ]]        
remote: + case "$1" in        
remote: ++ ls -d /var/lib/dokku/plugins/00_dokku-standard/commands /var/lib/dokku/plugins/backup/commands /var/lib/dokku/plugins/config/commands /var/lib/dokku/plugins/git/commands /var/lib/dokku/plugins/nginx-vhosts/commands /var/lib/dokku/plugins/rethinkdb/commands        
remote: + for script in '$(ls -d /var/lib/dokku/plugins/*/commands)'        
remote: + /var/lib/dokku/plugins/00_dokku-standard/commands git-hook myproject        
remote: + case "$1" in        
remote: + for script in '$(ls -d /var/lib/dokku/plugins/*/commands)'        
remote: + /var/lib/dokku/plugins/backup/commands git-hook myproject        
remote: + CURRENT_BACKUP_VERSION=1        
remote: + set -e        
remote: + case "$1" in        
remote: + for script in '$(ls -d /var/lib/dokku/plugins/*/commands)'        
remote: + /var/lib/dokku/plugins/config/commands git-hook myproject        
remote: + [[ git-hook == config ]]        
remote: + [[ git-hook == config:* ]]        
remote: + case "$1" in        
remote: + for script in '$(ls -d /var/lib/dokku/plugins/*/commands)'        
remote: + /var/lib/dokku/plugins/git/commands git-hook myproject        
remote: + case "$1" in        
remote: + APP=myproject        
remote: + read oldrev newrev refname        
remote: + [[ refs/heads/master = \r\e\f\s\/\h\e\a\d\s\/\m\a\s\t\e\r ]]        
remote: + sed -u 's/^//'        
remote: + dokku receive myproject        
remote: + git_archive_all myproject 99c1715f420c341f8f633953e05d0ba669bba1ad        
remote: + APP=myproject        
remote: + REV=99c1715f420c341f8f633953e05d0ba669bba1ad        
remote: ++ mktemp -d        
remote: ++ id -un        
remote: + TMP_WORK_DIR=/tmp/tmp.fBVyhzalgk        
remote: + chmod 755 /tmp/tmp.fBVyhzalgk        
remote: + [[ dokku != \d\o\k\k\u ]]        
remote: + case "$1" in        
remote: + APP=myproject        
remote: + IMAGE=dokku/myproject        
remote: + echo '-----> Cleaning up ...'        
remote: + dokku cleanup        
remote: -----> Cleaning up ...        
remote: + unset GIT_DIR GIT_WORK_TREE        
remote: + git clone /home/dokku/myproject /tmp/tmp.fBVyhzalgk        
remote: Cloning into '/tmp/tmp.fBVyhzalgk'...        
remote: ++ id -un        
remote: + [[ dokku != \d\o\k\k\u ]]        
remote: + case "$1" in        
remote: + echo '-----> Building myproject ...'        
remote: -----> Building myproject ...        
remote: + docker images        
remote: + grep '<none>'        
remote: + cat        
remote: + awk '{print $3}'        
remote: + xargs docker rmi        
remote: + dokku build myproject        
remote: + xargs docker rm        
remote: + awk '{print $1}'        
remote: + grep Exit        
remote: + docker ps -a        
remote: warning: You appear to have cloned an empty repository.        
remote: done.        
remote: + pushd /tmp/tmp.fBVyhzalgk        
remote: + git config advice.detachedHead false        
remote: ++ id -un        
remote: + [[ dokku != \d\o\k\k\u ]]        
remote: + case "$1" in        
remote: + APP=myproject        
remote: + IMAGE=dokku/myproject        
remote: + CACHE_DIR=/home/dokku/myproject/cache        
remote: + git checkout 99c1715f420c341f8f633953e05d0ba669bba1ad        
remote: ++ docker run -i -a stdin progrium/buildstep /bin/bash -c 'mkdir -p /app && tar -xC /app'        
remote: ++ cat        
remote: HEAD is now at 99c1715... add linux binary and automatically create database tables if none exist        
remote: + git submodule update --init --recursive        
remote: + find -name .git -prune -exec rm -rf '{}' ';'        
remote: + tar c .        
remote: + popd        
remote: + rm -rf /tmp/tmp.fBVyhzalgk        
remote: + id=6671c5ab114e6a5d8363fa44edf841533107795cb26a094e8460a1d7e97c0629        
remote: ++ docker wait 6671c5ab114e6a5d8363fa44edf841533107795cb26a094e8460a1d7e97c0629        
remote: + test 0 -eq 0        
remote: + docker commit 6671c5ab114e6a5d8363fa44edf841533107795cb26a094e8460a1d7e97c0629 dokku/myproject        
remote: + [[ -d /home/dokku/myproject/cache ]]        
remote: + pluginhook pre-build myproject        
remote: ++ docker run -d -v /home/dokku/myproject/cache:/cache dokku/myproject /build/builder        
remote: + id=214b43aed3683232d7e28d8b21deffa99dec0db79d751cad8d186b37a28edfb7        
remote: + docker attach 214b43aed3683232d7e28d8b21deffa99dec0db79d751cad8d186b37a28edfb7        
remote:        Go app detected        
remote: -----> Using go1.2        
remote: -----> Running: godep go install -tags heroku ./...        
remote: -----> Discovering process types        
remote:        Procfile declares types -> web        
remote: ++ docker wait 214b43aed3683232d7e28d8b21deffa99dec0db79d751cad8d186b37a28edfb7        
remote: + test 0 -eq 0        
remote: + docker commit 214b43aed3683232d7e28d8b21deffa99dec0db79d751cad8d186b37a28edfb7 dokku/myproject        
remote: + pluginhook post-build myproject        
remote: + echo '-----> Releasing myproject ...'        
remote: + dokku release myproject        
remote: -----> Releasing myproject ...        
remote: ++ id -un        
remote: + [[ dokku != \d\o\k\k\u ]]        
remote: + case "$1" in        
remote: + APP=myproject        
remote: + IMAGE=dokku/myproject        
remote: + pluginhook pre-release myproject        
remote: + APP=myproject        
remote: + PENDING_DIR=/home/dokku/.rethinkdb/pending-volumes        
remote: + VOLUME_DIR=/home/dokku/myproject/rethinkdb        
remote: + [[ -d /home/dokku/myproject ]]        
remote: + [[ -d /home/dokku/.rethinkdb/pending-volumes/myproject ]]        
remote: + [[ -f /home/dokku/myproject/ENV ]]        
remote: ++ docker run -i -a stdin dokku/myproject /bin/bash -c 'mkdir -p /app/.profile.d && cat > /app/.profile.d/app-env.sh'        
remote: ++ cat /home/dokku/myproject/ENV        
remote: + id=e686de39eef57a782ffa0019d77ad108c729ac678b4c7f0e2ae209e015d689d3        
remote: ++ docker wait e686de39eef57a782ffa0019d77ad108c729ac678b4c7f0e2ae209e015d689d3        
remote: + test 0 -eq 0        
remote: + docker commit e686de39eef57a782ffa0019d77ad108c729ac678b4c7f0e2ae209e015d689d3 dokku/myproject        
remote: + pluginhook post-release myproject        
remote: + echo '-----> Deploying myproject ...'        
remote: + dokku deploy myproject        
remote: -----> Deploying myproject ...        
remote: ++ id -un        
remote: + [[ dokku != \d\o\k\k\u ]]        
remote: + case "$1" in        
remote: + APP=myproject        
remote: + IMAGE=dokku/myproject        
remote: + pluginhook pre-deploy myproject        
remote: + APP=myproject        
remote: + CONTAINER_NAME=rethinkdb_myproject        
remote: + VOLUME_DIR=/home/dokku/myproject/rethinkdb        
remote: + [[ -d /home/dokku/myproject/rethinkdb ]]        
remote: + echo '-----> Starting linked container rethinkdb_myproject ...'        
remote: -----> Starting linked container rethinkdb_myproject ...        
remote: + dokku rethinkdb:start myproject        
remote: ++ id -un        
remote: + [[ dokku != \d\o\k\k\u ]]        
remote: + case "$1" in        
remote: ++ ls -d /var/lib/dokku/plugins/00_dokku-standard/commands /var/lib/dokku/plugins/backup/commands /var/lib/dokku/plugins/config/commands /var/lib/dokku/plugins/git/commands /var/lib/dokku/plugins/nginx-vhosts/commands /var/lib/dokku/plugins/rethinkdb/commands        
remote: + for script in '$(ls -d /var/lib/dokku/plugins/*/commands)'        
remote: + /var/lib/dokku/plugins/00_dokku-standard/commands rethinkdb:start myproject        
remote: + case "$1" in        
remote: + for script in '$(ls -d /var/lib/dokku/plugins/*/commands)'        
remote: + /var/lib/dokku/plugins/backup/commands rethinkdb:start myproject        
remote: + CURRENT_BACKUP_VERSION=1        
remote: + set -e        
remote: + case "$1" in        
remote: + for script in '$(ls -d /var/lib/dokku/plugins/*/commands)'        
remote: + /var/lib/dokku/plugins/config/commands rethinkdb:start myproject        
remote: + [[ rethinkdb:start == config ]]        
remote: + [[ rethinkdb:start == config:* ]]        
remote: + case "$1" in        
remote: + for script in '$(ls -d /var/lib/dokku/plugins/*/commands)'        
remote: + /var/lib/dokku/plugins/git/commands rethinkdb:start myproject        
remote: + case "$1" in        
remote: + for script in '$(ls -d /var/lib/dokku/plugins/*/commands)'        
remote: + /var/lib/dokku/plugins/nginx-vhosts/commands rethinkdb:start myproject        
remote: + case "$1" in        
remote: + for script in '$(ls -d /var/lib/dokku/plugins/*/commands)'        
remote: + /var/lib/dokku/plugins/rethinkdb/commands rethinkdb:start myproject        
remote: + RETHINKDB_IMAGE=crosbymichael/rethinkdb        
remote: + RUNAS_USER=dokku        
remote: + PENDING_DIR=/home/dokku/.rethinkdb/pending-volumes        
remote: + [[ rethinkdb:start == rethinkdb:* ]]        
remote: + [[ -z myproject ]]        
remote: + APP=myproject        
remote: + [[ -d /home/dokku/myproject ]]        
remote: + APP_EXISTS=true        
remote: + VOLUME_DIR=        
remote: + [[ -d /home/dokku/myproject/rethinkdb ]]        
remote: + VOLUME_DIR=/home/dokku/myproject/rethinkdb        
remote: + BIND_FILE=/home/dokku/myproject/rethinkdb/PUBLISH        
remote: + CONTAINER_NAME=rethinkdb_myproject        
remote: + ENV_FILE=/home/dokku/myproject/ENV        
remote: + case "$1" in        
remote: + [[ -z /home/dokku/myproject/rethinkdb ]]        
remote: + dokku rethinkdb:stop myproject        
remote: ++ id -un        
remote: + [[ dokku != \d\o\k\k\u ]]        
remote: + case "$1" in        
remote: ++ ls -d /var/lib/dokku/plugins/00_dokku-standard/commands /var/lib/dokku/plugins/backup/commands /var/lib/dokku/plugins/config/commands /var/lib/dokku/plugins/git/commands /var/lib/dokku/plugins/nginx-vhosts/commands /var/lib/dokku/plugins/rethinkdb/commands        
remote: + for script in '$(ls -d /var/lib/dokku/plugins/*/commands)'        
remote: + /var/lib/dokku/plugins/00_dokku-standard/commands rethinkdb:stop myproject        
remote: + case "$1" in        
remote: + for script in '$(ls -d /var/lib/dokku/plugins/*/commands)'        
remote: + /var/lib/dokku/plugins/backup/commands rethinkdb:stop myproject        
remote: + CURRENT_BACKUP_VERSION=1        
remote: + set -e        
remote: + case "$1" in        
remote: + for script in '$(ls -d /var/lib/dokku/plugins/*/commands)'        
remote: + /var/lib/dokku/plugins/config/commands rethinkdb:stop myproject        
remote: + [[ rethinkdb:stop == config ]]        
remote: + [[ rethinkdb:stop == config:* ]]        
remote: + case "$1" in        
remote: + for script in '$(ls -d /var/lib/dokku/plugins/*/commands)'        
remote: + /var/lib/dokku/plugins/git/commands rethinkdb:stop myproject        
remote: + case "$1" in        
remote: + for script in '$(ls -d /var/lib/dokku/plugins/*/commands)'        
remote: + /var/lib/dokku/plugins/nginx-vhosts/commands rethinkdb:stop myproject        
remote: + case "$1" in        
remote: + for script in '$(ls -d /var/lib/dokku/plugins/*/commands)'        
remote: + /var/lib/dokku/plugins/rethinkdb/commands rethinkdb:stop myproject        
remote: + RETHINKDB_IMAGE=crosbymichael/rethinkdb        
remote: + RUNAS_USER=dokku        
remote: + PENDING_DIR=/home/dokku/.rethinkdb/pending-volumes        
remote: + [[ rethinkdb:stop == rethinkdb:* ]]        
remote: + [[ -z myproject ]]        
remote: + APP=myproject        
remote: + [[ -d /home/dokku/myproject ]]        
remote: + APP_EXISTS=true        
remote: + VOLUME_DIR=        
remote: + [[ -d /home/dokku/myproject/rethinkdb ]]        
remote: + VOLUME_DIR=/home/dokku/myproject/rethinkdb        
remote: + BIND_FILE=/home/dokku/myproject/rethinkdb/PUBLISH        
remote: + CONTAINER_NAME=rethinkdb_myproject        
remote: + ENV_FILE=/home/dokku/myproject/ENV        
remote: + case "$1" in        
remote: ++ docker_get_id rethinkdb_myproject        
remote: ++ docker inspect '-f={{.ID}}' rethinkdb_myproject        
remote: + ID='<no value>'        
remote: + [[ ! -z <no value> ]]        
remote: + docker stop '<no' 'value>'        
remote: Error: No such container: <no        
remote: Error: No such container: value>        
remote: 2014/07/19 08:16:14 Error: failed to stop one or more containers        
+ for script in '$(ls -d /var/lib/dokku/plugins/*/commands)'
+ /var/lib/dokku/plugins/nginx-vhosts/commands git-receive-pack ''\''myproject'\'''
+ case "$1" in
+ for script in '$(ls -d /var/lib/dokku/plugins/*/commands)'
+ /var/lib/dokku/plugins/rethinkdb/commands git-receive-pack ''\''myproject'\'''
+ RETHINKDB_IMAGE=crosbymichael/rethinkdb
+ RUNAS_USER=dokku
+ PENDING_DIR=/home/dokku/.rethinkdb/pending-volumes
+ [[ git-receive-pack == rethinkdb:* ]]
+ case "$1" in
To dokku@178.62.......:myproject
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'dokku@178.62.......:myproject'
Completed with errors, see above
stuartpb commented 10 years ago

Either I didn't test the apps-that-don't-have-rethinkdb-containers case (which I'm pretty sure I did), or Docker changed the way it handles inspecting IDs of containers that don't exist (it used to be that docker inspect '-f={{.ID}}' "$1" 2> /dev/null || true would yield an empty string).

That's weird: it seems the container exists (hence the docker inspect not failing over to true without output) and you have a rethinkdb volume present, yet Docker is giving <no value> for ID. Did Docker make a change that creates containers without IDs?

stuartpb commented 10 years ago

What happens if you run docker inspect rethinkdb_myproject?

jhvst commented 10 years ago

Is dokku rethinkdb:create foo supposed to spin up a docker container? Running that and docker ps shows no running containers.

jhvst commented 10 years ago

OK, deploying an app creates a new container.

Running docker inspect returns the following:

[{
    "Args": [
        "--bind",
        "all"
    ],
    "Config": {
        "AttachStderr": false,
        "AttachStdin": false,
        "AttachStdout": false,
        "Cmd": [
            "--bind",
            "all"
        ],
        "CpuShares": 0,
        "Cpuset": "",
        "Domainname": "",
        "Entrypoint": [
            "/usr/bin/rethinkdb"
        ],
        "Env": [
            "HOME=/",
            "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
        ],
        "ExposedPorts": {
            "28015/tcp": {},
            "29015/tcp": {},
            "8080/tcp": {}
        },
        "Hostname": "075f135300cc",
        "Image": "crosbymichael/rethinkdb",
        "Memory": 0,
        "MemorySwap": 0,
        "NetworkDisabled": false,
        "OnBuild": null,
        "OpenStdin": false,
        "PortSpecs": null,
        "StdinOnce": false,
        "Tty": false,
        "User": "1000",
        "Volumes": null,
        "WorkingDir": "/rethinkdb"
    },
    "Created": "2014-07-19T20:28:13.591077147Z",
    "Driver": "aufs",
    "ExecDriver": "native-0.2",
    "HostConfig": {
        "Binds": [
            "/home/dokku/myproject/rethinkdb:/rethinkdb"
        ],
        "ContainerIDFile": "",
        "Dns": null,
        "DnsSearch": null,
        "Links": null,
        "LxcConf": [],
        "NetworkMode": "bridge",
        "PortBindings": {
            "28015/tcp": null,
            "29015/tcp": null,
            "8080/tcp": null
        },
        "Privileged": false,
        "PublishAllPorts": false,
        "VolumesFrom": null
    },
    "HostnamePath": "/var/lib/docker/containers/075f135300cc9ac0684b5d35c831083adc55951532d096066e2042fb2d88a8be/hostname",
    "HostsPath": "/var/lib/docker/containers/075f135300cc9ac0684b5d35c831083adc55951532d096066e2042fb2d88a8be/hosts",
    "Id": "075f135300cc9ac0684b5d35c831083adc55951532d096066e2042fb2d88a8be",
    "Image": "711aeb054191091afa1e2bab09ae6452a79b5b5c0f9343e501f0b2d3884e0a85",
    "MountLabel": "",
    "Name": "/rethinkdb_myproject",
    "NetworkSettings": {
        "Bridge": "docker0",
        "Gateway": "172.17.42.1",
        "IPAddress": "172.17.0.5",
        "IPPrefixLen": 16,
        "PortMapping": null,
        "Ports": {
            "28015/tcp": null,
            "29015/tcp": null,
            "8080/tcp": null
        }
    },
    "Path": "/usr/bin/rethinkdb",
    "ProcessLabel": "",
    "ResolvConfPath": "/etc/resolv.conf",
    "State": {
        "ExitCode": 0,
        "FinishedAt": "0001-01-01T00:00:00Z",
        "Paused": false,
        "Pid": 2006,
        "Running": true,
        "StartedAt": "2014-07-19T20:28:13.662176944Z"
    },
    "Volumes": {
        "/rethinkdb": "/home/dokku/myproject/rethinkdb"
    },
    "VolumesRW": {
        "/rethinkdb": true
    }
}
]
stuartpb commented 10 years ago
"Id": "075f135300cc9ac0684b5d35c831083adc55951532d096066e2042fb2d88a8be",

are you fsfsdonmjsgdigsdiogjsing serious did Docker break backwards compatibility on a key name for aesthetic (in)consistency (look at "IP" being two capital letters)

I'll go look at Docker. In the meantime, you can patch this by changing line 47 to

docker inspect '-f={{.Id}}' "$1" 2> /dev/null || true
jhvst commented 10 years ago

I personally don't have a lot of experience as what comes to Docker, but breaking backwards compatibility for aesthetic reasons sound odd to me.

Are there any other log information you'd like me to share?

stuartpb commented 10 years ago

https://github.com/dotcloud/docker/commit/68fb7f4b744bf71206898d32fe203556a6261e5d

aaaaargh

jhvst commented 10 years ago

I wonder do they golint their code, as the change they've made is against golint guidelines. Anyway, thanks for the patch, I'll apply it now.

stuartpb commented 10 years ago

So anyway, you can submit a PR for that patch if you want, but otherwise I'm not likely to fix this any time soon. This plugin is really an uncalled-for pile of hacks, on top of Dokku's pile of hacks, specific to a single datastore, for no good reason. (The bug we're seeing here would be better fixed by using a cidfile, but cidfiles aren't used anywhere else in Dokku, so it uses this hacky name+inspect approach.)

I've just finished up the Dokku-equivalent ecosystem for Plushu (well, finished building something I can test), and that is where I'll be focusing my efforts going forward. (I'm planning on making a generalized "addons" system for services like datastores, of which RethinkDB will be the first addom I'll support.)

stuartpb commented 10 years ago

Closed with #5.