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
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 18c3ec44ecb7a7ac2933d5fa3149f5741daf401e
|
4
|
+
data.tar.gz: 890b5f3d80b6bc85b8415273e7f9dd932c198920
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c7b8c7dc6fb9fca3190a6693d0c85a978d308009684afd24bfff07289d4cd246f13c20728e8105f902c944a9ae9dd2da8efabea1ab71460ce345b3aff1439154
|
7
|
+
data.tar.gz: 3462611a424e21ee36c5e84358a83c5d12395ba04f5962cc7b08e66991bcbc30e876e6d92c2e7a563bdea8ee9f208c99ecf2de746a3fdd1448b508883b3bd9c8
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require "vagrant/plugin/state_file"
|
2
|
+
require_relative "../communicator_extender"
|
3
|
+
require_relative "../dir_structure"
|
4
|
+
require_relative "../util/host/file_util"
|
5
|
+
|
6
|
+
module VagrantPlugins
|
7
|
+
module ECSandbox
|
8
|
+
module Action
|
9
|
+
class Base
|
10
|
+
def template(script_name, variables=nil)
|
11
|
+
contents = Vagrant::Util::TemplateRenderer.render(
|
12
|
+
VagrantPlugins::ECSandbox.source_root.join("templates/action/#{script_name}"), variables)
|
13
|
+
end
|
14
|
+
|
15
|
+
def get_session(env)
|
16
|
+
env[:sandbox_session]
|
17
|
+
end
|
18
|
+
|
19
|
+
def choose(env, title, message, choices)
|
20
|
+
choice = nil
|
21
|
+
allowed = choices.keys
|
22
|
+
|
23
|
+
if !choice
|
24
|
+
while true
|
25
|
+
if title
|
26
|
+
env[:ui].info(title)
|
27
|
+
env[:ui].info('-----------------')
|
28
|
+
end
|
29
|
+
|
30
|
+
choices.each do |option, data|
|
31
|
+
env[:ui].info("#{option}. #{data[:text]}")
|
32
|
+
end
|
33
|
+
|
34
|
+
env[:ui].info('')
|
35
|
+
choice = env[:ui].ask(message)
|
36
|
+
|
37
|
+
# If we don't have an allowed set just exit
|
38
|
+
break if !allowed
|
39
|
+
break if allowed.include?(choice)
|
40
|
+
|
41
|
+
env[:ui].info('')
|
42
|
+
env[:ui].info('')
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
env[:ui].info('')
|
47
|
+
c = choices[choice]
|
48
|
+
c[:id]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,41 @@
|
|
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
|
+
# This middleware checks that a dir exists on guest
|
11
|
+
# system.
|
12
|
+
class CheckDir < Base
|
13
|
+
def initialize(app, env, file, exception, *args)
|
14
|
+
@app = app
|
15
|
+
@logger = Wildfly.logger("check_dir")
|
16
|
+
@file = file
|
17
|
+
@exception = exception
|
18
|
+
@args = args.first
|
19
|
+
end
|
20
|
+
|
21
|
+
def call(env)
|
22
|
+
command = "if [ -d #{@file} ]; then echo Y; else echo N; fi;"
|
23
|
+
installed = nil
|
24
|
+
|
25
|
+
env[:machine].communicate.execute(command) do |type, data|
|
26
|
+
result = data.chop
|
27
|
+
if result == "Y"
|
28
|
+
installed = true
|
29
|
+
elsif result == 'N'
|
30
|
+
installed = false
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
raise @exception, @args unless installed
|
35
|
+
|
36
|
+
@app.call(env)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,41 @@
|
|
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
|
+
# This middleware checks that a file exists on guest
|
11
|
+
# system.
|
12
|
+
class CheckFile < Base
|
13
|
+
def initialize(app, env, file, exception, *args)
|
14
|
+
@app = app
|
15
|
+
@logger = Wildfly.logger("check_file")
|
16
|
+
@file = file
|
17
|
+
@exception = exception
|
18
|
+
@args = args.first
|
19
|
+
end
|
20
|
+
|
21
|
+
def call(env)
|
22
|
+
command = "if [ -f #{@file} ]; then echo Y; else echo N; fi;"
|
23
|
+
installed = nil
|
24
|
+
|
25
|
+
env[:machine].communicate.execute(command) do |type, data|
|
26
|
+
result = data.chop
|
27
|
+
if result == "Y"
|
28
|
+
installed = true
|
29
|
+
elsif result == 'N'
|
30
|
+
installed = false
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
raise @exception, @args unless installed
|
35
|
+
|
36
|
+
@app.call(env)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
File without changes
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require "log4r"
|
2
|
+
require "vagrant/plugin/manager"
|
3
|
+
require "vagrant/util/platform"
|
4
|
+
require "uri"
|
5
|
+
require_relative "../code"
|
6
|
+
require_relative "../base"
|
7
|
+
require_relative "../../errors"
|
8
|
+
require_relative "../../util/host/mvn"
|
9
|
+
|
10
|
+
|
11
|
+
module VagrantPlugins
|
12
|
+
module ECSandbox
|
13
|
+
module Action
|
14
|
+
module Code
|
15
|
+
# This middleware checks that the wildfly is created, and raises
|
16
|
+
# an exception if it is not.
|
17
|
+
class PrepareDist < Base
|
18
|
+
def initialize(app, env)
|
19
|
+
@app = app
|
20
|
+
@logger = Code.logger("build_dist")
|
21
|
+
end
|
22
|
+
|
23
|
+
def call(env)
|
24
|
+
session = get_session(env)
|
25
|
+
artifact_provider = session.resource_provider(:artifact, 'distribution')
|
26
|
+
files = artifact_provider.prepare(env) || []
|
27
|
+
files = [files] unless files.is_a?(Array)
|
28
|
+
|
29
|
+
env[:ui].info("Following files will be used for Sandbox installation: #{files.join(', ')}")
|
30
|
+
env[:build_result] = files
|
31
|
+
@app.call(env)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
File without changes
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module ECSandbox
|
3
|
+
module Action
|
4
|
+
module Code
|
5
|
+
def self.logger(class_name)
|
6
|
+
Log4r::Logger.new("vagrantplugins::ecsandbox::action::code::#{class_name}")
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.code_dir(session, repo_name)
|
10
|
+
session.dir_structures[:host].resource(:code, 'ec', repo_name)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,26 @@
|
|
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
|
+
|
8
|
+
|
9
|
+
module VagrantPlugins
|
10
|
+
module ECSandbox
|
11
|
+
module Action
|
12
|
+
module Dist
|
13
|
+
# This middleware checks that the wildfly is created, and raises
|
14
|
+
# an exception if it is not.
|
15
|
+
class CheckArtifact < VagrantPlugins::ECSandbox::Action::CheckFile
|
16
|
+
def initialize(app, env)
|
17
|
+
session = get_session(env)
|
18
|
+
path = Dist.dist_artifact_path(session, :sandbox)
|
19
|
+
path_host = Dist.dist_artifact_path(session, :host)
|
20
|
+
super(app, env, path, VagrantPlugins::ECSandbox::Errors::DistNotFound, path: path_host)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,28 @@
|
|
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 "../check_file"
|
7
|
+
require_relative "../../errors"
|
8
|
+
|
9
|
+
|
10
|
+
module VagrantPlugins
|
11
|
+
module ECSandbox
|
12
|
+
module Action
|
13
|
+
module Dist
|
14
|
+
# This middleware checks that the wildfly is created, and raises
|
15
|
+
# an exception if it is not.
|
16
|
+
class CheckWildflyInstaller < VagrantPlugins::ECSandbox::Action::CheckFile
|
17
|
+
def initialize(app, env)
|
18
|
+
session = get_session(env)
|
19
|
+
path = Dist.dist_wildfly_path(session)
|
20
|
+
|
21
|
+
super(app, env, path,
|
22
|
+
VagrantPlugins::ECSandbox::Errors::WildflyInstallerNotFound, path: path)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,34 @@
|
|
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 "../check_file"
|
7
|
+
require_relative "../../errors"
|
8
|
+
|
9
|
+
|
10
|
+
module VagrantPlugins
|
11
|
+
module ECSandbox
|
12
|
+
module Action
|
13
|
+
module Dist
|
14
|
+
# This middleware clears EC distribution contents from
|
15
|
+
# tmp directory.
|
16
|
+
class ClearContents < Base
|
17
|
+
def initialize(app, env)
|
18
|
+
@app = app
|
19
|
+
@logger = Dist.logger("clear_contents")
|
20
|
+
end
|
21
|
+
|
22
|
+
def call(env)
|
23
|
+
session = get_session(env)
|
24
|
+
env[:ui].output("Clearing EC distribution contents...")
|
25
|
+
command = "rm -r --force #{Dist.dist_content_path(session)}"
|
26
|
+
env[:machine].communicate.sudo(command)
|
27
|
+
|
28
|
+
@app.call(env)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,92 @@
|
|
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/add-user"
|
8
|
+
require_relative "../../config/sandbox_config"
|
9
|
+
|
10
|
+
|
11
|
+
module VagrantPlugins
|
12
|
+
module ECSandbox
|
13
|
+
module Action
|
14
|
+
module Dist
|
15
|
+
# This middleware places EC distribution contents to the
|
16
|
+
# tmp directory.
|
17
|
+
class ConfigEC < Base
|
18
|
+
def initialize(app, env)
|
19
|
+
@app = app
|
20
|
+
@logger = Dist.logger("config_ec")
|
21
|
+
end
|
22
|
+
|
23
|
+
def call(env)
|
24
|
+
env[:ui].output("Configuring wildfly for EC...")
|
25
|
+
sleep 3
|
26
|
+
|
27
|
+
session = get_session(env)
|
28
|
+
db_info = env[:selected_db_info]
|
29
|
+
raise "no database info selected" unless db_info
|
30
|
+
raise "no machine found" unless env[:machine]
|
31
|
+
|
32
|
+
server_id = env[:server_id]
|
33
|
+
raise "no server id found" unless server_id
|
34
|
+
|
35
|
+
|
36
|
+
server_config = get_session(env).config.get_server_config(server_id)
|
37
|
+
admin_name = 'admin'
|
38
|
+
admin_password = 'admin'
|
39
|
+
|
40
|
+
opts = {
|
41
|
+
jboss_dir: Dist.wildfly_home_path(session),
|
42
|
+
port: 8080,
|
43
|
+
db_host: db_info.host,
|
44
|
+
db_port: db_info.port,
|
45
|
+
db_serv: db_info.service,
|
46
|
+
db_user: db_info.user,
|
47
|
+
db_pw: db_info.password,
|
48
|
+
smtp_host: server_config.smtp_host,
|
49
|
+
smtp_port: server_config.smtp_port,
|
50
|
+
datasrc_pw_encryption: server_config.datasrc_pw_encryption || false,
|
51
|
+
developer_mode: server_config.developer_mode || true
|
52
|
+
}
|
53
|
+
|
54
|
+
|
55
|
+
installer_opts_str = ""
|
56
|
+
installer_opts_str << " -j #{opts[:jboss_dir]}"
|
57
|
+
installer_opts_str << " -o #{opts[:port]}"
|
58
|
+
installer_opts_str << " -h #{opts[:db_host]}"
|
59
|
+
installer_opts_str << " -p #{opts[:db_port] || 1521}"
|
60
|
+
installer_opts_str << " -s #{opts[:db_serv]}"
|
61
|
+
installer_opts_str << " -u #{opts[:db_user]}"
|
62
|
+
installer_opts_str << " -w #{opts[:db_pw]}"
|
63
|
+
installer_opts_str << " -m #{opts[:smtp_host]}" if opts[:smtp_host]
|
64
|
+
installer_opts_str << " -n #{opts[:smtp_port] || 25}" if opts[:smtp_host]
|
65
|
+
#installer_opts_str << " -e #{opts[:datasrc_pw_encryption] || false}"
|
66
|
+
installer_opts_str << " -d #{opts[:developer_mode]}" if opts[:developer_mode]
|
67
|
+
|
68
|
+
variables = {
|
69
|
+
wildfly_user:"wildfly",
|
70
|
+
default_user:"vagrant",
|
71
|
+
dist_contents_dir:Dist.dist_content_installer_path(session),
|
72
|
+
installer_opts:installer_opts_str
|
73
|
+
}
|
74
|
+
|
75
|
+
env[:machine].communicate.sh(session, template("wildfly/config_ec.sh", variables),
|
76
|
+
file_name_base: "config_ec.sh") do |type, data|
|
77
|
+
# puts "#{type}: #{data}"
|
78
|
+
end
|
79
|
+
|
80
|
+
VagrantPlugins::ECSandbox::Util::Sandbox::Wildfly::AddUser.execute(env, admin_name, admin_password,
|
81
|
+
user_type: :management)
|
82
|
+
|
83
|
+
env[:ui].detail("Admin user '#{admin_name}' has been created.")
|
84
|
+
env[:ui].success("Wildfly is configured for EC, ready for deploy.")
|
85
|
+
|
86
|
+
@app.call(env)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,44 @@
|
|
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 "../dist"
|
7
|
+
require_relative "../../util/sandbox/wildfly/deploy"
|
8
|
+
|
9
|
+
|
10
|
+
module VagrantPlugins
|
11
|
+
module ECSandbox
|
12
|
+
module Action
|
13
|
+
module Dist
|
14
|
+
# This middleware checks that the wildfly is created, the
|
15
|
+
# result is placed in `env[:result]` so that it can be used
|
16
|
+
# with the {Call} class.
|
17
|
+
class DeployEcApp < Base
|
18
|
+
def initialize(app, env)
|
19
|
+
@app = app
|
20
|
+
@logger = Dist.logger("deploy_ecapp")
|
21
|
+
end
|
22
|
+
|
23
|
+
def call(env)
|
24
|
+
session = get_session(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
|
+
|
30
|
+
env[:ui].info(I18n.t("ec_sandbox.action.dist.deploying_ec_app"))
|
31
|
+
result = VagrantPlugins::ECSandbox::Util::Sandbox::Wildfly::Deploy.execute(
|
32
|
+
Dist.wildfly_home_path(session),
|
33
|
+
Dist.dist_ecapp_path(session),
|
34
|
+
server_config.wildfly_server_group,
|
35
|
+
env)
|
36
|
+
env[:ui].success(I18n.t("ec_sandbox.action.dist.ec_app_deployed"))
|
37
|
+
|
38
|
+
@app.call(env)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require "log4r"
|
2
|
+
require "vagrant/plugin/manager"
|
3
|
+
require "vagrant/util/platform"
|
4
|
+
require_relative "../base"
|
5
|
+
require_relative "../../dir_structure"
|
6
|
+
|
7
|
+
|
8
|
+
module VagrantPlugins
|
9
|
+
module ECSandbox
|
10
|
+
module Action
|
11
|
+
module Dist
|
12
|
+
# This middleware installs wildfly to app directory.
|
13
|
+
class GetViaBuild < Base
|
14
|
+
def initialize(app, env)
|
15
|
+
@app = app
|
16
|
+
@logger = Dist.logger("install")
|
17
|
+
end
|
18
|
+
|
19
|
+
def call(env)
|
20
|
+
session = get_session(env)
|
21
|
+
last_build_result = env[:build_result]
|
22
|
+
raise "no files installed from last build" if last_build_result.empty?
|
23
|
+
|
24
|
+
for f in last_build_result
|
25
|
+
if f.end_with?('-distribution.zip')
|
26
|
+
path = f if f.end_with?('-distribution.zip')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
raise "cannot find distribution file from last build" unless path
|
30
|
+
|
31
|
+
FileUtils.rm(Dist.dist_artifact_path(session, :host)) if File.exist?(Dist.dist_artifact_path(session, :host))
|
32
|
+
FileUtils.cp(path, Dist.dist_artifact_path(session, :host))
|
33
|
+
@app.call(env)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require "log4r"
|
2
|
+
require "vagrant/plugin/manager"
|
3
|
+
require "vagrant/util/platform"
|
4
|
+
require "vagrant/util/downloader"
|
5
|
+
|
6
|
+
require_relative "../../dir_structure"
|
7
|
+
require_relative "../base"
|
8
|
+
require_relative "../check_file"
|
9
|
+
require_relative "../../errors"
|
10
|
+
require_relative "../../util/name"
|
11
|
+
|
12
|
+
|
13
|
+
module VagrantPlugins
|
14
|
+
module ECSandbox
|
15
|
+
module Action
|
16
|
+
module Dist
|
17
|
+
# This middleware checks that the wildfly is created, and raises
|
18
|
+
# an exception if it is not.
|
19
|
+
class GetViaNexus < Base
|
20
|
+
def initialize(app, env)
|
21
|
+
@app = app
|
22
|
+
@logger = Dist.logger("get_vnexus")
|
23
|
+
end
|
24
|
+
|
25
|
+
def call(env)
|
26
|
+
session = get_session(env)
|
27
|
+
env[:ui].output("Downloading EC Install package from nexus...")
|
28
|
+
|
29
|
+
url = "http://ws002990.eu.tieto.com:8082/nexus/service/local/repositories/releases/content/com/ec/frmw/ec-app-install/11.0.0/ec-app-install-11.0.0-distribution.zip"
|
30
|
+
tmmp_name = VagrantPlugins::ECSandbox::Util::Name.unique("ec-app-install-11.0.0-distribution") + ".zip"
|
31
|
+
temp_path = session.dir_structures[:host].tmp("action", "Dist_GetViaNexus", tmmp_name)
|
32
|
+
downloader_options = {
|
33
|
+
ui:env[:ui]
|
34
|
+
}
|
35
|
+
# downloader_options[:ca_cert] = env[:box_download_ca_cert]
|
36
|
+
# downloader_options[:ca_path] = env[:box_download_ca_path]
|
37
|
+
# downloader_options[:continue] = true
|
38
|
+
# downloader_options[:insecure] = env[:box_download_insecure]
|
39
|
+
# downloader_options[:client_cert] = env[:box_download_client_cert]
|
40
|
+
# downloader_options[:headers] = ["Accept: application/json"] if opts[:json]
|
41
|
+
|
42
|
+
d = Vagrant::Util::Downloader.new(url, temp_path, downloader_options)
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
begin
|
47
|
+
d.download!
|
48
|
+
rescue Errors::DownloaderInterrupted
|
49
|
+
# The downloader was interrupted, so just return, because that
|
50
|
+
# means we were interrupted as well.
|
51
|
+
@download_interrupted = true
|
52
|
+
env[:ui].info(I18n.t("vagrant.actions.box.download.interrupted"))
|
53
|
+
end
|
54
|
+
|
55
|
+
Pathname.new(d.destination)
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
@app.call(env)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require "log4r"
|
2
|
+
require "vagrant/plugin/manager"
|
3
|
+
require "vagrant/util/platform"
|
4
|
+
require_relative "../base"
|
5
|
+
require_relative "../../dir_structure"
|
6
|
+
|
7
|
+
|
8
|
+
module VagrantPlugins
|
9
|
+
module ECSandbox
|
10
|
+
module Action
|
11
|
+
module Dist
|
12
|
+
# This middleware installs wildfly to app directory.
|
13
|
+
class InstallWildfly < Base
|
14
|
+
def initialize(app, env)
|
15
|
+
@app = app
|
16
|
+
@logger = Dist.logger("install")
|
17
|
+
end
|
18
|
+
|
19
|
+
def call(env)
|
20
|
+
session = get_session(env)
|
21
|
+
|
22
|
+
variables = {
|
23
|
+
app_dir: Dist.appserver_root_path(session),
|
24
|
+
wildfly_dist: Dist.dist_wildfly_path(session)
|
25
|
+
}
|
26
|
+
|
27
|
+
env[:ui].output("Installing wildfly...")
|
28
|
+
|
29
|
+
env[:machine].communicate.sh(session, template("dist/install_wildfly.sh", variables),
|
30
|
+
file_name_base: "install_wildfly.sh")
|
31
|
+
|
32
|
+
env[:ui].success("Wildfly installed.")
|
33
|
+
|
34
|
+
@app.call(env)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,36 @@
|
|
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 "../check_file"
|
7
|
+
require_relative "../../errors"
|
8
|
+
|
9
|
+
|
10
|
+
module VagrantPlugins
|
11
|
+
module ECSandbox
|
12
|
+
module Action
|
13
|
+
module Dist
|
14
|
+
# This middleware places EC distribution contents to the
|
15
|
+
# tmp directory.
|
16
|
+
class MakeContents < Base
|
17
|
+
def initialize(app, env)
|
18
|
+
@app = app
|
19
|
+
@logger = Dist.logger("make_contents")
|
20
|
+
end
|
21
|
+
|
22
|
+
def call(env)
|
23
|
+
session = get_session(env)
|
24
|
+
env[:ui].output("Making EC distribution contents...")
|
25
|
+
command = "unzip #{Dist.dist_artifact_path(session)} -d #{Dist.dist_content_path(session)}"
|
26
|
+
env[:machine].communicate.execute(command)
|
27
|
+
command = "chmod 775 -R #{Dist.dist_content_path(session)}"
|
28
|
+
env[:machine].communicate.sudo(command)
|
29
|
+
|
30
|
+
@app.call(env)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require_relative "../dir_structure"
|
2
|
+
|
3
|
+
|
4
|
+
module VagrantPlugins
|
5
|
+
module ECSandbox
|
6
|
+
module Action
|
7
|
+
module Dist
|
8
|
+
def self.logger(class_name)
|
9
|
+
Log4r::Logger.new("vagrantplugins::ecsandbox::action::dist::#{class_name}")
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.dist_artifact_path(session, env_name = :sandbox)
|
13
|
+
session.dir_structures[env_name || :sandbox].resource(:artifacts, :distribution)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.dist_content_path(session)
|
17
|
+
session.dir_structures[:sandbox].tmp("dist_contents")
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.dist_content_installer_path(session)
|
21
|
+
session.dir_structures[:sandbox].internal(:tmp, "dist_contents", "ec-app-install")
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.appserver_root_path(session)
|
25
|
+
session.dir_structures[:sandbox].internal(:app, :as)
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.wildfly_home_path(session)
|
29
|
+
session.dir_structures[:sandbox].internal(:app, :as, "wildfly-8.1.0.Final")
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.dist_wildfly_path(session)
|
33
|
+
session.dir_structures[:sandbox].internal(
|
34
|
+
:tmp, "dist_contents", "ec-app-install", "bin", "wildfly-dist", "wildfly-dist.zip")
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.dist_ecapp_path(session)
|
38
|
+
session.dir_structures[:sandbox].internal(
|
39
|
+
:tmp, "dist_contents", "ec-app-install", "bin", "ec-app", "ec-app.ear")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "vagrant/action/builtin/confirm"
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module ECSandbox
|
5
|
+
module Action
|
6
|
+
module Init
|
7
|
+
class EnvConfigConfirm < Vagrant::Action::Builtin::Confirm
|
8
|
+
def initialize(app, env)
|
9
|
+
force_key = :force_env_config_destroy
|
10
|
+
message = I18n.t("ec_sandbox.action.init.configure_system_confirm")
|
11
|
+
|
12
|
+
super(app, env, message, force_key, allowed: ["y", "n", "Y", "N"])
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|