这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@michaelshobbs
Copy link
Member

  • supports scripts.dokku.predeploy and scripts.dokku.postdeploy in (/app/app.json in the app image)
  • adds a couple json parsing utility functions
  • adds IMAGE_TAG post-deploy plugn trigger call
  • and oh yeah, adds a test and docs :P

closes #1824

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should really be cleaned up imo. port and then ip? ew.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wut?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pre-deploy hook is:

plugn trigger pre-deploy $APP $IMAGE_TAG

Maybe we should follow that and instead do:

plugn trigger post-deploy $APP $IMAGE_TAG $ipaddr $port

Or similar? What uses the port/ipaddr from here that cannot retrieve it from some other helper?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see. This would break any post-deploy plugins that used those arguments. While I agree with you that this should probably happen at some point, I don't think it should go in this PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant post-deploy in my second example.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I meant that too :)

@josegonzalez
Copy link
Member

What happens for Dockerfile users that don't have bash in their containers?

@michaelshobbs
Copy link
Member Author

Yeah the current implementation only supports buildpack apps anyway since we don't nullglob on sourcing files from /app/.profile.d/*. Not sure dockerfile support makes sense since app.json is a Herokuism anyway. Thoughts?

EDIT: if this is to only be supported in buildpack apps (which i'm leaning that way) then I'll need to drop the dockerfile reference from the documentation.

@michaelshobbs
Copy link
Member Author

Tests are failing because CircleCi did not include their docker cp patch in the 1.9.0-circleci daemon binary we're using now. We can downgrade back to 1.8.2-circleci but I'd like to see if they will patch the newer version first. I've opened a support ticket that asks for this.

@josegonzalez
Copy link
Member

Yeah lets drop the dockerfile reference.

@michaelshobbs
Copy link
Member Author

Noooooo! 😜 This really doesn't need to wait for 0.5.0.

@josegonzalez
Copy link
Member

I'd like to leave features up for 0.5.0 to push people to upgrade :)

@michaelshobbs
Copy link
Member Author

Bah! Ok 😿

@josegonzalez
Copy link
Member

Is there a good reason why we shouldn't incentivize updates?

@michaelshobbs
Copy link
Member Author

Meh?

@josegonzalez
Copy link
Member

Note, I don't mind doing it in 0.4.x if that's your wish.

@michaelshobbs
Copy link
Member Author

no. 0.5.0 works for me

@michaelshobbs michaelshobbs force-pushed the 1824_mh-app-json branch 8 times, most recently from 29182d9 to bfa26fe Compare January 8, 2016 01:53
@michaelshobbs
Copy link
Member Author

I've split out the commits that don't belong here into other PRs. Once those tests pass, I'll update this one.

@michaelshobbs
Copy link
Member Author

I'm wondering if postdeploy makes any sense. The way dokku deploys is illustrated below.

# copy app to container
docker run
docker wait
docker commit dokku/$APP

# trigger pre-build
# build
docker run
docker wait
docker commit dokku/$APP
# tigger post-build

# trigger pre-release
# release
docker run ...
docker wait
docker commit dokku/$APP
# trigger post-release

# trigger pre-deploy (run app.json: scripts.dokku.predeploy)
# deploy
docker run /start web (this is the deployed app container)
docker wait
docker commit dokku/$APP
# trigger check-deploy
# trigger post-deploy (run app.json: scripts.dokku.postdeploy)

If an app.json postdeploy script makes changes to the app image, the app will never see those changes because our container is already running with the previous image layer.

As far as I can tell, we have 2 options.

  • drop scripts.dokku.postdeploy support
  • don't commit the scripts.dokku.postdeploy container
    • committing this step ends up creating an image layer that is never used by the app and drops the image name from docker ps output
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
2fcdcdb6d725        f84f300e0aed        "/start web"        25 minutes ago      Up 25 minutes                           node-js-express.web.1

I'm leaning towards option 2. Thoughts?

@josegonzalez
Copy link
Member

Option 2

@michaelshobbs
Copy link
Member Author

Assuming tests pass, I think this is good to go.

@michaelshobbs michaelshobbs modified the milestone: 0.5.0 Jan 13, 2016
@josegonzalez
Copy link
Member

This looks good to me for the 0.5.0 release.

@jvanbaarsen
Copy link
Contributor

🎉 Awesome! @michaelshobbs Thanks for working on this ❤️

@josegonzalez
Copy link
Member

Don't know why help generation is failing very weird, as master passes...

@michaelshobbs
Copy link
Member Author

Must have been something weird with your rebase. I rebased and forced-push. Tests pass now

@josegonzalez
Copy link
Member

Merge when ready :)

michaelshobbs added a commit that referenced this pull request Feb 20, 2016
support scripts.dokku. in app.json
@michaelshobbs michaelshobbs merged commit a9de299 into master Feb 20, 2016
@josegonzalez josegonzalez deleted the 1824_mh-app-json branch February 21, 2016 01:09
@josegonzalez josegonzalez changed the title support scripts.dokku. in app.json Support scripts.dokku. in app.json Mar 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a plugin that runs certain commands after deployment

4 participants