dokku / dokku

A docker-powered PaaS that helps you build and manage the lifecycle of applications
https://dokku.com
MIT License
28.92k stars 1.91k forks source link

Config Variable Prior to First Push #487

Closed AlJohri closed 9 years ago

AlJohri commented 10 years ago

What would be the quickest way to implement sending config variables before the first push? I have an app that requires:

HEROKU=1
C_FORCE_ROOT=1

or else it won't push properly. It would be nice to be able to set the config variables prior as opposed to: (1) push, (2) set variables, and (3) restart.

Perhaps a way to dokku create $APP that just creates an empty folder in /home/dokku with a blank ENV file ready to be written to?

ghost commented 10 years ago

Currently you'd have to do:

mkdir /home/dokku/<app>
vim /home/dokku/<app>/ENV

In ENV you'd add:

export HEROKU=1
export C_FORCE_ROOT=1
plietar commented 10 years ago

git init --bare isn't required since #391, so a create command would only have to mkdir /home/dokku/<app>

ghost commented 10 years ago

Ah yes, thanks

AlJohri commented 10 years ago

In addition to that, I think you'd need to add a conditional here (https://github.com/progrium/dokku/blob/master/plugins/config/commands#L127) to set RESTART_APP=false if $DOKKU_ROOT/$APP/CONTAINER doesn't exist.

This allows you to run a dokku create command which just does:

    mkdir -p $DOKKU_ROOT/$APP
    touch $DOKKU_ROOT/$APP/ENV

and then you can use the regular dokku config plugin to set the variables dokku config:set HEROKU=1

Should I submit a PR for this?

jazzzz commented 10 years ago

Should I submit a PR for this?

Yes please!

nickl- commented 10 years ago

+1 for a dokku create that will create the app complete with CONTAINER but stops short of processing the buildpack. It is not only environment variables that introduces these "chicken or egg" scenarios as you may require a database or similar services which are produced by other plugins, all dependent on the existence of an app, which in turn fails in their absence and so on and so forth.

It sucks to first have to create an app but it sucks way less than having to wait for an app to crash first, when you know it will only to do the settings it requires afterwards.

What would really kick ass though, if we could decouple these interdependencies and make it irrelevant whether the chicken came before the egg or the other way around. @jazzzz do you have a solution like that?

dmil commented 10 years ago

+1

jazzzz commented 10 years ago

I implemented the create command in PR #599.

josegonzalez commented 9 years ago

You can now use dokku apps:create APP_NAME and then dokku config:set as you might on heroku.