First Push Only Options
crisward opened this issue · comments
It would be good to enable some options to only apply on first push / or perhaps if they don't already exist. (as per discussion here dokku/dokku#2269)
Env vars are mentioned as an issue, but dokku-require doesn't specifically support env vars. However having a 'firstpush' option could be useful in general.
Dokku may add something to core for this, but here could be a good place to experiment with the feature.
eg.
"dokku":{
"plugins":[
{
"name":"mariadb",
"firstpush":true,
"commands":["mariadb:create mydb","mariadb:link mydb $APP"]
}
]
}
Or better would be something like phase
?
What options would you have under phase?
I think it makes sense to make "firstpush": true
the default option. Are there even any cases when recreating a plugin on each push is a desired behaviour?
Just to clarify, it never 'recreates' a plugin if it already exists. So if you have postgres setup and linked, it will not add it the second time. But if you delete your database and repush, it will then recreate it. I personally find this useful as the ability to wipe and re-push during development can be very useful.
The attempted re-create of plugins doesn't really take any significant time so I think I'm going to leave this for now. I'll revisit this if it seems necessary in the future.