This a starter app for Meteor developers who want to structure their work according to the Mantra Specification.
Please feel welcome to comment on any experience you have with it in the on going discussion here ( for reference, prior discussion venues are available here and, even earlier, here )
You get :
- a thoroughly tested application from which to launch your application development
- single command installation of all dependencies and support services
- single command build of Android APK, with download from app menu bar.
- full end to end, functional testing with Chimp and Cucumber
- continuous integration and test in CircleCI. (Latest build result :: )
- unit testing with Mocha, Chai, Sinon
- client side and server side logging to Loggly:
- Mailgun ready password reset example
- several different CRUD examples, including
- an isomorphic MongoDB CRUD module in a single NPM package, which contains all client and server elements, as well as all Chimp tests
- a isomorphic Apollo CRUD module in a single NPM package, which contains all client and server elements, as well as all Chimp tests
- user management CRUD module: user registration, password reset, login, logout
- full multi-level access control authorizations:
- levels: Owner, Administrator, Staff, Member, Customer, Registered
- acts on: menu items, React components and server side methods
- uses mantra-core modularization, with application wide state, composed in pure React JS components with react-komposer (Blaze is not used at all)
- Astronomy v2 model schema
- forms based development examples with:
- tcomb-form: for CRUD modules
- formsy-react: for user login, registration and password forms. Also formsy-react-components
- Flatly bootstrap theme module
- completely linted with eslint, with specs available to editors such as Sublime Text 3
My default development, test and run environment is a virtual machine running Xubuntu Xenial Xerus, with 12Gb of disk, 3Gb memory and 2 processors.
If you are in a disposable virtual machine with a recent fresh Ubuntu installation, you can follow the steps below more or less blindly. Please, do NOT do this in a machine that has stuff you care about!
-
Pull in your GitHub SSH credentials from somewhere, for example a sister VM...
pushd ~/.ssh; scp -r 192.168.122.xxx:/home/you/.ssh .; popd;
-
Ensure dependencies are clean and up-to-date :
sudo apt-get -y update && sudo apt-get -y upgrade && sudo apt-get -y dist-upgrade && sudo apt-get -y clean && sudo apt-get -y autoremove;
-
Install and configure git :
sudo apt -y install git; git config --global user.name "You Yourself"; git config --global user.email "[email protected]"; git config --global credential.helper cache; git config --global credential.helper 'cache --timeout=36000'; git config --global push.default simple;
-
Make a parent directory and step into it :
mkdir -p ~/projects; cd ~/projects;
-
Clone our repository and step into it :
git clone [email protected]:yourse1f-yourorg/mmks.git; cd meteor-mantra-kickstarter;
-
Switch over to our branch :
git checkout apollo; git branch # verify being on apollo;
-
Run the script to set up for development and testing (installs Java, NodeJS, Chimp, Meteor and the project's NodeJS package dependencies) :
./install_all.sh;
-
Prepare our
settings.json
:cp settings.json.example settings.json; nano settings.json;
You'll need to go get your Mailgun API key. and your Loggly domain token, then correct these settings :
> "HOST_URI": "localhost:3000", > "MAILGUN_DOMAIN": "yourhost.yourpublic.work", > "MAILGUN_KEY": "(As if I'm gonna to leave THAT lying around.) A valid key has 36 characters and begins with 'key-'.", > "LOGGLY_SUBDOMAIN": "yourwork", > "LOGGLY_TOKEN": " ( not this either ) ",
- Note : If you don't care whether password reset works, you don't need Mailgun. In that case, you can use this as your API key ...
key-dead0dead0dead0dead0dead0dead000
.
- Note : If you don't care whether password reset works, you don't need Mailgun. In that case, you can use this as your API key ...
-
Now we can run Meteor and explore at http://localhost:3000 :
meteor --settings=settings.json;
(The first time through, you may see it terminate with the message
killed
. Just run it again.) -
Open a new terminal window to run linting and unit-tests :
cd ~/projects/meteor-mantra-kickstarter; npm test;
A goodly portion of the client side is fully tested using the familiar tools Mocha, Chai and Sinon.
-
Open another terminal window and run acceptance tests :
source ~/.profile; # if you have not yet logged out since running './install_all.sh' cd ~/projects/meteor-mantra-kickstarter; meteor npm run acceptance;
-
See the
scripts
section ofpackage.json
for details of other testing and setup commands. -
Return to your original terminal window and build for Android :
export KEYSTORE_PWD="obscuregobbledygook"; export HOST_SERVER_NAME="http://moon.planet.sun:3000/"; export ROOT_URL="${HOST_SERVER_NAME}"; export YOUR_FULLNAME="You Yourself"; export GITHUB_ORGANIZATION_NAME="YourOrg"; ./build_all.sh; meteor run --mobile-server=${HOST_SERVER_NAME} --settings=settings.json;
-
Debug in Android in a Xubuntu virtual machine :
To see how to debug an Android app between two virtual machines watch Meteor / CircleCI Tutorial -- Bonus - Debug your Android App in a Virtual Machine
For my own use, I keep open at least 4 terminal windows, with these commands, ready to run :
-
For running Meteor
cd projects/meteor-mantra-kickstarter/ meteor --settings=settings.json
-
For running acceptance tests
cd projects/meteor-mantra-kickstarter/ meteor npm run acceptance
-
For checking changes in the database
cd projects/meteor-mantra-kickstarter/ meteor mongo # then db.users.findOne({ "emails.address" : "[email protected]" }); db.getCollection("_colors").find({});
-
For searching for keywords in the code
cd projects/meteor-mantra-kickstarter/ grep -R --exclude=\*.{css,txt,min.js} --exclude-dir={.git,.meteor,node_modules} "key" -A 1
I tend to use the above commands daily. To get quickly ready to work, I open this README page, open the four terminal windows and cut and paste into them.