vagrant-ec-sandbox 0.1.0.Preview
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 +7 -0
- data/lib/vagrant-ec-sandbox/action/base.rb +53 -0
- data/lib/vagrant-ec-sandbox/action/check_dir.rb +41 -0
- data/lib/vagrant-ec-sandbox/action/check_file.rb +41 -0
- data/lib/vagrant-ec-sandbox/action/code/install.rb +0 -0
- data/lib/vagrant-ec-sandbox/action/code/prepare_dist.rb +37 -0
- data/lib/vagrant-ec-sandbox/action/code/remove.rb +0 -0
- data/lib/vagrant-ec-sandbox/action/code.rb +15 -0
- data/lib/vagrant-ec-sandbox/action/dist/check_artifact.rb +26 -0
- data/lib/vagrant-ec-sandbox/action/dist/check_wildfly_installer.rb +28 -0
- data/lib/vagrant-ec-sandbox/action/dist/clear_contents.rb +34 -0
- data/lib/vagrant-ec-sandbox/action/dist/config_ec.rb +92 -0
- data/lib/vagrant-ec-sandbox/action/dist/deploy_ecapp.rb +44 -0
- data/lib/vagrant-ec-sandbox/action/dist/get_vbuild.rb +39 -0
- data/lib/vagrant-ec-sandbox/action/dist/get_vnexus.rb +65 -0
- data/lib/vagrant-ec-sandbox/action/dist/install_wildfly.rb +40 -0
- data/lib/vagrant-ec-sandbox/action/dist/make_contents.rb +36 -0
- data/lib/vagrant-ec-sandbox/action/dist.rb +44 -0
- data/lib/vagrant-ec-sandbox/action/init/env_config_confirm.rb +18 -0
- data/lib/vagrant-ec-sandbox/action/init/init_dir.rb +31 -0
- data/lib/vagrant-ec-sandbox/action/init/init_vagrant.rb +67 -0
- data/lib/vagrant-ec-sandbox/action/init.rb +11 -0
- data/lib/vagrant-ec-sandbox/action/select_db.rb +51 -0
- data/lib/vagrant-ec-sandbox/action/up_vagrant.rb +23 -0
- data/lib/vagrant-ec-sandbox/action/use_app_server.rb +27 -0
- data/lib/vagrant-ec-sandbox/action/wildfly/get_isinstalled.rb +50 -0
- data/lib/vagrant-ec-sandbox/action/wildfly/redirect_dirs.rb +56 -0
- data/lib/vagrant-ec-sandbox/action/wildfly/reload.rb +45 -0
- data/lib/vagrant-ec-sandbox/action/wildfly/reload_admin.rb +38 -0
- data/lib/vagrant-ec-sandbox/action/wildfly/remove.rb +32 -0
- data/lib/vagrant-ec-sandbox/action/wildfly/start.rb +42 -0
- data/lib/vagrant-ec-sandbox/action/wildfly/start_admin.rb +36 -0
- data/lib/vagrant-ec-sandbox/action/wildfly/status.rb +36 -0
- data/lib/vagrant-ec-sandbox/action/wildfly/stop.rb +42 -0
- data/lib/vagrant-ec-sandbox/action/wildfly/switch_db.rb +48 -0
- data/lib/vagrant-ec-sandbox/action/wildfly.rb +79 -0
- data/lib/vagrant-ec-sandbox/action.rb +129 -0
- data/lib/vagrant-ec-sandbox/command/as/config_db.rb +34 -0
- data/lib/vagrant-ec-sandbox/command/as/install.rb +34 -0
- data/lib/vagrant-ec-sandbox/command/as/restart.rb +33 -0
- data/lib/vagrant-ec-sandbox/command/as/show_status.rb +32 -0
- data/lib/vagrant-ec-sandbox/command/as/start.rb +33 -0
- data/lib/vagrant-ec-sandbox/command/as/stop.rb +32 -0
- data/lib/vagrant-ec-sandbox/command/as/test.rb +32 -0
- data/lib/vagrant-ec-sandbox/command/base.rb +52 -0
- data/lib/vagrant-ec-sandbox/command/init.rb +29 -0
- data/lib/vagrant-ec-sandbox/command/root.rb +101 -0
- data/lib/vagrant-ec-sandbox/communicator_extender.rb +45 -0
- data/lib/vagrant-ec-sandbox/config/sandbox_config.rb +235 -0
- data/lib/vagrant-ec-sandbox/db_selector/db_info.rb +8 -0
- data/lib/vagrant-ec-sandbox/db_selector/db_selector.rb +20 -0
- data/lib/vagrant-ec-sandbox/db_selector/direct_selector.rb +30 -0
- data/lib/vagrant-ec-sandbox/db_selector/direct_selector_config.rb +37 -0
- data/lib/vagrant-ec-sandbox/db_selector/manual_input_selector.rb +32 -0
- data/lib/vagrant-ec-sandbox/db_selector/oracle_db_info.rb +19 -0
- data/lib/vagrant-ec-sandbox/db_selector/selector_config.rb +22 -0
- data/lib/vagrant-ec-sandbox/dir_structure.rb +306 -0
- data/lib/vagrant-ec-sandbox/errors.rb +33 -0
- data/lib/vagrant-ec-sandbox/helpers.rb +11 -0
- data/lib/vagrant-ec-sandbox/plugin.rb +29 -0
- data/lib/vagrant-ec-sandbox/resource/hg_clone_provider.rb +46 -0
- data/lib/vagrant-ec-sandbox/resource/hg_clone_provider_config.rb +29 -0
- data/lib/vagrant-ec-sandbox/resource/local_provider.rb +19 -0
- data/lib/vagrant-ec-sandbox/resource/local_provider_config.rb +20 -0
- data/lib/vagrant-ec-sandbox/resource/maven_provider.rb +51 -0
- data/lib/vagrant-ec-sandbox/resource/maven_provider_config.rb +20 -0
- data/lib/vagrant-ec-sandbox/resource/provider_config.rb +10 -0
- data/lib/vagrant-ec-sandbox/resource/resource_provider.rb +20 -0
- data/lib/vagrant-ec-sandbox/server/app_server/as.rb +18 -0
- data/lib/vagrant-ec-sandbox/server/app_server/as_config.rb +38 -0
- data/lib/vagrant-ec-sandbox/server/server.rb +18 -0
- data/lib/vagrant-ec-sandbox/session.rb +146 -0
- data/lib/vagrant-ec-sandbox/util/host/dir_util.rb +39 -0
- data/lib/vagrant-ec-sandbox/util/host/file_util.rb +67 -0
- data/lib/vagrant-ec-sandbox/util/host/hg_clone.rb +32 -0
- data/lib/vagrant-ec-sandbox/util/host/mvn.rb +54 -0
- data/lib/vagrant-ec-sandbox/util/name.rb +22 -0
- data/lib/vagrant-ec-sandbox/util/output_buffer.rb +58 -0
- data/lib/vagrant-ec-sandbox/util/sandbox/get_user_processes.rb +85 -0
- data/lib/vagrant-ec-sandbox/util/sandbox/system_command.rb +91 -0
- data/lib/vagrant-ec-sandbox/util/sandbox/wildfly/add-user.rb +48 -0
- data/lib/vagrant-ec-sandbox/util/sandbox/wildfly/deploy.rb +34 -0
- data/lib/vagrant-ec-sandbox/util/sandbox/wildfly/response.rb +32 -0
- data/lib/vagrant-ec-sandbox/util/sandbox/wildfly/run_cli.rb +86 -0
- data/lib/vagrant-ec-sandbox/version.rb +5 -0
- data/lib/vagrant-ec-sandbox.rb +113 -0
- data/templates/action/dist/install_wildfly.sh.erb +23 -0
- data/templates/action/hello.sh.erb +1 -0
- data/templates/action/init/Vagrantfile.erb +91 -0
- data/templates/action/init/provision.sh.erb +71 -0
- data/templates/action/init/resources/settings.xml.erb +118 -0
- data/templates/action/wildfly/config_ec.sh.erb +5 -0
- data/templates/action/wildfly/deloy.cli.erb +0 -0
- data/templates/action/wildfly/open_interface.cli.erb +3 -0
- data/templates/action/wildfly/redirect_log.cli.erb +3 -0
- data/templates/action/wildfly/switch_db.cli.erb +43 -0
- data/templates/locales/en.yml +35 -0
- metadata +168 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
require "log4r"
|
2
|
+
require "vagrant/plugin/manager"
|
3
|
+
require "vagrant/util/platform"
|
4
|
+
require_relative "../base"
|
5
|
+
require_relative "../../dir_structure"
|
6
|
+
require_relative "../../util/host/file_util"
|
7
|
+
require_relative "../check_file"
|
8
|
+
require_relative "../../errors"
|
9
|
+
|
10
|
+
|
11
|
+
module VagrantPlugins
|
12
|
+
module ECSandbox
|
13
|
+
module Action
|
14
|
+
module Init
|
15
|
+
class InitDir < Base
|
16
|
+
def initialize(app, env)
|
17
|
+
@app = app
|
18
|
+
@logger = Init.logger("init_dir")
|
19
|
+
end
|
20
|
+
|
21
|
+
def call(env)
|
22
|
+
host_dir = get_session(env).dir_structures[:host]
|
23
|
+
host_dir.make_all
|
24
|
+
env[:ui].info(I18n.t("ec_sandbox.action.init.dir_created"), prefix: false)
|
25
|
+
@app.call(env)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require "log4r"
|
2
|
+
require "vagrant/plugin/manager"
|
3
|
+
require "vagrant/util/platform"
|
4
|
+
require_relative "../base"
|
5
|
+
require_relative "../../dir_structure"
|
6
|
+
require_relative "../../util/host/file_util"
|
7
|
+
require_relative "../check_file"
|
8
|
+
require_relative "../../errors"
|
9
|
+
|
10
|
+
|
11
|
+
module VagrantPlugins
|
12
|
+
module ECSandbox
|
13
|
+
module Action
|
14
|
+
module Init
|
15
|
+
class InitVagrant < Base
|
16
|
+
def initialize(app, env)
|
17
|
+
@app = app
|
18
|
+
@logger = Init.logger("init_vagrant")
|
19
|
+
end
|
20
|
+
|
21
|
+
def call(env)
|
22
|
+
template = "templates/action/init/"
|
23
|
+
session = get_session(env)
|
24
|
+
host_dir = session.dir_structures[:host]
|
25
|
+
box = nil
|
26
|
+
memory = nil
|
27
|
+
cpus = nil
|
28
|
+
|
29
|
+
if host_dir.is_sandboxed_dev
|
30
|
+
env[:ui].info(I18n.t("ec_sandbox.action.init.in_dev"), prefix: false)
|
31
|
+
box = "ubuntu/trusty32"
|
32
|
+
memory = "2048"
|
33
|
+
cpus = "1"
|
34
|
+
else
|
35
|
+
box = "ubuntu/trusty64"
|
36
|
+
memory = "3072"
|
37
|
+
cpus = "4"
|
38
|
+
end
|
39
|
+
|
40
|
+
begin
|
41
|
+
template_path = ::VagrantPlugins::ECSandbox.source_root.join(template + "Vagrantfile")
|
42
|
+
contents = Vagrant::Util::TemplateRenderer.render(template_path,
|
43
|
+
box: box, memory: memory, cpus: cpus, session: session)
|
44
|
+
VagrantPlugins::ECSandbox::Util::Host::FileUtil.create(host_dir.vagrantfile, contents,
|
45
|
+
make_dir: true, delete_existing: true)
|
46
|
+
|
47
|
+
template_path = ::VagrantPlugins::ECSandbox.source_root.join(template + "provision.sh")
|
48
|
+
contents = Vagrant::Util::TemplateRenderer.render(template_path, session: session)
|
49
|
+
VagrantPlugins::ECSandbox::Util::Host::FileUtil.create(host_dir.provision_script, contents,
|
50
|
+
make_dir: true, delete_existing: true)
|
51
|
+
|
52
|
+
template_path = ::VagrantPlugins::ECSandbox.source_root.join(template + "resources/settings.xml")
|
53
|
+
contents = Vagrant::Util::TemplateRenderer.render(template_path, session: session)
|
54
|
+
VagrantPlugins::ECSandbox::Util::Host::FileUtil.create(host_dir.mvn_settings, contents,
|
55
|
+
make_dir: true, delete_existing: true)
|
56
|
+
rescue Errno::EACCES
|
57
|
+
raise Vagrant::Errors::VagrantfileWriteError
|
58
|
+
end
|
59
|
+
|
60
|
+
env[:ui].success(I18n.t("ec_sandbox.action.init.success", path: host_dir.vagrantfile), prefix: false)
|
61
|
+
@app.call(env)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require "vagrant/plugin/state_file"
|
2
|
+
require_relative "../communicator_extender"
|
3
|
+
require_relative "../dir_structure"
|
4
|
+
require_relative "base"
|
5
|
+
|
6
|
+
module VagrantPlugins
|
7
|
+
module ECSandbox
|
8
|
+
module Action
|
9
|
+
class SelectDb < Base
|
10
|
+
def initialize(app, env)
|
11
|
+
@app = app
|
12
|
+
@logger = Dist.logger("select_db")
|
13
|
+
end
|
14
|
+
|
15
|
+
def call(env)
|
16
|
+
use_default = env[:use_default_db_selector] || false
|
17
|
+
session = get_session(env)
|
18
|
+
ui = env[:ui]
|
19
|
+
result = nil
|
20
|
+
|
21
|
+
if use_default
|
22
|
+
if session.config.default_db_selector_id
|
23
|
+
db_selector = session.db_selectors.get(session.config.default_db_selector_id)
|
24
|
+
result = db_selector.select(env)
|
25
|
+
raise "no db selected" unless result
|
26
|
+
else
|
27
|
+
ui.info("No default db-selector specified, fallback to manual select.")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
unless result
|
32
|
+
selections = {}
|
33
|
+
session.db_selectors.keys.each do |id|
|
34
|
+
selector = session.db_selectors.get(id)
|
35
|
+
source_name = "[#{selector.class.source || '(no source name)'}] "
|
36
|
+
source_name << selector.name if selector.name
|
37
|
+
selections[(selections.size + 1).to_s] = {text: source_name, id: id}
|
38
|
+
end
|
39
|
+
|
40
|
+
s = choose(env, 'Available data sources', 'Select one database source from above: ', selections)
|
41
|
+
selector = session.db_selectors.get(s)
|
42
|
+
result = selector.select(env)
|
43
|
+
end
|
44
|
+
|
45
|
+
env[:selected_db_info] = result
|
46
|
+
@app.call(env)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "vagrant/plugin/state_file"
|
2
|
+
require_relative "../communicator_extender"
|
3
|
+
require_relative "../dir_structure"
|
4
|
+
require_relative "base"
|
5
|
+
|
6
|
+
module VagrantPlugins
|
7
|
+
module ECSandbox
|
8
|
+
module Action
|
9
|
+
class UpVagrant < Base
|
10
|
+
def initialize(app, env)
|
11
|
+
@app = app
|
12
|
+
@logger = Dist.logger("up_vagrant")
|
13
|
+
end
|
14
|
+
|
15
|
+
def call(env)
|
16
|
+
puts env[:machine].state
|
17
|
+
|
18
|
+
@app.call(env)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "vagrant/plugin/state_file"
|
2
|
+
require_relative "../communicator_extender"
|
3
|
+
require_relative "../dir_structure"
|
4
|
+
require_relative "base"
|
5
|
+
|
6
|
+
module VagrantPlugins
|
7
|
+
module ECSandbox
|
8
|
+
module Action
|
9
|
+
class UseAppServer < Base
|
10
|
+
def initialize(app, env)
|
11
|
+
@app = app
|
12
|
+
@logger = Dist.logger("use_app_server")
|
13
|
+
end
|
14
|
+
|
15
|
+
def call(env)
|
16
|
+
session = env[:sandbox_session]
|
17
|
+
(session.server_ids[:app_server] || []).each do |id|
|
18
|
+
env[:server_id] = id
|
19
|
+
end
|
20
|
+
|
21
|
+
raise "cannot find application server" unless env[:server_id]
|
22
|
+
@app.call(env)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require "log4r"
|
2
|
+
require "vagrant/plugin/manager"
|
3
|
+
require "vagrant/util/platform"
|
4
|
+
require_relative "../../dir_structure"
|
5
|
+
require_relative "../base"
|
6
|
+
require_relative "../wildfly"
|
7
|
+
|
8
|
+
|
9
|
+
module VagrantPlugins
|
10
|
+
module ECSandbox
|
11
|
+
module Action
|
12
|
+
module Wildfly
|
13
|
+
# This middleware checks that the wildfly is created, the
|
14
|
+
# result is placed in `env[:result]` so that it can be used
|
15
|
+
# with the {Call} class.
|
16
|
+
class GetIsInstalled < Base
|
17
|
+
def initialize(app, env)
|
18
|
+
@app = app
|
19
|
+
@logger = Wildfly.logger("check_installed")
|
20
|
+
end
|
21
|
+
|
22
|
+
def call(env)
|
23
|
+
session = get_session(env)
|
24
|
+
command = "if [ -d #{Wildfly.wildfly_home_path(session)} ]; then echo Y; else echo N; fi;"
|
25
|
+
installed = nil
|
26
|
+
|
27
|
+
env[:machine].communicate.execute(command) do |type, data|
|
28
|
+
data = data.chop
|
29
|
+
if data == "Y"
|
30
|
+
installed = true
|
31
|
+
elsif data == "N"
|
32
|
+
installed = false
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
env[:result] = installed || false
|
37
|
+
|
38
|
+
if installed
|
39
|
+
env[:ui].output(I18n.t("ec_sandbox.action.wildfly.installed"))
|
40
|
+
else
|
41
|
+
env[:ui].output(I18n.t("ec_sandbox.action.wildfly.not_installed"))
|
42
|
+
end
|
43
|
+
|
44
|
+
@app.call(env)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require "log4r"
|
2
|
+
require "vagrant/plugin/manager"
|
3
|
+
require "vagrant/util/platform"
|
4
|
+
require_relative "../base"
|
5
|
+
require_relative "../check_file"
|
6
|
+
require_relative "../../errors"
|
7
|
+
require_relative "../../util/sandbox/wildfly/run_cli"
|
8
|
+
require_relative "../../communicator_extender"
|
9
|
+
require_relative "../../dir_structure"
|
10
|
+
|
11
|
+
|
12
|
+
module VagrantPlugins
|
13
|
+
module ECSandbox
|
14
|
+
module Action
|
15
|
+
module Wildfly
|
16
|
+
# This middleware clears EC distribution contents from
|
17
|
+
# tmp directory.
|
18
|
+
class RedirectDirs < Base
|
19
|
+
def initialize(app, env)
|
20
|
+
@app = app
|
21
|
+
@logger = Dist.logger("redirect_dirs")
|
22
|
+
end
|
23
|
+
|
24
|
+
def call(env)
|
25
|
+
session = get_session(env)
|
26
|
+
server_id = env[:server_id]
|
27
|
+
raise "no server id found" unless server_id
|
28
|
+
|
29
|
+
server_config = get_session(env).config.get_server_config(server_id)
|
30
|
+
|
31
|
+
commands = template("wildfly/redirect_log.cli",
|
32
|
+
profile_name:server_config.wildfly_profile,
|
33
|
+
logging_path:session.dir_structures[:sandbox].status(:app_server, :logs, '${jboss.server.name}/server.log'))
|
34
|
+
|
35
|
+
result = Util::Sandbox::Wildfly::RunCli.execute(env, commands, nil,
|
36
|
+
file_name_base:'redirect_log.cli')
|
37
|
+
|
38
|
+
env[:ui].success("Server log is avaliable at #{session.dir_structures[:host].status(:app_server, :logs)}.")
|
39
|
+
|
40
|
+
|
41
|
+
commands = template("wildfly/open_interface.cli",
|
42
|
+
host: 'master', interface:'management')
|
43
|
+
|
44
|
+
result = Util::Sandbox::Wildfly::RunCli.execute(env, commands, nil,
|
45
|
+
file_name_base:'open_interface.cli')
|
46
|
+
|
47
|
+
env[:ui].success("Management console is now avaliable.")
|
48
|
+
|
49
|
+
|
50
|
+
@app.call(env)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require "log4r"
|
2
|
+
require "vagrant/plugin/manager"
|
3
|
+
require "vagrant/util/platform"
|
4
|
+
require_relative "../base"
|
5
|
+
require_relative "../check_file"
|
6
|
+
require_relative "../../errors"
|
7
|
+
require_relative "../../util/sandbox/wildfly/run_cli"
|
8
|
+
require_relative "../../communicator_extender"
|
9
|
+
require_relative "../../dir_structure"
|
10
|
+
|
11
|
+
|
12
|
+
module VagrantPlugins
|
13
|
+
module ECSandbox
|
14
|
+
module Action
|
15
|
+
module Wildfly
|
16
|
+
# This middleware clears EC distribution contents from
|
17
|
+
# tmp directory.
|
18
|
+
class Reload < Base
|
19
|
+
def initialize(app, env)
|
20
|
+
@app = app
|
21
|
+
@logger = Dist.logger("reload")
|
22
|
+
end
|
23
|
+
|
24
|
+
def call(env)
|
25
|
+
server_id = env[:server_id]
|
26
|
+
raise "no server id found" unless server_id
|
27
|
+
|
28
|
+
server_config = get_session(env).config.get_server_config(server_id)
|
29
|
+
possible_servers = (server_config.wildfly_servers || []) + ['server-two']
|
30
|
+
|
31
|
+
result = Util::Sandbox::Wildfly::RunCli.execute(env, "reload --host=master", nil,
|
32
|
+
file_name_base:'reload.cli')
|
33
|
+
|
34
|
+
Wildfly.wait_server(env, possible_servers,
|
35
|
+
wait_for_any:true)
|
36
|
+
|
37
|
+
env[:ui].success("Application server reloaded.")
|
38
|
+
|
39
|
+
@app.call(env)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require "log4r"
|
2
|
+
require "vagrant/plugin/manager"
|
3
|
+
require "vagrant/util/platform"
|
4
|
+
require_relative "../base"
|
5
|
+
require_relative "../check_file"
|
6
|
+
require_relative "../../errors"
|
7
|
+
require_relative "../../util/sandbox/wildfly/run_cli"
|
8
|
+
require_relative "../../communicator_extender"
|
9
|
+
require_relative "../../dir_structure"
|
10
|
+
|
11
|
+
|
12
|
+
module VagrantPlugins
|
13
|
+
module ECSandbox
|
14
|
+
module Action
|
15
|
+
module Wildfly
|
16
|
+
# This middleware clears EC distribution contents from
|
17
|
+
# tmp directory.
|
18
|
+
class ReloadAdmin < Base
|
19
|
+
def initialize(app, env)
|
20
|
+
@app = app
|
21
|
+
@logger = Dist.logger("reload")
|
22
|
+
end
|
23
|
+
|
24
|
+
def call(env)
|
25
|
+
result = Util::Sandbox::Wildfly::RunCli.execute(env, "reload --host=master --admin-only=true", nil,
|
26
|
+
file_name_base:'reload.cli')
|
27
|
+
|
28
|
+
Wildfly.wait_host(env)
|
29
|
+
|
30
|
+
env[:ui].success("Application server reloaded.")
|
31
|
+
|
32
|
+
@app.call(env)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require "log4r"
|
2
|
+
require "vagrant/plugin/manager"
|
3
|
+
require "vagrant/util/platform"
|
4
|
+
require_relative "../../dir_structure"
|
5
|
+
require_relative "../base"
|
6
|
+
|
7
|
+
|
8
|
+
module VagrantPlugins
|
9
|
+
module ECSandbox
|
10
|
+
module Action
|
11
|
+
module Wildfly
|
12
|
+
# This middleware re4moves the wildfly installation.
|
13
|
+
class Remove < Base
|
14
|
+
def initialize(app, env)
|
15
|
+
@app = app
|
16
|
+
@logger = Wildfly.logger("remove")
|
17
|
+
end
|
18
|
+
|
19
|
+
def call(env)
|
20
|
+
session = get_session(env)
|
21
|
+
env[:ui].output("Removing wildfly...")
|
22
|
+
command = "rm -r #{Wildfly.wildfly_home_path(session)}"
|
23
|
+
env[:machine].communicate.sudo(command)
|
24
|
+
env[:ui].success("Wildfly removed.")
|
25
|
+
|
26
|
+
@app.call(env)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require "log4r"
|
2
|
+
require "vagrant/plugin/manager"
|
3
|
+
require "vagrant/util/platform"
|
4
|
+
require_relative "../base"
|
5
|
+
|
6
|
+
|
7
|
+
module VagrantPlugins
|
8
|
+
module ECSandbox
|
9
|
+
module Action
|
10
|
+
module Wildfly
|
11
|
+
# This middleware starts wildfly in domain mode.
|
12
|
+
class Start < Base
|
13
|
+
def initialize(app, env)
|
14
|
+
@app = app
|
15
|
+
@logger = Wildfly.logger("start")
|
16
|
+
end
|
17
|
+
|
18
|
+
def call(env)
|
19
|
+
session = get_session(env)
|
20
|
+
server_id = env[:server_id]
|
21
|
+
raise "no server id found" unless server_id
|
22
|
+
|
23
|
+
server_config = get_session(env).config.get_server_config(server_id)
|
24
|
+
possible_servers = (server_config.wildfly_servers || []) + ['server-two']
|
25
|
+
|
26
|
+
env[:ui].output("Starting wildfly...")
|
27
|
+
command = "start-stop-daemon --start --background --chuid wildfly --name wildfly --exec #{Wildfly.wildfly_home_path(session)}/bin/domain.sh -- -b 0.0.0.0"
|
28
|
+
env[:machine].communicate.sudo(command)
|
29
|
+
|
30
|
+
Wildfly.wait_server(env, possible_servers,
|
31
|
+
wait_for_any:true)
|
32
|
+
|
33
|
+
# TODO: wait for port 9990 instead of 3 seconds here
|
34
|
+
sleep 3
|
35
|
+
|
36
|
+
@app.call(env)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require "log4r"
|
2
|
+
require "vagrant/plugin/manager"
|
3
|
+
require "vagrant/util/platform"
|
4
|
+
require_relative "../base"
|
5
|
+
require_relative "../wildfly"
|
6
|
+
|
7
|
+
|
8
|
+
module VagrantPlugins
|
9
|
+
module ECSandbox
|
10
|
+
module Action
|
11
|
+
module Wildfly
|
12
|
+
# This middleware starts wildfly in domain mode.
|
13
|
+
class StartAdmin < Base
|
14
|
+
def initialize(app, env)
|
15
|
+
@app = app
|
16
|
+
@logger = Wildfly.logger("start")
|
17
|
+
end
|
18
|
+
|
19
|
+
def call(env)
|
20
|
+
session = get_session(env)
|
21
|
+
env[:ui].output("Starting wildfly...")
|
22
|
+
command = "start-stop-daemon --start --background --chuid wildfly --name wildfly --exec #{Wildfly.wildfly_home_path(session)}/bin/domain.sh -- --admin-only -b 0.0.0.0"
|
23
|
+
env[:machine].communicate.sudo(command)
|
24
|
+
|
25
|
+
Wildfly.wait_host(env)
|
26
|
+
|
27
|
+
# TODO: wait for port 9990 instead of 3 seconds here
|
28
|
+
sleep 3
|
29
|
+
|
30
|
+
@app.call(env)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require "log4r"
|
2
|
+
require "vagrant/plugin/manager"
|
3
|
+
require "vagrant/util/platform"
|
4
|
+
require_relative "../base"
|
5
|
+
require_relative "../../util/sandbox/get_user_processes"
|
6
|
+
require_relative "../../communicator_extender"
|
7
|
+
|
8
|
+
|
9
|
+
module VagrantPlugins
|
10
|
+
module ECSandbox
|
11
|
+
module Action
|
12
|
+
module Wildfly
|
13
|
+
class Status < Base
|
14
|
+
def initialize(app, env)
|
15
|
+
@app = app
|
16
|
+
@logger = Wildfly.logger("status")
|
17
|
+
end
|
18
|
+
|
19
|
+
def call(env)
|
20
|
+
processes = Util::Sandbox::GetUserProcesses.execute("wildfly", env)
|
21
|
+
|
22
|
+
env[:ui].output("Started servers:")
|
23
|
+
for proc in processes
|
24
|
+
if proc[:info][:type] == :wildfly_server
|
25
|
+
server = proc[:info][:server_name] || "(no name)"
|
26
|
+
env[:ui].detail(server)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
@app.call(env)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require "log4r"
|
2
|
+
require "vagrant/plugin/manager"
|
3
|
+
require "vagrant/util/platform"
|
4
|
+
require_relative "../base"
|
5
|
+
require_relative "../../util/sandbox/get_user_processes"
|
6
|
+
require_relative "../../communicator_extender"
|
7
|
+
|
8
|
+
|
9
|
+
module VagrantPlugins
|
10
|
+
module ECSandbox
|
11
|
+
module Action
|
12
|
+
module Wildfly
|
13
|
+
class Stop < Base
|
14
|
+
def initialize(app, env)
|
15
|
+
@app = app
|
16
|
+
@logger = Wildfly.logger("stop")
|
17
|
+
end
|
18
|
+
|
19
|
+
def call(env)
|
20
|
+
# :ask, :detail, :warn, :error, :info, :output, :success
|
21
|
+
processes = VagrantPlugins::ECSandbox::Util::Sandbox::GetUserProcesses.execute("wildfly", env)
|
22
|
+
|
23
|
+
for proc in processes
|
24
|
+
env[:ui].info("Stopping #{proc[:info][:name]}...")
|
25
|
+
command = "sudo kill #{proc[:pid]}"
|
26
|
+
|
27
|
+
begin
|
28
|
+
env[:machine].communicate.sudo(command)
|
29
|
+
rescue
|
30
|
+
env[:ui].warn("Failed to stop #{proc[:info][:name]}, it may already be stopped.")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
env[:ui].success("Wildfly stopped.")
|
35
|
+
|
36
|
+
@app.call(env)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require "log4r"
|
2
|
+
require "vagrant/plugin/manager"
|
3
|
+
require "vagrant/util/platform"
|
4
|
+
require_relative "../base"
|
5
|
+
require_relative "../check_file"
|
6
|
+
require_relative "../../errors"
|
7
|
+
require_relative "../../util/sandbox/wildfly/run_cli"
|
8
|
+
require_relative "../../communicator_extender"
|
9
|
+
require_relative "../../dir_structure"
|
10
|
+
|
11
|
+
|
12
|
+
module VagrantPlugins
|
13
|
+
module ECSandbox
|
14
|
+
module Action
|
15
|
+
module Wildfly
|
16
|
+
# This middleware clears EC distribution contents from
|
17
|
+
# tmp directory.
|
18
|
+
class SwitchDb < Base
|
19
|
+
def initialize(app, env)
|
20
|
+
@app = app
|
21
|
+
@logger = Dist.logger("switch_db")
|
22
|
+
end
|
23
|
+
|
24
|
+
def call(env)
|
25
|
+
db_info = env[:selected_db_info]
|
26
|
+
raise "no database info found" unless db_info
|
27
|
+
|
28
|
+
commands = template("wildfly/switch_db.cli",
|
29
|
+
profile_name:'full',
|
30
|
+
host: db_info.host,
|
31
|
+
port: db_info.port,
|
32
|
+
service: db_info.service,
|
33
|
+
user: db_info.user,
|
34
|
+
password: db_info.password
|
35
|
+
)
|
36
|
+
|
37
|
+
result = Util::Sandbox::Wildfly::RunCli.execute(env, commands, nil,
|
38
|
+
file_name_base:'switch_db.cli')
|
39
|
+
|
40
|
+
env[:ui].success("DB connection has been updated on wildfly.")
|
41
|
+
|
42
|
+
@app.call(env)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|