App Store application for the Sandstorm.io platform for personal servers.
AT PRESENT, SANDSTORM APP STORE ONLY RUNS ON LINUX
Sandstorm App Store is configured to store all assets (.spk files and images) in Google Cloud Storage, so you need to set this up even if you're running the application locally. Note that you will also use this Google Cloud project for login service configuration and VM provisioning (if you deploy the app store).
gsutil
by following these instructions.wget https://raw.githubusercontent.com/CulturalMe/meteor-slingshot/master/docs/gs-cors.json
.gsutil cors set gs-cors.json gs://MYBUCKETNAME
.openssl pkcs12 -in YOURKEYNAME.p12 -nodes -nocerts > YOURKEYNAME.pem
. When you are prompted for a password, enter notasecret
./app/private
directory. Note that these should not be uploaded to Github under any circumstances. The default .gitignore should prevent this, but caution is advised.settings.json
file in the project root to /app
and begin to populate it. You should also avoid uploading this file to Github once it's populated.The required information is as follows:
.json
key file you copied to your /app/private
directory; note that the full path is not required..pem
key file you copied to your /app/private
directory.Sandstorm App Store runs on Meteor. To install Meteor locally:
curl https://install.meteor.com/ | sh
Meteor comes with an integrated CLI which will build and serve the app locally, and also deploy the application to Meteor's own servers (useful for testing).
To clone and run the app locally (once you've configured storage as per above):
git clone git@github.com:tableflip/sandstorm-appstore.git
cd sandstorm-appstore/app
meteor run --settings settings.json
The app will be served at localhost:3000
.
Sandstorm App Store allows users to authenticate with Github and Google (for login) and Facebook and Twitter (to attach social links to apps). In order to facilitate this, each of the services must be configured.
/service-configure
./
.You should now be able to log in with Github and/or Google, if these have had their configurations updated.
Sandstorm App Store can be deployed to any VM or dedicated Meteor hosting service, but comes configured for deployment to Google Cloud Compute VMs via Meteor Up.
To deploy to Google Cloud Compute Engine:
From the Google Cloud console, select Compute > Compute Engine > VM Instances, and click "Create Instance".
Name and configure the instance-type. It is suggested that you use the same location as chosen for data storage.
Change the Boot disk setting to "Ubuntu 14.04 LTS".
Check "Allow HTTP traffic" and "Allow HTTPS traffic".
Click "Create".
Whilst it's provisioning your VM, create a new SSH key (if required; you may already have a suitable one) by following the instructions here under "Generating RSA Keys".
Once your instance has been provisioned, click on it and select "New Static IP" from the dropdown beneath "External IP Address". Give your new IP a name and hit create. Then hit "Save" below "External IP Address". Note down the IP (up to 12 digits).
Under "SSH Keys" click "Edit", and copy the entire body of the .pub file that your created in step 6 into the space provided. Your username should appear on the left. Hit "Save".
Copy the app's settings.json
template from the project root into the /mup
directory, and enter all the project details as above. Note that using the same bucket and credentials for two versions of the app (e.g. local and production) will cause conflicts and is not recommended. Instead, set up a new bucket by following the same instructions, and enter its name in your settings.json
.
Now edit the /mup/mup.json
file with your project's details. The fields that will need to be changed are as follows:
Once the mup.json
file has been correctly populated, you're ready to setup your server. From the /mup
directory, run the command mup setup
. The install script will connect to your privisioned VM and install the necessary scaffolding to run the App Store; it will take several minutes, with each step being marked "SUCCESS".
As a final step before deploying, you need to change some permissions in the server filesystem. In the Google Cloud console page for your VM, click on "SSH" at the top of the page. A new window should open with a shell prompt once connection has taken place.
Enter the following command in the new window: sudo chown -R meteoruser /opt/APPNAME
, where APPNAME
is as you entered into the mup.json
in step 10. If that completes without an error, you can close the window.
You can now deploy the app from your local shell, with the command mup deploy
from the /mup
directory. If the script completes with the message "Invoking deployment process: SUCCESS" you should be able to access your app at the IP address you noted down earlier.
Currently, upgrading users to admin status needs to be done via the mongo shell.
mongo APPNAME
, where APPNAME
is the name you entered in your mup.json
.db.users.update({username: 'USERNAME'}, {$set: {roles: ['admin']}})
, where USERNAME
is the name that appears on the /login
page in your deployed app. You should see a response of the form WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
.