diff --git a/README.md b/README.md index 90bb6dd4c9..18948ebd57 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,10 @@ Phraseanet 4.1 - Digital Asset Management application - Elasticsearch search engine - Multiple resolution assets generation +# License : + +Phraseanet is licensed under GPL-v3 license. + # Documentation : https://docs.phraseanet.com/ @@ -31,17 +35,22 @@ https://www.phraseanet.com/download/ # Development : For development purpose Phraseanet is shipped with ready to use development environments using vagrant. +You can easily choose betweeen a complete build or a prebuild box, with a specific PHP version. -- git clone -- vagrant up + git clone + vagrant up --provision + +then, a prompt allow you to choose PHP version, and another one to choose a complete build or an Alchemy prebuilt boxes. + +Ex: +- vagrant up --provision //// 5.6 ///// 1 >> Build an ubuntu/xenial box with php5.6 +- vagrant up --provision //// 7.0 ///// 1 >> Build an ubuntu/xenial with php7.0 +- vagrant up --provision //// 7.2 ///// 2 >> Build the alchemy/phraseanet-php-7.2 box +- vagrant up --provision //// 5.6 ///// 1 >> Build the alchemy/phraseanet-php-5.6 box For development with Phraseanet API see https://docs.phraseanet.com/4.0/en/Devel/index.html -# License : - -Phraseanet is licensed under GPL-v3 license. - # Docker build diff --git a/Vagrantfile b/Vagrantfile index 74f8710e8e..a899a77ca5 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -11,6 +11,7 @@ class MyCustomError < StandardError "[#{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 @@ -34,15 +35,52 @@ else if which('ifconfig') end end -$php = [ "5.6", "7.0", "7.1", "7.2" ] -$phpVersion = ENV['phpversion'] ? ENV['phpversion'] : "7.0"; - unless Vagrant.has_plugin?('vagrant-hostmanager') raise "vagrant-hostmanager is not installed! Please run\n vagrant plugin install vagrant-hostmanager\n\n" end -unless $php.include?($phpVersion) - raise "You should specify php version before running vagrant\n\n (Available : 5.6, 7.0, 7.1, 7.2 | default => 5.6)\n\n Exemple: phpversion='7.0' vagrant up \n\n" +if ARGV[1] == '--provision' + print "\033[34m \nChoose a Build type :\n\n(1) Use prebuilt Phraseanet Box\n(2) Build Phraseanet from scratch (xenial)\n\033[00m" + type = STDIN.gets.chomp + print "\n" + # Switch between Phraseanet box and native trusty64 + case (type) + when '1' + $box = "alchemy/Phraseanet-vagrant-dev_php" + when '2' + $box = "ubuntu/xenial64" + print("\033[91mComplete build selected, don't forget to uncomment all roles on playbook.yml\n\n\033[00m") + else + raise "\033[31mYou should specify Build type before running vagrant\n\n (Available : 1, 2)\n\n\033[00m" + end + print "\033[32m-----------------------------------------------\n" + print "Build with "+$box+" box\n" + print "-----------------------------------------------\n\n\033[00m" + + print "\033[34mChoose a PHP version for your build (Available : 5.6, 7.0, 7.1, 7.2)\n\033[00m" + phpversion = STDIN.gets.chomp + print "\n" + # Php version selection + case (phpversion) + when "5.6", "7.0", "7.1", "7.2" + print "\033[32mSelected PHP version : "+phpversion+"\n\033[00m" + print "Continue ? (Y/n) \n" + continue = STDIN.gets.chomp + case continue + when 'n', 'no', 'N', 'NO' + raise "\033[31mBuild aborted\033[00m" + else + if (type == '1') + $box.concat(phpversion) + end + print "\033[32m-----------------------------------------------\n" + print "Build with PHP"+phpversion+"\n" + print "-----------------------------------------------\n\n\033[00m" + + end + else + raise "\033[31mYou should specify php version before running vagrant\n\n (Available : 5.6, 7.0, 7.1, 7.2)\n\n\033[00m" + end end $root = File.dirname(File.expand_path(__FILE__)) @@ -119,14 +157,12 @@ Vagrant.configure("2") do |config| ] end - # Switch between Phraseanet box and native trusty64 - config.vm.box = "alchemy/Phraseanet-vagrant-dev" - #config.vm.box = "ubuntu/trusty64" + config.vm.box = ($box) ? $box : "ubuntu/xenial64" # In case, Phraseanet box, choose the php version # For php 7.0 use box 0.0.1 # For php 7.1 use box 0.0.2 - config.vm.box_version = "0.0.1" + #config.vm.box_version = "0.0.1" config.ssh.forward_agent = true config_net(config) @@ -141,7 +177,7 @@ Vagrant.configure("2") do |config| ansible.extra_vars = { hostname: $hostname, host_addresses: $hostIps, - phpversion: $phpVersion, + phpversion: phpversion, postfix: { postfix_domain: $hostname + ".vb" } diff --git a/resources/ansible/roles/elasticsearch/tasks/main.yml b/resources/ansible/roles/elasticsearch/tasks/main.yml index d246953df7..655567c119 100644 --- a/resources/ansible/roles/elasticsearch/tasks/main.yml +++ b/resources/ansible/roles/elasticsearch/tasks/main.yml @@ -13,7 +13,7 @@ changed_when: false - name: Install Dependencies - apt: pkg=openjdk-7-jre state=latest + apt: pkg=openjdk-8-jre state=latest - name: Remove temporary debian package shell: rm -f /tmp/elasticsearch-{{ elasticsearch.version }}.deb diff --git a/resources/ansible/roles/repositories/tasks/main.yml b/resources/ansible/roles/repositories/tasks/main.yml index 2c00cef1e7..ee459d8949 100644 --- a/resources/ansible/roles/repositories/tasks/main.yml +++ b/resources/ansible/roles/repositories/tasks/main.yml @@ -16,7 +16,7 @@ - name: Add Key for MariaDB Repository sudo: yes - apt_key: url=http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xcbcb082a1bb943db + apt_key: url=http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xF1656F24C74CD1D8 # RabbitMQ - name: Add rabbitmq package repository diff --git a/resources/ansible/vars/all.yml b/resources/ansible/vars/all.yml index 5cdf9f6a51..acef9788e3 100644 --- a/resources/ansible/vars/all.yml +++ b/resources/ansible/vars/all.yml @@ -34,12 +34,14 @@ server: - fr_FR.UTF-8 - de_DE.UTF-8 - nl_NL.UTF-8 + repositories: php: 'ppa:ondrej/php' - mariadb: 'deb http://mirror6.layerjet.com/mariadb/repo/10.1/ubuntu' + mariadb: 'deb [arch=amd64,arm64,i386,ppc64el] http://mirror.nodesdirect.com/mariadb/repo/10.3/ubuntu' elasticsearch: 'ppa:webupd8team/java' rabbitmq: 'deb http://www.rabbitmq.com/debian/ testing main' yarn: 'https://dl.yarnpkg.com/debian/' + vagrant_local: install: '1' vm: