Sunday, June 1, 2014

Expand FreeNAS with plugins

http://www.openlogic.com/wazi/bid/345617/expand-freenas-with-plugins

FreeNAS is a powerful open source implementation of a network-attached storage (NAS) server – file-level computer data storage connected to your network. FreeNAS is easy to manage, and because it's free it can serve files for small- to mid-sized companies without straining their software budgets or act as a media and storage server for a home network – a great way to make use of any aging Windows XP boxes lying around.
FreeNAS supports a powerful plugin architecture that lets you expand its default feature set to better meet your demands. You'll find plugins for Firefly media server, CouchPotato movie server, and more. The plugins are in 32-bit or 64-bit PBI (push button installer) files on the FreeNAS project's website. PBI provides a native FreeNAS graphical installation wrapper for software ported to FreeBSD, allowing you to automate installation.
Here's a taste of some of the most interesting available plugins:

CrashPlan

You can use a plugin to back up your FreeNAS data to CrashPlan cloud-based backup, if you have an account with the service. While FreeNAS software stores your data safely and securely, computer hardware is prone to crashes, so both organizations and individuals need a solid backup and disaster recovery plan.

ownCloud

ownCloud is another cloud connector, but one that offers greater flexibility. If you have an in-house ownCloud server you can take advantage of this plugin to automatically back up your FreeNAS server.

Bacula

The Bacula plugin allows you to connect your FreeNAS servers to this powerful open source backup tool. This plugin includes file daemons (backup clients), directors (backup server), and storage daemons (back end). Bacula itself, however, is a bit of a challenge to get up and running.

Maraschino

The Maraschino project aims at creating an easy-to-use interface for managing a home theatre PC (HTPC). With this tool you can see recently added files, browse your media library, check disk space, and control multiple media servers.

Plex Media Server

You can turn your FreeNAS into a powerful multimedia server with the plugin for Plex Media Server. You can use Plex not only to view your favorite sci-fi films, instructional videos, and TED talks, but you can also create a training resource for new hires.
How can you make use of these plugins? All you need is a running FreeNAS server and access to the FreeNAS administrator account.

Installing plugins

First, determine whether you're running FreeNAS on 64-bit or 32-bit hardware. More plugins are available for the former than the latter, so if you have a choice, install FreeNAS on 64-bit hardware.
In order to install plugins, you must already have your FreeNAS set up with volumes.
The easiest way to install plugins is to select them from a list on the software's Plugins tab. Log in to the FreeNAS web administration portal as the admin (or root) user and go to the Plugins tab. Select a plugin to install (Figure 1), click the Install button, and let the installation complete:
Figure 1 The list of plugins will vary depending upon your system architecture.
Though it's simple, the process of installing a plugin can be time-consuming. FreeNAS first creates a jail – that is, a virtual environment with its own hostname and IP address – so it can install the plugin, in the form of a PBI file, onto the FreeBSD system that underlies FreeNAS. When the process completes successfully you should see the new plugin listed in the left navigation tree (Figure 2):
Figure 2 The Firefly media server plugin is now installed.
After you install a plugin you need to enable it. Click on the Installed tab and then click the slider for the plugin to the On position (Figure 3):
Figure 3 Enabling plugins to make them available for FreeNAS
You can then configure the plugin by clicking on its entry in the left navigation tree. A popup window appears (Figure 4) to allow you to set up the plugin to meet your needs:
Figure 4 Configuring the Firefly media server plugin for FreeNAS
Alternatively, you can install plugins by uploading a PBI file to FreeNAS. Once you've downloaded the plugin you want from the FreeNAS site, click on the Plugins tab, then click on the Upload button. Choose a file and allow the installation to complete.

Troubleshooting

When FreeNAS creates a new jail for a plugin, that jail is assigned an IP address. If you find that your plugins continually fail either to install or to work properly, the most likely cause is that the jail's IP address conflicts with the address of something else on your network. To avoid this, assign an IP address range to your jails that is outside the DHCP scope of your network. You can do this as the FreeNAS root user from the Jails tab (Figure 5):
Figure 5 Configuring jail addresses to be outside of your DHCP scope
If you still have issues, make sure the gateway address and DNS are correctly configured within FreeNAS. Click on the Network button (in the top navigation bar) and then click Global Configuration (Figure 6). Enter the correct hostname, domain, gateway, and nameserver, click Save, then attempt to work with plugins again.
Figure 6 Configuring networkin for FreeNAS.
As you can see, FreeNAS's powerful plugin system gives you the ability to use the software for more than just file storage and sharing.

Set FTP Autologin with .netrc file in linux

http://www.nextstep4it.com/categories/unix-command/ftp-autologin


There are some scenario where we do not want to specify ftp user name and password on the ftp command line. So to automatically supply ftp username and password to the ftp client, create a file .netrc in user's home direcrory which contains the information regarding the ftp server name, ftp user & password.

We can also use .netrc file in a shell script where we will use ftp client to transfer files to remote ftp server.

Below are the steps to enable FTP autologin with .netrc file .

Step:1 Create a .netrc file in user's home directory


# vi ~/.netrc
machine login password

Example :


machine  ftp.nstpmail.com  login ftp-user password xyz@abc123

Save & Exit the file.

Note: We can add multiple machines ,Just one line per machine in the .netrc file.

Step:2 Set permissions so that Owner can only read the file


# chmod 0600 ~/.netrc

Step:3 Now Try to connect Your ftp server


# ftp < FTP-Server-Name>

Now above command will connect to your ftp server automatically, whereas ftp user name and password is picked up from .netrc file

TogetherJS

http://www.linuxjournal.com/content/togetherjs

Want to add real-time collaboration to your Web application? Mozilla's TogetherJS is worth a look.
When Tim Berners-Lee invented the World Wide Web more than 20 years ago, he did it in the hopes that physicists would be able to collaborate easily with one another over the Internet. Since then, the Web has grown and morphed into a new medium that handles everything from newspapers to finance to supermarkets.
And yet, although we can marvel at the large number of things we can do on the Web nowadays, the original idea that drove it all, of collaboration, is still a bit of a dream. Sure, we have sites like GitHub, which provide a Web interface to the Git version-control system. And of course, we have plenty of writing systems, such as WordPress, that allow a number of people to create (and publish) documents. And there's also Facebook, which sometimes can be seen as collaborative.
But if you really think about it, we still don't have the sort of seamless collaboration we originally thought might be possible via the Web. Sure, I can work on something, hand it to others, and then work on it again when they are done with it, but it's still relatively rare to have collaborative tools on-line.
Perhaps the most sophisticated and widespread example of real-time, Web-based collaboration is Google Docs (now known, I think, as Google Drive). It's true that Google's applications make it possible for you to store your documents in the cloud, as people now like to say. And it's certainly convenient to be able to read and write your documents from anywhere, so long as you have access to a Web browser. But for me, the real power of Google Docs is in the collaboration. Many different people can work on the same document, and they even can do so at the same time. I found this sort of collaboration to be invaluable when I had to work with several other people to put together a budget on a project several years ago. The fact that we could all, from our own computers, edit the same spreadsheet in real time was quite useful.
There are a number of open-source alternatives to Google's word processor as well. Etherpad was released as an open-source project after its authors were acquired by Google several years ago. You can download and install Etherpad on your own, or you can take advantage of one of the existing Etherpad servers on-line. Another interesting application is Ace, a browser-based programming editor with impressive collaborative abilities.
Now, I never would claim that all collaboration needs to be in real time. There are many examples in the open-source world of people communicating and collaborating asynchronously, using e-mail and Git to work together—often quite effectively, without the bells and whistles that real-time collaboration seems to offer.
However, for many of us, collaboration without a real-time component is always missing something. It would be great for me not only to be able to talk to someone about a Web site, but also to look at it (and edit its content) along with them, in real time. Yes, there are screen-sharing systems, such as VNC, Join.me and ScreenHero, but they require that you install something on your computer and that you activate it.
That's why I have become interested in a project sponsored by the Mozilla Foundation known as TogetherJS. As the name implies, TogetherJS is a JavaScript-based, real-time collaboration system. The most impressive thing, in my opinion, is how much TogetherJS provides out of the box, with little or no configuration. It allows you to make your site more collaborative by adding some simple elements to each page.
So in this article, I want to look into TogetherJS—what it does, how you can add it to your own sites, and how you even can connect your application to it, creating your own, custom collaborative experience.

What Is TogetherJS?

TogetherJS is a project sponsored by the Mozilla Foundation (best known for the Firefox browser and the Thunderbird e-mail client). Mozilla has been developing and releasing a growing number of interesting open-source tools during the past few years, of which TogetherJS is one of the most recent examples. (In recent months, for instance, Mozilla also released Persona, which attempts to let you sign in to multiple sites using a single identity, without tying it to a for-profit company.) TogetherJS was released by "Mozilla Labs", which, from the name and description, suggests this is where Mozilla experiments with new ideas and technologies.
On a technical level, TogetherJS is a client-server system. The client is a JavaScript library—or more accurately, a set of JavaScript libraries—loaded onto a Web page, which then communicates back to a server. The server to which things are sent, known in TogetherJS parlance as the "hub", runs under node.js, the JavaScript-powered server system that has become quite popular during the past few years. The hub acts as a simple switchboard operator, running WebSockets, a low-overhead protocol designed for real-time communication. Thus, if there are ten people using TogetherJS, divided into five pairs of collaborators, they can all be using the same hub, but the hub will make sure to pass messages solely to the appropriate collaborators.
Installing TogetherJS on a Web site is surprisingly easy. You first need to load the TogetherJS library into your page. This is done by adding the following line into your Web application:


Of course, you also can host the JavaScript file on your own server, either because you want to keep it private or internal, or if you are modifying it, or if you simply prefer not to have it upgrade each time Mozilla releases a new version.
That JavaScript file doesn't actually do much on its own. Rather, it checks to see whether you want to download a minimized version of the code. Based on that, it decides whether to download all of the code in a single file or in separate ones. Regardless of how you download TogetherJS, the above line ensures that the JavaScript component is ready to work.
But of course, it's not enough to install the JavaScript. Someone needs to activate and then use it, which means installing a button on your Web site that will do so. Once again, because of the way TogetherJS is constructed, it's pretty straightforward. You can install the following:


In other words, you create a button that, when clicked, invokes the TogetherJS function. When users click on that button, they will be added to TogetherJS. Now, this is actually pretty boring; if you're running TogetherJS by yourself, it's not going to seem to be doing very much. Once you click on the TogetherJS button, and after you click through the first-time introduction, you'll immediately be given a link, labeled "invite a friend". In my particular case, running this on port 8000 of my server, I get http://lerner.co.il:8000/togetherjs.html#&togetherjs=oTtEp6wmoF.
As you can see, the TogetherJS special-invitation URL combines the URL of the page you own, along with a token that uniquely identifies your session. This allows multiple sets of people to collaborate on the same page, with each set existing in its own, isolated environment.
For example, togetherjs.html (Listing 1) is a file that I put up on my server. I opened two separate browsers onto that page, one via the direct URL and the second by using the full URL shown above, with a specific confirmation token. Once both browsers were pointing to the site, and once both users had confirmed their interest in collaborating and using TogetherJS, I found that either user could modify the content of the "textarea" tag, and that no matter who was typing, the changes were reflected immediately on the other person's computer. In addition, each click of the mouse is displayed graphically. And if one user goes to a different page on the site (assuming that the TogetherJS library is on the other page as well), TogetherJS will ask the other user if he or she wants to follow along.

Listing 1. togetherjs.html




  
    

Collaborate!

Collaborate!

 

Configuration and Customization

It's great and amazing that TogetherJS works so well, immediately upon installing it. However, there also are ways you can configure TogetherJS, so it'll reflect your needs. Because of the way TogetherJS is loaded, it's recommended that you make these configuration settings before TogetherJS has been loaded. For example: