Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
vms:freenas [2015/10/08 15:42]
admin [Using SSHFS to Access VM's Files]
vms:freenas [2017/03/31 15:13] (current)
admin ↷ Links adapted because of a move operation
Line 11: Line 11:
  
 ---- ----
-++++|+
 ===== Shortcut ===== ===== Shortcut =====
 ---- ----
  
-OK, for the ones that do not want to take the deep dive into the gruesome details of building a FreeNAS development VM. Or if you simply don't have the time required to achieve the whole process, as it takes more than 3 hours to complete all described operations! Here is a download link to the .vdi file that is going to get build following the steps described in this article (you lucky ones!):+OK, for the ones that do not want to take the deep dive into the gruesome details of building a FreeNAS development VM. Or if you simply don't have the time required to achieve the whole process, as it takes more than 3 hours to complete all described operations! Here is a download link to the .vdi file that is going to get build following the steps described in this article ​+/- 663MB (you lucky ones!):
  
-DOWNLOAD LINK (not yet available sorry) +Note that you'll probably have to create extra virtual drives for the VM to create a "​virtual pool". 
-+++++ 
 +**{{:​vms:​freenas:​freenas-dev-9.3.1.vdi|Download FreeNAS-Dev-9.3.1.vdi}}**
 ---- ----
 ===== Create a FreeBSD 9.3 Build Environment ===== ===== Create a FreeBSD 9.3 Build Environment =====
Line 355: Line 356:
  
 > Network > Global Configuration > Network > Global Configuration
 +> Hostname: freenasDEV
 > Default Gateway : 10.0.2.1 > Default Gateway : 10.0.2.1
 > Nameserver 1 : 8.8.8.8 > Nameserver 1 : 8.8.8.8
 > Nameserver 2 : 8.8.4.4 > Nameserver 2 : 8.8.4.4
  
 +=== VM Snapshot ===
  
 +As our FreeNAS dev platform is now basicaly configured, it's time to make a snapshot of it (using VirtualBox GUI application for example).
 ---- ----
 ==== Additional Packages ==== ==== Additional Packages ====
Line 397: Line 401:
 What we usually have are files residing on our host's FS, accessed by our VM through a sharing mechanism (Shared Folder or SAMBA mount). The coming solution will reverse that paradigm, letting the host workstation access VM's files as if they were on a regular FS. Note that **in this scenario DESTROYING THE VM WILL DESTROY DEVELOPMENT DATA!** What we usually have are files residing on our host's FS, accessed by our VM through a sharing mechanism (Shared Folder or SAMBA mount). The coming solution will reverse that paradigm, letting the host workstation access VM's files as if they were on a regular FS. Note that **in this scenario DESTROYING THE VM WILL DESTROY DEVELOPMENT DATA!**
  
-A detailed article [[https://​www.digitalocean.com/​community/​tutorials/​how-to-use-sshfs-to-mount-remote-file-systems-over-ssh|is available in the Digital Ocean'​s tutorials]].+A detailed article [[https://​www.digitalocean.com/​community/​tutorials/​how-to-use-sshfs-to-mount-remote-file-systems-over-ssh|is available in the Digital Ocean'​s tutorials]] ​in case one wants to use the same principle on OSX or Windows.
  
 === Prepare host workstation === === Prepare host workstation ===
Line 409: Line 413:
 <​code>​ <​code>​
 > sudo mkdir /​mnt/​FreeNAS-DEV-9.3.1 > sudo mkdir /​mnt/​FreeNAS-DEV-9.3.1
 +> sudo chown -R <​devuser>:<​devgroup>​ /​mnt/​FreeNAS-9.3.1
 </​code>​ </​code>​
  
-=== Mount the VM's FS on host system ===+=== (un)Mount the VM's FS on host system ===
 <​code>​ <​code>​
-sudo sshfs root@172.20.20.3:/​ /​mnt/​FreeNAS-DEV-9.3.1+> sshfs root@172.20.20.3:/​ /​mnt/​FreeNAS-DEV-9.3.1
 </​code>​ </​code>​
 +
 +<​code>​
 +> umount /​mnt/​FreeNAS-DEV-9.3.1
 +</​code>​
 +
 +<wrap tip>Once again this configuration will <color darkred>​leave all development files **in the VM's filesystem**</​color>​. One might want to set-up some sort of **automated folder sync** to keep a copy on the host filesystem.</​wrap>​
  
 ---- ----
 ==== Create a SAMBA Share to Ease FreeNAS GUI's Files Edition ==== ==== Create a SAMBA Share to Ease FreeNAS GUI's Files Edition ====
- 
  
 <WRAP center round tip> <WRAP center round tip>
 Although this configuration works for the **/​usr/​local/​www/​freenasUI** files, it <color darkred>​**WON'​T WORK** for the **/​data/​freenas-v1.db** database</​color>​ that is accessed during the boot process **before SAMBA mounts are available**,​ resulting in an unbootable system ! Although this configuration works for the **/​usr/​local/​www/​freenasUI** files, it <color darkred>​**WON'​T WORK** for the **/​data/​freenas-v1.db** database</​color>​ that is accessed during the boot process **before SAMBA mounts are available**,​ resulting in an unbootable system !
  
-**Another approach [[|using sshfs mounting]]** from the workstation to the VM might well be the easiest way to access/edit files on the FreeNAS development VM...+**Another approach [[vms:​freenas#​using_sshfs_to_access_vm_s_files|using sshfs mounting]]** from the workstation to the VM might well be the easiest way to access/edit files on the FreeNAS development VM...
 </​WRAP>​ </​WRAP>​
  
-Since we won't be able to use shared folders with FreeBSD (as described in this wiki's [[vms:​django#​using_a_shared_folder_to_host_your_projects|Python/​Django Development Environment section]]) we'll have to create a SAMBA shared folder to easily manage and edit FreeNAS GUI's files from our host system.+++++ CLICK HERE TO READ| 
 + 
 +Since we won't be able to use shared folders with FreeBSD (as described in this wiki's [[vms:python:​django#​using_a_shared_folder_to_host_your_projects|Python/​Django Development Environment section]]) we'll have to create a SAMBA shared folder to easily manage and edit FreeNAS GUI's files from our host system.
  
 As the intention is to analyze, and maybe modify, some code in the FreeNAS GUI and/or api, our main target directory location is //​**/​usr/​local/​www/​freenasUI**//​. We'll first duplicate it's content to the host's HD, then make this duplicate directory a SAMBA shared folder that we'll access from the FreeNAS development VM. Finally this SAMBA share will be mounted, with adequate ownership and permissions,​ as the ///​usr/​local/​www/​freenasUI//​ directory inside the FreeNAS development VM. As the intention is to analyze, and maybe modify, some code in the FreeNAS GUI and/or api, our main target directory location is //​**/​usr/​local/​www/​freenasUI**//​. We'll first duplicate it's content to the host's HD, then make this duplicate directory a SAMBA shared folder that we'll access from the FreeNAS development VM. Finally this SAMBA share will be mounted, with adequate ownership and permissions,​ as the ///​usr/​local/​www/​freenasUI//​ directory inside the FreeNAS development VM.
Line 577: Line 589:
  
 Let's restart our VM to check everything goes as expected once we reboot the machine. Let's restart our VM to check everything goes as expected once we reboot the machine.
 +
 +----
 +++++
 +
 +----
 +===== IntelliJ IDEA Project Configuration =====
 +----
 +
 +Now that we have access to the FreeNAS files, we'll create an IntelliJ IDEA project to manage our development actions.
 +
 +Open **IntelliJ IDEA** and create a **new project**:
 +
 +  * Project type: Python
 +  * Project SDK:
 +    * ... -> Add Remote
 +    * SSH Credentials
 +    * Host: 172.20.20.3
 +    * User name: root
 +    * Password: 123456
 +    * Python interpreter path: /​usr/​local/​bin/​python
 +  * Additional Libraries and Frameworks: Django
 +  * Template language: Django
 +  * Templates folder: templates
 +  * Application name: FreeNAS-9.3.1
 +  * No Django admin
 +
 +-> Next -> Next
 +
 +  * Project name: FreeNAS-9.3.1
 +  * Project location: /​mnt/​FreeNAS-DEV-9.3.1/​usr/​local/​www/​freenasUI
 +  * Leave all default for "More Settings"​
 +
 +-> Finnish
 +
 +Warning says files cannot be watched for external update because they are network-mounted.
 +
 +=== Initiate git repo ===
 +
 +(menu) VCS > Enable Version Control Integration : git
 +
 +
 +