From f8766708c7511a7b5318e634ff9cadecb74e8871 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 6 Jan 2019 22:26:54 -0500 Subject: [PATCH 1/2] feat: add support for alternate ssh authorized_keys locations On Ubuntu within AWS environments, the default user is the `ubuntu` user, and this is where the ssh key should be pulled from. CentOS has a tendency to use `ec2-user`. On all other environments, the `root` user is typically the only user provisioned. Closes #3372 --- contrib/dokku-installer.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/contrib/dokku-installer.py b/contrib/dokku-installer.py index 5b321c98d..7c31b2887 100755 --- a/contrib/dokku-installer.py +++ b/contrib/dokku-installer.py @@ -21,7 +21,13 @@ try: except subprocess.CalledProcessError: pass -key_file = os.getenv('KEY_FILE', '/root/.ssh/authorized_keys') +key_file = os.getenv('KEY_FILE', None) +if os.path.isfile('/home/ec2-user/.ssh/authorized_keys'): + key_file = '/home/ec2-user/.ssh/authorized_keys' +elif os.path.isfile('/home/ubuntu/.ssh/authorized_keys'): + key_file = '/home/ubuntu/.ssh/authorized_keys' +else: + key_file = '/root/.ssh/authorized_keys' admin_keys = [] if os.path.isfile(key_file): From 2dd9ff3ac8c923615307ad2a784e61593f9e4995 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 6 Jan 2019 22:38:49 -0500 Subject: [PATCH 2/2] refactor: make admin setup UI look a bit nicer The initial admin setup UI is a bit of a hack, but could also be a bit frustrating to new users as the settings are unclear. Rather than throw them to the wolves, include some useful information to allow them to make good decisions when setting up Dokku. - Upgrade to latest bootstramp and latest jquery 1.x release - Add a warning for people who might miss this setup page - Add placeholder text to both the ssh key area and the hostname - Add descriptions to all form fields to further explain the consequences of a particular field - Add links where necessary for users who wish to explore how to change settings in the future - Make the "result" message on submission red or green depending on the success or failure of the submission. - Wait 3 seconds before redirecting on success --- contrib/dokku-installer.py | 113 +++++++++++++++++++++++++++++-------- 1 file changed, 88 insertions(+), 25 deletions(-) diff --git a/contrib/dokku-installer.py b/contrib/dokku-installer.py index 7c31b2887..025e49773 100755 --- a/contrib/dokku-installer.py +++ b/contrib/dokku-installer.py @@ -78,6 +78,7 @@ class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): def do_GET(self): content = PAGE.replace('{VERSION}', VERSION) content = content.replace('{HOSTNAME}', hostname) + content = content.replace('{AUTHORIZED_KEYS_LOCATION}', key_file) content = content.replace('{ADMIN_KEYS}', "\n".join(admin_keys)) self.send_response(200) self.end_headers() @@ -218,33 +219,91 @@ PAGE = """ Dokku Setup - - + + + -
-
-

Dokku Setup {VERSION}

-
-

Admin Access

-
- -
-
-

Hostname Configuration

-
- - +
+ +

Dokku Setup {VERSION}

+ -
- + +
+
+

Admin Access

+
+
+ + Public keys allow users to ssh onto the server as the dokku user, as well as remotely execute Dokku commands. They are currently auto-populated from: {AUTHORIZED_KEYS_LOCATION}, and can be changed later via the dokku ssh-keys plugin. +
+
-

Your app URLs will look like:

-
http://hostname:port
-
- - + +
+
+

Hostname Configuration

+
+ + + This will be used as the default host for all applications, and can be changed later via the dokku domains:set-global command. +
+
+ + + When enabled, Nginx will be run on port 80 and proxy requests to apps based on hostname. + When disabled, a specific port will be setup for each application on first deploy, and requests to that port will be proxied to the relevant app. +
+
+
What will app URLs look like?
+
http://hostname:port
+
+
+
+ +
+