From 52774536ca50626fe269c3ba02dab3657f97564e Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 16 Nov 2014 02:59:42 -0500 Subject: [PATCH] Standardize installer on 2 spaces --- contrib/dokku-installer.rb | 192 ++++++++++++++++++------------------- 1 file changed, 96 insertions(+), 96 deletions(-) diff --git a/contrib/dokku-installer.rb b/contrib/dokku-installer.rb index 89ffbdc43..938ca8544 100755 --- a/contrib/dokku-installer.rb +++ b/contrib/dokku-installer.rb @@ -3,120 +3,120 @@ require "sinatra" require "open3" if ARGV[0] == "onboot" - File.open("/etc/init/dokku-installer.conf", "w") do |f| - f.puts "start on runlevel [2345]" - f.puts "exec #{File.absolute_path(__FILE__)} selfdestruct" - end - File.open("/etc/nginx/conf.d/dokku-installer.conf", "w") do |f| - f.puts "upstream dokku-installer { server 127.0.0.1:2000; }" - f.puts "server {" - f.puts " listen 80;" - f.puts " location / {" - f.puts " proxy_pass http://dokku-installer;" - f.puts " }" - f.puts "}" - end - `rm /etc/nginx/sites-enabled/*` - puts "Installed Upstart service and default Nginx virtualhost for installer to run on boot." - exit + File.open("/etc/init/dokku-installer.conf", "w") do |f| + f.puts "start on runlevel [2345]" + f.puts "exec #{File.absolute_path(__FILE__)} selfdestruct" + end + File.open("/etc/nginx/conf.d/dokku-installer.conf", "w") do |f| + f.puts "upstream dokku-installer { server 127.0.0.1:2000; }" + f.puts "server {" + f.puts " listen 80;" + f.puts " location / {" + f.puts " proxy_pass http://dokku-installer;" + f.puts " }" + f.puts "}" + end + `rm /etc/nginx/sites-enabled/*` + puts "Installed Upstart service and default Nginx virtualhost for installer to run on boot." + exit end -dokku_root = ENV["DOKKU_ROOT"] || "/home/dokku" -admin_key = `cat /root/.ssh/authorized_keys`.split("\n").first -hostname = `bash -c '[[ $(dig +short $HOSTNAME) ]] && echo $HOSTNAME || curl icanhazip.com'`.strip -template = DATA.read version = "v0.3.0" +dokku_root = ENV["DOKKU_ROOT"] || "/home/dokku" +admin_key = `cat /root/.ssh/authorized_keys`.split("\n").first +hostname = `bash -c '[[ $(dig +short $HOSTNAME) ]] && echo $HOSTNAME || curl icanhazip.com'`.strip +template = DATA.read set :port, 2000 set :environment, :production disable :protection get "/" do - ERB.new(template).result binding + ERB.new(template).result binding end post "/setup" do - if params[:vhost] == "true" - File.open("#{dokku_root}/VHOST", "w") {|f| f.write params[:hostname] } - else - `rm #{dokku_root}/VHOST` - end - File.open("#{dokku_root}/HOSTNAME", "w") {|f| f.write params[:hostname] } - Open3.capture2("sshcommand acl-add dokku admin", :stdin_data => params[:key]) - Thread.new { - `rm /etc/nginx/conf.d/dokku-installer.conf && /etc/init.d/nginx stop && /etc/init.d/nginx start` - `rm /etc/init/dokku-installer.conf && stop dokku-installer` - }.run if ARGV[0] == "selfdestruct" + if params[:vhost] == "true" + File.open("#{dokku_root}/VHOST", "w") {|f| f.write params[:hostname] } + else + `rm #{dokku_root}/VHOST` + end + File.open("#{dokku_root}/HOSTNAME", "w") {|f| f.write params[:hostname] } + Open3.capture2("sshcommand acl-add dokku admin", :stdin_data => params[:key]) + Thread.new { + `rm /etc/nginx/conf.d/dokku-installer.conf && /etc/init.d/nginx stop && /etc/init.d/nginx start` + `rm /etc/init/dokku-installer.conf && stop dokku-installer` + }.run if ARGV[0] == "selfdestruct" end __END__ - Dokku Setup - - + Dokku Setup + + -
-
-

Dokku Setup <%= version %>

-
-

Admin Access

-
- -
-
-

Hostname Configuration

-
- - -
-
- -
-

Your app URLs will look like:

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

Dokku Setup <%= version %>

+
+

Admin Access

+
+ +
+
+

Hostname Configuration

+
+ + +
+
+ +
+

Your app URLs will look like:

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