smartmachine 1.1.1 → 1.2.0.dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/smart_machine/commands/grid.rb +4 -0
- data/lib/smart_machine/commands/grid_commands/phpmyadmin.rb +65 -0
- data/lib/smart_machine/commands/machine.rb +6 -0
- data/lib/smart_machine/commands/machine_commands/network.rb +65 -0
- data/lib/smart_machine/commands/machine_commands/sub_thor.rb +15 -0
- data/lib/smart_machine/configuration.rb +24 -2
- data/lib/smart_machine/grids/mysql.rb +8 -0
- data/lib/smart_machine/grids/phpmyadmin.rb +104 -0
- data/lib/smart_machine/grids/terminal/init.el +70 -140
- data/lib/smart_machine/machines/network.rb +37 -0
- data/lib/smart_machine/syncer.rb +4 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/mysql.yml +2 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/network.yml +8 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/phpmyadmin/phpmyadminone/config.user.inc.php +7 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/phpmyadmin.yml +11 -0
- data/lib/smart_machine/version.rb +3 -3
- data/lib/smart_machine.rb +3 -0
- metadata +15 -7
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 3d02cc8e054d7716fda6e487f5964c2c0e47a604e664be9cbcc77436ac1b8cc3
         | 
| 4 | 
            +
              data.tar.gz: e476480bd9b755c84f4996e86dbc99e1d24d96b1139a9fd7bb14c4ab7b24cc29
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 06ad0c9df3fde28ce64a629d2caa597cd84838eed893a3ce7b835bc29715f8b4f2d0764b8e32bb6593f255010519d342f60593ae5caf4417802953ea4e47d287
         | 
| 7 | 
            +
              data.tar.gz: 6eadb0a1ba55a868f738dd7cb5ccfedda02247406d9d0fadc8f8b18918a43a9859164fd9844921bd377f0e4a4e4b4ba6c9890ca68bbbd494c25459b93c53c063
         | 
| @@ -4,6 +4,7 @@ require 'smart_machine/commands/grid_commands/minio' | |
| 4 4 | 
             
            require 'smart_machine/commands/grid_commands/mysql'
         | 
| 5 5 | 
             
            require 'smart_machine/commands/grid_commands/nextcloud'
         | 
| 6 6 | 
             
            require 'smart_machine/commands/grid_commands/nginx'
         | 
| 7 | 
            +
            require 'smart_machine/commands/grid_commands/phpmyadmin'
         | 
| 7 8 | 
             
            require 'smart_machine/commands/grid_commands/prereceiver'
         | 
| 8 9 | 
             
            require 'smart_machine/commands/grid_commands/redis'
         | 
| 9 10 | 
             
            require 'smart_machine/commands/grid_commands/terminal'
         | 
| @@ -28,6 +29,9 @@ module SmartMachine | |
| 28 29 | 
             
                  desc "nginx", "Run nginx grid commands"
         | 
| 29 30 | 
             
                  subcommand "nginx", GridCommands::Nginx
         | 
| 30 31 |  | 
| 32 | 
            +
                  desc "phpmyadmin", "Run phpmyadmin grid commands"
         | 
| 33 | 
            +
                  subcommand "phpmyadmin", GridCommands::Phpmyadmin
         | 
| 34 | 
            +
             | 
| 31 35 | 
             
                  desc "prereceiver", "Run prereceiver grid commands"
         | 
| 32 36 | 
             
                  subcommand "prereceiver", GridCommands::Prereceiver
         | 
| 33 37 |  | 
| @@ -0,0 +1,65 @@ | |
| 1 | 
            +
            module SmartMachine
         | 
| 2 | 
            +
              module Commands
         | 
| 3 | 
            +
                module GridCommands
         | 
| 4 | 
            +
                  class Phpmyadmin < SubThor
         | 
| 5 | 
            +
                    include Utilities
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                    desc "up", "Take UP the phpmyadmin grid"
         | 
| 8 | 
            +
                    option :name, type: :string
         | 
| 9 | 
            +
                    def up
         | 
| 10 | 
            +
                      inside_machine_dir do
         | 
| 11 | 
            +
                        with_docker_running do
         | 
| 12 | 
            +
                          machine = SmartMachine::Machine.new
         | 
| 13 | 
            +
                          name_option = options[:name] ? " --name=#{options[:name]}" : ""
         | 
| 14 | 
            +
                          machine.run_on_machine commands: "smartengine grid phpmyadmin uper#{name_option}"
         | 
| 15 | 
            +
                        end
         | 
| 16 | 
            +
                      end
         | 
| 17 | 
            +
                    end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                    desc "down", "Take DOWN the phpmyadmin grid"
         | 
| 20 | 
            +
                    option :name, type: :string
         | 
| 21 | 
            +
                    def down
         | 
| 22 | 
            +
                      inside_machine_dir do
         | 
| 23 | 
            +
                        with_docker_running do
         | 
| 24 | 
            +
                          machine = SmartMachine::Machine.new
         | 
| 25 | 
            +
                          name_option = options[:name] ? " --name=#{options[:name]}" : ""
         | 
| 26 | 
            +
                          machine.run_on_machine commands: "smartengine grid phpmyadmin downer#{name_option}"
         | 
| 27 | 
            +
                        end
         | 
| 28 | 
            +
                      end
         | 
| 29 | 
            +
                    end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                    desc "uper", "Phpmyadmin grid uper", hide: true
         | 
| 32 | 
            +
                    option :name, type: :string
         | 
| 33 | 
            +
                    def uper
         | 
| 34 | 
            +
                      inside_engine_machine_dir do
         | 
| 35 | 
            +
                        if options[:name]
         | 
| 36 | 
            +
                          phpmyadmin = SmartMachine::Grids::Phpmyadmin.new(name: options[:name])
         | 
| 37 | 
            +
                          phpmyadmin.uper
         | 
| 38 | 
            +
                        else
         | 
| 39 | 
            +
                          SmartMachine.config.grids.phpmyadmin.each do |name, config|
         | 
| 40 | 
            +
                            phpmyadmin = SmartMachine::Grids::Phpmyadmin.new(name: name.to_s)
         | 
| 41 | 
            +
                            phpmyadmin.uper
         | 
| 42 | 
            +
                          end
         | 
| 43 | 
            +
                        end
         | 
| 44 | 
            +
                      end
         | 
| 45 | 
            +
                    end
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                    desc "downer", "Phpmyadmin grid downer", hide: true
         | 
| 48 | 
            +
                    option :name, type: :string
         | 
| 49 | 
            +
                    def downer
         | 
| 50 | 
            +
                      inside_engine_machine_dir do
         | 
| 51 | 
            +
                        if options[:name]
         | 
| 52 | 
            +
                          phpmyadmin = SmartMachine::Grids::Phpmyadmin.new(name: options[:name])
         | 
| 53 | 
            +
                          phpmyadmin.downer
         | 
| 54 | 
            +
                        else
         | 
| 55 | 
            +
                          SmartMachine.config.grids.phpmyadmin.each do |name, config|
         | 
| 56 | 
            +
                            phpmyadmin = SmartMachine::Grids::Phpmyadmin.new(name: name.to_s)
         | 
| 57 | 
            +
                            phpmyadmin.downer
         | 
| 58 | 
            +
                          end
         | 
| 59 | 
            +
                        end
         | 
| 60 | 
            +
                      end
         | 
| 61 | 
            +
                    end
         | 
| 62 | 
            +
                  end
         | 
| 63 | 
            +
                end
         | 
| 64 | 
            +
              end
         | 
| 65 | 
            +
            end
         | 
| @@ -1,3 +1,6 @@ | |
| 1 | 
            +
            require 'smart_machine/commands/machine_commands/sub_thor'
         | 
| 2 | 
            +
            require 'smart_machine/commands/machine_commands/network'
         | 
| 3 | 
            +
             | 
| 1 4 | 
             
            module SmartMachine
         | 
| 2 5 | 
             
              module Commands
         | 
| 3 6 | 
             
                class Machine < Thor
         | 
| @@ -27,6 +30,9 @@ module SmartMachine | |
| 27 30 | 
             
                      machine.run_on_machine(commands: "#{args.join(' ')}")
         | 
| 28 31 | 
             
                    end
         | 
| 29 32 | 
             
                  end
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                  desc "network", "Run machine network commands"
         | 
| 35 | 
            +
                  subcommand "network", MachineCommands::Network
         | 
| 30 36 | 
             
                end
         | 
| 31 37 | 
             
              end
         | 
| 32 38 | 
             
            end
         | 
| @@ -0,0 +1,65 @@ | |
| 1 | 
            +
            module SmartMachine
         | 
| 2 | 
            +
              module Commands
         | 
| 3 | 
            +
                module MachineCommands
         | 
| 4 | 
            +
                  class Network < SubThor
         | 
| 5 | 
            +
                    include Utilities
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                    desc "up", "Take UP the machine network"
         | 
| 8 | 
            +
                    option :name, type: :string
         | 
| 9 | 
            +
                    def up
         | 
| 10 | 
            +
                      inside_machine_dir do
         | 
| 11 | 
            +
                        with_docker_running do
         | 
| 12 | 
            +
                          machine = SmartMachine::Machine.new
         | 
| 13 | 
            +
                          name_option = options[:name] ? " --name=#{options[:name]}" : ""
         | 
| 14 | 
            +
                          machine.run_on_machine commands: "smartengine machine network uper#{name_option}"
         | 
| 15 | 
            +
                        end
         | 
| 16 | 
            +
                      end
         | 
| 17 | 
            +
                    end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                    desc "down", "Take DOWN the machine network"
         | 
| 20 | 
            +
                    option :name, type: :string
         | 
| 21 | 
            +
                    def down
         | 
| 22 | 
            +
                      inside_machine_dir do
         | 
| 23 | 
            +
                        with_docker_running do
         | 
| 24 | 
            +
                          machine = SmartMachine::Machine.new
         | 
| 25 | 
            +
                          name_option = options[:name] ? " --name=#{options[:name]}" : ""
         | 
| 26 | 
            +
                          machine.run_on_machine commands: "smartengine machine network downer#{name_option}"
         | 
| 27 | 
            +
                        end
         | 
| 28 | 
            +
                      end
         | 
| 29 | 
            +
                    end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                    desc "uper", "Machine network uper", hide: true
         | 
| 32 | 
            +
                    option :name, type: :string
         | 
| 33 | 
            +
                    def uper
         | 
| 34 | 
            +
                      inside_engine_machine_dir do
         | 
| 35 | 
            +
                        if options[:name]
         | 
| 36 | 
            +
                          network = SmartMachine::Machines::Network.new(name: options[:name])
         | 
| 37 | 
            +
                          network.uper
         | 
| 38 | 
            +
                        else
         | 
| 39 | 
            +
                          SmartMachine.config.network.each do |name, config|
         | 
| 40 | 
            +
                            network = SmartMachine::Machines::Network.new(name: name.to_s)
         | 
| 41 | 
            +
                            network.uper
         | 
| 42 | 
            +
                          end
         | 
| 43 | 
            +
                        end
         | 
| 44 | 
            +
                      end
         | 
| 45 | 
            +
                    end
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                    desc "downer", "Machine network downer", hide: true
         | 
| 48 | 
            +
                    option :name, type: :string
         | 
| 49 | 
            +
                    def downer
         | 
| 50 | 
            +
                      inside_engine_machine_dir do
         | 
| 51 | 
            +
                        if options[:name]
         | 
| 52 | 
            +
                          network = SmartMachine::Machines::Network.new(name: options[:name])
         | 
| 53 | 
            +
                          network.downer
         | 
| 54 | 
            +
                        else
         | 
| 55 | 
            +
                          SmartMachine.config.network.each do |name, config|
         | 
| 56 | 
            +
                            network = SmartMachine::Machines::Network.new(name: name.to_s)
         | 
| 57 | 
            +
                            network.downer
         | 
| 58 | 
            +
                          end
         | 
| 59 | 
            +
                        end
         | 
| 60 | 
            +
                      end
         | 
| 61 | 
            +
                    end
         | 
| 62 | 
            +
                  end
         | 
| 63 | 
            +
                end
         | 
| 64 | 
            +
              end
         | 
| 65 | 
            +
            end
         | 
| @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            module SmartMachine
         | 
| 2 | 
            +
              module Commands
         | 
| 3 | 
            +
                module MachineCommands
         | 
| 4 | 
            +
                  class SubThor < Thor
         | 
| 5 | 
            +
                    def self.banner(command, namespace = nil, subcommand = false)
         | 
| 6 | 
            +
                      "#{basename} machine #{subcommand_prefix} #{command.usage}"
         | 
| 7 | 
            +
                    end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                    def self.subcommand_prefix
         | 
| 10 | 
            +
                      self.name.gsub(%r{.*::}, '').gsub(%r{^[A-Z]}) { |match| match[0].downcase }.gsub(%r{[A-Z]}) { |match| "-#{match[0].downcase}" }
         | 
| 11 | 
            +
                    end
         | 
| 12 | 
            +
                  end
         | 
| 13 | 
            +
                end
         | 
| 14 | 
            +
              end
         | 
| 15 | 
            +
            end
         | 
| @@ -8,13 +8,13 @@ module SmartMachine | |
| 8 8 | 
             
                end
         | 
| 9 9 |  | 
| 10 10 | 
             
                def config
         | 
| 11 | 
            -
                  @config ||= OpenStruct.new(grids: grids)
         | 
| 11 | 
            +
                  @config ||= OpenStruct.new(grids: grids, network: network)
         | 
| 12 12 | 
             
                end
         | 
| 13 13 |  | 
| 14 14 | 
             
                private
         | 
| 15 15 |  | 
| 16 16 | 
             
                def grids
         | 
| 17 | 
            -
                  @grids ||= OpenStruct.new(elasticsearch: elasticsearch, minio: minio, mysql: mysql, nextcloud: nextcloud, prereceiver: prereceiver, redis: redis, terminal: terminal)
         | 
| 17 | 
            +
                  @grids ||= OpenStruct.new(elasticsearch: elasticsearch, minio: minio, mysql: mysql, nextcloud: nextcloud, phpmyadmin: phpmyadmin, prereceiver: prereceiver, redis: redis, terminal: terminal)
         | 
| 18 18 | 
             
                end
         | 
| 19 19 |  | 
| 20 20 | 
             
                def elasticsearch
         | 
| @@ -61,6 +61,17 @@ module SmartMachine | |
| 61 61 | 
             
                  end
         | 
| 62 62 | 
             
                end
         | 
| 63 63 |  | 
| 64 | 
            +
                def phpmyadmin
         | 
| 65 | 
            +
                  # Once the SmartMachine.config assignments in smart_machine.rb file has been removed, then this file exist condition can be removed to ensure that config/phpmyadmin.yml always exists
         | 
| 66 | 
            +
                  if File.exist? "config/phpmyadmin.yml"
         | 
| 67 | 
            +
                    deserialize(IO.binread("config/phpmyadmin.yml")).deep_symbolize_keys
         | 
| 68 | 
            +
                  elsif File.exist? "#{File.expand_path('~')}/machine/config/phpmyadmin.yml"
         | 
| 69 | 
            +
                    deserialize(IO.binread("#{File.expand_path('~')}/machine/config/phpmyadmin.yml")).deep_symbolize_keys
         | 
| 70 | 
            +
                  else
         | 
| 71 | 
            +
                    {}
         | 
| 72 | 
            +
                  end
         | 
| 73 | 
            +
                end
         | 
| 74 | 
            +
             | 
| 64 75 | 
             
                def prereceiver
         | 
| 65 76 | 
             
                  # Once the SmartMachine.config assignments in smart_machine.rb file has been removed, then this file exist condition can be removed to ensure that config/prereceiver.yml always exists
         | 
| 66 77 | 
             
                  if File.exist? "config/prereceiver.yml"
         | 
| @@ -94,6 +105,17 @@ module SmartMachine | |
| 94 105 | 
             
                  end
         | 
| 95 106 | 
             
                end
         | 
| 96 107 |  | 
| 108 | 
            +
                def network
         | 
| 109 | 
            +
                  # Once the SmartMachine.config assignments in smart_machine.rb file has been removed, then this file exist condition can be removed to ensure that config/network.yml always exists
         | 
| 110 | 
            +
                  if File.exist? "config/network.yml"
         | 
| 111 | 
            +
                    deserialize(IO.binread("config/network.yml")).deep_symbolize_keys
         | 
| 112 | 
            +
                  elsif File.exist? "#{File.expand_path('~')}/machine/config/network.yml"
         | 
| 113 | 
            +
                    deserialize(IO.binread("#{File.expand_path('~')}/machine/config/network.yml")).deep_symbolize_keys
         | 
| 114 | 
            +
                  else
         | 
| 115 | 
            +
                    {}
         | 
| 116 | 
            +
                  end
         | 
| 117 | 
            +
                end
         | 
| 118 | 
            +
             | 
| 97 119 | 
             
                def deserialize(config)
         | 
| 98 120 | 
             
                  YAML.load(ERB.new(config).result).presence || {}
         | 
| 99 121 | 
             
                end
         | 
| @@ -6,6 +6,7 @@ module SmartMachine | |
| 6 6 | 
             
                    raise "mysql config for #{name} not found." unless config
         | 
| 7 7 |  | 
| 8 8 | 
             
                    @port = config.dig(:port)
         | 
| 9 | 
            +
                    @networks = Array(config.dig(:networks))
         | 
| 9 10 | 
             
                    @root_password = config.dig(:root_password)
         | 
| 10 11 | 
             
                    @username = config.dig(:username)
         | 
| 11 12 | 
             
                    @password = config.dig(:password)
         | 
| @@ -48,6 +49,9 @@ module SmartMachine | |
| 48 49 | 
             
                      puts "done"
         | 
| 49 50 | 
             
                      puts "-----> Starting container #{@name} ... "
         | 
| 50 51 | 
             
                      if system("docker start #{@name}", out: File::NULL)
         | 
| 52 | 
            +
                        @networks.each do |network|
         | 
| 53 | 
            +
                          raise "Error: Could not connect container: #{network} - #{@name}" unless system("docker network connect #{network} #{@name}", out: File::NULL)
         | 
| 54 | 
            +
                        end
         | 
| 51 55 | 
             
                        puts "done"
         | 
| 52 56 | 
             
                      else
         | 
| 53 57 | 
             
                        raise "Error: Could not start the created #{@name} container"
         | 
| @@ -59,6 +63,10 @@ module SmartMachine | |
| 59 63 |  | 
| 60 64 | 
             
                  # Stopping & Removing containers - in reverse order
         | 
| 61 65 | 
             
                  def downer
         | 
| 66 | 
            +
                    @networks.each do |network|
         | 
| 67 | 
            +
                      raise "Error: Could not disconnect container: #{network} - #{@name}" unless system("docker network disconnect #{network} #{@name}", out: File::NULL)
         | 
| 68 | 
            +
                    end
         | 
| 69 | 
            +
             | 
| 62 70 | 
             
                    puts "-----> Stopping container #{@name} ... "
         | 
| 63 71 | 
             
                    if system("docker stop '#{@name}'", out: File::NULL)
         | 
| 64 72 | 
             
                      puts "done"
         | 
| @@ -0,0 +1,104 @@ | |
| 1 | 
            +
            module SmartMachine
         | 
| 2 | 
            +
              class Grids
         | 
| 3 | 
            +
                class Phpmyadmin < SmartMachine::Base
         | 
| 4 | 
            +
                  def initialize(name:)
         | 
| 5 | 
            +
                    config = SmartMachine.config.grids.phpmyadmin.dig(name.to_sym)
         | 
| 6 | 
            +
                    raise "phpmyadmin config for #{name} not found." unless config
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                    @image = config.dig(:image)
         | 
| 9 | 
            +
                    @command = config.dig(:command)
         | 
| 10 | 
            +
                    @host = config.dig(:host)
         | 
| 11 | 
            +
                    @networks = Array(config.dig(:networks))
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                    @pma_controlhost = config.dig(:pma_controlhost)
         | 
| 14 | 
            +
                    mysql_config = SmartMachine.config.grids.mysql.dig(@pma_controlhost&.to_sym)
         | 
| 15 | 
            +
                    raise "phpmyadmin | mysql config for #{@pma_controlhost} not found." unless mysql_config
         | 
| 16 | 
            +
                    @mysql_config_root_password = mysql_config.dig(:root_password)
         | 
| 17 | 
            +
                    @pma_controlport = mysql_config.dig(:port)
         | 
| 18 | 
            +
                    @pma_controluser = mysql_config.dig(:username)
         | 
| 19 | 
            +
                    @pma_controlpass = mysql_config.dig(:password)
         | 
| 20 | 
            +
                    @pma_pmadb = "phpmyadmin"
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                    @name = name.to_s
         | 
| 23 | 
            +
                    @home_dir = File.expand_path('~')
         | 
| 24 | 
            +
                  end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                  def uper
         | 
| 27 | 
            +
                    raise "Error: Could not create container: #{@name}"  unless system(command.compact.join(' '), out: File::NULL)
         | 
| 28 | 
            +
                    raise "Error: Could not start container: #{@name}"   unless system("docker start #{@name}", out: File::NULL)
         | 
| 29 | 
            +
                    @networks.each do |network|
         | 
| 30 | 
            +
                      raise "Error: Could not connect container: #{network} - #{@name}" unless system("docker network connect #{network} #{@name}", out: File::NULL)
         | 
| 31 | 
            +
                    end
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                    raise "Error: Could not setup database: #{@name}"    unless system(command_db_setup.compact.join(' '), out: File::NULL)
         | 
| 34 | 
            +
                    raise "Error: Could not setup tables: #{@name}"      unless system(command_db_tables_setup.compact.join(' '), out: File::NULL)
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                    puts "Created, Started & Connected container: #{@name}"
         | 
| 37 | 
            +
                  end
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                  def downer
         | 
| 40 | 
            +
                    @networks.each do |network|
         | 
| 41 | 
            +
                      raise "Error: Could not disconnect container: #{network} - #{@name}" unless system("docker network disconnect #{network} #{@name}", out: File::NULL)
         | 
| 42 | 
            +
                    end
         | 
| 43 | 
            +
                    raise "Error: Could not stop container: #{@name}"   unless system("docker stop '#{@name}'", out: File::NULL)
         | 
| 44 | 
            +
                    raise "Error: Could not remove container: #{@name}" unless system("docker rm '#{@name}'", out: File::NULL)
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                    puts "Disconnected, Stopped & Removed container: #{@name}"
         | 
| 47 | 
            +
                  end
         | 
| 48 | 
            +
             | 
| 49 | 
            +
                  private
         | 
| 50 | 
            +
             | 
| 51 | 
            +
                  def command
         | 
| 52 | 
            +
                    [
         | 
| 53 | 
            +
                      'docker create',
         | 
| 54 | 
            +
                      "--name='#{@name}'",
         | 
| 55 | 
            +
                      "--env VIRTUAL_HOST=#{@host}",
         | 
| 56 | 
            +
                      "--env LETSENCRYPT_HOST=#{@host}",
         | 
| 57 | 
            +
                      "--env LETSENCRYPT_EMAIL=#{SmartMachine.config.sysadmin_email}",
         | 
| 58 | 
            +
                      '--env LETSENCRYPT_TEST=false',
         | 
| 59 | 
            +
                      "--env PMA_CONTROLHOST=#{@pma_controlhost}",
         | 
| 60 | 
            +
                      "--env PMA_CONTROLPORT=#{@pma_controlport}",
         | 
| 61 | 
            +
                      "--env PMA_CONTROLUSER=#{@pma_controluser}",
         | 
| 62 | 
            +
                      "--env PMA_CONTROLPASS=#{@pma_controlpass}",
         | 
| 63 | 
            +
                      "--env PMA_PMADB=#{@pma_pmadb}",
         | 
| 64 | 
            +
                      '--env PMA_QUERYHISTORYDB=true',
         | 
| 65 | 
            +
                      '--env HIDE_PHP_VERSION=true',
         | 
| 66 | 
            +
                      '--env PMA_ARBITRARY=1',
         | 
| 67 | 
            +
                      volumes,
         | 
| 68 | 
            +
                      "--restart='always'",
         | 
| 69 | 
            +
                      "--network='#{@networks.shift}'",
         | 
| 70 | 
            +
                      @image,
         | 
| 71 | 
            +
                      @command
         | 
| 72 | 
            +
                    ]
         | 
| 73 | 
            +
                  end
         | 
| 74 | 
            +
             | 
| 75 | 
            +
                  def volumes
         | 
| 76 | 
            +
                    volumes = []
         | 
| 77 | 
            +
             | 
| 78 | 
            +
                    if File.exist?("#{@home_dir}/machine/config/phpmyadmin/#{@name}/config.user.inc.php")
         | 
| 79 | 
            +
                      volumes.push("--volume='#{@home_dir}/smartmachine/config/phpmyadmin/#{@name}/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php'")
         | 
| 80 | 
            +
                    end
         | 
| 81 | 
            +
             | 
| 82 | 
            +
                    volumes.join(" ")
         | 
| 83 | 
            +
                  end
         | 
| 84 | 
            +
             | 
| 85 | 
            +
                  def command_db_setup
         | 
| 86 | 
            +
                    [
         | 
| 87 | 
            +
                      "docker exec -i #{@pma_controlhost}",
         | 
| 88 | 
            +
                      "bash -c \"exec mysql --defaults-extra-file=<(echo $'[client]\npassword='\"#{@mysql_config_root_password}\") -uroot --execute \\\"",
         | 
| 89 | 
            +
                      "CREATE DATABASE IF NOT EXISTS #{@pma_pmadb};",
         | 
| 90 | 
            +
                      "GRANT ALL PRIVILEGES ON #{@pma_pmadb}.* TO #{@pma_controluser}@'%';",
         | 
| 91 | 
            +
                      "\\\"\""
         | 
| 92 | 
            +
                    ]
         | 
| 93 | 
            +
                  end
         | 
| 94 | 
            +
             | 
| 95 | 
            +
                  def command_db_tables_setup
         | 
| 96 | 
            +
                    [
         | 
| 97 | 
            +
                      "docker cp #{@name}:/var/www/html/sql/create_tables.sql - | tar -xO |",
         | 
| 98 | 
            +
                      "docker exec -i #{@pma_controlhost} bash -c",
         | 
| 99 | 
            +
                      "\"exec mysql --defaults-extra-file=<(echo $'[client]\npassword='\"#{@mysql_config_root_password}\") -uroot\""
         | 
| 100 | 
            +
                    ]
         | 
| 101 | 
            +
                  end
         | 
| 102 | 
            +
                end
         | 
| 103 | 
            +
              end
         | 
| 104 | 
            +
            end
         | 
| @@ -1,58 +1,29 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
             ;; custom-set-variables was added by Custom.
         | 
| 3 | 
            -
             ;; If you edit it by hand, you could mess it up, so be careful.
         | 
| 4 | 
            -
             ;; Your init file should contain only one such instance.
         | 
| 5 | 
            -
             ;; If there is more than one, they won't work right.
         | 
| 6 | 
            -
             '(package-selected-packages
         | 
| 7 | 
            -
               '(polymode ruby-electric ruby-electric-mode ruby-mode dockerfile-mode expand-region flycheck zenburn-theme multi-vterm vterm yaml-mode web-mode use-package undo-tree typescript-mode smartparens robe rbenv rainbow-delimiters projectile-rails osx-trash magit logview indent-guide diredfl dired-sidebar dired-narrow dired-git-info diff-hl company clipetty bundler)))
         | 
| 8 | 
            -
            (custom-set-faces
         | 
| 9 | 
            -
             ;; custom-set-faces was added by Custom.
         | 
| 10 | 
            -
             ;; If you edit it by hand, you could mess it up, so be careful.
         | 
| 11 | 
            -
             ;; Your init file should contain only one such instance.
         | 
| 12 | 
            -
             ;; If there is more than one, they won't work right.
         | 
| 13 | 
            -
             '(diff-hl-change ((t (:foreground "#f7ca88" :background "#f7ca88"))))
         | 
| 14 | 
            -
             '(diff-hl-delete ((t (:foreground "#ab4642" :background "#ab4642"))))
         | 
| 15 | 
            -
             '(diff-hl-insert ((t (:foreground "#a1b56c" :background "#a1b56c")))))
         | 
| 1 | 
            +
            ;;; init.el --- Emacs Init: Initial file that emacs loads at startup.
         | 
| 16 2 |  | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
            (add-to-list 'package-archives
         | 
| 20 | 
            -
                         '("melpa" . "http://melpa.org/packages/") t)
         | 
| 3 | 
            +
            ;;; Commentary:
         | 
| 4 | 
            +
            ;; This file includes the basic setup necessary to get started with Emacs.
         | 
| 21 5 |  | 
| 22 | 
            -
             | 
| 23 | 
            -
            ;; Ensure use-package is installed.
         | 
| 24 | 
            -
            (unless (package-installed-p 'use-package)
         | 
| 25 | 
            -
              (package-refresh-contents)
         | 
| 26 | 
            -
              (package-install 'use-package))
         | 
| 27 | 
            -
            ;; Configure and load use-package.
         | 
| 28 | 
            -
            (setq use-package-always-ensure t)
         | 
| 29 | 
            -
            (eval-when-compile
         | 
| 30 | 
            -
              (defvar use-package-verbose t)
         | 
| 31 | 
            -
              (require 'use-package))
         | 
| 6 | 
            +
            ;;; Code:
         | 
| 32 7 |  | 
| 33 | 
            -
            ;; Disable menu bar in  | 
| 8 | 
            +
            ;; Disable menu bar in Emacs.
         | 
| 34 9 | 
             
            (menu-bar-mode -1)
         | 
| 35 10 |  | 
| 36 | 
            -
            ;;  | 
| 11 | 
            +
            ;; Change backup file directory for emacs.
         | 
| 37 12 | 
             
            (setq backup-directory-alist `(("." . ,(concat user-emacs-directory "backups"))))
         | 
| 38 13 |  | 
| 39 | 
            -
            ;;  | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
            (when (string= system-type "darwin")
         | 
| 43 | 
            -
              (setq dired-use-ls-dired t
         | 
| 44 | 
            -
                    insert-directory-program "/usr/local/bin/gls"
         | 
| 45 | 
            -
                    dired-listing-switches "-aBhl --ignore=.DS_Store --ignore=.git --ignore=.bundle --ignore=.byebug_history --group-directories-first"))
         | 
| 14 | 
            +
            ;; This lists the directories first and ignores some files and directories in dired.
         | 
| 15 | 
            +
            (setq dired-use-ls-dired t)
         | 
| 16 | 
            +
            (setq dired-listing-switches "-aBhl --ignore=.git --ignore=.bundle --ignore=.byebug_history --group-directories-first")
         | 
| 46 17 |  | 
| 47 | 
            -
            ;; Hide dired details on startup
         | 
| 18 | 
            +
            ;; Hide dired details on startup.
         | 
| 48 19 | 
             
            (add-hook 'dired-mode-hook
         | 
| 49 20 | 
             
            	  (lambda ()
         | 
| 50 21 | 
             
            	    (dired-hide-details-mode)))
         | 
| 51 22 |  | 
| 52 | 
            -
            ;; Setup initial screen
         | 
| 23 | 
            +
            ;; Setup initial screen.
         | 
| 53 24 | 
             
            (setq initial-buffer-choice (expand-file-name "."))
         | 
| 54 25 |  | 
| 55 | 
            -
            ;; Org mode key bindings
         | 
| 26 | 
            +
            ;; Org mode key bindings.
         | 
| 56 27 | 
             
            (global-set-key (kbd "C-c l") 'org-store-link)
         | 
| 57 28 | 
             
            (global-set-key (kbd "C-c a") 'org-agenda)
         | 
| 58 29 | 
             
            (global-set-key (kbd "C-c c") 'org-capture)
         | 
| @@ -64,7 +35,7 @@ | |
| 64 35 | 
             
            ;; Highlight current line.
         | 
| 65 36 | 
             
            (global-hl-line-mode +1)
         | 
| 66 37 |  | 
| 67 | 
            -
            ;; Revert buffers if they've changed on disk
         | 
| 38 | 
            +
            ;; Revert buffers if they've changed on disk.
         | 
| 68 39 | 
             
            (global-auto-revert-mode 1)
         | 
| 69 40 | 
             
            (setq auto-revert-verbose nil)
         | 
| 70 41 |  | 
| @@ -80,31 +51,31 @@ | |
| 80 51 | 
             
                 (add-to-list 'grep-find-ignored-directories "auto")
         | 
| 81 52 | 
             
                 (add-to-list 'grep-find-ignored-directories "elpa")))
         | 
| 82 53 |  | 
| 83 | 
            -
             | 
| 84 | 
            -
             | 
| 85 | 
            -
             | 
| 86 | 
            -
             | 
| 87 | 
            -
              (zenburn-with-color-variables
         | 
| 88 | 
            -
                (custom-theme-set-faces
         | 
| 89 | 
            -
                 'zenburn
         | 
| 90 | 
            -
                 `(hl-line-face ((t (:background ,zenburn-bg+05 ))))
         | 
| 91 | 
            -
                 `(hl-line ((t (:background ,zenburn-bg+05 ))))
         | 
| 92 | 
            -
                 `(region ((nil (:background ,zenburn-bg+2))))
         | 
| 93 | 
            -
                 )))
         | 
| 54 | 
            +
            ;; Add melpa to package-archives list.
         | 
| 55 | 
            +
            (require 'package)
         | 
| 56 | 
            +
            (add-to-list 'package-archives
         | 
| 57 | 
            +
                         '("melpa" . "http://melpa.org/packages/") t)
         | 
| 94 58 |  | 
| 95 | 
            -
             | 
| 96 | 
            -
             | 
| 59 | 
            +
            ;; use-package
         | 
| 60 | 
            +
            ;; Ensure use-package is installed.
         | 
| 61 | 
            +
            (unless (package-installed-p 'use-package)
         | 
| 62 | 
            +
              (package-refresh-contents)
         | 
| 63 | 
            +
              (package-install 'use-package))
         | 
| 64 | 
            +
            ;; Configure and load use-package.
         | 
| 65 | 
            +
            (setq use-package-always-ensure t)
         | 
| 66 | 
            +
            (eval-when-compile
         | 
| 67 | 
            +
              (defvar use-package-verbose t)
         | 
| 68 | 
            +
              (require 'use-package))
         | 
| 69 | 
            +
             | 
| 70 | 
            +
            (use-package logview)
         | 
| 97 71 |  | 
| 98 | 
            -
            (use-package dired-hacks-utils
         | 
| 99 | 
            -
              :ensure t)
         | 
| 72 | 
            +
            (use-package dired-hacks-utils)
         | 
| 100 73 |  | 
| 101 74 | 
             
            (use-package dired-narrow
         | 
| 102 | 
            -
              :ensure t
         | 
| 103 75 | 
             
              :bind (:map dired-mode-map
         | 
| 104 76 | 
             
            	      ("/" . dired-narrow)))
         | 
| 105 77 |  | 
| 106 78 | 
             
            (use-package dired-subtree
         | 
| 107 | 
            -
              :ensure t
         | 
| 108 79 | 
             
              :after dired
         | 
| 109 80 | 
             
              :bind (:map dired-mode-map
         | 
| 110 81 | 
             
            	      ("TAB" . dired-subtree-toggle)
         | 
| @@ -113,33 +84,21 @@ | |
| 113 84 | 
             
              (setq dired-subtree-use-backgrounds nil))
         | 
| 114 85 |  | 
| 115 86 | 
             
            (use-package dired-git-info
         | 
| 116 | 
            -
              :ensure t
         | 
| 117 87 | 
             
              :bind (:map dired-mode-map
         | 
| 118 88 | 
             
            	      (")" . dired-git-info-mode)))
         | 
| 119 89 |  | 
| 120 | 
            -
             | 
| 121 | 
            -
             | 
| 122 | 
            -
              : | 
| 123 | 
            -
               | 
| 124 | 
            -
              :init
         | 
| 125 | 
            -
              (setq dired-sidebar-use-term-integration t)
         | 
| 126 | 
            -
              (setq dired-sidebar-use-custom-font t))
         | 
| 127 | 
            -
             | 
| 128 | 
            -
            (use-package typescript-mode
         | 
| 129 | 
            -
              :ensure t)
         | 
| 90 | 
            +
            ;; Extra font lock rules for a more colourful dired.
         | 
| 91 | 
            +
            (use-package diredfl
         | 
| 92 | 
            +
              :config
         | 
| 93 | 
            +
              (diredfl-global-mode))
         | 
| 130 94 |  | 
| 131 95 | 
             
            (use-package clipetty
         | 
| 132 | 
            -
              :ensure t
         | 
| 133 96 | 
             
              :bind ("M-w" . clipetty-kill-ring-save))
         | 
| 134 97 |  | 
| 135 | 
            -
            (use-package osx-trash
         | 
| 136 | 
            -
              :config
         | 
| 137 | 
            -
              (when (eq system-type 'darwin)
         | 
| 138 | 
            -
                (osx-trash-setup))
         | 
| 139 | 
            -
              (setq delete-by-moving-to-trash t))
         | 
| 140 | 
            -
             | 
| 141 98 | 
             
            (use-package undo-tree
         | 
| 142 99 | 
             
              :config
         | 
| 100 | 
            +
              ;; Prevent undo tree files from polluting your git repo
         | 
| 101 | 
            +
              (setq undo-tree-history-directory-alist `(("." . ,(concat user-emacs-directory "backups/undotree"))))
         | 
| 143 102 | 
             
              (global-undo-tree-mode))
         | 
| 144 103 |  | 
| 145 104 | 
             
            (use-package indent-guide
         | 
| @@ -156,17 +115,6 @@ | |
| 156 115 | 
             
              (require 'smartparens-config))
         | 
| 157 116 | 
             
            (add-hook 'prog-mode-hook #'smartparens-mode)
         | 
| 158 117 |  | 
| 159 | 
            -
            (use-package ruby-mode
         | 
| 160 | 
            -
              :config
         | 
| 161 | 
            -
              (add-to-list 'auto-mode-alist
         | 
| 162 | 
            -
            	       '("\\.\\(?:cap\\|gemspec\\|irbrc\\|gemrc\\|rake\\|rb\\|ru\\|thor\\)\\'" . ruby-mode))
         | 
| 163 | 
            -
              (add-to-list 'auto-mode-alist
         | 
| 164 | 
            -
            	       '("\\(?:Brewfile\\|Capfile\\|Gemfile\\(?:\\.[a-zA-Z0-9._-]+\\)?\\|[rR]akefile\\)\\'" . ruby-mode)))
         | 
| 165 | 
            -
             | 
| 166 | 
            -
            (use-package ruby-electric
         | 
| 167 | 
            -
              :config
         | 
| 168 | 
            -
              (add-hook 'ruby-mode-hook 'ruby-electric-mode))
         | 
| 169 | 
            -
             | 
| 170 118 | 
             
            (use-package robe
         | 
| 171 119 | 
             
              :config
         | 
| 172 120 | 
             
              (eval-after-load 'company '(push 'company-robe company-backends))
         | 
| @@ -176,33 +124,6 @@ | |
| 176 124 | 
             
              :config
         | 
| 177 125 | 
             
              (add-hook 'after-init-hook 'global-company-mode))
         | 
| 178 126 |  | 
| 179 | 
            -
            (use-package bundler)
         | 
| 180 | 
            -
             | 
| 181 | 
            -
            (use-package rbenv
         | 
| 182 | 
            -
              :config
         | 
| 183 | 
            -
              (global-rbenv-mode))
         | 
| 184 | 
            -
             | 
| 185 | 
            -
            (use-package yaml-mode
         | 
| 186 | 
            -
              :config
         | 
| 187 | 
            -
              (add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode))
         | 
| 188 | 
            -
              (add-hook 'yaml-mode-hook '(lambda () (define-key yaml-mode-map "\C-m" 'newline-and-indent))))
         | 
| 189 | 
            -
             | 
| 190 | 
            -
            (use-package web-mode
         | 
| 191 | 
            -
              :config
         | 
| 192 | 
            -
              (add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
         | 
| 193 | 
            -
              (add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
         | 
| 194 | 
            -
              (add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode))
         | 
| 195 | 
            -
              (add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
         | 
| 196 | 
            -
              (add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
         | 
| 197 | 
            -
              (add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
         | 
| 198 | 
            -
              (add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
         | 
| 199 | 
            -
              (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
         | 
| 200 | 
            -
              (add-to-list 'auto-mode-alist '("\\.js?\\'" . web-mode))
         | 
| 201 | 
            -
              (add-to-list 'auto-mode-alist '("\\.jsx?\\'" . web-mode))
         | 
| 202 | 
            -
              (add-to-list 'auto-mode-alist '("\\.css?\\'" . web-mode))
         | 
| 203 | 
            -
              (add-to-list 'auto-mode-alist '("\\.scss?\\'" . web-mode))
         | 
| 204 | 
            -
              (add-to-list 'auto-mode-alist '("\\.xml?\\'" . web-mode)))
         | 
| 205 | 
            -
             | 
| 206 127 | 
             
            (use-package projectile
         | 
| 207 128 | 
             
              :config
         | 
| 208 129 | 
             
              (projectile-mode +1)
         | 
| @@ -214,12 +135,6 @@ | |
| 214 135 | 
             
              (projectile-rails-global-mode)
         | 
| 215 136 | 
             
              (define-key projectile-rails-mode-map (kbd "C-c r") 'projectile-rails-command-map))
         | 
| 216 137 |  | 
| 217 | 
            -
            ;; Extra font lock rules for a more colourful dired.
         | 
| 218 | 
            -
            (use-package diredfl
         | 
| 219 | 
            -
              :ensure t
         | 
| 220 | 
            -
              :config
         | 
| 221 | 
            -
              (diredfl-global-mode))
         | 
| 222 | 
            -
             | 
| 223 138 | 
             
            (use-package diff-hl
         | 
| 224 139 | 
             
              :custom-face
         | 
| 225 140 | 
             
              ;; Change colors for insert, delete and change indicators in diff-hl
         | 
| @@ -244,8 +159,6 @@ | |
| 244 159 |  | 
| 245 160 | 
             
            ;; A Git porcelain inside Emacs.
         | 
| 246 161 | 
             
            (use-package magit
         | 
| 247 | 
            -
              :ensure t
         | 
| 248 | 
            -
             | 
| 249 162 | 
             
              :commands (magit-add-section-hook magit-section-initial-visibility-alist)
         | 
| 250 163 |  | 
| 251 164 | 
             
              :init
         | 
| @@ -261,36 +174,53 @@ | |
| 261 174 | 
             
              (magit-add-section-hook 'magit-status-sections-hook 'magit-insert-tags nil t)
         | 
| 262 175 | 
             
              (add-to-list 'magit-section-initial-visibility-alist '(tags . hide)))
         | 
| 263 176 |  | 
| 264 | 
            -
            ;; Emacs-libvterm (vterm) is fully-fledged terminal emulator inside GNU Emacs based on libvterm, a C library.
         | 
| 265 | 
            -
            (use-package vterm
         | 
| 266 | 
            -
              :ensure t
         | 
| 267 | 
            -
              :config
         | 
| 268 | 
            -
              (define-key vterm-mode-map (kbd "C-q") #'vterm-send-next-key)
         | 
| 269 | 
            -
              :custom
         | 
| 270 | 
            -
              (vterm-always-compile-module t))
         | 
| 271 | 
            -
            ;; Managing multiple vterm buffers in Emacs.
         | 
| 272 | 
            -
            (use-package multi-vterm
         | 
| 273 | 
            -
              :ensure t)
         | 
| 274 | 
            -
             | 
| 275 177 | 
             
            ;; Flycheck is a modern on-the-fly syntax checking extension for GNU Emacs.
         | 
| 276 178 | 
             
            (use-package flycheck
         | 
| 277 | 
            -
              :ensure t
         | 
| 278 179 | 
             
              :init
         | 
| 279 180 | 
             
              (global-flycheck-mode))
         | 
| 280 181 |  | 
| 281 182 | 
             
            ;; Expand region increases the selected region by semantic units. Just keep pressing the key until it selects what you want.
         | 
| 282 183 | 
             
            (use-package expand-region
         | 
| 283 | 
            -
              :ensure t
         | 
| 284 184 | 
             
              :bind
         | 
| 285 185 | 
             
              ("C-=" . er/expand-region))
         | 
| 286 186 |  | 
| 287 | 
            -
             | 
| 288 | 
            -
             | 
| 187 | 
            +
            ;; ruby-mode - comes included in latest emacs.
         | 
| 188 | 
            +
            (add-to-list 'auto-mode-alist
         | 
| 189 | 
            +
            	     '("\\.\\(?:cap\\|gemspec\\|irbrc\\|gemrc\\|rake\\|rb\\|ru\\|thor\\|god\\)\\'" . ruby-mode))
         | 
| 190 | 
            +
            (add-to-list 'auto-mode-alist
         | 
| 191 | 
            +
            	     '("\\(?:Brewfile\\|Capfile\\|Gemfile\\(?:\\.[a-zA-Z0-9._-]+\\)?\\|[rR]akefile\\)\\'" . ruby-mode))
         | 
| 192 | 
            +
            (use-package ruby-electric
         | 
| 193 | 
            +
              :config
         | 
| 194 | 
            +
              (eval-after-load "ruby-mode"
         | 
| 195 | 
            +
                '(add-hook 'ruby-mode-hook 'ruby-electric-mode)))
         | 
| 196 | 
            +
             | 
| 197 | 
            +
            (use-package yaml-mode
         | 
| 198 | 
            +
              :config
         | 
| 199 | 
            +
              (add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode))
         | 
| 200 | 
            +
              (add-hook 'yaml-mode-hook '(lambda () (define-key yaml-mode-map "\C-m" 'newline-and-indent))))
         | 
| 201 | 
            +
             | 
| 202 | 
            +
            (use-package typescript-mode)
         | 
| 203 | 
            +
             | 
| 204 | 
            +
            (use-package web-mode
         | 
| 205 | 
            +
              :config
         | 
| 206 | 
            +
              (add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
         | 
| 207 | 
            +
              (add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
         | 
| 208 | 
            +
              (add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode))
         | 
| 209 | 
            +
              (add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
         | 
| 210 | 
            +
              (add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
         | 
| 211 | 
            +
              (add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
         | 
| 212 | 
            +
              (add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
         | 
| 213 | 
            +
              (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
         | 
| 214 | 
            +
              (add-to-list 'auto-mode-alist '("\\.js?\\'" . web-mode))
         | 
| 215 | 
            +
              (add-to-list 'auto-mode-alist '("\\.jsx?\\'" . web-mode))
         | 
| 216 | 
            +
              (add-to-list 'auto-mode-alist '("\\.css?\\'" . web-mode))
         | 
| 217 | 
            +
              (add-to-list 'auto-mode-alist '("\\.scss?\\'" . web-mode))
         | 
| 218 | 
            +
              (add-to-list 'auto-mode-alist '("\\.xml?\\'" . web-mode)))
         | 
| 219 | 
            +
             | 
| 220 | 
            +
            (use-package dockerfile-mode)
         | 
| 289 221 |  | 
| 290 222 | 
             
            ;; Polymode is a framework for multiple major modes (MMM) inside a single Emacs buffer.
         | 
| 291 223 | 
             
            (use-package polymode
         | 
| 292 | 
            -
              :ensure t
         | 
| 293 | 
            -
             | 
| 294 224 | 
             
              :config
         | 
| 295 225 | 
             
              (with-eval-after-load "polymode"
         | 
| 296 226 | 
             
                (eieio-oset-default pm-inner-chunkmode :adjust-face -2))
         | 
| @@ -0,0 +1,37 @@ | |
| 1 | 
            +
            module SmartMachine
         | 
| 2 | 
            +
              class Machines
         | 
| 3 | 
            +
                class Network < SmartMachine::Base
         | 
| 4 | 
            +
                  def initialize(name:)
         | 
| 5 | 
            +
                    config = SmartMachine.config.network.dig(name.to_sym)
         | 
| 6 | 
            +
                    raise "network config for #{name} not found." unless config
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                    @driver = config.dig(:driver)
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                    @name = name.to_s
         | 
| 11 | 
            +
                    @home_dir = File.expand_path('~')
         | 
| 12 | 
            +
                  end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                  def uper
         | 
| 15 | 
            +
                    raise "Error: Could not create network: #{@name}" unless system(command.compact.join(' '), out: File::NULL)
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                    puts "Created network: #{@name}"
         | 
| 18 | 
            +
                  end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                  def downer
         | 
| 21 | 
            +
                    raise "Error: Could not remove network: #{@name}" unless system("docker network rm '#{@name}'", out: File::NULL)
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                    puts "Removed network: #{@name}"
         | 
| 24 | 
            +
                  end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                  private
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                  def command
         | 
| 29 | 
            +
                    [
         | 
| 30 | 
            +
                      'docker network create',
         | 
| 31 | 
            +
                      "--driver=#{@driver}",
         | 
| 32 | 
            +
                      @name
         | 
| 33 | 
            +
                    ]
         | 
| 34 | 
            +
                  end
         | 
| 35 | 
            +
                end
         | 
| 36 | 
            +
              end
         | 
| 37 | 
            +
            end
         | 
    
        data/lib/smart_machine/syncer.rb
    CHANGED
    
    | @@ -103,12 +103,16 @@ module SmartMachine | |
| 103 103 | 
             
                    'config',
         | 
| 104 104 | 
             
                    'config/mysql',
         | 
| 105 105 | 
             
                    'config/mysql/schedule.rb',
         | 
| 106 | 
            +
                    'config/phpmyadmin',
         | 
| 107 | 
            +
                    'config/phpmyadmin/***',
         | 
| 106 108 | 
             
                    'config/credentials.yml.enc',
         | 
| 107 109 | 
             
                    'config/environment.rb',
         | 
| 108 110 | 
             
                    'config/elasticsearch.yml',
         | 
| 109 111 | 
             
                    'config/minio.yml',
         | 
| 110 112 | 
             
                    'config/mysql.yml',
         | 
| 113 | 
            +
                    'config/network.yml',
         | 
| 111 114 | 
             
                    'config/nextcloud.yml',
         | 
| 115 | 
            +
                    'config/phpmyadmin.yml',
         | 
| 112 116 | 
             
                    'config/prereceiver.yml',
         | 
| 113 117 | 
             
                    'config/redis.yml',
         | 
| 114 118 | 
             
                    'config/terminal.yml',
         | 
| @@ -1,5 +1,6 @@ | |
| 1 1 | 
             
            mysqlone:
         | 
| 2 2 | 
             
              port: 3306
         | 
| 3 | 
            +
              networks: networkone
         | 
| 3 4 | 
             
              root_password: <%= SmartMachine.credentials.dig(:mysqlone, :root_password) %>
         | 
| 4 5 | 
             
              username: <%= SmartMachine.credentials.dig(:mysqlone, :username) %>
         | 
| 5 6 | 
             
              password: <%= SmartMachine.credentials.dig(:mysqlone, :password) %>
         | 
| @@ -7,6 +8,7 @@ mysqlone: | |
| 7 8 |  | 
| 8 9 | 
             
            # mysqltwo:
         | 
| 9 10 | 
             
            #   port: 3307
         | 
| 11 | 
            +
            #   networks: networkone
         | 
| 10 12 | 
             
            #   root_password: <%= SmartMachine.credentials.dig(:mysqltwo, :root_password) %>
         | 
| 11 13 | 
             
            #   username: <%= SmartMachine.credentials.dig(:mysqltwo, :username) %>
         | 
| 12 14 | 
             
            #   password: <%= SmartMachine.credentials.dig(:mysqltwo, :password) %>
         | 
| @@ -0,0 +1,11 @@ | |
| 1 | 
            +
            phpmyadminone:
         | 
| 2 | 
            +
              image: "phpmyadmin:5.2.1"
         | 
| 3 | 
            +
              host: "yourphpmyadminone.yourdomain.com"
         | 
| 4 | 
            +
              networks: ["networkone", "nginx-network"]
         | 
| 5 | 
            +
              pma_controlhost: mysqlone
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            # phpmyadmintwo:
         | 
| 8 | 
            +
            #   image: "phpmyadmin:5.2.1"
         | 
| 9 | 
            +
            #   host: "yourphpmyadmintwo.yourdomain.com"
         | 
| 10 | 
            +
            #   networks: ["networkone", "nginx-network"]
         | 
| 11 | 
            +
            #   pma_controlhost: mysqlone
         | 
    
        data/lib/smart_machine.rb
    CHANGED
    
    | @@ -27,12 +27,15 @@ require 'smart_machine/grids/minio' | |
| 27 27 | 
             
            require 'smart_machine/grids/mysql'
         | 
| 28 28 | 
             
            require 'smart_machine/grids/nextcloud'
         | 
| 29 29 | 
             
            require 'smart_machine/grids/nginx'
         | 
| 30 | 
            +
            require 'smart_machine/grids/phpmyadmin'
         | 
| 30 31 | 
             
            require 'smart_machine/grids/prereceiver'
         | 
| 31 32 | 
             
            require 'smart_machine/grids/redis'
         | 
| 32 33 | 
             
            # require 'smart_machine/grids/solr'
         | 
| 33 34 | 
             
            require 'smart_machine/grids/terminal/wetty'
         | 
| 34 35 | 
             
            require 'smart_machine/grids/terminal'
         | 
| 35 36 |  | 
| 37 | 
            +
            require 'smart_machine/machines/network'
         | 
| 38 | 
            +
             | 
| 36 39 | 
             
            module SmartMachine
         | 
| 37 40 | 
             
              class Error < StandardError; end
         | 
| 38 41 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: smartmachine
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 1.2.0.dev
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - plainsource
         | 
| 8 | 
            -
            autorequire: | 
| 8 | 
            +
            autorequire:
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2023- | 
| 11 | 
            +
            date: 2023-10-23 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: net-ssh
         | 
| @@ -185,11 +185,14 @@ files: | |
| 185 185 | 
             
            - lib/smart_machine/commands/grid_commands/mysql.rb
         | 
| 186 186 | 
             
            - lib/smart_machine/commands/grid_commands/nextcloud.rb
         | 
| 187 187 | 
             
            - lib/smart_machine/commands/grid_commands/nginx.rb
         | 
| 188 | 
            +
            - lib/smart_machine/commands/grid_commands/phpmyadmin.rb
         | 
| 188 189 | 
             
            - lib/smart_machine/commands/grid_commands/prereceiver.rb
         | 
| 189 190 | 
             
            - lib/smart_machine/commands/grid_commands/redis.rb
         | 
| 190 191 | 
             
            - lib/smart_machine/commands/grid_commands/sub_thor.rb
         | 
| 191 192 | 
             
            - lib/smart_machine/commands/grid_commands/terminal.rb
         | 
| 192 193 | 
             
            - lib/smart_machine/commands/machine.rb
         | 
| 194 | 
            +
            - lib/smart_machine/commands/machine_commands/network.rb
         | 
| 195 | 
            +
            - lib/smart_machine/commands/machine_commands/sub_thor.rb
         | 
| 193 196 | 
             
            - lib/smart_machine/commands/syncer.rb
         | 
| 194 197 | 
             
            - lib/smart_machine/commands/utilities.rb
         | 
| 195 198 | 
             
            - lib/smart_machine/configuration.rb
         | 
| @@ -202,6 +205,7 @@ files: | |
| 202 205 | 
             
            - lib/smart_machine/grids/mysql/docker-entrypoint-initdb.d/.keep
         | 
| 203 206 | 
             
            - lib/smart_machine/grids/nextcloud.rb
         | 
| 204 207 | 
             
            - lib/smart_machine/grids/nginx.rb
         | 
| 208 | 
            +
            - lib/smart_machine/grids/phpmyadmin.rb
         | 
| 205 209 | 
             
            - lib/smart_machine/grids/prereceiver.rb
         | 
| 206 210 | 
             
            - lib/smart_machine/grids/prereceiver/Dockerfile
         | 
| 207 211 | 
             
            - lib/smart_machine/grids/prereceiver/pre-receive
         | 
| @@ -378,6 +382,7 @@ files: | |
| 378 382 | 
             
            - lib/smart_machine/grids/terminal/wetty.rb
         | 
| 379 383 | 
             
            - lib/smart_machine/logger.rb
         | 
| 380 384 | 
             
            - lib/smart_machine/machine.rb
         | 
| 385 | 
            +
            - lib/smart_machine/machines/network.rb
         | 
| 381 386 | 
             
            - lib/smart_machine/scp.rb
         | 
| 382 387 | 
             
            - lib/smart_machine/ssh.rb
         | 
| 383 388 | 
             
            - lib/smart_machine/syncer.rb
         | 
| @@ -389,7 +394,10 @@ files: | |
| 389 394 | 
             
            - lib/smart_machine/templates/dotsmartmachine/config/minio.yml
         | 
| 390 395 | 
             
            - lib/smart_machine/templates/dotsmartmachine/config/mysql.yml
         | 
| 391 396 | 
             
            - lib/smart_machine/templates/dotsmartmachine/config/mysql/schedule.rb
         | 
| 397 | 
            +
            - lib/smart_machine/templates/dotsmartmachine/config/network.yml
         | 
| 392 398 | 
             
            - lib/smart_machine/templates/dotsmartmachine/config/nextcloud.yml
         | 
| 399 | 
            +
            - lib/smart_machine/templates/dotsmartmachine/config/phpmyadmin.yml
         | 
| 400 | 
            +
            - lib/smart_machine/templates/dotsmartmachine/config/phpmyadmin/phpmyadminone/config.user.inc.php
         | 
| 393 401 | 
             
            - lib/smart_machine/templates/dotsmartmachine/config/prereceiver.yml
         | 
| 394 402 | 
             
            - lib/smart_machine/templates/dotsmartmachine/config/redis.yml
         | 
| 395 403 | 
             
            - lib/smart_machine/templates/dotsmartmachine/config/terminal.yml
         | 
| @@ -409,9 +417,9 @@ licenses: | |
| 409 417 | 
             
            metadata:
         | 
| 410 418 | 
             
              homepage_uri: https://github.com/plainsource/smartmachine
         | 
| 411 419 | 
             
              bug_tracker_uri: https://github.com/plainsource/smartmachine/issues
         | 
| 412 | 
            -
              changelog_uri: https://github.com/plainsource/smartmachine/releases/tag/v1. | 
| 413 | 
            -
              source_code_uri: https://github.com/plainsource/smartmachine/tree/v1. | 
| 414 | 
            -
            post_install_message: | 
| 420 | 
            +
              changelog_uri: https://github.com/plainsource/smartmachine/releases/tag/v1.2.0.dev
         | 
| 421 | 
            +
              source_code_uri: https://github.com/plainsource/smartmachine/tree/v1.2.0.dev
         | 
| 422 | 
            +
            post_install_message:
         | 
| 415 423 | 
             
            rdoc_options: []
         | 
| 416 424 | 
             
            require_paths:
         | 
| 417 425 | 
             
            - lib
         | 
| @@ -427,7 +435,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 427 435 | 
             
                  version: 1.8.11
         | 
| 428 436 | 
             
            requirements: []
         | 
| 429 437 | 
             
            rubygems_version: 3.1.6
         | 
| 430 | 
            -
            signing_key: | 
| 438 | 
            +
            signing_key:
         | 
| 431 439 | 
             
            specification_version: 4
         | 
| 432 440 | 
             
            summary: Full-stack deployment framework for Rails.
         | 
| 433 441 | 
             
            test_files: []
         |