-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVirtufile
executable file
·106 lines (88 loc) · 5 KB
/
Virtufile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
Namespace Model ;
class Virtufile extends VirtufileBase {
public $config ;
public function __construct() {
$this->setConfig();
}
private function setConfig() {
$variables = array() ;
require (__DIR__.DIRECTORY_SEPARATOR.'vars'.DIRECTORY_SEPARATOR.'vm.php') ;
// var_dump('vfile vars', __DIR__.DIRECTORY_SEPARATOR.'vars'.DIRECTORY_SEPARATOR.'vm.php', $variables) ;
$this->setDefaultConfig();
$this->config["vm"]["name"] = strtolower(basename(dirname(__FILE__))) ;
$this->config["vm"]["gui_mode"] = "gui" ;
$this->config["vm"]["box"] = "pharaohubuntu14041amd64" ;
$this->config["vm"]["box"] = "standard_ubuntu" ;
$bu = '/opt/ptvirtualize/boxes/vanillaubuntu1604264bitserver.box' ;
$bu = 'https://www.pharaohtools.com/virtualize/boxes/vanillaubuntu1404264bitserveredition' ;
$this->config["vm"]["box_url"] = $bu ;
$this->config["vm"]["box"] = "vanillaubuntu1404264bitserveredition" ;
$random_port_suffix = '76' ;
$this->config["vm"]["cpus"] = "2" ;
$this->config["vm"]["memory"] = "8192" ;
$this->config["vm"]["graceful_halt_timeout"] = 15 ;
$this->config["vm"]["ssh_halt_timeout"] = 2 ;
$this->config["network"]["natpf1"][] = "{$this->config["vm"]["name"]}_guestssh,tcp,,22{$random_port_suffix},,22";
$this->config["network"]["natpf1"][] = "{$this->config["vm"]["name"]}_guestweb,tcp,,80{$random_port_suffix},,80";
$this->config["network"]["natpf1"][] = "{$this->config["vm"]["name"]}_guestmobile,tcp,,88{$random_port_suffix},,8000";
$this->config["ssh"]["driver"] = "native" ;
$this->config["ssh"]["user"] = "ptv" ;
$this->config["ssh"]["password"] = "ptv" ;
$this->config["ssh"]["target"] = "127.0.0.1" ;
$this->config["ssh"]["port"] = "22{$random_port_suffix}" ;
# Shared folder - This should map to the workstation environment vhost path parent...
$this->config["vm"]["shared_folders"][] =
array(
"name" => "host_www",
"host_path" => getcwd().DIRECTORY_SEPARATOR,
"guest_path" => "/var/www/hostshare/",
) ;
# Provisioning
$this->config["vm"]["provision"][] =
[ "provisioner" => "Shell",
"tool" => "shell",
"target" => "guest",
"default" => "MountShares" ];
$this->config["vm"]["provision"][] =
[ "provisioner" => "Shell",
"tool" => "shell",
"target" => "guest",
"default" => "PTConfigureInit" ];
$this->config["vm"]["provision"][] = $this->config["vm"]["provision_up_light"][] =
[ "provisioner" => "PharaohTools",
"tool" => "ptdeploy",
"target" => "host",
"script" => getcwd()."/build/ptd/add-hostfile-entry.dsl.php",
"params" => array("vars" => dirname(__FILE__)."/vars/vm.php"), ] ;
$this->config["vm"]["provision_destroy_post"][] =
[ "provisioner" => "PharaohTools", "tool" => "ptdeploy", "target" => "host",
"script" => getcwd()."/build/ptd/remove-hostfile-entry.dsl.php",
"params" => array("vars" => getcwd()."/vars/vm.php") ] ;
$this->config["vm"]["provision"][] =
[ "provisioner" => "PharaohTools",
"tool" => "ptconfigure",
"target" => "guest",
"script" => "/var/www/hostshare/build/ptc/development.dsl.php",
"params" => array('start-dir' => "/var/www/hostshare", 'vars' => '/var/www/hostshare/vars/vm.php') ] ;
$this->config["vm"]["provision"][] =
[ "provisioner" => "PharaohTools",
"tool" => "ptconfigure",
"target" => "guest",
"script" => "/var/www/hostshare/build/ptc/build-web-client-application.dsl.php",
"params" => array('start-dir' => "/var/www/hostshare", 'vars' => '/var/www/hostshare/vars/vm.php') ] ;
$this->config["vm"]["provision"][] =
[ "provisioner" => "PharaohTools",
"tool" => "ptconfigure",
"target" => "guest",
"script" => "/var/www/hostshare/build/ptc/build-web-server-application.dsl.php",
"params" => array('start-dir' => "/var/www/hostshare", 'vars' => '/var/www/hostshare/vars/vm.php') ] ;
$description = (isset($variables['description'])) ? "\n\n{$variables['description']}\n\n" : '' ;
$this->config["vm"]["post_up_message"] = "Your ISOPHP Virtualize Box has been brought up. $description
You now have the following urls:\n\n
http://build.{$variables['domain']}:8076/ - Build Server\n
http://www.{$variables['domain']}:8076/ - Web Client Application\n
http://www.{$variables['domain']}:8876/ - Mobile Application Web Emulator \n
http://server.{$variables['domain']}:8076/ - Web Server Application\n\n";
}
}