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

Conversation

@josegonzalez
Copy link
Member

A slightly better local dokku client. Appears to work with multiple hosts, and can be set as an alias in your bashrc. Also enforces usage of bash.

@josegonzalez
Copy link
Member Author

:|

Copy link
Member

Choose a reason for hiding this comment

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

Having to echo app_name | dokku apps:destroy app_name was annoying. This allows dokku apps:destroy app_name force

@josegonzalez
Copy link
Member Author

Fancy.

@michaelshobbs
Copy link
Member

I just realized this breaks the auto adding of the remote. I feex.

Copy link
Member

Choose a reason for hiding this comment

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

This errors:
dokku_client.sh: line 34: lua: command not found

@michaelshobbs
Copy link
Member

Nevermind that's a lie. If you set DOKKU_HOST variable it will attempt to git remote add. However lua is not installed. Do we want to auto add a remote in the case of a DOKKU_HOST env var but no git remote?

If we are to auto add a git remote we'll need a way to generate an app name....

@josegonzalez
Copy link
Member Author

We do not want to do that if we don't have a remote. I mentioned in irc, but here are a few ways we can look at it:

Implement a solution in pure bash. OS X has Bash 3, so we might need to shell out to a temp file or something since you get arrays only in Bash 4 (or do something clever with sed/cut/counting spaces in a long string and getting the nth space and then the word before that...).

You'll probably also want to check that an app of that name doesn't collide with an existing app, but we can actually do that in a later PR, given that this is in contrib.

Either way 👍 thanks for the extra work :)

@michaelshobbs michaelshobbs force-pushed the dokku-client branch 2 times, most recently from aab1936 to 863790f Compare January 17, 2015 02:40
@michaelshobbs
Copy link
Member

Includes dup app check and random app generator all in bash (works in bash 3 and 4)!

Copy link
Member

Choose a reason for hiding this comment

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

Because why tr if we don't have to 😉

Copy link
Member Author

Choose a reason for hiding this comment

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

Do these lines work in bash3? I'll test in the morning, but OS X comes with Bash 3 and I'm like 90% sure arrays are Bash 4.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also trollerskares around the word-wrapping :P

Copy link
Member

Choose a reason for hiding this comment

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

I tested this with

# /bin/bash --version
GNU bash, version 3.2.53(1)-release (x86_64-apple-darwin14)
Copyright (C) 2007 Free Software Foundation, Inc.

and

# /usr/local/bin/bash --version
GNU bash, version 4.3.18(1)-release (x86_64-apple-darwin13.3.0)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I was going to put the arrays in another file and source them but then that seemed to break the single-file nature of the client anyway...So, here we are? Open to suggestions.

Copy link
Member Author

Choose a reason for hiding this comment

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

Nah, its all good :)

@AlJohri
Copy link
Contributor

AlJohri commented Jan 17, 2015

Does "enforces usage of bash" mean the script must be called from a bash shell or that the script needs to use bash specific syntax?

@michaelshobbs
Copy link
Member

I believe @josegonzalez is referring the shebang at the top of the file that was not there before. Of course, this also would mean that the script needs to use bash compatible syntax.

@michaelshobbs
Copy link
Member

@josegonzalez dropped create and destroy.

This allows someone to pass apps:create and get an auto generated app name and then apps:destroy or apps:destroy force and operate on their auto generated app. If they pass in an app name it will act just like a local execution of dokku apps:create or dokku apps:destroy.

josegonzalez added a commit that referenced this pull request Jan 18, 2015
@josegonzalez josegonzalez merged commit b8851a6 into master Jan 18, 2015
@josegonzalez josegonzalez deleted the dokku-client branch January 18, 2015 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants