Understanding the difference between Apps and Grains is important to understanding how Sandstorm works.
Grains are discrete instances of apps. Each grain is a copy of an app. This allows each grain to run isolated from other copies of the app in Sandstorm. Here’s a little walk through to help you understand how they relate to each other.
Adding the app to Sandstorm
Before you can create grains, you have to add the app from the Sandstorm app market to your local instance of Sandstorm. When you log into Sandstorm the first time, you’ll see a blank slate that looks like this:
Not much there.
In the left hand navigation, there are 2 sections; Apps and Grains. The screenshot above is the default Apps section. If I switch to the Grains view I get a message that I don’t have any Grains installed yet.
Understanding the difference between Apps and Grains is important to understand how Sandstorm works.
In a nutshell, you install the application once on your local instance of Sandstorm. Once it is installed, you can create multiple copies of that app to use. Each of these copies is called a Grain in the Sandstorm world.
So, let’s use Etherpad as an example. I install the Etherpad app from the Sandstorm App market onto my Sandstorm server. Once that is done, every time I want to create a new unique Etherpad document, I create a new grain (copy) of Etherpad with each grain operating independent of the others.
Installing an App
The first step in making Etherpad available on Sandstorm is to install the app from the Sandstorm App Market. Think of the Sandstorm App Market like Google Play or the Apple App Store. I only have to do this step once. Once Etherpad is installed on my Sandstorm server, I can then create multiple grains of Etherpad with the click of a button.
In the Apps section, click Install from App market. This will open a new tab/browser window in the Sandstorm App Market. Find Etherpad and click Install.
You’ll be taken back to Sandstorm and get a message asking you to verify that you want to install the app.
This is one of the most visible places where you will see the commitment to security that Sandstorm has as each app has some additional information included to help you verify that this application is legitimate. You will see a PGP key signed by the application publisher along with their verified contact information. Sandstorm provides a cryptographic chain of trust that connects the app package you’re installing to the app publisher’s online accounts. This is an assurance method that you are installing a legitimate Sandstorm application and provides a verified trail back to the person who published the app.
Click Install Etherpad and the application is installed and ready to use.
Create a Grain
Once the app is installed, you can now create your first Etherpad Grain by clicking on Create new pad.
You’ll see the Etherpad Grain now appear in your left hand navigation under Grains as Untitled Etherpad. To change the title to something more meaningful, click on the title Untitled Etherpad pad at the top of the screen.
A popup will appear where you can change the name
Click Ok and your Etherpad name is changed at the top of the screen and in the Grains navigation on the left.
And I am ready to start working on this Etherpad. Click the Share access link at the top of the page and I can generate a link that I can send to co-collaborators and give them anonymous access to collaborate on this document, just like you can with Google Docs.
Go back to the apps page and you’ll see that Etherpad has now been installed on our local instance of Sandstorm.
If I want to create another Etherpad Grain, I don’t have to go back to the app market and reinstall the application from the start. I simply click on the Etherpad app icon and a create a new grain. Clicking on the Etherpad icon also shows me all the grains of Etherpad I currently have installed.
With the app installed, I can now create dozens of discrete Etherpad apps and share them with different groups of people, each running as their own application within Sandstorm.
Header image: Grains of Sand by Fran Tapia CC-BY-ND