launcher maps more stuff, bootloader gone
authorSam Saffron <sam.saffron@gmail.com>
Wed, 30 Oct 2013 06:17:34 +0000 (23:17 -0700)
committerSam Saffron <sam.saffron@gmail.com>
Wed, 30 Oct 2013 06:17:34 +0000 (23:17 -0700)
.gitignore [new file with mode: 0644]
launcher
shared/bootloader.rb [deleted file]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..7b199b0
--- /dev/null
@@ -0,0 +1,3 @@
+shared/pups
+*.swp
+cids/*
index 27cfc4e792dc3fe3b51857e3e26477ec53400843..79272274cfaf0538aef4e50b0c723637b7563b7c 100755 (executable)
--- a/launcher
+++ b/launcher
@@ -70,8 +70,7 @@ if [ "$command" == "start" ]
     if [ ! -e $cidfile ]
        then
          echo "No cid found, creating a new container"
-#docker run -cidfile $cidfile -p 22 -d -v `pwd`/shared:/shared samsaffron/discourse /usr/local/bin/ruby /shared/bootloader.rb
-         docker run -d samsaffron/discourse /usr/local/bin/ruby -e 'sleep 100'
+         docker run -cidfile $cidfile -p 22 -p 3000 -d -v `pwd`/shared:/shared samsaffron/discourse /shared/pups/bin/pups /$config_file
          exit 0
        else
          echo "cid found, ensuring container is started"
diff --git a/shared/bootloader.rb b/shared/bootloader.rb
deleted file mode 100644 (file)
index eed2688..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-# trap "SIGHUP" do
-#   STDERR.puts "Trapped SIGHUP"
-#   STDERR.flush
-#   exit
-# end
-# 
-# trap "SIGINT" do
-#   STDERR.puts "Trapped SIGINT"
-#   STDERR.flush
-#   exit
-# end
-# 
-# trap "SIGTERM" do
-#   STDERR.puts "Trapped SIGTERM"
-#   STDERR.flush
-#   exit
-# end
-
-STDERR.puts "Started #{Process.pid}"
-STDERR.puts `ps aux`
-
-while true
-  gets
-    STDERR.puts "HERE"
-    sleep 1
-end
-
-STDERR.puts "HERE"
-
-exit
-
-require 'yaml'
-require 'open3'
-require 'readline'
-
-@host = ARGV[0]
-
-STDERR.puts "Started bootloader for #{@host} at: #{Time.now}"
-
-module Discourse; end
-
-class Discourse::Config
-  def initialize(config, discourse_root=nil)
-    @config = YAML.load_file(config)
-    @discourse_root = discourse_root || "/var/www/discourse"
-  end
-
-  def startup
-    load_env
-    ensure_git_version
-    ensure_database_config
-    start_roles
-  end
-
-  def load_env
-    @config["env"].each do |k,v|
-      ENV[k.to_s] = v.to_s
-    end if @config["env"]
-  end
-
-  def ensure_database_config
-    current = YAML.load_file("#{@discourse_root}/config/database.yml.production-sample")
-    current = current.merge(@config["databases"])
-    File.open("#{@discourse_root}/config/database.yml", "w"){|f| f.write current.to_yaml }
-  end
-
-  def ensure_git_version
-    STDERR.puts `cd #{@discourse_root} && git pull`
-  end
-
-  def start_roles
-    @config["roles"].each do |role|
-      case role
-      when "unicorn"
-        start_unicorn
-      end
-    end
-  end
-
-  def start_unicorn
-    STDERR.puts `cd #{@discourse_root} && RAILS_ENV=production bundle exec rake db:migrate`
-  end
-
-end
-
-class Discourse::Process
-  def self.pids
-    @@pids ||= []
-  end
-
-  def self.spawn(*args)
-    pid = Process.spawn(*args)
-    STDERR.puts "Spawned #{args.inspect} pid: #{pid}"
-    pids << pid
-
-    Thread.start do
-      Process.wait(pid)
-      pids.delete(pid)
-    end
-
-    pid
-  end
-
-  def spawn(*args)
-    self.class.spawn(*args)
-  end
-
-  # trap "HUP" do
-  #   STDERR.puts "Trapped SIGHUP"
-  # end
-
-  # trap "INT" do
-  #   STDERR.puts "Trapped SIGINT"
-  # end
-
-  # trap "TERM" do
-  #   STDERR.puts "Trapped SIGTERM"
-  #   pids.dup.each do |pid|
-  #     STDERR.puts "Sending TERM to #{pid}"
-  #     # no such process
-  #     Process.kill("TERM", pid) rescue nil
-  #   end
-
-  #   pids.dup.each do |pid|
-  #     # no such process
-  #     Process.wait(pid) rescue nil
-  #   end
-
-  #   STDERR.puts "Exiting"
-  #   exit 1
-  # end
-end
-
-class Discourse::Postgres
-  attr_accessor :data_dir
-  def start
-  end
-end
-
-class Discourse::Sshd < Discourse::Process
-  def start
-    # we need this dir to run sshd
-    `mkdir /var/run/sshd` unless File.directory? "/var/run/sshd"
-    spawn("/usr/sbin/sshd")
-  end
-end
-
-# tmp = "/home/sam/Source/discourse_docker/shared/config/web1/conf.yml"
-tmp = "/shared/config/web1/conf.yml"
-conf = Discourse::Config.new(tmp)
-#conf.startup
-
-
-#Discourse::Sshd.new.start
-