mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
PHRAS-2131 Fix windows provisioning
This commit is contained in:
26
Vagrantfile
vendored
26
Vagrantfile
vendored
@@ -1,5 +1,16 @@
|
||||
Vagrant.require_version ">= 1.5"
|
||||
|
||||
class MyCustomError < StandardError
|
||||
attr_reader :code
|
||||
|
||||
def initialize(code)
|
||||
@code = code
|
||||
end
|
||||
|
||||
def to_s
|
||||
"[#{code} #{super}]"
|
||||
end
|
||||
end
|
||||
# Check to determine whether we're on a windows or linux/os-x host,
|
||||
# later on we use this to launch ansible in the supported way
|
||||
# source: https://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby
|
||||
@@ -56,6 +67,7 @@ def config_net(config)
|
||||
vb.customize ["modifyvm", :id, "--hostonlyadapter2", "vboxnet0"]
|
||||
else
|
||||
vb.customize ["modifyvm", :id, "--hostonlyadapter2", "VirtualBox Host-Only Ethernet Adapter"]
|
||||
vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant", "1"]
|
||||
end
|
||||
end
|
||||
config.hostmanager.ip_resolver = proc do |vm, resolving_vm|
|
||||
@@ -79,7 +91,9 @@ if $env == "mac"
|
||||
else if $env == "linux"
|
||||
$hostIps = `ifconfig | sed -nE 's/[[:space:]]*inet ([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3})(.*)$/\\1/p'`.split("\n");
|
||||
else
|
||||
$hostIps = `resources/ansible/inventories/GetIpAdresses.cmd`
|
||||
$hostIps = `resources/ansible/inventories/GetIpAdresses.cmd`;
|
||||
# raise MyCustomError.new($hostIps), "HOST IP"
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -134,13 +148,19 @@ Vagrant.configure("2") do |config|
|
||||
}
|
||||
end
|
||||
else
|
||||
config.vm.provision :shell, path: "resources/ansible/windows.sh", args: ["default", $phpVersion]
|
||||
# raise MyCustomError.new([$hostname, $phpVersion, $hostIps]), "HOST IP"
|
||||
# raise MyCustomError.new($hostIps), "HOST IP"
|
||||
# raise MyCustomError.new($hostIps), "HOST IP"
|
||||
|
||||
config.vm.provision :shell, path: "resources/ansible/windows.sh", args: [$hostname, $phpVersion, $hostIps]
|
||||
# config.vm.provision :shell, run: "always", path: "resources/ansible/windows-always.sh", args: ["default"]
|
||||
end
|
||||
|
||||
if $env == "mac" || $env == "linux"
|
||||
config.vm.synced_folder "./", "/vagrant", type: "nfs", mount_options: ['rw', 'vers=3', 'tcp', 'fsc']
|
||||
else
|
||||
config.vm.synced_folder "./", "/vagrant", type: "smb", mount_options: ["vers=3.02","mfsymlinks"]
|
||||
# config.vm.synced_folder "./", "/vagrant", type: "smb", mount_options: ["vers=3.02","mfsymlinks","noserverino"]
|
||||
config.vm.synced_folder "./", "/vagrant"
|
||||
|
||||
end
|
||||
end
|
@@ -14,8 +14,8 @@ for /f "usebackq tokens=*" %%a in (`ipconfig ^| findstr /i "ipv4"`) do (
|
||||
set _o3=%%e
|
||||
set _o4=%%f
|
||||
rem strip leading space from first octet
|
||||
set _3octet=!_o1:~1!.!_o2!.!_o3!.
|
||||
echo !_3octet!
|
||||
set _4octet=!_o1:~1!.!_o2!.!_o3!.!_o4!
|
||||
echo !_4octet!
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@@ -32,35 +32,35 @@
|
||||
- name: Run application setup
|
||||
become: yes
|
||||
become_user: vagrant
|
||||
shell: 'bin/setup system:install --email=admin@{{ hostname }}.vb --password=admin --db-host=127.0.0.1 --db-port=3306 --db-user={{ mariadb.user }} --db-password={{ mariadb.password }} --db-template=en-simple --appbox={{ mariadb.appbox_db }} --databox={{ mariadb.databox_db }} --server-name=www.{{ hostname }}.vb --data-path=/vagrant/datas -y'
|
||||
shell: 'php bin/setup system:install --email=admin@{{ hostname }}.vb --password=admin --db-host=127.0.0.1 --db-port=3306 --db-user={{ mariadb.user }} --db-password={{ mariadb.password }} --db-template=en-simple --appbox={{ mariadb.appbox_db }} --databox={{ mariadb.databox_db }} --server-name=www.{{ hostname }}.vb --data-path=/vagrant/datas -y'
|
||||
args:
|
||||
chdir: /vagrant/
|
||||
|
||||
- name: Create extra databox
|
||||
become: yes
|
||||
become_user: vagrant
|
||||
shell: 'bin/console databox:create {{ mariadb.alt_databox_db }} admin@{{ hostname }}.vb'
|
||||
shell: 'php bin/console databox:create {{ mariadb.alt_databox_db }} admin@{{ hostname }}.vb'
|
||||
args:
|
||||
chdir: /vagrant/
|
||||
|
||||
- name: Enable debugger for host IP addresses
|
||||
shell: bin/setup system:config add debugger.allowed-ips "{{ item }}"
|
||||
shell: php bin/setup system:config add debugger.allowed-ips "{{ item }}"
|
||||
with_items: '{{ host_addresses }}'
|
||||
args:
|
||||
chdir: /vagrant/
|
||||
|
||||
- name: Disable API SSL requirement
|
||||
shell: bin/setup system:config set main.api_require_ssl false
|
||||
shell: php bin/setup system:config set main.api_require_ssl false
|
||||
args:
|
||||
chdir: /vagrant/
|
||||
|
||||
- name: Enable API routes
|
||||
shell: bin/setup system:config set registry.api-clients.api-enable true
|
||||
shell: php bin/setup system:config set registry.api-clients.api-enable true
|
||||
args:
|
||||
chdir: /vagrant/
|
||||
|
||||
- name: Create ElasticSearch indexes
|
||||
shell: bin/console s:i:c
|
||||
shell: php bin/console s:i:c
|
||||
args:
|
||||
chdir: /vagrant/
|
||||
|
||||
|
@@ -28,4 +28,4 @@ sudo apt-get install -y ansible
|
||||
cp /vagrant/resources/ansible/inventories/dev /etc/ansible/hosts -f
|
||||
chmod 666 /etc/ansible/hosts
|
||||
cat /vagrant/resources/ansible/files/authorized_keys >> /home/vagrant/.ssh/authorized_keys
|
||||
sudo ansible-playbook /vagrant/resources/ansible/playbook.yml -e hostname=$1 phpversion=$2 --connection=local
|
||||
sudo ansible-playbook /vagrant/resources/ansible/playbook.yml -e "hostname=$1 phpversion=$2 host_addresses=$3" --connection=local
|
Reference in New Issue
Block a user