This repository has been archived by the owner. It is now read-only.

Adding environment variables before an app exists prevents app creation #11

Open
ryana opened this Issue Dec 16, 2013 · 5 comments

Comments

Projects
None yet
3 participants
@ryana

ryana commented Dec 16, 2013

Hey there,

I'm adding a new app to a server. When I do the following steps:

  • add an environment variable for the app "staging.myserver.com"
  • run chef-client on staging.myserver.com
  • push a new app to dokku@staging.myserver.com:staging.myserver.com

I get an error from the push:

ra:app(dev-procfile) ryan$ git push staging dev-procfile:master
fatal: 'staging.ramen.is' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
ra:app(dev-procfile) ryan$

I'm guessing git is mad that the /home/dokku/staging.myserver.com directory exists, but only contains the ENV file and is not a git repo.

Am I just using this wrong, or have I hit a race condition?

@ryana

This comment has been minimized.

ryana commented Dec 16, 2013

And if I do a git init --bare in that directory, then the push succeeds, but the hooks aren't there so nothing else happens...

Context: I'm brand new to docker & dokku btw :)

@wingrunr21

This comment has been minimized.

Collaborator

wingrunr21 commented Dec 16, 2013

Hmm, that's interesting. So yes I believe you've hit a race condition. We need to move this cookbook over to using LWRPs for the dokku config command over writing the ENV file ourself. For the time being, can you just deploy with dokku and then run chef-client? (alternatively just rename that dir, deploy with dokku, and move the ENV file back in).

@ryana

This comment has been minimized.

ryana commented Dec 16, 2013

Yeah I've been just doing the push to setup the directory, canceling once the buildpack starts it's thing, running chef-client, then pushing again.

Ok thanks!

@mikexstudios

This comment has been minimized.

Contributor

mikexstudios commented Dec 24, 2013

It's not a chef-dokku bug but rather from line 26 of dokku's plugins/git/commands:

 if [[ $1 == "git-receive-pack" && ! -d $APP_PATH ]]; then

Since $APP_PATH directory already exists, then the bare git repo won't be initialized and the pre-receive hook won't be installed during the first push. I'll open a ticket with dokku for a fix.

@wingrunr21

This comment has been minimized.

Collaborator

wingrunr21 commented Dec 24, 2013

Yes, that is definitely the case. Thanks for pushing that PR to dokku.

Users will need to target dokku master instead of the v0.2.0 tag to pick up that change.

It does not solve the underlying issue, however. We should be using LWRPs for in-built dokku commands rather than duplicating the process manually. I'm hoping to give chef-dokku some more love over the holidays.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.