diff --git a/Vagrantfile b/Vagrantfile index 48af4ae51..4f1181b82 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,16 +1,19 @@ -server_ip = "192.168.22.10" -server_memory = "384" # MB -server_timezone = "UTC" +server_ip = "192.168.22.10" +server_memory = "384" # MB +server_timezone = "UTC" -public_folder = "/vagrant" +public_folder = "/vagrant" -Vagrant.configure("2") do |config| +Vagrant.configure(2) do |config| - # Set server to Ubuntu 12.04 - config.vm.box = "precise64" + # Set server to Ubuntu 14.04 + config.vm.box = "ubuntu/trusty64" - config.vm.box_url = "http://files.vagrantup.com/precise64.box" + # Disable automatic box update checking. If you disable this, then + # boxes will only be checked for updates when the user runs + # `vagrant box outdated`. This is not recommended. + # config.vm.box_check_update = false # Create a hostname, don't forget to put it to the `hosts` file # This will point to the server's default virtual host @@ -20,40 +23,21 @@ Vagrant.configure("2") do |config| # Create a static IP config.vm.network :private_network, ip: server_ip - # If using VirtualBox - config.vm.provider :virtualbox do |vb| - - # Set server memory - vb.customize ["modifyvm", :id, "--memory", server_memory] - - # Set the timesync threshold to 10 seconds, instead of the default 20 minutes. - # If the clock gets more than 15 minutes out of sync (due to your laptop going - # to sleep for instance, then some 3rd party services will reject requests. - vb.customize ["guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 10000] - - # Prevent VMs running on Ubuntu to lose internet connection - vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] - vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"] + # Share a folder between host and guest + config.vm.synced_folder "./", "/vagrant/", owner: "www-data", group: "vagrant" + # Provider-specific configuration so you can fine-tune various + # backing providers for Vagrant. These expose provider-specific options. + config.vm.provider "virtualbox" do |vb| + # # Display the VirtualBox GUI when booting the machine + # vb.gui = true + # + # # Customize the amount of memory on the VM: + vb.memory = server_memory end - # If using VMWare Fusion - config.vm.provider "vmware_fusion" do |vb, override| - override.vm.box_url = "http://files.vagrantup.com/precise64_vmware.box" - - # Set server memory - vb.vmx["memsize"] = server_memory - - end - - - #### - # Local Scripts - # Any local scripts you may want to run post-provisioning. - # Add these to the same directory as the Vagrantfile. - ########## - - config.vm.synced_folder "./", "/vagrant/", :owner=> 'www-data', :group=>'vagrant', :mount_options => ['dmode=775', 'fmode=775'] - config.vm.provision "shell", path: "./util/vagrant_provision.sh" - + # Enable provisioning with a shell script. + config.vm.provision "shell", path: "./util/vagrant_provision.sh" + # run: "always" + # run: "once" end diff --git a/doc/Vagrant.md b/doc/Vagrant.md index 1d23ace13..4bc9e6c54 100644 --- a/doc/Vagrant.md +++ b/doc/Vagrant.md @@ -8,10 +8,12 @@ Getting started [Vagrant](https://www.vagrantup.com/) is a virtualization solution for developers. No need to setup up a webserver, database etc. before actually starting. -Vagrant creates a virtual machine (an Ubuntu 12.04) for you that you can just run inside VirtualBox and start to work directly on Friendica. +Vagrant creates a virtual machine (an Ubuntu 14.04) for you that you can just run inside VirtualBox and start to work directly on Friendica. + What you need to do: 1. Install VirtualBox and vagrant. +Please use an up-to-date vagrant version from https://www.vagrantup.com/downloads.html. 2. Git clone your Friendica repository. Inside, you'll find a "Vagrantfile" and some scripts in the utils folder. 3. Run "vagrant up" from inside the friendica clone. @@ -20,8 +22,10 @@ Be patient: When it runs for the first time, it downloads an Ubuntu Server image 5. Open 192.168.22.10 in a browser. The mysql database is called "friendica", the mysql user and password both are "root". 6. Work on Friendica's code in your git clone on your machine (not in the VM). +Your local working directory is set up as a shared directory with the VM (/vagrant). 7. Check the changes in your browser in the VM. Debug via the "vagrant ssh" login. +Find the Friendica log file /vagrant/logfile.out. 8. Commit and push your changes directly back to Github. If you want to stop vagrant after finishing your work, run the following command @@ -40,3 +44,10 @@ You will then have the following accounts to login: * friendica2 and friendica3 are conntected. friendica4 and friendica5 are connected. For further documentation of vagrant, please see [the vagrant*docs*](https://docs.vagrantup.com/v2/). + +**Important notice:** +If you already had an Ubuntu 12.04 Vagrant VM, please run + + $> vagrant destroy + +before starting the new 14.04 machine. diff --git a/util/htconfig.vagrant.php b/util/htconfig.vagrant.php index 4665e68c0..71e9d673f 100644 --- a/util/htconfig.vagrant.php +++ b/util/htconfig.vagrant.php @@ -70,3 +70,9 @@ $a->config['system']['no_regfullname'] = true; // Location of the global directory $a->config['system']['directory'] = 'http://dir.friendi.ca'; + +// turn on friendica's log +$a->config['system']['debugging'] = true; +$a->config['system']['logfile'] = 'logfile.out'; +$a->config['system']['loglevel'] = LOGGER_DEBUG; + diff --git a/util/vagrant_provision.sh b/util/vagrant_provision.sh index ac2465966..3dbe80404 100644 --- a/util/vagrant_provision.sh +++ b/util/vagrant_provision.sh @@ -21,18 +21,13 @@ organizationalUnitName= emailAddress= " sudo mkdir -p "$SSL_DIR" -sudo openssl genrsa -out "$SSL_DIR/xip.io.key" 1024 +sudo openssl genrsa -out "$SSL_DIR/xip.io.key" 4096 sudo openssl req -new -subj "$(echo -n "$SUBJ" | tr "\n" "/")" -key "$SSL_DIR/xip.io.key" -out "$SSL_DIR/xip.io.csr" -passin pass:$PASSPHRASE sudo openssl x509 -req -days 365 -in "$SSL_DIR/xip.io.csr" -signkey "$SSL_DIR/xip.io.key" -out "$SSL_DIR/xip.io.crt" #Install apache2 echo ">>> Installing Apache2 webserver" -# The package python-software-properties provides add-apt-repository on Ubuntu Precise Server -sudo apt-get install python-software-properties -sudo add-apt-repository -y ppa:ondrej/apache2 -sudo apt-key update -sudo apt-get update sudo apt-get install -y apache2 sudo a2enmod rewrite actions ssl sudo cp /vagrant/util/vagrant_vhost.sh /usr/local/bin/vhost