Browse Source

Configuration for Vagrant running Ubuntu 14.04

tags/3.4.3
Silke Meyer 3 years ago
parent
commit
a5af773bc8
3 changed files with 39 additions and 49 deletions
  1. 26
    42
      Vagrantfile
  2. 12
    1
      doc/Vagrant.md
  3. 1
    6
      util/vagrant_provision.sh

+ 26
- 42
Vagrantfile View File

@@ -1,16 +1,19 @@
1 1
 
2
-server_ip             = "192.168.22.10"
3
-server_memory         = "384" # MB
4
-server_timezone       = "UTC"
2
+server_ip = "192.168.22.10"
3
+server_memory = "384" # MB
4
+server_timezone = "UTC"
5 5
 
6
-public_folder         = "/vagrant" 
6
+public_folder = "/vagrant"
7 7
 
8
-Vagrant.configure("2") do |config|
8
+Vagrant.configure(2) do |config|
9 9
 
10
-  # Set server to Ubuntu 12.04
11
-  config.vm.box = "precise64"
10
+  # Set server to Ubuntu 14.04
11
+  config.vm.box = "ubuntu/trusty64"
12 12
 
13
-  config.vm.box_url = "http://files.vagrantup.com/precise64.box"
13
+  # Disable automatic box update checking. If you disable this, then
14
+  # boxes will only be checked for updates when the user runs
15
+  # `vagrant box outdated`. This is not recommended.
16
+  # config.vm.box_check_update = false
14 17
 
15 18
   # Create a hostname, don't forget to put it to the `hosts` file
16 19
   # This will point to the server's default virtual host
@@ -20,40 +23,21 @@ Vagrant.configure("2") do |config|
20 23
   # Create a static IP
21 24
   config.vm.network :private_network, ip: server_ip
22 25
 
23
-  # If using VirtualBox
24
-  config.vm.provider :virtualbox do |vb|
25
-
26
-    # Set server memory
27
-    vb.customize ["modifyvm", :id, "--memory", server_memory]
28
-
29
-    # Set the timesync threshold to 10 seconds, instead of the default 20 minutes.
30
-    # If the clock gets more than 15 minutes out of sync (due to your laptop going
31
-    # to sleep for instance, then some 3rd party services will reject requests.
32
-    vb.customize ["guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 10000]
33
-
34
-    # Prevent VMs running on Ubuntu to lose internet connection
35
-    vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
36
-    vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
37
-
26
+  # Share a folder between host and guest
27
+  config.vm.synced_folder "./", "/vagrant/", owner: "www-data", group: "vagrant"
28
+
29
+  # Provider-specific configuration so you can fine-tune various
30
+  # backing providers for Vagrant. These expose provider-specific options.
31
+  config.vm.provider "virtualbox" do |vb|
32
+  #   # Display the VirtualBox GUI when booting the machine
33
+  #   vb.gui = true
34
+  #
35
+  #   # Customize the amount of memory on the VM:
36
+      vb.memory = server_memory
38 37
   end
39 38
 
40
-  # If using VMWare Fusion
41
-  config.vm.provider "vmware_fusion" do |vb, override|
42
-    override.vm.box_url = "http://files.vagrantup.com/precise64_vmware.box"
43
-    
44
-    # Set server memory
45
-    vb.vmx["memsize"] = server_memory
46
-
47
-  end
48
-
49
-  
50
-  ####
51
-  # Local Scripts
52
-  # Any local scripts you may want to run post-provisioning.
53
-  # Add these to the same directory as the Vagrantfile.
54
-  ##########
55
-
56
-  config.vm.synced_folder "./", "/vagrant/", :owner=> 'www-data', :group=>'vagrant', :mount_options => ['dmode=775', 'fmode=775']
57
-  config.vm.provision "shell", path: "./util/vagrant_provision.sh" 
58
-
39
+  # Enable provisioning with a shell script. 
40
+  config.vm.provision "shell", path: "./util/vagrant_provision.sh"
41
+    # run: "always"
42
+    # run: "once"
59 43
 end

+ 12
- 1
doc/Vagrant.md View File

@@ -8,10 +8,12 @@ Getting started
8 8
 
9 9
 [Vagrant](https://www.vagrantup.com/) is a virtualization solution for developers.
10 10
 No need to setup up a webserver, database etc. before actually starting.
11
-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.
11
+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.
12
+
12 13
 What you need to do:
13 14
 
14 15
 1. Install VirtualBox and vagrant.
16
+Please use an up-to-date vagrant version from https://www.vagrantup.com/downloads.html.
15 17
 2. Git clone your Friendica repository.
16 18
 Inside, you'll find a "Vagrantfile" and some scripts in the utils folder.
17 19
 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
20 22
 5. Open 192.168.22.10 in a browser.
21 23
 The mysql database is called "friendica", the mysql user and password both are "root".
22 24
 6. Work on Friendica's code in your git clone on your machine (not in the VM).
25
+Your local working directory is set up as a shared directory with the VM (/vagrant).
23 26
 7. Check the changes in your browser in the VM.
24 27
 Debug via the "vagrant ssh" login.
28
+Find the Friendica log file /vagrant/logfile.out.
25 29
 8. Commit and push your changes directly back to Github.
26 30
 
27 31
 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:
40 44
   * friendica2 and friendica3 are conntected. friendica4 and friendica5 are connected. 
41 45
 
42 46
 For further documentation of vagrant, please see [the vagrant*docs*](https://docs.vagrantup.com/v2/).
47
+
48
+**Important notice:**
49
+If you already had an Ubuntu 12.04 Vagrant VM, please run 
50
+
51
+	$> vagrant destroy
52
+
53
+before starting the new 14.04 machine.

+ 1
- 6
util/vagrant_provision.sh View File

@@ -21,18 +21,13 @@ organizationalUnitName=
21 21
 emailAddress=
22 22
 "
23 23
 sudo mkdir -p "$SSL_DIR"
24
-sudo openssl genrsa -out "$SSL_DIR/xip.io.key" 1024
24
+sudo openssl genrsa -out "$SSL_DIR/xip.io.key" 4096
25 25
 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
26 26
 sudo openssl x509 -req -days 365 -in "$SSL_DIR/xip.io.csr" -signkey "$SSL_DIR/xip.io.key" -out "$SSL_DIR/xip.io.crt"
27 27
 
28 28
 
29 29
 #Install apache2
30 30
 echo ">>> Installing Apache2 webserver"
31
-# The package python-software-properties provides add-apt-repository on Ubuntu Precise Server
32
-sudo apt-get install python-software-properties
33
-sudo add-apt-repository -y ppa:ondrej/apache2
34
-sudo apt-key update
35
-sudo apt-get update
36 31
 sudo apt-get install -y apache2
37 32
 sudo a2enmod rewrite actions ssl
38 33
 sudo cp /vagrant/util/vagrant_vhost.sh /usr/local/bin/vhost

Loading…
Cancel
Save